summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-29 18:06:55 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-29 18:06:55 +0000
commit773c29a2014f8ff58f1eea8d8b1eb5caf1705b43 (patch)
treebb00f3296bdb7fae4a5d15a57868adbdb797cf6f /webkit
parent87244af04147bd7c85f12f2cf3906e6cdce20046 (diff)
downloadchromium_src-773c29a2014f8ff58f1eea8d8b1eb5caf1705b43.zip
chromium_src-773c29a2014f8ff58f1eea8d8b1eb5caf1705b43.tar.gz
chromium_src-773c29a2014f8ff58f1eea8d8b1eb5caf1705b43.tar.bz2
Pepper video layer API
Define the Pepper Video Layer API to enhance video rendering performance. This video layer will have a corresponding LayerChromium in WebKit which the compositor can use directly. The objective is to save the extra operation to write to PPB_Surface3D which saves one memory read/write routine in the GPU. BUG=None TEST=None Review URL: http://codereview.chromium.org/6902048 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83546 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/webkit_glue.gypi6
-rw-r--r--webkit/plugins/ppapi/plugin_module.cc8
-rw-r--r--webkit/plugins/ppapi/ppb_layer_compositor_impl.cc106
-rw-r--r--webkit/plugins/ppapi/ppb_layer_compositor_impl.h44
-rw-r--r--webkit/plugins/ppapi/ppb_video_layer_impl.cc93
-rw-r--r--webkit/plugins/ppapi/ppb_video_layer_impl.h43
-rw-r--r--webkit/plugins/ppapi/ppb_video_layer_software.cc37
-rw-r--r--webkit/plugins/ppapi/ppb_video_layer_software.h35
-rw-r--r--webkit/plugins/ppapi/resource.h2
9 files changed, 374 insertions, 0 deletions
diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi
index 48072c4..a19efdb 100644
--- a/webkit/glue/webkit_glue.gypi
+++ b/webkit/glue/webkit_glue.gypi
@@ -273,6 +273,8 @@
'../plugins/ppapi/ppb_graphics_3d_impl.h',
'../plugins/ppapi/ppb_image_data_impl.cc',
'../plugins/ppapi/ppb_image_data_impl.h',
+ '../plugins/ppapi/ppb_layer_compositor_impl.cc',
+ '../plugins/ppapi/ppb_layer_compositor_impl.h',
'../plugins/ppapi/ppb_nacl_private_impl.cc',
'../plugins/ppapi/ppb_nacl_private_impl.h',
'../plugins/ppapi/ppb_opengles_impl.cc',
@@ -295,6 +297,10 @@
'../plugins/ppapi/ppb_url_util_impl.h',
'../plugins/ppapi/ppb_video_decoder_impl.cc',
'../plugins/ppapi/ppb_video_decoder_impl.h',
+ '../plugins/ppapi/ppb_video_layer_impl.cc',
+ '../plugins/ppapi/ppb_video_layer_impl.h',
+ '../plugins/ppapi/ppb_video_layer_software.cc',
+ '../plugins/ppapi/ppb_video_layer_software.h',
'../plugins/ppapi/ppb_widget_impl.cc',
'../plugins/ppapi/ppb_widget_impl.h',
'../plugins/ppapi/resource.cc',
diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc
index 28b22b2..9073ed0 100644
--- a/webkit/plugins/ppapi/plugin_module.cc
+++ b/webkit/plugins/ppapi/plugin_module.cc
@@ -28,6 +28,7 @@
#include "ppapi/c/dev/ppb_fullscreen_dev.h"
#include "ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h"
#include "ppapi/c/dev/ppb_graphics_3d_dev.h"
+#include "ppapi/c/dev/ppb_layer_compositor_dev.h"
#include "ppapi/c/dev/ppb_opengles_dev.h"
#include "ppapi/c/dev/ppb_scrollbar_dev.h"
#include "ppapi/c/dev/ppb_testing_dev.h"
@@ -35,6 +36,7 @@
#include "ppapi/c/dev/ppb_url_util_dev.h"
#include "ppapi/c/dev/ppb_var_deprecated.h"
#include "ppapi/c/dev/ppb_video_decoder_dev.h"
+#include "ppapi/c/dev/ppb_video_layer_dev.h"
#include "ppapi/c/dev/ppb_widget_dev.h"
#include "ppapi/c/dev/ppb_zoom_dev.h"
#include "ppapi/c/pp_module.h"
@@ -86,6 +88,7 @@
#include "webkit/plugins/ppapi/ppb_font_impl.h"
#include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h"
#include "webkit/plugins/ppapi/ppb_image_data_impl.h"
+#include "webkit/plugins/ppapi/ppb_layer_compositor_impl.h"
#include "webkit/plugins/ppapi/ppb_nacl_private_impl.h"
#include "webkit/plugins/ppapi/ppb_pdf_impl.h"
#include "webkit/plugins/ppapi/ppb_proxy_impl.h"
@@ -96,6 +99,7 @@
#include "webkit/plugins/ppapi/ppb_url_response_info_impl.h"
#include "webkit/plugins/ppapi/ppb_url_util_impl.h"
#include "webkit/plugins/ppapi/ppb_video_decoder_impl.h"
+#include "webkit/plugins/ppapi/ppb_video_layer_impl.h"
#include "webkit/plugins/ppapi/ppb_widget_impl.h"
#include "webkit/plugins/ppapi/resource_tracker.h"
#include "webkit/plugins/ppapi/var.h"
@@ -311,6 +315,8 @@ const void* GetInterface(const char* name) {
return Var::GetInterface();
if (strcmp(name, PPB_VIDEODECODER_DEV_INTERFACE) == 0)
return PPB_VideoDecoder_Impl::GetInterface();
+ if (strcmp(name, PPB_VIDEOLAYER_DEV_INTERFACE) == 0)
+ return PPB_VideoLayer_Impl::GetInterface();
if (strcmp(name, PPB_WIDGET_DEV_INTERFACE) == 0)
return PPB_Widget_Impl::GetInterface();
if (strcmp(name, PPB_ZOOM_DEV_INTERFACE) == 0)
@@ -331,6 +337,8 @@ const void* GetInterface(const char* name) {
return PPB_OpenGLES_Impl::GetInterface();
if (strcmp(name, PPB_SURFACE_3D_DEV_INTERFACE) == 0)
return PPB_Surface3D_Impl::GetInterface();
+ if (strcmp(name, PPB_LAYER_COMPOSITOR_DEV_INTERFACE) == 0)
+ return PPB_LayerCompositor_Impl::GetInterface();
}
#endif // ENABLE_GPU
diff --git a/webkit/plugins/ppapi/ppb_layer_compositor_impl.cc b/webkit/plugins/ppapi/ppb_layer_compositor_impl.cc
new file mode 100644
index 0000000..86334ab
--- /dev/null
+++ b/webkit/plugins/ppapi/ppb_layer_compositor_impl.cc
@@ -0,0 +1,106 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "webkit/plugins/ppapi/ppb_layer_compositor_impl.h"
+
+#include "webkit/plugins/ppapi/common.h"
+
+namespace webkit {
+namespace ppapi {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance) {
+ return NULL;
+}
+
+PP_Bool IsLayerCompositor(PP_Resource resource) {
+ return PP_FALSE;
+}
+
+PP_Bool AddLayer(PP_Resource compositor, PP_Resource layer) {
+ return PP_FALSE;
+}
+
+void RemoveLayer(PP_Resource compositor, PP_Resource layer) {
+}
+
+void SetZIndex(PP_Resource compositor, PP_Resource layer, int32_t index) {
+}
+
+void SetRect(PP_Resource compositor, PP_Resource layer,
+ const struct PP_Rect* rect) {
+}
+
+void SetDisplay(PP_Resource compositor, PP_Resource layer,
+ PP_Bool is_displayed) {
+}
+
+void MarkAsDirty(PP_Resource compositor, PP_Resource layer) {
+}
+
+PP_Bool SwapBuffers(PP_Resource compositor,
+ struct PP_CompletionCallback callback) {
+ return PP_FALSE;
+}
+
+const PPB_LayerCompositor_Dev ppb_layercompositor = {
+ &Create,
+ &IsLayerCompositor,
+ &AddLayer,
+ &RemoveLayer,
+ &SetZIndex,
+ &SetRect,
+ &SetDisplay,
+ &MarkAsDirty,
+ &SwapBuffers,
+};
+
+} // namespace
+
+PPB_LayerCompositor_Impl::PPB_LayerCompositor_Impl(PluginInstance* instance)
+ : Resource(instance) {
+}
+
+PPB_LayerCompositor_Impl::~PPB_LayerCompositor_Impl() {
+}
+
+PPB_LayerCompositor_Impl*
+PPB_LayerCompositor_Impl::AsPPB_LayerCompositor_Impl() {
+ return this;
+}
+
+// static
+const PPB_LayerCompositor_Dev* PPB_LayerCompositor_Impl::GetInterface() {
+ return &ppb_layercompositor;
+}
+
+PP_Bool PPB_LayerCompositor_Impl::AddLayer(PP_Resource layer) {
+ return PP_FALSE;
+}
+
+void PPB_LayerCompositor_Impl::RemoveLayer(PP_Resource layer) {
+}
+
+void PPB_LayerCompositor_Impl::SetZIndex(PP_Resource layer, int32_t index) {
+}
+
+void PPB_LayerCompositor_Impl::SetRect(PP_Resource layer,
+ const struct PP_Rect* rect) {
+}
+
+void PPB_LayerCompositor_Impl::SetDisplay(PP_Resource layer,
+ PP_Bool is_displayed) {
+}
+
+void PPB_LayerCompositor_Impl::MarkAsDirty(PP_Resource layer) {
+}
+
+PP_Bool PPB_LayerCompositor_Impl::SwapBuffers(
+ struct PP_CompletionCallback callback) {
+ return PP_FALSE;
+}
+
+} // namespace ppapi
+} // namespace webkit
diff --git a/webkit/plugins/ppapi/ppb_layer_compositor_impl.h b/webkit/plugins/ppapi/ppb_layer_compositor_impl.h
new file mode 100644
index 0000000..a84fb27
--- /dev/null
+++ b/webkit/plugins/ppapi/ppb_layer_compositor_impl.h
@@ -0,0 +1,44 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_PLUGINS_PPAPI_PPB_LAYER_COMPOSITOR_IMPL_H_
+#define WEBKIT_PLUGINS_PPAPI_PPB_LAYER_COMPOSITOR_IMPL_H_
+
+#include "ppapi/c/dev/ppb_layer_compositor_dev.h"
+#include "webkit/plugins/ppapi/resource.h"
+
+struct PP_Rect;
+struct PP_Size;
+
+namespace webkit {
+namespace ppapi {
+
+class PluginInstance;
+
+class PPB_LayerCompositor_Impl : public Resource {
+ public:
+ explicit PPB_LayerCompositor_Impl(PluginInstance* instance);
+ virtual ~PPB_LayerCompositor_Impl();
+
+ static const PPB_LayerCompositor_Dev* GetInterface();
+
+ // Resource override.
+ virtual PPB_LayerCompositor_Impl* AsPPB_LayerCompositor_Impl();
+
+ PP_Bool AddLayer(PP_Resource layer);
+ void RemoveLayer(PP_Resource layer);
+ void SetZIndex(PP_Resource layer, int32_t index);
+ void SetRect(PP_Resource layer, const struct PP_Rect* rect);
+ void SetDisplay(PP_Resource layer, PP_Bool is_displayed);
+ void MarkAsDirty(PP_Resource layer);
+ PP_Bool SwapBuffers(struct PP_CompletionCallback callback);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PPB_LayerCompositor_Impl);
+};
+
+} // namespace ppapi
+} // namespace webkit
+
+#endif // WEBKIT_PLUGINS_PPAPI_PPB_LAYER_COMPOSITOR_IMPL_H_
diff --git a/webkit/plugins/ppapi/ppb_video_layer_impl.cc b/webkit/plugins/ppapi/ppb_video_layer_impl.cc
new file mode 100644
index 0000000..f91b16a
--- /dev/null
+++ b/webkit/plugins/ppapi/ppb_video_layer_impl.cc
@@ -0,0 +1,93 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "webkit/plugins/ppapi/ppb_video_layer_impl.h"
+
+#include "base/logging.h"
+#include "webkit/plugins/ppapi/common.h"
+#include "webkit/plugins/ppapi/ppb_video_layer_software.h"
+
+namespace webkit {
+namespace ppapi {
+
+namespace {
+
+PP_Resource Create(PP_Instance instance_id, PP_VideoLayerMode_Dev mode) {
+ PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id);
+ if (!instance)
+ return NULL;
+
+ if (mode != PP_VIDEOLAYERMODE_SOFTWARE)
+ return NULL;
+
+ scoped_refptr<PPB_VideoLayer_Impl> layer(
+ new PPB_VideoLayer_Software(instance));
+ return layer->GetReference();
+}
+
+PP_Bool IsVideoLayer(PP_Resource resource) {
+ return BoolToPPBool(!!Resource::GetAs<PPB_VideoLayer_Impl>(resource));
+}
+void SetPixelFormat(PP_Resource resource,
+ PP_VideoLayerPixelFormat_Dev pixel_format) {
+ scoped_refptr<PPB_VideoLayer_Impl> layer(
+ Resource::GetAs<PPB_VideoLayer_Impl>(resource));
+ layer->SetPixelFormat(pixel_format);
+}
+
+void SetNativeSize(PP_Resource resource, const struct PP_Size* size) {
+ scoped_refptr<PPB_VideoLayer_Impl> layer(
+ Resource::GetAs<PPB_VideoLayer_Impl>(resource));
+ layer->SetNativeSize(size);
+}
+
+void SetClipRect(PP_Resource resource, const struct PP_Rect* clip_rect) {
+ scoped_refptr<PPB_VideoLayer_Impl> layer(
+ Resource::GetAs<PPB_VideoLayer_Impl>(resource));
+ layer->SetClipRect(clip_rect);
+}
+
+PP_Bool IsReady(PP_Resource resource) {
+ scoped_refptr<PPB_VideoLayer_Impl> layer(
+ Resource::GetAs<PPB_VideoLayer_Impl>(resource));
+ return layer->IsReady();
+}
+
+PP_Bool UpdateContent(PP_Resource resource, uint32_t no_of_planes,
+ const void** planes) {
+ scoped_refptr<PPB_VideoLayer_Impl> layer(
+ Resource::GetAs<PPB_VideoLayer_Impl>(resource));
+ return layer->UpdateContent(no_of_planes, planes);
+}
+
+const PPB_VideoLayer_Dev ppb_videolayer = {
+ &Create,
+ &IsVideoLayer,
+ &SetPixelFormat,
+ &SetNativeSize,
+ &SetClipRect,
+ &IsReady,
+ &UpdateContent,
+};
+
+} // namespace
+
+PPB_VideoLayer_Impl::PPB_VideoLayer_Impl(PluginInstance* instance)
+ : Resource(instance) {
+}
+
+PPB_VideoLayer_Impl::~PPB_VideoLayer_Impl() {
+}
+
+PPB_VideoLayer_Impl* PPB_VideoLayer_Impl::AsPPB_VideoLayer_Impl() {
+ return this;
+}
+
+// static
+const PPB_VideoLayer_Dev* PPB_VideoLayer_Impl::GetInterface() {
+ return &ppb_videolayer;
+}
+
+} // namespace ppapi
+} // namespace webkit
diff --git a/webkit/plugins/ppapi/ppb_video_layer_impl.h b/webkit/plugins/ppapi/ppb_video_layer_impl.h
new file mode 100644
index 0000000..2cfc181
--- /dev/null
+++ b/webkit/plugins/ppapi/ppb_video_layer_impl.h
@@ -0,0 +1,43 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_LAYER_IMPL_H_
+#define WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_LAYER_IMPL_H_
+
+#include "ppapi/c/dev/ppb_video_layer_dev.h"
+#include "webkit/plugins/ppapi/resource.h"
+
+struct PP_Rect;
+struct PP_Size;
+
+namespace webkit {
+namespace ppapi {
+
+class PluginInstance;
+
+class PPB_VideoLayer_Impl : public Resource {
+ public:
+ explicit PPB_VideoLayer_Impl(PluginInstance* instance);
+ virtual ~PPB_VideoLayer_Impl();
+
+ static const PPB_VideoLayer_Dev* GetInterface();
+
+ // Resource override.
+ virtual PPB_VideoLayer_Impl* AsPPB_VideoLayer_Impl();
+
+ // Pure virtual methods to be implemented by subclasses.
+ virtual void SetPixelFormat(PP_VideoLayerPixelFormat_Dev pixel_format) = 0;
+ virtual void SetNativeSize(const PP_Size* size) = 0;
+ virtual void SetClipRect(const PP_Rect* clip_rect) = 0;
+ virtual PP_Bool IsReady() = 0;
+ virtual PP_Bool UpdateContent(uint32_t no_of_planes, const void** planes) = 0;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PPB_VideoLayer_Impl);
+};
+
+} // namespace ppapi
+} // namespace webkit
+
+#endif // WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_LAYER_IMPL_H_
diff --git a/webkit/plugins/ppapi/ppb_video_layer_software.cc b/webkit/plugins/ppapi/ppb_video_layer_software.cc
new file mode 100644
index 0000000..dbc1364
--- /dev/null
+++ b/webkit/plugins/ppapi/ppb_video_layer_software.cc
@@ -0,0 +1,37 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "webkit/plugins/ppapi/ppb_video_layer_software.h"
+
+namespace webkit {
+namespace ppapi {
+
+PPB_VideoLayer_Software::PPB_VideoLayer_Software(PluginInstance* instance)
+ : PPB_VideoLayer_Impl(instance) {
+}
+
+PPB_VideoLayer_Software::~PPB_VideoLayer_Software() {
+}
+
+void PPB_VideoLayer_Software::SetPixelFormat(
+ PP_VideoLayerPixelFormat_Dev pixel_format) {
+}
+
+void PPB_VideoLayer_Software::SetNativeSize(const PP_Size* size) {
+}
+
+void PPB_VideoLayer_Software::SetClipRect(const PP_Rect* clip_rect) {
+}
+
+PP_Bool PPB_VideoLayer_Software::IsReady() {
+ return PP_FALSE;
+}
+
+PP_Bool PPB_VideoLayer_Software::UpdateContent(uint32_t no_of_planes,
+ const void** planes) {
+ return PP_FALSE;
+}
+
+} // namespace ppapi
+} // namespace webkit
diff --git a/webkit/plugins/ppapi/ppb_video_layer_software.h b/webkit/plugins/ppapi/ppb_video_layer_software.h
new file mode 100644
index 0000000..a1b901b
--- /dev/null
+++ b/webkit/plugins/ppapi/ppb_video_layer_software.h
@@ -0,0 +1,35 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_LAYER_SOFTWARE_H_
+#define WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_LAYER_SOFTWARE_H_
+
+#include "webkit/plugins/ppapi/ppb_video_layer_impl.h"
+#include "webkit/plugins/ppapi/resource.h"
+
+namespace webkit {
+namespace ppapi {
+
+class PluginInstance;
+
+class PPB_VideoLayer_Software : public PPB_VideoLayer_Impl {
+ public:
+ explicit PPB_VideoLayer_Software(PluginInstance* instance);
+ virtual ~PPB_VideoLayer_Software();
+
+ // PPB_VideoLayer_Impl implementations.
+ virtual void SetPixelFormat(PP_VideoLayerPixelFormat_Dev pixel_format);
+ virtual void SetNativeSize(const PP_Size* size);
+ virtual void SetClipRect(const PP_Rect* clip_rect);
+ virtual PP_Bool IsReady();
+ virtual PP_Bool UpdateContent(uint32_t no_of_planes, const void** planes);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PPB_VideoLayer_Software);
+};
+
+} // namespace ppapi
+} // namespace webkit
+
+#endif // WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_LAYER_SOFTWARE_H_
diff --git a/webkit/plugins/ppapi/resource.h b/webkit/plugins/ppapi/resource.h
index 267249b..8b08805 100644
--- a/webkit/plugins/ppapi/resource.h
+++ b/webkit/plugins/ppapi/resource.h
@@ -32,6 +32,7 @@ namespace ppapi {
F(PPB_Graphics2D_Impl) \
F(PPB_Graphics3D_Impl) \
F(PPB_ImageData_Impl) \
+ F(PPB_LayerCompositor_Impl) \
F(PPB_Scrollbar_Impl) \
F(PPB_Surface3D_Impl) \
F(PPB_Transport_Impl) \
@@ -39,6 +40,7 @@ namespace ppapi {
F(PPB_URLRequestInfo_Impl) \
F(PPB_URLResponseInfo_Impl) \
F(PPB_VideoDecoder_Impl) \
+ F(PPB_VideoLayer_Impl) \
F(PPB_Widget_Impl) \
F(PrivateFontFile)