iris: Simplify bo import in memobj_create_from_handle

Looking at the caller, we only import FDs without modifiers. By
asserting this behavior and dropping the unused cases, we gain some
clarity on the alignment of the imported BO's VMA.

Reviewed-by: Rohan Garg <rohan.garg@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29094>
This commit is contained in:
Nanley Chery 2024-05-14 11:19:57 -04:00 committed by Marge Bot
parent 6b969a4b43
commit 31560d82ad

View file

@ -376,24 +376,13 @@ iris_memobj_create_from_handle(struct pipe_screen *pscreen,
{
struct iris_screen *screen = (struct iris_screen *)pscreen;
struct iris_memory_object *memobj = CALLOC_STRUCT(iris_memory_object);
struct iris_bo *bo;
if (!memobj)
return NULL;
switch (whandle->type) {
case WINSYS_HANDLE_TYPE_SHARED:
bo = iris_bo_gem_create_from_name(screen->bufmgr, "winsys image",
whandle->handle);
break;
case WINSYS_HANDLE_TYPE_FD:
bo = iris_bo_import_dmabuf(screen->bufmgr, whandle->handle,
whandle->modifier);
break;
default:
unreachable("invalid winsys handle type");
}
assert(whandle->type == WINSYS_HANDLE_TYPE_FD);
assert(whandle->modifier == DRM_FORMAT_MOD_INVALID);
struct iris_bo *bo = iris_bo_import_dmabuf(screen->bufmgr, whandle->handle,
DRM_FORMAT_MOD_INVALID);
if (!bo) {
free(memobj);
return NULL;