Commit c789639d authored by erikchen's avatar erikchen Committed by Commit bot

Clear IOSurfaces immediately after creating them.

Calling IOSurfaceLock() followed by IOSurfaceUnlock() appears sufficient.

BUG=584760

Review URL: https://codereview.chromium.org/1709443002

Cr-Commit-Position: refs/heads/master@{#376054}
parent d24b85fd
...@@ -148,7 +148,16 @@ IOSurfaceRef CreateIOSurface(const gfx::Size& size, gfx::BufferFormat format) { ...@@ -148,7 +148,16 @@ IOSurfaceRef CreateIOSurface(const gfx::Size& size, gfx::BufferFormat format) {
BytesPerElement(format, 0)); BytesPerElement(format, 0));
} }
return IOSurfaceCreate(properties); IOSurfaceRef surface = IOSurfaceCreate(properties);
// Zero-initialize the IOSurface. Calling IOSurfaceLock/IOSurfaceUnlock
// appears to be sufficient. https://crbug.com/584760#c17
IOReturn r = IOSurfaceLock(surface, 0, nullptr);
DCHECK_EQ(kIOReturnSuccess, r);
r = IOSurfaceUnlock(surface, 0, nullptr);
DCHECK_EQ(kIOReturnSuccess, r);
return surface;
} }
} // namespace gfx } // namespace gfx
...@@ -177,9 +177,7 @@ class GLImageZeroInitializeTest : public GLImageTest<GLImageTestDelegate> {}; ...@@ -177,9 +177,7 @@ class GLImageZeroInitializeTest : public GLImageTest<GLImageTestDelegate> {};
// result is zero-initialized. // result is zero-initialized.
TYPED_TEST_CASE_P(GLImageZeroInitializeTest); TYPED_TEST_CASE_P(GLImageZeroInitializeTest);
// TODO(erikchen): Enable this test when it actually passes on Mac. TYPED_TEST_P(GLImageZeroInitializeTest, ZeroInitialize) {
// https://crbug.com/584760.
TYPED_TEST_P(GLImageZeroInitializeTest, DISABLED_ZeroInitialize) {
const gfx::Size image_size(256, 256); const gfx::Size image_size(256, 256);
GLuint framebuffer = GLuint framebuffer =
...@@ -217,7 +215,7 @@ TYPED_TEST_P(GLImageZeroInitializeTest, DISABLED_ZeroInitialize) { ...@@ -217,7 +215,7 @@ TYPED_TEST_P(GLImageZeroInitializeTest, DISABLED_ZeroInitialize) {
image->Destroy(true /* have_context */); image->Destroy(true /* have_context */);
} }
REGISTER_TYPED_TEST_CASE_P(GLImageZeroInitializeTest, DISABLED_ZeroInitialize); REGISTER_TYPED_TEST_CASE_P(GLImageZeroInitializeTest, ZeroInitialize);
template <typename GLImageTestDelegate> template <typename GLImageTestDelegate>
class GLImageCopyTest : public GLImageTest<GLImageTestDelegate> {}; class GLImageCopyTest : public GLImageTest<GLImageTestDelegate> {};
......
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