From 31560d82ad25a2870a5994bcd13caa5fe4a1456e Mon Sep 17 00:00:00 2001 From: Nanley Chery Date: Tue, 14 May 2024 11:19:57 -0400 Subject: [PATCH] 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 Reviewed-by: Lionel Landwerlin Part-of: --- src/gallium/drivers/iris/iris_resource.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index 10316dbf143..e84077d215c 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -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;