gallium/dri: let the driver know if the imported image is DRI_PRIME buffer

Use createImageFromFds2 together with __DRI_IMAGE_PRIME_LINEAR_BUFFER, so
the driver's resource_from_handle hook will be aware that this specific
image is the linear buffer.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13362>
This commit is contained in:
Pierre-Eric Pelloux-Prayer
2021-10-14 15:12:12 +02:00
parent 7a5de84249
commit e9c3dbd046
4 changed files with 25 additions and 9 deletions
+21 -9
View File
@@ -1545,15 +1545,27 @@ dri3_alloc_render_buffer(struct loader_dri3_drawable *draw, unsigned int format,
/* The linear buffer was created in the display GPU's vram, so we
* need to make it visible to render GPU
*/
buffer->linear_buffer =
draw->ext->image->createImageFromFds(draw->dri_screen,
width,
height,
image_format_to_fourcc(format),
&buffer_fds[0], num_planes,
&buffer->strides[0],
&buffer->offsets[0],
buffer);
if (draw->ext->image->base.version >= 20)
buffer->linear_buffer =
draw->ext->image->createImageFromFds2(draw->dri_screen,
width,
height,
image_format_to_fourcc(format),
&buffer_fds[0], num_planes,
__DRI_IMAGE_PRIME_LINEAR_BUFFER,
&buffer->strides[0],
&buffer->offsets[0],
buffer);
else
buffer->linear_buffer =
draw->ext->image->createImageFromFds(draw->dri_screen,
width,
height,
image_format_to_fourcc(format),
&buffer_fds[0], num_planes,
&buffer->strides[0],
&buffer->offsets[0],
buffer);
if (!buffer->linear_buffer)
goto no_buffer_attrib;