Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Unified Diff: components/mus/gles2/command_buffer_driver.cc

Issue 1857243005: Scan-out capable buffers (aka ui::NativePixmap) for Mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build fix for windows Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/mus/gles2/command_buffer_driver.h ('k') | components/mus/gles2/command_buffer_local.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/mus/gles2/command_buffer_driver.cc
diff --git a/components/mus/gles2/command_buffer_driver.cc b/components/mus/gles2/command_buffer_driver.cc
index ea0f54098bfc3f970597ed10ee4767f52ae25f9a..a173e08421dfff5bfb721531639f9c3c454efded 100644
--- a/components/mus/gles2/command_buffer_driver.cc
+++ b/components/mus/gles2/command_buffer_driver.cc
@@ -35,6 +35,10 @@
#include "ui/gl/gl_image_shared_memory.h"
#include "ui/gl/gl_surface.h"
+#if defined(USE_OZONE)
+#include "ui/gl/gl_image_ozone_native_pixmap.h"
+#endif
+
namespace mus {
namespace {
@@ -84,10 +88,19 @@ bool CommandBufferDriver::Initialize(
const bool offscreen = widget_ == gfx::kNullAcceleratedWidget;
static scoped_refptr<gfx::GLSurface> underlying_surface;
if (offscreen) {
- surface_ = gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size(1, 1));
+ surface_ = gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size(0, 0));
} else {
+#if defined(USE_OZONE)
+ scoped_refptr<gfx::GLSurface> underlying_surface =
+ gfx::GLSurface::CreateSurfacelessViewGLSurface(widget_);
+ if (!underlying_surface)
+ underlying_surface = gfx::GLSurface::CreateViewGLSurface(widget_);
+#else
+ scoped_refptr<gfx::GLSurface> underlying_surface =
+ gfx::GLSurface::CreateViewGLSurface(widget_);
+#endif
scoped_refptr<GLSurfaceAdapterMus> surface_adapter =
- new GLSurfaceAdapterMus(gfx::GLSurface::CreateViewGLSurface(widget_));
+ new GLSurfaceAdapterMus(underlying_surface);
surface_adapter->SetGpuCompletedSwapBuffersCallback(
base::Bind(&CommandBufferDriver::OnGpuCompletedSwapBuffers,
weak_factory_.GetWeakPtr()));
@@ -272,6 +285,32 @@ void CommandBufferDriver::CreateImage(int32_t id,
image_manager->AddImage(image.get(), id);
}
+// TODO(rjkroege): It is conceivable that this code belongs in
+// ozone_gpu_memory_buffer.cc
+void CommandBufferDriver::CreateImageNativeOzone(int32_t id,
+ int32_t type,
+ gfx::Size size,
+ gfx::BufferFormat format,
+ uint32_t internal_format,
+ ui::NativePixmap* pixmap) {
+#if defined(USE_OZONE)
+ gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager();
+ if (image_manager->LookupImage(id)) {
+ LOG(ERROR) << "Image already exists with same ID.";
+ return;
+ }
+
+ scoped_refptr<gfx::GLImageOzoneNativePixmap> image =
+ new gfx::GLImageOzoneNativePixmap(size, internal_format);
+ if (!image->Initialize(pixmap, format)) {
+ NOTREACHED();
+ return;
+ }
+
+ image_manager->AddImage(image.get(), id);
+#endif
+}
+
void CommandBufferDriver::DestroyImage(int32_t id) {
DCHECK(CalledOnValidThread());
gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager();
@@ -286,6 +325,7 @@ void CommandBufferDriver::DestroyImage(int32_t id) {
bool CommandBufferDriver::IsScheduled() const {
DCHECK(CalledOnValidThread());
+ DCHECK(executor_);
return executor_->scheduled();
}
« no previous file with comments | « components/mus/gles2/command_buffer_driver.h ('k') | components/mus/gles2/command_buffer_local.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698