Commit 55d66a55 authored by ccameron@chromium.org's avatar ccameron@chromium.org

Don't issue any extra geometry for the IOSurface leak workaround

The official solution to the problem where an IOSurface outlives
its bindings is to send a glBegin/glEnd pair down, which will
kick loose any references in the kernel.

BUG=158469


Review URL: https://chromiumcodereview.appspot.com/11418303

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170938 0039d316-1c4b-4281-b951-d872f2087c98
parent 804370fc
......@@ -196,10 +196,6 @@ class CompositingIOSurfaceMac {
bool is_vsync_disabled,
CVDisplayLinkRef display_link);
// Issue a draw call to try to flush references to an IOSurface out of
// the GL driver.
void DoWorkaroundForIOSurfaceLeak();
// Returns true if IOSurface is ready to render. False otherwise.
bool MapIOSurfaceToTexture(uint64 io_surface_handle);
......
......@@ -386,11 +386,13 @@ void CompositingIOSurfaceMac::DrawIOSurface(NSView* view, float scale_factor) {
}
}
glUseProgram(0); CHECK_GL_ERROR();
// Workaround for issue 158469. Issue a dummy draw call with texture_ not
// bound to blit_rgb_sampler_location_, in order to shake all references
// to the IOSurface out of the driver.
glBegin(GL_TRIANGLES);
glEnd();
// Issue a dummy draw call to flush references to the IOSurface out of
// the GL driver.
DoWorkaroundForIOSurfaceLeak();
glUseProgram(0); CHECK_GL_ERROR();
} else {
// Should match the clear color of RenderWidgetHostViewMac.
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
......@@ -530,34 +532,6 @@ void CompositingIOSurfaceMac::DrawQuad(const SurfaceQuad& quad) {
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
void CompositingIOSurfaceMac::DoWorkaroundForIOSurfaceLeak() {
if (!shader_program_blit_rgb_)
return;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, 1, 0, 1, -1, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
// Workaround for issue 158469. Issue a dummy draw call with texture_ not
// bound to blit_rgb_sampler_location_, in order to shake all references
// to the IOSurface out of the driver.
glUseProgram(shader_program_blit_rgb_);
glUniform1i(blit_rgb_sampler_location_, 0);
glActiveTexture(GL_TEXTURE0 + 0);
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
// Let invisible_quad be a quad that is outside of the viewport.
SurfaceQuad invisible_quad;
invisible_quad.set_rect(-2.0f, -2.0f, -1.9f, -1.9f);
invisible_quad.set_texcoord_rect(0.0f, 0.0f, 1.0f, 1.0f);
DrawQuad(invisible_quad);
glUseProgram(0);
CHECK_GL_ERROR();
}
void CompositingIOSurfaceMac::UnrefIOSurfaceWithContextCurrent() {
if (texture_) {
glDeleteTextures(1, &texture_);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment