[Mesa-dev] [PATCH 3/3] st/egl: Add support for EGL_NV_post_sub_buffer
Fredrik Höglund
fredrik at kde.org
Sat Dec 10 09:56:16 PST 2011
Signed-off-by: Fredrik Höglund <fredrik at kde.org>
---
src/gallium/state_trackers/egl/common/egl_g3d.c | 6 ++++-
.../state_trackers/egl/common/egl_g3d_api.c | 24 ++++++++++++++++++++
2 files changed, 29 insertions(+), 1 deletions(-)
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c
index feebfaf..554c23c 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.c
@@ -606,10 +606,14 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy)
dpy->Extensions.WL_bind_wayland_display = EGL_TRUE;
#endif
+ if (gdpy->native->get_param(gdpy->native, NATIVE_PARAM_PRESENT_REGION)) {
#ifdef EGL_NOK_swap_region
- if (gdpy->native->get_param(gdpy->native, NATIVE_PARAM_PRESENT_REGION))
dpy->Extensions.NOK_swap_region = EGL_TRUE;
#endif
+#ifdef EGL_NV_post_sub_buffer
+ dpy->Extensions.NV_post_sub_buffer = EGL_TRUE;
+#endif
+ }
if (egl_g3d_add_configs(drv, dpy, 1) == 1) {
_eglError(EGL_NOT_INITIALIZED, "eglInitialize(unable to add configs)");
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
index e8f2abc..7fa31bc 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
@@ -296,6 +296,14 @@ egl_g3d_create_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
gconf->stvis.buffer_mask & ST_ATTACHMENT_FRONT_LEFT_MASK)
gsurf->stvis.render_buffer = ST_ATTACHMENT_FRONT_LEFT;
+#ifdef EGL_NV_post_sub_buffer
+ if (dpy->Extensions.NV_post_sub_buffer) {
+ if (gsurf->base.Type == EGL_WINDOW_BIT &&
+ gsurf->base.RenderBuffer == EGL_BACK_BUFFER)
+ gsurf->base.PostSubBufferSupportedNV = EGL_TRUE;
+ }
+#endif
+
gsurf->stfbi = egl_g3d_create_st_framebuffer(&gsurf->base);
if (!gsurf->stfbi) {
nsurf->destroy(nsurf);
@@ -602,6 +610,18 @@ egl_g3d_swap_buffers_region(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf
}
#endif /* EGL_NOK_swap_region */
+#ifdef EGL_NV_post_sub_buffer
+static EGLBoolean
+egl_g3d_post_sub_buffer(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
+ EGLint x, EGLint y, EGLint width, EGLint height)
+{
+ /* Note: y=0=bottom */
+ const EGLint rect[4] = { x, surf->Height - y - height, width, height };
+
+ return swap_buffers(drv, dpy, surf, 1, rect, EGL_TRUE);
+}
+#endif /* EGL_NV_post_sub_buffer */
+
static EGLBoolean
egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
EGLNativePixmapType target)
@@ -894,4 +914,8 @@ egl_g3d_init_driver_api(_EGLDriver *drv)
#ifdef EGL_NOK_swap_region
drv->API.SwapBuffersRegionNOK = egl_g3d_swap_buffers_region;
#endif
+
+#ifdef EGL_NV_post_sub_buffer
+ drv->API.PostSubBufferNV = egl_g3d_post_sub_buffer;
+#endif
}
--
1.7.7.3
More information about the mesa-dev
mailing list