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

Unified Diff: content/common/gpu/media/rendering_helper.cc

Issue 938873002: Add a new API to create a surfaceless GLSurface for Ozone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix swapbuffers & overlay scheduling Created 5 years, 10 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
Index: content/common/gpu/media/rendering_helper.cc
diff --git a/content/common/gpu/media/rendering_helper.cc b/content/common/gpu/media/rendering_helper.cc
index cd4e601a3b89c2f274bd427b54dadb7d7b61cdb3..2c72849c9667296c30231b35bd3372253b52e0a4 100644
--- a/content/common/gpu/media/rendering_helper.cc
+++ b/content/common/gpu/media/rendering_helper.cc
@@ -313,6 +313,7 @@ void RenderingHelper::Initialize(const RenderingHelperParams& params,
message_loop_ = base::MessageLoop::current();
gl_surface_ = gfx::GLSurface::CreateViewGLSurface(window_);
+ gl_surface_->Resize(platform_window_delegate_->GetSize());
Pawel Osciak 2015/02/24 00:13:47 I think platform_window_delegate_ is under #if def
achaulk 2015/02/24 19:07:21 Ah, yes it is
screen_size_ = gl_surface_->GetSize();
gl_context_ = gfx::GLContext::CreateGLContext(
@@ -363,7 +364,8 @@ void RenderingHelper::Initialize(const RenderingHelperParams& params,
CHECK(fb_status == GL_FRAMEBUFFER_COMPLETE) << fb_status;
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
- glBindFramebufferEXT(GL_FRAMEBUFFER, 0);
+ glBindFramebufferEXT(GL_FRAMEBUFFER,
+ gl_surface_->GetBackingFrameBufferObject());
}
// These vertices and texture coords. map (0,0) in the texture to the
@@ -503,6 +505,7 @@ void RenderingHelper::UnInitialize(base::WaitableEvent* done) {
glDeleteFramebuffersEXT(1, &thumbnails_fbo_id_);
}
+ gl_surface_->Destroy();
dnicoara 2015/02/23 22:48:26 This shouldn't be needed in here. Most implementat
achaulk 2015/02/23 22:50:17 That might cause issues with cleanup if there's no
gl_context_->ReleaseCurrent(gl_surface_.get());
gl_context_ = NULL;
gl_surface_ = NULL;
@@ -569,7 +572,8 @@ void RenderingHelper::RenderThumbnail(uint32 texture_target,
glBindFramebufferEXT(GL_FRAMEBUFFER, thumbnails_fbo_id_);
GLSetViewPort(area);
RenderTexture(texture_target, texture_id);
- glBindFramebufferEXT(GL_FRAMEBUFFER, 0);
+ glBindFramebufferEXT(GL_FRAMEBUFFER,
+ gl_surface_->GetBackingFrameBufferObject());
// Need to flush the GL commands before we return the tnumbnail texture to
// the decoder.
@@ -660,7 +664,8 @@ void RenderingHelper::GetThumbnailsAsRGB(std::vector<unsigned char>* rgb,
GL_RGBA,
GL_UNSIGNED_BYTE,
&rgba[0]);
- glBindFramebufferEXT(GL_FRAMEBUFFER, 0);
+ glBindFramebufferEXT(GL_FRAMEBUFFER,
+ gl_surface_->GetBackingFrameBufferObject());
rgb->resize(num_pixels * 3);
// Drop the alpha channel, but check as we go that it is all 0xff.
bool solid = true;
@@ -697,7 +702,13 @@ void RenderingHelper::RenderContent() {
static_cast<base::WaitableEvent*>(NULL)));
}
- glUniform1i(glGetUniformLocation(program_, "tex_flip"), 1);
+ int tex_flip = 1;
+#if USE_OZONE
Pawel Osciak 2015/02/24 00:13:47 #if defined(USE_OZONE)
achaulk 2015/02/24 19:07:21 Done.
+ // Ozone surfaceless renders flipped from normal GL, so there's no need to
+ // do an extra flip.
+ tex_flip = 0;
+#endif
+ glUniform1i(glGetUniformLocation(program_, "tex_flip"), tex_flip);
// Frames that will be returned to the client (via the no_longer_needed_cb)
// after this vector falls out of scope at the end of this method. We need

Powered by Google App Engine
This is Rietveld 408576698