[Mesa-dev] [PATCH 1/2] st/egl: Add support for EGL_NOK_swap_region

Fredrik Höglund fredrik at kde.org
Tue Dec 13 14:03:06 PST 2011


On Tuesday 13 December 2011, Chia-I Wu wrote:
> On Fri, Dec 9, 2011 at 11:36 PM, Fredrik Höglund <fredrik at 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 <fredrik at 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



More information about the mesa-dev mailing list