<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 22, 2014 at 12:19 PM, Sarah Sharp <span dir="ltr"><<a href="mailto:sarah.a.sharp@linux.intel.com" target="_blank">sarah.a.sharp@linux.intel.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="">On Sat, Apr 19, 2014 at 12:34:37PM -0700, Stéphane Marchesin wrote:<br>


> On Fri, Apr 18, 2014 at 3:37 PM, Sarah Sharp<br>
> <<a href="mailto:sarah.a.sharp@linux.intel.com">sarah.a.sharp@linux.intel.com</a>>wrote:<br>
><br>
> > Chromium defined a new GL extension (that isn't registered with Khronos).<br>
> ><br>
><br>
> This here is the problem IMO. I'll see next week what we can do about<br>
> pushing for this to become a registered extension. Intel would be our 2nd<br>
> implementation, so I think we have enough support at this point.<br>
<br>
</div>Sure.  How long does getting an extension registered take?  Should I<br>
hold off on this patch until it lands, </blockquote><div><br></div><div><div>No, don't hold off anything, it can take a bit.</div><div><br></div><div>Stéphane</div><div> </div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

or should we just remove the EGL<br>
definition from eglmesaext.h once it gets imported into eglext.h?<br>
<span class=""><font color="#888888"><br>
Sarah Sharp<br>
</font></span><div class=""><div class="h5"><br>
> > We need to add an EGL extension for it, so we can migrate ChromeOS on<br>
> > Intel systems to use EGL instead of GLX.<br>
> ><br>
> ><br>
> > <a href="http://git.chromium.org/gitweb/?p=chromium/src/third_party/khronos.git;a=commitdiff;h=27cbfdab35c601f70aa150581ad1448d0401f447" target="_blank">http://git.chromium.org/gitweb/?p=chromium/src/third_party/khronos.git;a=commitdiff;h=27cbfdab35c601f70aa150581ad1448d0401f447</a><br>


> ><br>
> > The extension is similar to the GLX extension OML_sync_control, but only<br>
> > defines one function, eglGetSyncValuesCHROMIUM, which is equivalent to<br>
> > glXGetSyncValuesOML.<br>
> ><br>
> > <a href="http://www.opengl.org/registry/specs/OML/glx_sync_control.txt" target="_blank">http://www.opengl.org/registry/specs/OML/glx_sync_control.txt</a><br>
> ><br>
> > One open question:<br>
> ><br>
> > I've used the normal (error checked) version of xcb_dri2_get_msc.  The<br>
> > GLX implementation of glXGetSyncValuesOML uses the unchecked version,<br>
> > but I'm not convinced it's necessary.<br>
> ><br>
> > I talked to Jamey Sharp, and he doesn't understand why most of Mesa<br>
> > calls the unchecked versions of XCB functions.  He thought most<br>
> > developers would want to use the normal (checked) versions, since the<br>
> > unchecked versions may segfault on errors.  Mesa can always call the<br>
> > checked version, but ignore the error that's set, so it doesn't have to<br>
> > use the unchecked version.<br>
> ><br>
> > I talked to Kristen Høgsberg, who added most of the Mesa XCB calls, and<br>
> > he said he copied the style from Chris Wilson.  If using the unchecked<br>
> > versions isn't required, we should look into moving the XCB calls in<br>
> > Mesa to the normal checked versions.  Otherwise people will just keep<br>
> > copy-pasting the unchecked versions around.<br>
> ><br>
> > Signed-off-by: Sarah Sharp <<a href="mailto:sarah.a.sharp@linux.intel.com">sarah.a.sharp@linux.intel.com</a>><br>
> > Cc: Chad Versace <<a href="mailto:chad.versace@linux.intel.com">chad.versace@linux.intel.com</a>><br>
> > Cc: Kristian Høgsberg <<a href="mailto:krh@bitplanet.net">krh@bitplanet.net</a>><br>
> > Cc: Jamey Sharp <<a href="mailto:jamey@minilop.net">jamey@minilop.net</a>><br>
> > ---<br>
> >  include/EGL/eglext.h                      | 10 ++++++++++<br>
> >  src/egl/drivers/dri2/egl_dri2.c           | 15 +++++++++++++++<br>
> >  src/egl/drivers/dri2/egl_dri2.h           |  4 ++++<br>
> >  src/egl/drivers/dri2/egl_dri2_fallbacks.h |  8 ++++++++<br>
> >  src/egl/drivers/dri2/platform_android.c   |  1 +<br>
> >  src/egl/drivers/dri2/platform_drm.c       |  1 +<br>
> >  src/egl/drivers/dri2/platform_wayland.c   |  1 +<br>
> >  src/egl/drivers/dri2/platform_x11.c       | 27 +++++++++++++++++++++++++++<br>
> >  src/egl/main/eglapi.c                     | 27 +++++++++++++++++++++++++++<br>
> >  src/egl/main/eglapi.h                     |  7 +++++++<br>
> >  src/egl/main/egldisplay.h                 |  1 +<br>
> >  src/egl/main/eglmisc.c                    |  1 +<br>
> >  12 files changed, 103 insertions(+)<br>
> ><br>
> > diff --git a/include/EGL/eglext.h b/include/EGL/eglext.h<br>
> > index 243da4a..097ad68 100644<br>
> > --- a/include/EGL/eglext.h<br>
> > +++ b/include/EGL/eglext.h<br>
> > @@ -588,6 +588,16 @@ EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV<br>
> > (EGLDisplay dpy, EGLSurface sur<br>
> >  #endif<br>
> >  #endif /* EGL_NV_post_sub_buffer */<br>
> ><br>
> > +#if KHRONOS_SUPPORT_INT64   /* EGLSyncControlCHROMIUM requires 64-bit<br>
> > uint support */<br>
> > +#ifndef EGL_CHROMIUM_sync_control<br>
> > +#define EGL_CHROMIUM_sync_control 1<br>
> > +#ifdef EGL_EGLEXT_PROTOTYPES<br>
> > +EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncValuesCHROMIUM(EGLDisplay dpy,<br>
> > EGLSurface surface, EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR<br>
> > *sbc);<br>
> > +#endif /* EGL_EGLEXT_PROTOTYPES */<br>
> > +typedef EGLBoolean (EGLAPIENTRYP<br>
> > PFNEGLGETSYNCVALUESCHROMIUMPROC)(EGLDisplay dpy, EGLSurface surface,<br>
> > EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc);<br>
> > +#endif<br>
> > +#endif<br>
> > +<br>
> >  #ifndef EGL_NV_stream_sync<br>
> >  #define EGL_NV_stream_sync 1<br>
> >  #define EGL_SYNC_NEW_FRAME_NV             0x321F<br>
> > diff --git a/src/egl/drivers/dri2/egl_dri2.c<br>
> > b/src/egl/drivers/dri2/egl_dri2.c<br>
> > index dc541ad..df8d9af 100644<br>
> > --- a/src/egl/drivers/dri2/egl_dri2.c<br>
> > +++ b/src/egl/drivers/dri2/egl_dri2.c<br>
> > @@ -1386,6 +1386,18 @@ dri2_create_image_wayland_wl_buffer(_EGLDisplay<br>
> > *disp, _EGLContext *ctx,<br>
> >  }<br>
> >  #endif<br>
> ><br>
> > +#ifdef EGL_CHROMIUM_sync_control<br>
> > +static EGLBoolean<br>
> > +dri2_get_sync_values_chromium(_EGLDisplay *dpy, _EGLSurface *surf,<br>
> > +                              EGLuint64KHR *ust, EGLuint64KHR *msc,<br>
> > +                              EGLuint64KHR *sbc)<br>
> > +{<br>
> > +   struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);<br>
> > +   return dri2_dpy->vtbl->get_sync_values(dpy, surf, ust, msc, sbc);<br>
> > +}<br>
> > +#endif<br>
> > +<br>
> > +<br>
> >  /**<br>
> >   * Set the error code after a call to<br>
> >   * dri2_egl_image::dri_image::createImageFromTexture.<br>
> > @@ -2177,6 +2189,9 @@ _eglBuiltInDriverDRI2(const char *args)<br>
> >     dri2_drv->base.API.UnbindWaylandDisplayWL =<br>
> > dri2_unbind_wayland_display_wl;<br>
> >     dri2_drv->base.API.QueryWaylandBufferWL = dri2_query_wayland_buffer_wl;<br>
> >  #endif<br>
> > +#ifdef EGL_CHROMIUM_sync_control<br>
> > +   dri2_drv->base.API.GetSyncValuesCHROMIUM =<br>
> > dri2_get_sync_values_chromium;<br>
> > +#endif<br>
> ><br>
> >     dri2_drv->base.Name = "DRI2";<br>
> >     dri2_drv->base.Unload = dri2_unload;<br>
> > diff --git a/src/egl/drivers/dri2/egl_dri2.h<br>
> > b/src/egl/drivers/dri2/egl_dri2.h<br>
> > index e62e265..44f26fb 100644<br>
> > --- a/src/egl/drivers/dri2/egl_dri2.h<br>
> > +++ b/src/egl/drivers/dri2/egl_dri2.h<br>
> > @@ -138,6 +138,10 @@ struct dri2_egl_display_vtbl {<br>
> ><br>
> >     struct wl_buffer* (*create_wayland_buffer_from_image)(<br>
> >                          _EGLDriver *drv, _EGLDisplay *dpy, _EGLImage<br>
> > *img);<br>
> > +<br>
> > +   EGLBoolean (*get_sync_values)(_EGLDisplay *display, _EGLSurface<br>
> > *surface,<br>
> > +                                 EGLuint64KHR *ust, EGLuint64KHR *msc,<br>
> > +                                 EGLuint64KHR *sbc);<br>
> >  };<br>
> ><br>
> >  struct dri2_egl_display<br>
> > diff --git a/src/egl/drivers/dri2/egl_dri2_fallbacks.h<br>
> > b/src/egl/drivers/dri2/egl_dri2_fallbacks.h<br>
> > index a5cf344..9cba001 100644<br>
> > --- a/src/egl/drivers/dri2/egl_dri2_fallbacks.h<br>
> > +++ b/src/egl/drivers/dri2/egl_dri2_fallbacks.h<br>
> > @@ -98,3 +98,11 @@<br>
> > dri2_fallback_create_wayland_buffer_from_image(_EGLDriver *drv,<br>
> >  {<br>
> >     return NULL;<br>
> >  }<br>
> > +<br>
> > +static inline EGLBoolean<br>
> > +dri2_fallback_get_sync_values(_EGLDisplay *dpy, _EGLSurface *surf,<br>
> > +                              EGLuint64KHR *ust, EGLuint64KHR *msc,<br>
> > +                              EGLuint64KHR *sbc)<br>
> > +{<br>
> > +   return EGL_FALSE;<br>
> > +}<br>
> > diff --git a/src/egl/drivers/dri2/platform_android.c<br>
> > b/src/egl/drivers/dri2/platform_android.c<br>
> > index 7b1db76..71948bd 100644<br>
> > --- a/src/egl/drivers/dri2/platform_android.c<br>
> > +++ b/src/egl/drivers/dri2/platform_android.c<br>
> > @@ -650,6 +650,7 @@ static struct dri2_egl_display_vtbl droid_display_vtbl<br>
> > = {<br>
> >     .copy_buffers = dri2_fallback_copy_buffers,<br>
> >     .query_buffer_age = dri2_fallback_query_buffer_age,<br>
> >     .create_wayland_buffer_from_image =<br>
> > dri2_fallback_create_wayland_buffer_from_image,<br>
> > +   .get_sync_values = dri2_fallback_get_sync_values,<br>
> >  };<br>
> ><br>
> >  EGLBoolean<br>
> > diff --git a/src/egl/drivers/dri2/platform_drm.c<br>
> > b/src/egl/drivers/dri2/platform_drm.c<br>
> > index 9a7633a..52d8b49 100644<br>
> > --- a/src/egl/drivers/dri2/platform_drm.c<br>
> > +++ b/src/egl/drivers/dri2/platform_drm.c<br>
> > @@ -472,6 +472,7 @@ static struct dri2_egl_display_vtbl<br>
> > dri2_drm_display_vtbl = {<br>
> >     .copy_buffers = dri2_fallback_copy_buffers,<br>
> >     .query_buffer_age = dri2_drm_query_buffer_age,<br>
> >     .create_wayland_buffer_from_image =<br>
> > dri2_fallback_create_wayland_buffer_from_image,<br>
> > +   .get_sync_values = dri2_fallback_get_sync_values,<br>
> >  };<br>
> ><br>
> >  EGLBoolean<br>
> > diff --git a/src/egl/drivers/dri2/platform_wayland.c<br>
> > b/src/egl/drivers/dri2/platform_wayland.c<br>
> > index 691f3e1..efc5546 100644<br>
> > --- a/src/egl/drivers/dri2/platform_wayland.c<br>
> > +++ b/src/egl/drivers/dri2/platform_wayland.c<br>
> > @@ -964,6 +964,7 @@ static struct dri2_egl_display_vtbl<br>
> > dri2_wl_display_vtbl = {<br>
> >     .copy_buffers = dri2_fallback_copy_buffers,<br>
> >     .query_buffer_age = dri2_wl_query_buffer_age,<br>
> >     .create_wayland_buffer_from_image =<br>
> > dri2_wl_create_wayland_buffer_from_image,<br>
> > +   .get_sync_values = dri2_fallback_get_sync_values,<br>
> >  };<br>
> ><br>
> >  EGLBoolean<br>
> > diff --git a/src/egl/drivers/dri2/platform_x11.c<br>
> > b/src/egl/drivers/dri2/platform_x11.c<br>
> > index 7b585a2..a6b03cc 100644<br>
> > --- a/src/egl/drivers/dri2/platform_x11.c<br>
> > +++ b/src/egl/drivers/dri2/platform_x11.c<br>
> > @@ -1008,6 +1008,30 @@ dri2_x11_swrast_create_image_khr(_EGLDriver *drv,<br>
> > _EGLDisplay *disp,<br>
> >     return NULL;<br>
> >  }<br>
> ><br>
> > +static EGLBoolean<br>
> > +dri2_x11_get_sync_values(_EGLDisplay *display, _EGLSurface *surface,<br>
> > +                         EGLuint64KHR *ust, EGLuint64KHR *msc,<br>
> > +                         EGLuint64KHR *sbc)<br>
> > +{<br>
> > +   struct dri2_egl_display *dri2_dpy = dri2_egl_display(display);<br>
> > +   struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surface);<br>
> > +   xcb_dri2_get_msc_cookie_t cookie;<br>
> > +   xcb_dri2_get_msc_reply_t *reply;<br>
> > +<br>
> > +   cookie = xcb_dri2_get_msc(dri2_dpy->conn, dri2_surf->drawable);<br>
> > +   reply = xcb_dri2_get_msc_reply(dri2_dpy->conn, cookie, NULL);<br>
> > +<br>
> > +   if (!reply)<br>
> > +      return EGL_FALSE;<br>
> > +<br>
> > +   *ust = ((EGLuint64KHR) reply->ust_hi << 32) | reply->ust_lo;<br>
> > +   *msc = ((EGLuint64KHR) reply->msc_hi << 32) | reply->msc_lo;<br>
> > +   *sbc = ((EGLuint64KHR) reply->sbc_hi << 32) | reply->sbc_lo;<br>
> > +   free(reply);<br>
> > +<br>
> > +   return EGL_TRUE;<br>
> > +}<br>
> > +<br>
> >  static struct dri2_egl_display_vtbl dri2_x11_swrast_display_vtbl = {<br>
> >     .authenticate = NULL,<br>
> >     .create_window_surface = dri2_x11_create_window_surface,<br>
> > @@ -1022,6 +1046,7 @@ static struct dri2_egl_display_vtbl<br>
> > dri2_x11_swrast_display_vtbl = {<br>
> >     .copy_buffers = dri2_x11_copy_buffers,<br>
> >     .query_buffer_age = dri2_fallback_query_buffer_age,<br>
> >     .create_wayland_buffer_from_image =<br>
> > dri2_fallback_create_wayland_buffer_from_image,<br>
> > +   .get_sync_values = dri2_fallback_get_sync_values,<br>
> >  };<br>
> ><br>
> >  static struct dri2_egl_display_vtbl dri2_x11_display_vtbl = {<br>
> > @@ -1039,6 +1064,7 @@ static struct dri2_egl_display_vtbl<br>
> > dri2_x11_display_vtbl = {<br>
> >     .copy_buffers = dri2_x11_copy_buffers,<br>
> >     .query_buffer_age = dri2_fallback_query_buffer_age,<br>
> >     .create_wayland_buffer_from_image =<br>
> > dri2_fallback_create_wayland_buffer_from_image,<br>
> > +   .get_sync_values = dri2_x11_get_sync_values,<br>
> >  };<br>
> ><br>
> >  static EGLBoolean<br>
> > @@ -1243,6 +1269,7 @@ dri2_initialize_x11_dri2(_EGLDriver *drv,<br>
> > _EGLDisplay *disp)<br>
> >     disp->Extensions.NOK_swap_region = EGL_TRUE;<br>
> >     disp->Extensions.NOK_texture_from_pixmap = EGL_TRUE;<br>
> >     disp->Extensions.NV_post_sub_buffer = EGL_TRUE;<br>
> > +   disp->Extensions.CHROMIUM_get_sync_values = EGL_TRUE;<br>
> ><br>
> >  #ifdef HAVE_WAYLAND_PLATFORM<br>
> >     disp->Extensions.WL_bind_wayland_display = EGL_TRUE;<br>
> > diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c<br>
> > index 219d8e6..d876995 100644<br>
> > --- a/src/egl/main/eglapi.c<br>
> > +++ b/src/egl/main/eglapi.c<br>
> > @@ -1086,6 +1086,9 @@ eglGetProcAddress(const char *procname)<br>
> >        { "eglGetPlatformDisplayEXT", (_EGLProc) eglGetPlatformDisplayEXT },<br>
> >        { "eglCreatePlatformWindowSurfaceEXT", (_EGLProc)<br>
> > eglCreatePlatformWindowSurfaceEXT },<br>
> >        { "eglCreatePlatformPixmapSurfaceEXT", (_EGLProc)<br>
> > eglCreatePlatformPixmapSurfaceEXT },<br>
> > +#ifdef EGL_CHROMIUM_sync_control<br>
> > +      { "eglGetSyncValuesCHROMIUM", (_EGLProc) eglGetSyncValuesCHROMIUM },<br>
> > +#endif<br>
> >        { NULL, NULL }<br>
> >     };<br>
> >     EGLint i;<br>
> > @@ -1751,3 +1754,27 @@ eglPostSubBufferNV(EGLDisplay dpy, EGLSurface<br>
> > surface,<br>
> ><br>
> >     RETURN_EGL_EVAL(disp, ret);<br>
> >  }<br>
> > +<br>
> > +#ifdef EGL_CHROMIUM_sync_control<br>
> > +EGLBoolean EGLAPIENTRY<br>
> > +eglGetSyncValuesCHROMIUM(EGLDisplay display, EGLSurface surface,<br>
> > +                         EGLuint64KHR *ust, EGLuint64KHR *msc,<br>
> > +                         EGLuint64KHR *sbc)<br>
> > +{<br>
> > +   _EGLDisplay *disp = _eglLockDisplay(display);<br>
> > +   _EGLSurface *surf = _eglLookupSurface(surface, disp);<br>
> > +   _EGLDriver *drv;<br>
> > +   EGLBoolean ret;<br>
> > +<br>
> > +   _EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv);<br>
> > +   if (!disp->Extensions.CHROMIUM_get_sync_values)<br>
> > +      RETURN_EGL_EVAL(disp, EGL_FALSE);<br>
> > +<br>
> > +   if (!ust || !msc || !sbc)<br>
> > +      RETURN_EGL_EVAL(disp, EGL_FALSE);<br>
> > +<br>
> > +   ret = drv->API.GetSyncValuesCHROMIUM(disp, surf, ust, msc, sbc);<br>
> > +<br>
> > +   RETURN_EGL_EVAL(disp, ret);<br>
> > +}<br>
> > +#endif<br>
> > diff --git a/src/egl/main/eglapi.h b/src/egl/main/eglapi.h<br>
> > index f20ce5b..f176aa3 100644<br>
> > --- a/src/egl/main/eglapi.h<br>
> > +++ b/src/egl/main/eglapi.h<br>
> > @@ -139,6 +139,10 @@ typedef EGLint (*QueryBufferAge_t)(_EGLDriver *drv,<br>
> >  typedef EGLBoolean (*SwapBuffersWithDamageEXT_t) (_EGLDriver *drv,<br>
> > _EGLDisplay *dpy, _EGLSurface *surface, const EGLint *rects, EGLint<br>
> > n_rects);<br>
> >  #endif<br>
> ><br>
> > +#ifdef EGL_CHROMIUM_sync_control<br>
> > +typedef EGLBoolean (*GetSyncValuesCHROMIUM_t) (_EGLDisplay *dpy,<br>
> > _EGLSurface *surface, EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR<br>
> > *sbc);<br>
> > +#endif<br>
> > +<br>
> >  /**<br>
> >   * The API dispatcher jumps through these functions<br>
> >   */<br>
> > @@ -225,6 +229,9 @@ struct _egl_api<br>
> >     PostSubBufferNV_t PostSubBufferNV;<br>
> ><br>
> >     QueryBufferAge_t QueryBufferAge;<br>
> > +#ifdef EGL_CHROMIUM_sync_control<br>
> > +   GetSyncValuesCHROMIUM_t GetSyncValuesCHROMIUM;<br>
> > +#endif<br>
> >  };<br>
> ><br>
> >  #endif /* EGLAPI_INCLUDED */<br>
> > diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h<br>
> > index 970c21a..2dec6e4 100644<br>
> > --- a/src/egl/main/egldisplay.h<br>
> > +++ b/src/egl/main/egldisplay.h<br>
> > @@ -119,6 +119,7 @@ struct _egl_extensions<br>
> >     EGLBoolean EXT_buffer_age;<br>
> >     EGLBoolean EXT_swap_buffers_with_damage;<br>
> >     EGLBoolean EXT_image_dma_buf_import;<br>
> > +   EGLBoolean CHROMIUM_get_sync_values;<br>
> >  };<br>
> ><br>
> ><br>
> > diff --git a/src/egl/main/eglmisc.c b/src/egl/main/eglmisc.c<br>
> > index 65669d8..d867d1f 100644<br>
> > --- a/src/egl/main/eglmisc.c<br>
> > +++ b/src/egl/main/eglmisc.c<br>
> > @@ -123,6 +123,7 @@ _eglUpdateExtensionsString(_EGLDisplay *dpy)<br>
> >     _EGL_CHECK_EXTENSION(EXT_image_dma_buf_import);<br>
> ><br>
> >     _EGL_CHECK_EXTENSION(NV_post_sub_buffer);<br>
> > +   _EGL_CHECK_EXTENSION(CHROMIUM_get_sync_values);<br>
> >  #undef _EGL_CHECK_EXTENSION<br>
> >  }<br>
> ><br>
> > --<br>
> > 1.8.3.2<br>
> ><br>
> > _______________________________________________<br>
> > mesa-dev mailing list<br>
> > <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> > <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
> ><br>
</div></div></blockquote></div><br></div></div>