mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 14:57:20 +00:00
[client] x11: make use of eglSwapBuffersWithDamage if it's available
This commit is contained in:
parent
092ce61908
commit
03c247a9ff
@ -943,6 +943,39 @@ static EGLNativeWindowType x11GetEGLNativeWindow(void)
|
|||||||
static void x11EGLSwapBuffers(EGLDisplay display, EGLSurface surface,
|
static void x11EGLSwapBuffers(EGLDisplay display, EGLSurface surface,
|
||||||
const struct Rect * damage, int count)
|
const struct Rect * damage, int count)
|
||||||
{
|
{
|
||||||
|
static bool detectDone = false;
|
||||||
|
static eglSwapBuffersWithDamageKHR_t swapWithDamage = NULL;
|
||||||
|
|
||||||
|
if (!detectDone)
|
||||||
|
{
|
||||||
|
const char *exts = eglQueryString(display, EGL_EXTENSIONS);
|
||||||
|
DEBUG_INFO("%s", exts);
|
||||||
|
if (util_hasGLExt(exts, "EGL_KHR_swap_buffers_with_damage"))
|
||||||
|
swapWithDamage = g_egl_dynProcs.eglSwapBuffersWithDamageKHR;
|
||||||
|
else if (util_hasGLExt(exts, "EGL_EXT_swap_buffers_with_damage"))
|
||||||
|
swapWithDamage = g_egl_dynProcs.eglSwapBuffersWithDamageEXT;
|
||||||
|
|
||||||
|
if (swapWithDamage)
|
||||||
|
DEBUG_INFO("Using eglSwapBuffersWithDamage");
|
||||||
|
|
||||||
|
detectDone = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (swapWithDamage && count)
|
||||||
|
{
|
||||||
|
EGLint rects[count*4];
|
||||||
|
EGLint *p = rects;
|
||||||
|
for(int i = 0; i < count; ++i, p += 4)
|
||||||
|
{
|
||||||
|
p[0] = damage[i].x;
|
||||||
|
p[1] = damage[i].y;
|
||||||
|
p[2] = damage[i].w;
|
||||||
|
p[3] = damage[i].h;
|
||||||
|
}
|
||||||
|
|
||||||
|
swapWithDamage(display, surface, rects, count);
|
||||||
|
}
|
||||||
|
else
|
||||||
eglSwapBuffers(display, surface);
|
eglSwapBuffers(display, surface);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user