Commit 3f1eba94 by Geoff Lang Committed by Commit Bot

Support EGL_KHR_swap_buffers_with_damage in the EGL backend.

Update the EXT extension to KHR in ANGLE. BUG=angleproject:2544 Change-Id: Ia647191c3e762d658b0f7e28a34a9ce2cc545f48 Reviewed-on: https://chromium-review.googlesource.com/1054415Reviewed-by: 's avatarLuc Ferron <lucferron@chromium.org> Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent 1e91374e
...@@ -1351,7 +1351,7 @@ std::vector<std::string> DisplayExtensions::getStrings() const ...@@ -1351,7 +1351,7 @@ std::vector<std::string> DisplayExtensions::getStrings() const
InsertExtensionString("EGL_ANGLE_create_context_webgl_compatibility", createContextWebGLCompatibility, &extensionStrings); InsertExtensionString("EGL_ANGLE_create_context_webgl_compatibility", createContextWebGLCompatibility, &extensionStrings);
InsertExtensionString("EGL_CHROMIUM_create_context_bind_generates_resource", createContextBindGeneratesResource, &extensionStrings); InsertExtensionString("EGL_CHROMIUM_create_context_bind_generates_resource", createContextBindGeneratesResource, &extensionStrings);
InsertExtensionString("EGL_CHROMIUM_sync_control", getSyncValues, &extensionStrings); InsertExtensionString("EGL_CHROMIUM_sync_control", getSyncValues, &extensionStrings);
InsertExtensionString("EGL_EXT_swap_buffers_with_damage", swapBuffersWithDamage, &extensionStrings); InsertExtensionString("EGL_KHR_swap_buffers_with_damage", swapBuffersWithDamage, &extensionStrings);
InsertExtensionString("EGL_EXT_pixel_format_float", pixelFormatFloat, &extensionStrings); InsertExtensionString("EGL_EXT_pixel_format_float", pixelFormatFloat, &extensionStrings);
InsertExtensionString("EGL_KHR_surfaceless_context", surfacelessContext, &extensionStrings); InsertExtensionString("EGL_KHR_surfaceless_context", surfacelessContext, &extensionStrings);
InsertExtensionString("EGL_ANGLE_display_texture_share_group", displayTextureShareGroup, &extensionStrings); InsertExtensionString("EGL_ANGLE_display_texture_share_group", displayTextureShareGroup, &extensionStrings);
......
...@@ -744,7 +744,7 @@ struct DisplayExtensions ...@@ -744,7 +744,7 @@ struct DisplayExtensions
// EGL_CHROMIUM_get_sync_values // EGL_CHROMIUM_get_sync_values
bool getSyncValues; bool getSyncValues;
// EGL_EXT_swap_buffers_with_damage // EGL_KHR_swap_buffers_with_damage
bool swapBuffersWithDamage; bool swapBuffersWithDamage;
// EGL_EXT_pixel_format_float // EGL_EXT_pixel_format_float
......
...@@ -104,6 +104,7 @@ void DisplayEGL::generateExtensions(egl::DisplayExtensions *outExtensions) const ...@@ -104,6 +104,7 @@ void DisplayEGL::generateExtensions(egl::DisplayExtensions *outExtensions) const
mEGL->hasExtension("EGL_EXT_create_context_robustness"); mEGL->hasExtension("EGL_EXT_create_context_robustness");
outExtensions->postSubBuffer = false; // Since SurfaceEGL::postSubBuffer is not implemented outExtensions->postSubBuffer = false; // Since SurfaceEGL::postSubBuffer is not implemented
outExtensions->swapBuffersWithDamage = mEGL->hasExtension("EGL_KHR_swap_buffers_with_damage");
// Contexts are virtualized so textures can be shared globally // Contexts are virtualized so textures can be shared globally
outExtensions->displayTextureShareGroup = true; outExtensions->displayTextureShareGroup = true;
......
...@@ -62,7 +62,9 @@ struct FunctionsEGL::EGLDispatchTable ...@@ -62,7 +62,9 @@ struct FunctionsEGL::EGLDispatchTable
clientWaitSyncKHRPtr(nullptr), clientWaitSyncKHRPtr(nullptr),
createSyncKHRPtr(nullptr), createSyncKHRPtr(nullptr),
destroySyncKHRPtr(nullptr), destroySyncKHRPtr(nullptr),
getSyncAttribKHRPtr(nullptr) getSyncAttribKHRPtr(nullptr),
swapBuffersWithDamageKHRPtr(nullptr)
{ {
} }
...@@ -98,6 +100,9 @@ struct FunctionsEGL::EGLDispatchTable ...@@ -98,6 +100,9 @@ struct FunctionsEGL::EGLDispatchTable
PFNEGLCREATESYNCKHRPROC createSyncKHRPtr; PFNEGLCREATESYNCKHRPROC createSyncKHRPtr;
PFNEGLDESTROYSYNCKHRPROC destroySyncKHRPtr; PFNEGLDESTROYSYNCKHRPROC destroySyncKHRPtr;
PFNEGLGETSYNCATTRIBKHRPROC getSyncAttribKHRPtr; PFNEGLGETSYNCATTRIBKHRPROC getSyncAttribKHRPtr;
// EGL_KHR_swap_buffers_with_damage
PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC swapBuffersWithDamageKHRPtr;
}; };
FunctionsEGL::FunctionsEGL() FunctionsEGL::FunctionsEGL()
...@@ -177,6 +182,11 @@ egl::Error FunctionsEGL::initialize(EGLNativeDisplayType nativeDisplay) ...@@ -177,6 +182,11 @@ egl::Error FunctionsEGL::initialize(EGLNativeDisplayType nativeDisplay)
ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->getSyncAttribKHRPtr, eglGetSyncAttribKHR); ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->getSyncAttribKHRPtr, eglGetSyncAttribKHR);
} }
if (hasExtension("EGL_KHR_swap_buffers_with_damage"))
{
ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->swapBuffersWithDamageKHRPtr, eglSwapBuffersWithDamageKHR);
}
#undef ANGLE_GET_PROC_OR_ERROR #undef ANGLE_GET_PROC_OR_ERROR
return egl::NoError(); return egl::NoError();
...@@ -337,4 +347,11 @@ EGLBoolean FunctionsEGL::getSyncAttribKHR(EGLSyncKHR sync, EGLint attribute, EGL ...@@ -337,4 +347,11 @@ EGLBoolean FunctionsEGL::getSyncAttribKHR(EGLSyncKHR sync, EGLint attribute, EGL
{ {
return mFnPtrs->getSyncAttribKHRPtr(mEGLDisplay, sync, attribute, value); return mFnPtrs->getSyncAttribKHRPtr(mEGLDisplay, sync, attribute, value);
} }
EGLBoolean FunctionsEGL::swapBuffersWithDamageKHR(EGLSurface surface,
EGLint *rects,
EGLint n_rects) const
{
return mFnPtrs->swapBuffersWithDamageKHRPtr(mEGLDisplay, surface, rects, n_rects);
}
} // namespace rx } // namespace rx
...@@ -75,6 +75,8 @@ class FunctionsEGL ...@@ -75,6 +75,8 @@ class FunctionsEGL
EGLint clientWaitSyncKHR(EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); EGLint clientWaitSyncKHR(EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
EGLBoolean getSyncAttribKHR(EGLSyncKHR sync, EGLint attribute, EGLint *value); EGLBoolean getSyncAttribKHR(EGLSyncKHR sync, EGLint attribute, EGLint *value);
EGLBoolean swapBuffersWithDamageKHR(EGLSurface surface, EGLint *rects, EGLint n_rects) const;
private: private:
// So as to isolate from angle we do not include angleutils.h and cannot // So as to isolate from angle we do not include angleutils.h and cannot
// use angle::NonCopyable so we replicated it here instead. // use angle::NonCopyable so we replicated it here instead.
......
...@@ -43,6 +43,16 @@ egl::Error SurfaceEGL::swap(const gl::Context *context) ...@@ -43,6 +43,16 @@ egl::Error SurfaceEGL::swap(const gl::Context *context)
return egl::NoError(); return egl::NoError();
} }
egl::Error SurfaceEGL::swapWithDamage(const gl::Context *context, EGLint *rects, EGLint n_rects)
{
EGLBoolean success = mEGL->swapBuffersWithDamageKHR(mSurface, rects, n_rects);
if (success == EGL_FALSE)
{
return egl::Error(mEGL->getError(), "eglSwapBuffersWithDamageKHR failed");
}
return egl::NoError();
}
egl::Error SurfaceEGL::postSubBuffer(const gl::Context *context, egl::Error SurfaceEGL::postSubBuffer(const gl::Context *context,
EGLint x, EGLint x,
EGLint y, EGLint y,
......
...@@ -25,6 +25,7 @@ class SurfaceEGL : public SurfaceGL ...@@ -25,6 +25,7 @@ class SurfaceEGL : public SurfaceGL
egl::Error makeCurrent() override; egl::Error makeCurrent() override;
egl::Error swap(const gl::Context *context) override; egl::Error swap(const gl::Context *context) override;
egl::Error swapWithDamage(const gl::Context *context, EGLint *rects, EGLint n_rects) override;
egl::Error postSubBuffer(const gl::Context *context, egl::Error postSubBuffer(const gl::Context *context,
EGLint x, EGLint x,
EGLint y, EGLint y,
......
...@@ -2255,7 +2255,7 @@ Error ValidateGetSyncValuesCHROMIUM(const Display *display, ...@@ -2255,7 +2255,7 @@ Error ValidateGetSyncValuesCHROMIUM(const Display *display,
return NoError(); return NoError();
} }
Error ValidateSwapBuffersWithDamageEXT(const Display *display, Error ValidateSwapBuffersWithDamageKHR(const Display *display,
const Surface *surface, const Surface *surface,
EGLint *rects, EGLint *rects,
EGLint n_rects) EGLint n_rects)
...@@ -2270,7 +2270,7 @@ Error ValidateSwapBuffersWithDamageEXT(const Display *display, ...@@ -2270,7 +2270,7 @@ Error ValidateSwapBuffersWithDamageEXT(const Display *display,
{ {
// It is out of spec what happens when calling an extension function when the extension is // It is out of spec what happens when calling an extension function when the extension is
// not available. EGL_BAD_DISPLAY seems like a reasonable error. // not available. EGL_BAD_DISPLAY seems like a reasonable error.
return EglBadDisplay() << "EGL_EXT_swap_buffers_with_damage is not available."; return EglBadDisplay() << "EGL_KHR_swap_buffers_with_damage is not available.";
} }
if (surface == EGL_NO_SURFACE) if (surface == EGL_NO_SURFACE)
......
...@@ -104,7 +104,7 @@ Error ValidateGetSyncValuesCHROMIUM(const Display *display, ...@@ -104,7 +104,7 @@ Error ValidateGetSyncValuesCHROMIUM(const Display *display,
const EGLuint64KHR *msc, const EGLuint64KHR *msc,
const EGLuint64KHR *sbc); const EGLuint64KHR *sbc);
Error ValidateSwapBuffersWithDamageEXT(const Display *display, Error ValidateSwapBuffersWithDamageKHR(const Display *display,
const Surface *surface, const Surface *surface,
EGLint *rects, EGLint *rects,
EGLint n_rects); EGLint n_rects);
......
...@@ -368,12 +368,12 @@ EGLBoolean EGLAPIENTRY eglGetSyncValuesCHROMIUM(EGLDisplay dpy, ...@@ -368,12 +368,12 @@ EGLBoolean EGLAPIENTRY eglGetSyncValuesCHROMIUM(EGLDisplay dpy,
return egl::GetSyncValuesCHROMIUM(dpy, surface, ust, msc, sbc); return egl::GetSyncValuesCHROMIUM(dpy, surface, ust, msc, sbc);
} }
EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT(EGLDisplay dpy, EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageKHR(EGLDisplay dpy,
EGLSurface surface, EGLSurface surface,
EGLint *rects, EGLint *rects,
EGLint n_rects) EGLint n_rects)
{ {
return egl::SwapBuffersWithDamageEXT(dpy, surface, rects, n_rects); return egl::SwapBuffersWithDamageKHR(dpy, surface, rects, n_rects);
} }
EGLint EGLAPIENTRY eglProgramCacheGetAttribANGLE(EGLDisplay dpy, EGLenum attrib) EGLint EGLAPIENTRY eglProgramCacheGetAttribANGLE(EGLDisplay dpy, EGLenum attrib)
......
...@@ -58,7 +58,7 @@ EXPORTS ...@@ -58,7 +58,7 @@ EXPORTS
eglCreateStreamProducerD3DTextureANGLE @64 eglCreateStreamProducerD3DTextureANGLE @64
eglStreamPostD3DTextureANGLE @65 eglStreamPostD3DTextureANGLE @65
eglGetSyncValuesCHROMIUM @66 eglGetSyncValuesCHROMIUM @66
eglSwapBuffersWithDamageEXT @67 eglSwapBuffersWithDamageKHR @67
eglProgramCacheGetAttribANGLE @68 eglProgramCacheGetAttribANGLE @68
eglProgramCachePopulateANGLE @69 eglProgramCachePopulateANGLE @69
eglProgramCacheQueryANGLE @70 eglProgramCacheQueryANGLE @70
......
...@@ -754,10 +754,10 @@ EGLBoolean EGLAPIENTRY GetSyncValuesCHROMIUM(EGLDisplay dpy, ...@@ -754,10 +754,10 @@ EGLBoolean EGLAPIENTRY GetSyncValuesCHROMIUM(EGLDisplay dpy,
return EGL_TRUE; return EGL_TRUE;
} }
ANGLE_EXPORT EGLBoolean SwapBuffersWithDamageEXT(EGLDisplay dpy, EGLBoolean EGLAPIENTRY SwapBuffersWithDamageKHR(EGLDisplay dpy,
EGLSurface surface, EGLSurface surface,
EGLint *rects, EGLint *rects,
EGLint n_rects) EGLint n_rects)
{ {
EVENT( EVENT(
"(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint *rects = 0x%0.8p, EGLint " "(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint *rects = 0x%0.8p, EGLint "
...@@ -768,7 +768,7 @@ ANGLE_EXPORT EGLBoolean SwapBuffersWithDamageEXT(EGLDisplay dpy, ...@@ -768,7 +768,7 @@ ANGLE_EXPORT EGLBoolean SwapBuffersWithDamageEXT(EGLDisplay dpy,
Display *display = static_cast<Display *>(dpy); Display *display = static_cast<Display *>(dpy);
Surface *eglSurface = static_cast<Surface *>(surface); Surface *eglSurface = static_cast<Surface *>(surface);
Error error = ValidateSwapBuffersWithDamageEXT(display, eglSurface, rects, n_rects); Error error = ValidateSwapBuffersWithDamageKHR(display, eglSurface, rects, n_rects);
if (error.isError()) if (error.isError())
{ {
thread->setError(error); thread->setError(error);
......
...@@ -87,11 +87,11 @@ ANGLE_EXPORT EGLBoolean EGLAPIENTRY GetSyncValuesCHROMIUM(EGLDisplay dpy, ...@@ -87,11 +87,11 @@ ANGLE_EXPORT EGLBoolean EGLAPIENTRY GetSyncValuesCHROMIUM(EGLDisplay dpy,
EGLuint64KHR *msc, EGLuint64KHR *msc,
EGLuint64KHR *sbc); EGLuint64KHR *sbc);
// EGL_EXT_swap_buffers_with_damage // EGL_KHR_swap_buffers_with_damage
ANGLE_EXPORT EGLBoolean SwapBuffersWithDamageEXT(EGLDisplay dpy, ANGLE_EXPORT EGLBoolean EGLAPIENTRY SwapBuffersWithDamageKHR(EGLDisplay dpy,
EGLSurface surface, EGLSurface surface,
EGLint *rects, EGLint *rects,
EGLint n_rects); EGLint n_rects);
// //
ANGLE_EXPORT EGLint EGLAPIENTRY ProgramCacheGetAttribANGLE(EGLDisplay dpy, EGLenum attrib); ANGLE_EXPORT EGLint EGLAPIENTRY ProgramCacheGetAttribANGLE(EGLDisplay dpy, EGLenum attrib);
......
...@@ -92,7 +92,7 @@ ProcEntry g_procTable[] = { ...@@ -92,7 +92,7 @@ ProcEntry g_procTable[] = {
{"eglStreamPostD3DTextureANGLE", P(egl::StreamPostD3DTextureANGLE)}, {"eglStreamPostD3DTextureANGLE", P(egl::StreamPostD3DTextureANGLE)},
{"eglSurfaceAttrib", P(egl::SurfaceAttrib)}, {"eglSurfaceAttrib", P(egl::SurfaceAttrib)},
{"eglSwapBuffers", P(egl::SwapBuffers)}, {"eglSwapBuffers", P(egl::SwapBuffers)},
{"eglSwapBuffersWithDamageEXT", P(egl::SwapBuffersWithDamageEXT)}, {"eglSwapBuffersWithDamageKHR", P(egl::SwapBuffersWithDamageKHR)},
{"eglSwapInterval", P(egl::SwapInterval)}, {"eglSwapInterval", P(egl::SwapInterval)},
{"eglTerminate", P(egl::Terminate)}, {"eglTerminate", P(egl::Terminate)},
{"eglWaitClient", P(egl::WaitClient)}, {"eglWaitClient", P(egl::WaitClient)},
......
...@@ -822,8 +822,8 @@ ...@@ -822,8 +822,8 @@
"eglGetSyncValuesCHROMIUM" "eglGetSyncValuesCHROMIUM"
], ],
"EGL_EXT_swap_buffers_with_damage": [ "EGL_KHR_swap_buffers_with_damage": [
"eglSwapBuffersWithDamageEXT" "eglSwapBuffersWithDamageKHR"
], ],
"EGL_ANGLE_program_cache_control": [ "EGL_ANGLE_program_cache_control": [
......
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