Re: [Mesa-dev] [PATCH 1/2] st/egl: Add support for EGL_NOK_swap_region
On Tuesday 13 December 2011, Chia-I Wu wrote: On Fri, Dec 9, 2011 at 11:36 PM, Fredrik Höglund fred...@kde.org wrote: Backends indicate that they support this extension by returning EGL_TRUE when native_display::get_param() is called with NATIVE_PARAM_PRESENT_REGION. native_present_control is extended to include the region that should be presented. When the whole surface is to be presented, this region will be a single rect containing the dimensions of the surface. Signed-off-by: Fredrik Höglund fred...@kde.org --- src/gallium/state_trackers/egl/common/egl_g3d.c|5 +++ .../state_trackers/egl/common/egl_g3d_api.c| 31 ++- src/gallium/state_trackers/egl/common/native.h | 12 +++- 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c index 182ce68..feebfaf 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d.c @@ -606,6 +606,11 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy) dpy-Extensions.WL_bind_wayland_display = EGL_TRUE; #endif +#ifdef EGL_NOK_swap_region + if (gdpy-native-get_param(gdpy-native, NATIVE_PARAM_PRESENT_REGION)) + dpy-Extensions.NOK_swap_region = EGL_TRUE; +#endif + Does EGL_NOK_swap_region require the contents of the back buffer to be preserved? If so, NATIVE_PARAM_PRESERVE_BUFFER needs to be checked too. Unfortunately the specification isn't available, or at least not anywhere where google can find it. I think the safe thing to do for now is to assume that the back buffer must be preserved. EGL_NV_post_sub_buffer also requires this. static EGLBoolean +egl_g3d_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf) +{ + struct egl_g3d_surface *gsurf = egl_g3d_surface(surf); + const EGLint rect[4] = { 0, 0, gsurf-base.Width, gsurf-base.Height }; + + return swap_buffers(drv, dpy, surf, 1, rect, return swap_buffers(drv, dpy, surf, 0, NULL, ...); seems simpler here. It moves this logic into the backends, but on the other hand it makes it easier for them to detect when the whole surface should be presented. I'll update the patch to do this. Regards, Fredrik ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/2] st/egl: Add support for EGL_NOK_swap_region
Backends indicate that they support this extension by returning EGL_TRUE when native_display::get_param() is called with NATIVE_PARAM_PRESENT_REGION and NATIVE_PARAM_PRESERVE_BUFFER. native_present_control is extended to include the region that should be presented. When native_present_control::num_rects is zero, the whole surface is to be presented. Signed-off-by: Fredrik Höglund fred...@kde.org --- src/gallium/state_trackers/egl/common/egl_g3d.c|6 .../state_trackers/egl/common/egl_g3d_api.c| 30 ++- src/gallium/state_trackers/egl/common/native.h | 13 - 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c index 182ce68..53811b8 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d.c @@ -606,6 +606,12 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy) dpy-Extensions.WL_bind_wayland_display = EGL_TRUE; #endif +#ifdef EGL_NOK_swap_region + if (gdpy-native-get_param(gdpy-native, NATIVE_PARAM_PRESENT_REGION) + gdpy-native-get_param(gdpy-native, NATIVE_PARAM_PRESERVE_BUFFER)) + dpy-Extensions.NOK_swap_region = EGL_TRUE; +#endif + if (egl_g3d_add_configs(drv, dpy, 1) == 1) { _eglError(EGL_NOT_INITIALIZED, eglInitialize(unable to add configs)); goto fail; 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 911540e..2e3ead6 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c @@ -546,7 +546,8 @@ egl_g3d_make_current(_EGLDriver *drv, _EGLDisplay *dpy, } static EGLBoolean -egl_g3d_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf) +swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, + EGLint num_rects, const EGLint *rects, EGLBoolean preserve) { struct egl_g3d_surface *gsurf = egl_g3d_surface(surf); _EGLContext *ctx = _eglGetCurrentContext(); @@ -572,14 +573,35 @@ egl_g3d_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf) memset(ctrl, 0, sizeof(ctrl)); ctrl.natt = NATIVE_ATTACHMENT_BACK_LEFT; - ctrl.preserve = (gsurf-base.SwapBehavior == EGL_BUFFER_PRESERVED); + ctrl.preserve = preserve; ctrl.swap_interval = gsurf-base.SwapInterval; ctrl.premultiplied_alpha = (gsurf-base.VGAlphaFormat == EGL_VG_ALPHA_FORMAT_PRE); + ctrl.num_rects = num_rects; + ctrl.rects = rects; return gsurf-native-present(gsurf-native, ctrl); } static EGLBoolean +egl_g3d_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf) +{ + struct egl_g3d_surface *gsurf = egl_g3d_surface(surf); + + return swap_buffers(drv, dpy, surf, 0, NULL, + (gsurf-base.SwapBehavior == EGL_BUFFER_PRESERVED)); +} + +#ifdef EGL_NOK_swap_region +static EGLBoolean +egl_g3d_swap_buffers_region(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, +EGLint num_rects, const EGLint *rects) +{ + /* Note: y=0=top */ + return swap_buffers(drv, dpy, surf, num_rects, rects, EGL_TRUE); +} +#endif /* EGL_NOK_swap_region */ + +static EGLBoolean egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLNativePixmapType target) { @@ -867,4 +889,8 @@ egl_g3d_init_driver_api(_EGLDriver *drv) drv-API.CreateScreenSurfaceMESA = egl_g3d_create_screen_surface; drv-API.ShowScreenSurfaceMESA = egl_g3d_show_screen_surface; #endif + +#ifdef EGL_NOK_swap_region + drv-API.SwapBuffersRegionNOK = egl_g3d_swap_buffers_region; +#endif } diff --git a/src/gallium/state_trackers/egl/common/native.h b/src/gallium/state_trackers/egl/common/native.h index ee24c22..312b079 100644 --- a/src/gallium/state_trackers/egl/common/native.h +++ b/src/gallium/state_trackers/egl/common/native.h @@ -81,7 +81,13 @@ enum native_param_type { * EGL_ALPHA_SIZE. EGL_VG_ALPHA_FORMAT attribute of a surface will affect * how the surface is presented. */ - NATIVE_PARAM_PREMULTIPLIED_ALPHA + NATIVE_PARAM_PREMULTIPLIED_ALPHA, + + /** +* Return TRUE if native_surface::present supports presenting a partial +* surface. +*/ + NATIVE_PARAM_PRESENT_REGION }; /** @@ -99,6 +105,11 @@ struct native_present_control { /** pixels use premultiplied alpha */ boolean premultiplied_alpha; + + /** The region to present. y=0=top. +If num_rects is 0, the whole surface is to be presented */ + int num_rects; + const int *rects; /* x, y, width, height */ }; struct native_surface { -- 1.7.7.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] st/egl: Add support for EGL_NOK_swap_region
On Thu, Dec 15, 2011 at 4:06 AM, Fredrik Höglund fred...@kde.org wrote: Backends indicate that they support this extension by returning EGL_TRUE when native_display::get_param() is called with NATIVE_PARAM_PRESENT_REGION and NATIVE_PARAM_PRESERVE_BUFFER. native_present_control is extended to include the region that should be presented. When native_present_control::num_rects is zero, the whole surface is to be presented. Signed-off-by: Fredrik Höglund fred...@kde.org Committed. Thanks. --- src/gallium/state_trackers/egl/common/egl_g3d.c | 6 .../state_trackers/egl/common/egl_g3d_api.c | 30 ++- src/gallium/state_trackers/egl/common/native.h | 13 - 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c index 182ce68..53811b8 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d.c @@ -606,6 +606,12 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy) dpy-Extensions.WL_bind_wayland_display = EGL_TRUE; #endif +#ifdef EGL_NOK_swap_region + if (gdpy-native-get_param(gdpy-native, NATIVE_PARAM_PRESENT_REGION) + gdpy-native-get_param(gdpy-native, NATIVE_PARAM_PRESERVE_BUFFER)) + dpy-Extensions.NOK_swap_region = EGL_TRUE; +#endif + if (egl_g3d_add_configs(drv, dpy, 1) == 1) { _eglError(EGL_NOT_INITIALIZED, eglInitialize(unable to add configs)); goto fail; 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 911540e..2e3ead6 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c @@ -546,7 +546,8 @@ egl_g3d_make_current(_EGLDriver *drv, _EGLDisplay *dpy, } static EGLBoolean -egl_g3d_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf) +swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, + EGLint num_rects, const EGLint *rects, EGLBoolean preserve) { struct egl_g3d_surface *gsurf = egl_g3d_surface(surf); _EGLContext *ctx = _eglGetCurrentContext(); @@ -572,14 +573,35 @@ egl_g3d_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf) memset(ctrl, 0, sizeof(ctrl)); ctrl.natt = NATIVE_ATTACHMENT_BACK_LEFT; - ctrl.preserve = (gsurf-base.SwapBehavior == EGL_BUFFER_PRESERVED); + ctrl.preserve = preserve; ctrl.swap_interval = gsurf-base.SwapInterval; ctrl.premultiplied_alpha = (gsurf-base.VGAlphaFormat == EGL_VG_ALPHA_FORMAT_PRE); + ctrl.num_rects = num_rects; + ctrl.rects = rects; return gsurf-native-present(gsurf-native, ctrl); } static EGLBoolean +egl_g3d_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf) +{ + struct egl_g3d_surface *gsurf = egl_g3d_surface(surf); + + return swap_buffers(drv, dpy, surf, 0, NULL, + (gsurf-base.SwapBehavior == EGL_BUFFER_PRESERVED)); +} + +#ifdef EGL_NOK_swap_region +static EGLBoolean +egl_g3d_swap_buffers_region(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, + EGLint num_rects, const EGLint *rects) +{ + /* Note: y=0=top */ + return swap_buffers(drv, dpy, surf, num_rects, rects, EGL_TRUE); +} +#endif /* EGL_NOK_swap_region */ + +static EGLBoolean egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLNativePixmapType target) { @@ -867,4 +889,8 @@ egl_g3d_init_driver_api(_EGLDriver *drv) drv-API.CreateScreenSurfaceMESA = egl_g3d_create_screen_surface; drv-API.ShowScreenSurfaceMESA = egl_g3d_show_screen_surface; #endif + +#ifdef EGL_NOK_swap_region + drv-API.SwapBuffersRegionNOK = egl_g3d_swap_buffers_region; +#endif } diff --git a/src/gallium/state_trackers/egl/common/native.h b/src/gallium/state_trackers/egl/common/native.h index ee24c22..312b079 100644 --- a/src/gallium/state_trackers/egl/common/native.h +++ b/src/gallium/state_trackers/egl/common/native.h @@ -81,7 +81,13 @@ enum native_param_type { * EGL_ALPHA_SIZE. EGL_VG_ALPHA_FORMAT attribute of a surface will affect * how the surface is presented. */ - NATIVE_PARAM_PREMULTIPLIED_ALPHA + NATIVE_PARAM_PREMULTIPLIED_ALPHA, + + /** + * Return TRUE if native_surface::present supports presenting a partial + * surface. + */ + NATIVE_PARAM_PRESENT_REGION }; /** @@ -99,6 +105,11 @@ struct native_present_control { /** pixels use premultiplied alpha */ boolean premultiplied_alpha; + + /** The region to present. y=0=top. + If num_rects is 0, the whole surface is to be presented */ + int num_rects; + const int *rects; /* x, y, width, height */ }; struct native_surface { -- 1.7.7.3 ___ mesa-dev mailing list
Re: [Mesa-dev] [PATCH 1/2] st/egl: Add support for EGL_NOK_swap_region
On Fri, Dec 9, 2011 at 11:36 PM, Fredrik Höglund fred...@kde.org wrote: Backends indicate that they support this extension by returning EGL_TRUE when native_display::get_param() is called with NATIVE_PARAM_PRESENT_REGION. native_present_control is extended to include the region that should be presented. When the whole surface is to be presented, this region will be a single rect containing the dimensions of the surface. Signed-off-by: Fredrik Höglund fred...@kde.org --- src/gallium/state_trackers/egl/common/egl_g3d.c | 5 +++ .../state_trackers/egl/common/egl_g3d_api.c | 31 ++- src/gallium/state_trackers/egl/common/native.h | 12 +++- 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c index 182ce68..feebfaf 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d.c @@ -606,6 +606,11 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy) dpy-Extensions.WL_bind_wayland_display = EGL_TRUE; #endif +#ifdef EGL_NOK_swap_region + if (gdpy-native-get_param(gdpy-native, NATIVE_PARAM_PRESENT_REGION)) + dpy-Extensions.NOK_swap_region = EGL_TRUE; +#endif + Does EGL_NOK_swap_region require the contents of the back buffer to be preserved? If so, NATIVE_PARAM_PRESERVE_BUFFER needs to be checked too. if (egl_g3d_add_configs(drv, dpy, 1) == 1) { _eglError(EGL_NOT_INITIALIZED, eglInitialize(unable to add configs)); goto fail; 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 911540e..e8f2abc 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c @@ -546,7 +546,8 @@ egl_g3d_make_current(_EGLDriver *drv, _EGLDisplay *dpy, } static EGLBoolean -egl_g3d_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf) +swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, + EGLint num_rects, const EGLint *rects, EGLBoolean preserve) { struct egl_g3d_surface *gsurf = egl_g3d_surface(surf); _EGLContext *ctx = _eglGetCurrentContext(); @@ -572,14 +573,36 @@ egl_g3d_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf) memset(ctrl, 0, sizeof(ctrl)); ctrl.natt = NATIVE_ATTACHMENT_BACK_LEFT; - ctrl.preserve = (gsurf-base.SwapBehavior == EGL_BUFFER_PRESERVED); + ctrl.preserve = preserve; ctrl.swap_interval = gsurf-base.SwapInterval; ctrl.premultiplied_alpha = (gsurf-base.VGAlphaFormat == EGL_VG_ALPHA_FORMAT_PRE); + ctrl.num_rects = num_rects; + ctrl.rects = rects; return gsurf-native-present(gsurf-native, ctrl); } static EGLBoolean +egl_g3d_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf) +{ + struct egl_g3d_surface *gsurf = egl_g3d_surface(surf); + const EGLint rect[4] = { 0, 0, gsurf-base.Width, gsurf-base.Height }; + + return swap_buffers(drv, dpy, surf, 1, rect, return swap_buffers(drv, dpy, surf, 0, NULL, ...); seems simpler here. + (gsurf-base.SwapBehavior == EGL_BUFFER_PRESERVED)); +} + +#ifdef EGL_NOK_swap_region +static EGLBoolean +egl_g3d_swap_buffers_region(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, + EGLint num_rects, const EGLint *rects) +{ + /* Note: y=0=top */ + return swap_buffers(drv, dpy, surf, num_rects, rects, EGL_TRUE); This assumes the native display supports buffer preservation. If the extension requires that, then NATIVE_PARAM_PRESERVE_BUFFER should be checked. If not, EGL_SWAP_BEHAVIOR should be honored. +} +#endif /* EGL_NOK_swap_region */ + +static EGLBoolean egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLNativePixmapType target) { @@ -867,4 +890,8 @@ egl_g3d_init_driver_api(_EGLDriver *drv) drv-API.CreateScreenSurfaceMESA = egl_g3d_create_screen_surface; drv-API.ShowScreenSurfaceMESA = egl_g3d_show_screen_surface; #endif + +#ifdef EGL_NOK_swap_region + drv-API.SwapBuffersRegionNOK = egl_g3d_swap_buffers_region; +#endif } diff --git a/src/gallium/state_trackers/egl/common/native.h b/src/gallium/state_trackers/egl/common/native.h index ee24c22..f1e067e 100644 --- a/src/gallium/state_trackers/egl/common/native.h +++ b/src/gallium/state_trackers/egl/common/native.h @@ -81,7 +81,13 @@ enum native_param_type { * EGL_ALPHA_SIZE. EGL_VG_ALPHA_FORMAT attribute of a surface will affect * how the surface is presented. */ - NATIVE_PARAM_PREMULTIPLIED_ALPHA + NATIVE_PARAM_PREMULTIPLIED_ALPHA, + + /** + * Return TRUE if native_surface::present supports presenting a partial + * surface. + */ + NATIVE_PARAM_PRESENT_REGION }; /** @@ -99,6 +105,10 @@ struct
[Mesa-dev] [PATCH 1/2] st/egl: Add support for EGL_NOK_swap_region
Backends indicate that they support this extension by returning EGL_TRUE when native_display::get_param() is called with NATIVE_PARAM_PRESENT_REGION. native_present_control is extended to include the region that should be presented. When the whole surface is to be presented, this region will be a single rect containing the dimensions of the surface. Signed-off-by: Fredrik Höglund fred...@kde.org --- src/gallium/state_trackers/egl/common/egl_g3d.c|5 +++ .../state_trackers/egl/common/egl_g3d_api.c| 31 ++- src/gallium/state_trackers/egl/common/native.h | 12 +++- 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c index 182ce68..feebfaf 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d.c @@ -606,6 +606,11 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy) dpy-Extensions.WL_bind_wayland_display = EGL_TRUE; #endif +#ifdef EGL_NOK_swap_region + if (gdpy-native-get_param(gdpy-native, NATIVE_PARAM_PRESENT_REGION)) + dpy-Extensions.NOK_swap_region = EGL_TRUE; +#endif + if (egl_g3d_add_configs(drv, dpy, 1) == 1) { _eglError(EGL_NOT_INITIALIZED, eglInitialize(unable to add configs)); goto fail; 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 911540e..e8f2abc 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c @@ -546,7 +546,8 @@ egl_g3d_make_current(_EGLDriver *drv, _EGLDisplay *dpy, } static EGLBoolean -egl_g3d_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf) +swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, + EGLint num_rects, const EGLint *rects, EGLBoolean preserve) { struct egl_g3d_surface *gsurf = egl_g3d_surface(surf); _EGLContext *ctx = _eglGetCurrentContext(); @@ -572,14 +573,36 @@ egl_g3d_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf) memset(ctrl, 0, sizeof(ctrl)); ctrl.natt = NATIVE_ATTACHMENT_BACK_LEFT; - ctrl.preserve = (gsurf-base.SwapBehavior == EGL_BUFFER_PRESERVED); + ctrl.preserve = preserve; ctrl.swap_interval = gsurf-base.SwapInterval; ctrl.premultiplied_alpha = (gsurf-base.VGAlphaFormat == EGL_VG_ALPHA_FORMAT_PRE); + ctrl.num_rects = num_rects; + ctrl.rects = rects; return gsurf-native-present(gsurf-native, ctrl); } static EGLBoolean +egl_g3d_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf) +{ + struct egl_g3d_surface *gsurf = egl_g3d_surface(surf); + const EGLint rect[4] = { 0, 0, gsurf-base.Width, gsurf-base.Height }; + + return swap_buffers(drv, dpy, surf, 1, rect, + (gsurf-base.SwapBehavior == EGL_BUFFER_PRESERVED)); +} + +#ifdef EGL_NOK_swap_region +static EGLBoolean +egl_g3d_swap_buffers_region(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, +EGLint num_rects, const EGLint *rects) +{ + /* Note: y=0=top */ + return swap_buffers(drv, dpy, surf, num_rects, rects, EGL_TRUE); +} +#endif /* EGL_NOK_swap_region */ + +static EGLBoolean egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLNativePixmapType target) { @@ -867,4 +890,8 @@ egl_g3d_init_driver_api(_EGLDriver *drv) drv-API.CreateScreenSurfaceMESA = egl_g3d_create_screen_surface; drv-API.ShowScreenSurfaceMESA = egl_g3d_show_screen_surface; #endif + +#ifdef EGL_NOK_swap_region + drv-API.SwapBuffersRegionNOK = egl_g3d_swap_buffers_region; +#endif } diff --git a/src/gallium/state_trackers/egl/common/native.h b/src/gallium/state_trackers/egl/common/native.h index ee24c22..f1e067e 100644 --- a/src/gallium/state_trackers/egl/common/native.h +++ b/src/gallium/state_trackers/egl/common/native.h @@ -81,7 +81,13 @@ enum native_param_type { * EGL_ALPHA_SIZE. EGL_VG_ALPHA_FORMAT attribute of a surface will affect * how the surface is presented. */ - NATIVE_PARAM_PREMULTIPLIED_ALPHA + NATIVE_PARAM_PREMULTIPLIED_ALPHA, + + /** +* Return TRUE if native_surface::present supports presenting a partial +* surface. +*/ + NATIVE_PARAM_PRESENT_REGION }; /** @@ -99,6 +105,10 @@ struct native_present_control { /** pixels use premultiplied alpha */ boolean premultiplied_alpha; + + /** the region to present. y=0=top */ + int num_rects; + const int *rects; /* x, y, width, height */ }; struct native_surface { -- 1.7.7.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev