summaryrefslogtreecommitdiffstats
path: root/src/egl/main
diff options
context:
space:
mode:
authorPaulo Zanoni <[email protected]>2019-05-01 15:42:26 -0700
committerEric Engestrom <[email protected]>2019-05-14 12:41:14 +0000
commit04ecda3b3c85b5a3a52f4fa1a3e0f88c17231408 (patch)
treee0c74a7d73426ea424399e85fd37a863516bf645 /src/egl/main
parent9520e7c1e9206f94f73bb143483147e4600122ec (diff)
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 <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Signed-off-by: Paulo Zanoni <[email protected]>
Diffstat (limited to 'src/egl/main')
-rw-r--r--src/egl/main/eglsurface.c5
-rw-r--r--src/egl/main/eglsurface.h5
2 files changed, 8 insertions, 2 deletions
diff --git a/src/egl/main/eglsurface.c b/src/egl/main/eglsurface.c
index 7d96514f775..22257391d5c 100644
--- a/src/egl/main/eglsurface.c
+++ b/src/egl/main/eglsurface.c
@@ -334,7 +334,8 @@ _eglParseSurfaceAttribList(_EGLSurface *surf, const EGLint *attrib_list)
*/
EGLBoolean
_eglInitSurface(_EGLSurface *surf, _EGLDisplay *disp, EGLint type,
- _EGLConfig *conf, const EGLint *attrib_list)
+ _EGLConfig *conf, const EGLint *attrib_list,
+ void *native_surface)
{
const char *func;
EGLint renderBuffer = EGL_BACK_BUFFER;
@@ -421,6 +422,8 @@ _eglInitSurface(_EGLSurface *surf, _EGLDisplay *disp, EGLint type,
surf->Height = MIN2(surf->Height, _EGL_MAX_PBUFFER_HEIGHT);
}
+ surf->NativeSurface = native_surface;
+
return EGL_TRUE;
}
diff --git a/src/egl/main/eglsurface.h b/src/egl/main/eglsurface.h
index df8e2e6bdfb..903957a6eb3 100644
--- a/src/egl/main/eglsurface.h
+++ b/src/egl/main/eglsurface.h
@@ -170,12 +170,15 @@ struct _egl_surface
EGLBoolean PostSubBufferSupportedNV;
struct _egl_hdr_metadata HdrMetadata;
+
+ void *NativeSurface;
};
extern EGLBoolean
_eglInitSurface(_EGLSurface *surf, _EGLDisplay *disp, EGLint type,
- _EGLConfig *config, const EGLint *attrib_list);
+ _EGLConfig *config, const EGLint *attrib_list,
+ void *native_surface);
extern EGLBoolean