llvmpipe: query winsys support for dmabuf mapping
Fixes #11257 by ensuring winsys mapping functions is only called if its supported by the winsys, which should prevent llvmpipe from crashing with kmswast. If the winsys is kms_swrast then this method will be null, but on drisw it will be available. Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29546>
This commit is contained in:
@@ -664,7 +664,13 @@ llvmpipe_resource_from_handle(struct pipe_screen *_screen,
|
||||
#ifdef HAVE_LINUX_UDMABUF_H
|
||||
struct llvmpipe_memory_fd_alloc *alloc;
|
||||
uint64_t size;
|
||||
if(_screen->import_memory_fd(_screen, whandle->handle, (struct pipe_memory_allocation**)&alloc, &size, true)) {
|
||||
/* Not all winsys implement displaytarget_create_mapped so we need to check
|
||||
* that is available (not null).
|
||||
*/
|
||||
if (winsys->displaytarget_create_mapped &&
|
||||
_screen->import_memory_fd(_screen, whandle->handle,
|
||||
(struct pipe_memory_allocation**)&alloc,
|
||||
&size, true)) {
|
||||
data = alloc->data;
|
||||
lpr->dt = winsys->displaytarget_create_mapped(winsys, template->bind,
|
||||
template->format, template->width0, template->height0,
|
||||
|
Reference in New Issue
Block a user