egl: store the native surface pointer in struct _egl_surface
authorPaulo Zanoni <paulo.r.zanoni@intel.com>
Wed, 1 May 2019 22:42:26 +0000 (15:42 -0700)
committerEric Engestrom <eric@engestrom.ch>
Tue, 14 May 2019 12:41:14 +0000 (12:41 +0000)
commit04ecda3b3c85b5a3a52f4fa1a3e0f88c17231408
treee0c74a7d73426ea424399e85fd37a863516bf645
parent9520e7c1e9206f94f73bb143483147e4600122ec
egl: store the native surface pointer in struct _egl_surface

Each platform stores this in a different place:
  - platform_drm uses dri2_surf->gbm_surf->base
  - platform_android uses dri2_surf->window
  - platform_wayland uses dri2_surf->wl_win
  - platform_x11 uses dri2_surf->drawable
  - platform_x11_dri3 uses dri3_surf->loader_drawable.drawable
  - haiku doesn't even store it!

We need access to the native surface since the specification asks us
to refuse creating a new surface if there's already an EGLSurface
associated with native_surface.

An alternative to this patch would be to create a new
API.GetNativeWindow callback that each platform would have to
implement. While that's something we can definitely do, I prefer
this approach.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
src/egl/drivers/dri2/egl_dri2.c
src/egl/drivers/dri2/egl_dri2.h
src/egl/drivers/dri2/platform_android.c
src/egl/drivers/dri2/platform_drm.c
src/egl/drivers/dri2/platform_surfaceless.c
src/egl/drivers/dri2/platform_wayland.c
src/egl/drivers/dri2/platform_x11.c
src/egl/drivers/dri2/platform_x11_dri3.c
src/egl/drivers/haiku/egl_haiku.cpp
src/egl/main/eglsurface.c
src/egl/main/eglsurface.h