mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-26 04:40:39 +02:00
egl: implement eglQueryDmaBufFormatsEXT
allow egl clients to query the dmabuf formats supported on this platform. v2: return EGLBoolean. v3: Check DRIimageExtension version before querying (Daniel Stone). v4: move to DRIimageExtension version 15, error checking (Jason Ekstrand). Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com> Signed-off-by: Varad Gautam <varad.gautam@collabora.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
This commit is contained in:
parent
6f10e7c37a
commit
6719e058d6
4 changed files with 45 additions and 0 deletions
|
|
@ -2157,6 +2157,27 @@ dri2_check_dma_buf_format(const _EGLImageAttribs *attrs)
|
|||
return plane_n;
|
||||
}
|
||||
|
||||
static EGLBoolean
|
||||
dri2_query_dma_buf_formats(_EGLDriver *drv, _EGLDisplay *disp,
|
||||
EGLint max, EGLint *formats, EGLint *count)
|
||||
{
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||
if (max < 0 || (max > 0 && formats == NULL)) {
|
||||
_eglError(EGL_BAD_PARAMETER, "invalid value for max count of formats");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
if (dri2_dpy->image->base.version < 15 ||
|
||||
dri2_dpy->image->queryDmaBufFormats == NULL)
|
||||
return EGL_FALSE;
|
||||
|
||||
if (!dri2_dpy->image->queryDmaBufFormats(dri2_dpy->dri_screen, max,
|
||||
formats, count))
|
||||
return EGL_FALSE;
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* The spec says:
|
||||
*
|
||||
|
|
@ -3094,6 +3115,7 @@ _eglBuiltInDriverDRI2(const char *args)
|
|||
dri2_drv->base.API.ExportDRMImageMESA = dri2_export_drm_image_mesa;
|
||||
dri2_drv->base.API.ExportDMABUFImageQueryMESA = dri2_export_dma_buf_image_query_mesa;
|
||||
dri2_drv->base.API.ExportDMABUFImageMESA = dri2_export_dma_buf_image_mesa;
|
||||
dri2_drv->base.API.QueryDmaBufFormatsEXT = dri2_query_dma_buf_formats;
|
||||
#endif
|
||||
#ifdef HAVE_WAYLAND_PLATFORM
|
||||
dri2_drv->base.API.BindWaylandDisplayWL = dri2_bind_wayland_display_wl;
|
||||
|
|
|
|||
|
|
@ -2386,6 +2386,24 @@ _eglFunctionCompare(const void *key, const void *elem)
|
|||
return strcmp(procname, entrypoint->name);
|
||||
}
|
||||
|
||||
static EGLBoolean EGLAPIENTRY
|
||||
eglQueryDmaBufFormatsEXT(EGLDisplay dpy, EGLint max_formats,
|
||||
EGLint *formats, EGLint *num_formats)
|
||||
{
|
||||
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
||||
_EGLDriver *drv;
|
||||
EGLBoolean ret;
|
||||
|
||||
_EGL_FUNC_START(NULL, EGL_NONE, NULL, EGL_FALSE);
|
||||
|
||||
_EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv);
|
||||
|
||||
ret = drv->API.QueryDmaBufFormatsEXT(drv, disp, max_formats, formats,
|
||||
num_formats);
|
||||
|
||||
RETURN_EGL_EVAL(disp, ret);
|
||||
}
|
||||
|
||||
__eglMustCastToProperFunctionPointerType EGLAPIENTRY
|
||||
eglGetProcAddress(const char *procname)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -198,6 +198,10 @@ struct _egl_api
|
|||
int (*GLInteropExportObject)(_EGLDisplay *dpy, _EGLContext *ctx,
|
||||
struct mesa_glinterop_export_in *in,
|
||||
struct mesa_glinterop_export_out *out);
|
||||
|
||||
EGLBoolean (*QueryDmaBufFormatsEXT)(_EGLDriver *drv, _EGLDisplay *dpy,
|
||||
EGLint max_formats, EGLint *formats,
|
||||
EGLint *num_formats);
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ EGL_ENTRYPOINT(eglPostSubBufferNV)
|
|||
EGL_ENTRYPOINT(eglQueryAPI)
|
||||
EGL_ENTRYPOINT(eglQueryContext)
|
||||
EGL_ENTRYPOINT(eglQueryDebugKHR)
|
||||
EGL_ENTRYPOINT(eglQueryDmaBufFormatsEXT)
|
||||
EGL_ENTRYPOINT(eglQueryString)
|
||||
EGL_ENTRYPOINT(eglQuerySurface)
|
||||
EGL_ENTRYPOINT(eglQueryWaylandBufferWL)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue