loader/dri3: Use FourCC for create-image entrypoints

Use FourCC for everything winsys-facing, instead of pipe_format.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30245>
This commit is contained in:
Daniel Stone 2024-06-05 18:30:14 +01:00 committed by Marge Bot
parent 648d3da090
commit efb88deb36
3 changed files with 15 additions and 12 deletions

View file

@ -293,7 +293,7 @@ dri3_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx,
xcb_drawable_t drawable;
xcb_dri3_buffer_from_pixmap_cookie_t bp_cookie;
xcb_dri3_buffer_from_pixmap_reply_t *bp_reply;
unsigned int format;
unsigned int format, fourcc;
drawable = (xcb_drawable_t)(uintptr_t)buffer;
bp_cookie = xcb_dri3_buffer_from_pixmap(dri2_dpy->conn, drawable);
@ -311,6 +311,7 @@ dri3_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx,
free(bp_reply);
return EGL_NO_IMAGE_KHR;
}
fourcc = loader_image_format_to_fourcc(format);
dri2_img = malloc(sizeof *dri2_img);
if (!dri2_img) {
@ -322,7 +323,7 @@ dri3_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx,
_eglInitImage(&dri2_img->base, disp);
dri2_img->dri_image = loader_dri3_create_image(
dri2_dpy->conn, bp_reply, format, dri2_dpy->dri_screen_render_gpu,
dri2_dpy->conn, bp_reply, fourcc, dri2_dpy->dri_screen_render_gpu,
dri2_dpy->image, dri2_img);
free(bp_reply);
@ -341,7 +342,7 @@ dri3_create_image_khr_pixmap_from_buffers(_EGLDisplay *disp, _EGLContext *ctx,
xcb_dri3_buffers_from_pixmap_cookie_t bp_cookie;
xcb_dri3_buffers_from_pixmap_reply_t *bp_reply;
xcb_drawable_t drawable;
unsigned int format;
unsigned int format, fourcc;
drawable = (xcb_drawable_t)(uintptr_t)buffer;
bp_cookie = xcb_dri3_buffers_from_pixmap(dri2_dpy->conn, drawable);
@ -360,6 +361,7 @@ dri3_create_image_khr_pixmap_from_buffers(_EGLDisplay *disp, _EGLContext *ctx,
free(bp_reply);
return EGL_NO_IMAGE_KHR;
}
fourcc = loader_image_format_to_fourcc(format);
dri2_img = malloc(sizeof *dri2_img);
if (!dri2_img) {
@ -371,7 +373,7 @@ dri3_create_image_khr_pixmap_from_buffers(_EGLDisplay *disp, _EGLContext *ctx,
_eglInitImage(&dri2_img->base, disp);
dri2_img->dri_image = loader_dri3_create_image_from_buffers(
dri2_dpy->conn, bp_reply, format, dri2_dpy->dri_screen_render_gpu,
dri2_dpy->conn, bp_reply, fourcc, dri2_dpy->dri_screen_render_gpu,
dri2_dpy->image, dri2_img);
free(bp_reply);

View file

@ -1824,7 +1824,7 @@ dri3_update_drawable(struct loader_dri3_drawable *draw)
__DRIimage *
loader_dri3_create_image(xcb_connection_t *c,
xcb_dri3_buffer_from_pixmap_reply_t *bp_reply,
unsigned int format,
unsigned int fourcc,
__DRIscreen *dri_screen,
const __DRIimageExtension *image,
void *loaderPrivate)
@ -1848,7 +1848,7 @@ loader_dri3_create_image(xcb_connection_t *c,
image_planar = image->createImageFromDmaBufs(dri_screen,
bp_reply->width,
bp_reply->height,
loader_image_format_to_fourcc(format),
fourcc,
DRM_FORMAT_MOD_INVALID,
fds, 1,
&stride, &offset,
@ -1872,7 +1872,7 @@ loader_dri3_create_image(xcb_connection_t *c,
__DRIimage *
loader_dri3_create_image_from_buffers(xcb_connection_t *c,
xcb_dri3_buffers_from_pixmap_reply_t *bp_reply,
unsigned int format,
unsigned int fourcc,
__DRIscreen *dri_screen,
const __DRIimageExtension *image,
void *loaderPrivate)
@ -1898,7 +1898,7 @@ loader_dri3_create_image_from_buffers(xcb_connection_t *c,
ret = image->createImageFromDmaBufs(dri_screen,
bp_reply->width,
bp_reply->height,
loader_image_format_to_fourcc(format),
fourcc,
bp_reply->modifier,
fds, bp_reply->nfd,
strides, offsets,
@ -1931,6 +1931,7 @@ dri3_get_pixmap_buffer(__DRIdrawable *driDrawable, unsigned int format,
int height;
int fence_fd;
__DRIscreen *cur_screen;
int fourcc = loader_image_format_to_fourcc(format);
if (buffer)
return buffer;
@ -1977,7 +1978,7 @@ dri3_get_pixmap_buffer(__DRIdrawable *driDrawable, unsigned int format,
if (!bps_reply)
goto no_image;
buffer->image =
loader_dri3_create_image_from_buffers(draw->conn, bps_reply, format,
loader_dri3_create_image_from_buffers(draw->conn, bps_reply, fourcc,
cur_screen, draw->ext->image,
buffer);
width = bps_reply->width;
@ -1994,7 +1995,7 @@ dri3_get_pixmap_buffer(__DRIdrawable *driDrawable, unsigned int format,
if (!bp_reply)
goto no_image;
buffer->image = loader_dri3_create_image(draw->conn, bp_reply, format,
buffer->image = loader_dri3_create_image(draw->conn, bp_reply, fourcc,
cur_screen, draw->ext->image,
buffer);
width = bp_reply->width;

View file

@ -266,7 +266,7 @@ int loader_dri3_open(xcb_connection_t *conn,
__DRIimage *
loader_dri3_create_image(xcb_connection_t *c,
xcb_dri3_buffer_from_pixmap_reply_t *bp_reply,
unsigned int format,
unsigned int fourcc,
__DRIscreen *dri_screen,
const __DRIimageExtension *image,
void *loaderPrivate);
@ -275,7 +275,7 @@ loader_dri3_create_image(xcb_connection_t *c,
__DRIimage *
loader_dri3_create_image_from_buffers(xcb_connection_t *c,
xcb_dri3_buffers_from_pixmap_reply_t *bp_reply,
unsigned int format,
unsigned int fourcc,
__DRIscreen *dri_screen,
const __DRIimageExtension *image,
void *loaderPrivate);