sw_winsys: Add winsys_handle to displaytarget_create_mapped

The main intention is to allow to pass dmabuf handles, however as its
type differs depending on platform, just pass the whole whandle.

Also make use of it in llvmpipe_resource_from_handle(), in preparation
for the next commit.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37305>
This commit is contained in:
Robert Mader 2025-08-21 15:39:50 +02:00 committed by Marge Bot
parent 5a7cc8843c
commit 306feaf3a4
4 changed files with 9 additions and 5 deletions

View file

@ -766,7 +766,7 @@ llvmpipe_resource_from_handle(struct pipe_screen *_screen,
void *data = (char*)alloc->cpu_addr + whandle->offset;
lpr->dt = winsys->displaytarget_create_mapped(winsys, template->bind,
template->format, template->width0, template->height0,
whandle->stride, data);
whandle->stride, data, whandle);
if (!lpr->dt)
goto no_dt;
lpr->dmabuf_alloc = alloc;
@ -1649,7 +1649,8 @@ llvmpipe_resource_bind_backing(struct pipe_screen *pscreen,
lpr->base.format,
width, height,
lpr->row_stride[0],
lpr->tex_data);
lpr->tex_data,
NULL);
}
}
} else

View file

@ -145,7 +145,8 @@ struct sw_winsys
enum pipe_format format,
unsigned width, unsigned height,
unsigned stride,
void *data );
void *data,
struct winsys_handle *whandle );
};

View file

@ -186,7 +186,8 @@ dri_sw_displaytarget_create_mapped(struct sw_winsys *winsys,
enum pipe_format format,
unsigned width, unsigned height,
unsigned stride,
void *data)
void *data,
struct winsys_handle *whandle)
{
UNUSED struct dri_sw_winsys *ws = dri_sw_winsys(winsys);
struct dri_sw_displaytarget *dri_sw_dt;

View file

@ -97,7 +97,8 @@ null_sw_displaytarget_create_mapped(struct sw_winsys *winsys,
enum pipe_format format,
unsigned width, unsigned height,
unsigned stride,
void *data)
void *data,
struct winsys_handle *whandle)
{
fprintf(stderr, "null_sw_displaytarget_create_mapped() returning NULL\n");
return NULL;