[Mesa-dev] [PATCH 1/3] egl: add EGL_NV_post_sub_buffer

Chia-I Wu olvaffe at gmail.com
Tue Dec 13 04:56:37 PST 2011


On Sun, Dec 11, 2011 at 1:56 AM, Fredrik Höglund <fredrik at kde.org> wrote:
> Signed-off-by: Fredrik Höglund <fredrik at kde.org>
> ---
>  include/EGL/eglext.h      |    9 +++++++++
>  src/egl/main/eglapi.c     |   24 ++++++++++++++++++++++++
>  src/egl/main/eglapi.h     |    8 ++++++++
>  src/egl/main/egldisplay.h |    2 ++
>  src/egl/main/eglmisc.c    |    2 ++
>  src/egl/main/eglsurface.c |    9 +++++++++
>  src/egl/main/eglsurface.h |    4 ++++
>  7 files changed, 58 insertions(+), 0 deletions(-)
>
> diff --git a/include/EGL/eglext.h b/include/EGL/eglext.h
> index 9484b83..d03a24d 100644
> --- a/include/EGL/eglext.h
> +++ b/include/EGL/eglext.h
> @@ -144,6 +144,15 @@ typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESA) (EGLDisplay dpy, con
>  typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESA) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
>  #endif
>
> +#ifndef EGL_NV_post_sub_buffer
> +#define EGL_NV_post_sub_buffer 1
> +#define EGL_POST_SUB_BUFFER_SUPPORTED_NV       0x30BE
> +#ifdef EGL_EGLEXT_PROTOTYPES
> +EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV(EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
> +#endif /* EGL_EGLEXT_PROTOTYPES */
> +typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
> +#endif
> +
>  #ifndef EGL_WL_bind_wayland_display
>  #define EGL_WL_bind_wayland_display 1
>
> diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
> index 3cb1a5b..ff15476 100644
> --- a/src/egl/main/eglapi.c
> +++ b/src/egl/main/eglapi.c
> @@ -951,6 +951,9 @@ eglGetProcAddress(const char *procname)
>  #ifdef EGL_ANDROID_swap_rectangle
>       { "eglSetSwapRectangleANDROID", (_EGLProc) eglSetSwapRectangleANDROID },
>  #endif
> +#ifdef EGL_NV_post_sub_buffer
> +      { "eglPostSubBufferNV", (_EGLProc) eglPostSubBufferNV },
> +#endif
>       { NULL, NULL }
>    };
>    EGLint i;
> @@ -1590,3 +1593,24 @@ eglSetSwapRectangleANDROID(EGLDisplay dpy, EGLSurface draw,
>    RETURN_EGL_EVAL(disp, ret);
>  }
>  #endif
> +
> +#ifdef EGL_NV_post_sub_buffer
> +EGLBoolean EGLAPIENTRY
> +eglPostSubBufferNV(EGLDisplay dpy, EGLSurface surface,
> +                   EGLint x, EGLint y, EGLint width, EGLint height)
> +{
> +   _EGLDisplay *disp = _eglLockDisplay(dpy);
> +   _EGLSurface *surf = _eglLookupSurface(surface, disp);
> +   _EGLDriver *drv;
> +   EGLBoolean ret;
> +
> +   _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv);
> +
> +   if (!disp->Extensions.NV_post_sub_buffer)
> +      RETURN_EGL_EVAL(disp, EGL_FALSE);
> +
> +   ret = drv->API.PostSubBufferNV(drv, disp, surf, x, y, width, height);
> +
> +   RETURN_EGL_EVAL(disp, ret);
> +}
> +#endif
> diff --git a/src/egl/main/eglapi.h b/src/egl/main/eglapi.h
> index 1e0aef6..f374273 100644
> --- a/src/egl/main/eglapi.h
> +++ b/src/egl/main/eglapi.h
> @@ -135,6 +135,10 @@ typedef EGLBoolean (*UnbindWaylandDisplayWL_t)(_EGLDriver *drv, _EGLDisplay *dis
>  typedef EGLBoolean (*SetSwapRectangleANDROID_t)(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw, EGLint left, EGLint top, EGLint width, EGLint height);
>  #endif
>
> +#ifdef EGL_NV_post_sub_buffer
> +typedef EGLBoolean (*PostSubBufferNV_t)(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surface, EGLint x, EGLint y, EGLint width, EGLint height);
> +#endif
> +
>  /**
>  * The API dispatcher jumps through these functions
>  */
> @@ -218,6 +222,10 @@ struct _egl_api
>  #ifdef EGL_ANDROID_swap_rectangle
>    SetSwapRectangleANDROID_t SetSwapRectangleANDROID;
>  #endif
> +
> +#ifdef EGL_NV_post_sub_buffer
> +   PostSubBufferNV_t PostSubBufferNV;
> +#endif
>  };
>
>  #endif /* EGLAPI_INCLUDED */
> diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
> index 67a2e24..8f737df 100644
> --- a/src/egl/main/egldisplay.h
> +++ b/src/egl/main/egldisplay.h
> @@ -112,6 +112,8 @@ struct _egl_extensions
>
>    EGLBoolean ANDROID_image_native_buffer;
>    EGLBoolean ANDROID_swap_rectangle;
> +
> +   EGLBoolean NV_post_sub_buffer;
>  };
>
>
> diff --git a/src/egl/main/eglmisc.c b/src/egl/main/eglmisc.c
> index ab48bc6..30cd04e 100644
> --- a/src/egl/main/eglmisc.c
> +++ b/src/egl/main/eglmisc.c
> @@ -116,6 +116,8 @@ _eglUpdateExtensionsString(_EGLDisplay *dpy)
>
>    _EGL_CHECK_EXTENSION(ANDROID_image_native_buffer);
>    _EGL_CHECK_EXTENSION(ANDROID_swap_rectangle);
> +
> +   _EGL_CHECK_EXTENSION(NV_post_sub_buffer);
>  #undef _EGL_CHECK_EXTENSION
>  }
>
> diff --git a/src/egl/main/eglsurface.c b/src/egl/main/eglsurface.c
> index 3564ecd..92edff5 100644
> --- a/src/egl/main/eglsurface.c
> +++ b/src/egl/main/eglsurface.c
> @@ -323,6 +323,10 @@ _eglInitSurface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type,
>    surf->VerticalResolution = EGL_UNKNOWN;
>    surf->AspectRatio = EGL_UNKNOWN;
>
> +#ifdef EGL_NV_post_sub_buffer
> +   surf->PostSubBufferSupportedNV = EGL_FALSE;
> +#endif
> +
I think this attribute should be set according to attrib_list.
>    /* the default swap interval is 1 */
>    _eglClampSwapInterval(surf, 1);
>
> @@ -392,6 +396,11 @@ _eglQuerySurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface,
>    case EGL_VG_COLORSPACE:
>       *value = surface->VGColorspace;
>       break;
> +#ifdef EGL_NV_post_sub_buffer
> +   case EGL_POST_SUB_BUFFER_SUPPORTED_NV:
> +      *value = surface->PostSubBufferSupportedNV;
> +      break;
> +#endif
>    default:
>       _eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface");
>       return EGL_FALSE;
> diff --git a/src/egl/main/eglsurface.h b/src/egl/main/eglsurface.h
> index 0541ff4..7b774da 100644
> --- a/src/egl/main/eglsurface.h
> +++ b/src/egl/main/eglsurface.h
> @@ -73,6 +73,10 @@ struct _egl_surface
>
>    /* True if the surface is bound to an OpenGL ES texture */
>    EGLBoolean BoundToTexture;
> +
> +#ifdef EGL_NV_post_sub_buffer
> +   EGLBoolean PostSubBufferSupportedNV;
> +#endif
>  };
>
>
> --
> 1.7.7.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev



-- 
olv at LunarG.com


More information about the mesa-dev mailing list