Mesa (main): panfrost: Simplify panfrost_resource_get_handle
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Feb 23 18:47:23 UTC 2022
Module: Mesa
Branch: main
Commit: 51689a2b80b4daf5e78532304df311be8e627715
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=51689a2b80b4daf5e78532304df311be8e627715
Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date: Tue Feb 22 11:30:05 2022 -0500
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 at collabora.com>
Reviewed-by: Simon Ser <contact at emersion.fr>
Reviewed-by: James Jones <jajones at nvidia.com>
Acked-by: Daniel Stone <daniels at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15120>
---
src/gallium/drivers/panfrost/pan_resource.c | 23 +++++++++--------------
1 file changed, 9 insertions(+), 14 deletions(-)
diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index 094332862ff..477bf1d7ce1 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -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;
+ if (handle->type == WINSYS_HANDLE_TYPE_KMS && dev->ro) {
+ return renderonly_get_handle(scanout, handle);
} else if (handle->type == WINSYS_HANDLE_TYPE_KMS) {
- if (dev->ro) {
- return renderonly_get_handle(scanout, handle);
- } else {
- 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;
- }
+ handle->handle = rsrc->image.data.bo->gem_handle;
} 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;
- handle->stride = rsrc->image.layout.slices[0].line_stride;
- handle->offset = rsrc->image.layout.slices[0].offset;
- return true;
+ } else {
+ /* Other handle types not supported */
+ return false;
}
- return false;
+ handle->stride = rsrc->image.layout.slices[0].line_stride;
+ handle->offset = rsrc->image.layout.slices[0].offset;
+ return true;
}
static bool
More information about the mesa-commit
mailing list