panfrost: Simplify panfrost_resource_get_handle
Unify the exit paths to clean up the logic. There are logically three modes we support (KMS without renderonly, KMS with renderonly, and FD); these each correspond to a leg of a small if statement. Outside of the small if's, everything else should be identical. Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Reviewed-by: Simon Ser <contact@emersion.fr> Reviewed-by: James Jones <jajones@nvidia.com> Acked-by: Daniel Stone <daniels@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15120>
This commit is contained in:
parent
b5734cc1c4
commit
51689a2b80
|
@ -153,17 +153,10 @@ panfrost_resource_get_handle(struct pipe_screen *pscreen,
|
|||
handle->modifier = rsrc->image.layout.modifier;
|
||||
rsrc->modifier_constant = true;
|
||||
|
||||
if (handle->type == WINSYS_HANDLE_TYPE_SHARED) {
|
||||
return false;
|
||||
} else if (handle->type == WINSYS_HANDLE_TYPE_KMS) {
|
||||
if (dev->ro) {
|
||||
if (handle->type == WINSYS_HANDLE_TYPE_KMS && dev->ro) {
|
||||
return renderonly_get_handle(scanout, handle);
|
||||
} else {
|
||||
} else if (handle->type == WINSYS_HANDLE_TYPE_KMS) {
|
||||
handle->handle = rsrc->image.data.bo->gem_handle;
|
||||
handle->stride = rsrc->image.layout.slices[0].line_stride;
|
||||
handle->offset = rsrc->image.layout.slices[0].offset;
|
||||
return true;
|
||||
}
|
||||
} else if (handle->type == WINSYS_HANDLE_TYPE_FD) {
|
||||
int fd = panfrost_bo_export(rsrc->image.data.bo);
|
||||
|
||||
|
@ -171,12 +164,14 @@ panfrost_resource_get_handle(struct pipe_screen *pscreen,
|
|||
return false;
|
||||
|
||||
handle->handle = fd;
|
||||
} else {
|
||||
/* Other handle types not supported */
|
||||
return false;
|
||||
}
|
||||
|
||||
handle->stride = rsrc->image.layout.slices[0].line_stride;
|
||||
handle->offset = rsrc->image.layout.slices[0].offset;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
Loading…
Reference in New Issue