Mesa (master): panfrost: Respect offset for imported resources
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Oct 18 08:12:10 UTC 2019
Module: Mesa
Branch: master
Commit: 40689f5ac0bf2aecdcbf87103a25aed03ba8640f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=40689f5ac0bf2aecdcbf87103a25aed03ba8640f
Author: Daniel Stone <daniels at collabora.com>
Date: Thu Oct 17 13:49:54 2019 +0200
panfrost: Respect offset for imported resources
When we import a resource through Gallium, we need to take account of
the offset parameter passed.
Fixes a failure seen with the VIVID V4L2 driver, which would create NV12
resources within the same BO, with an offset. Sample pipeline to
reproduce (replace videoN with your actual VIVID device node):
gst-launch-1.0 v4l2src device=/dev/videoN ! video/x-raw,format=NV12 ! glimagesink
Signed-off-by: Daniel Stone <daniels at collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso at collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Reported-by: Nicolas Dufresne <nicolas.dufresne at collabora.com>
Tested-by: Nicolas Dufresne <nicolas.dufresne at collabora.com>
---
src/gallium/drivers/panfrost/pan_resource.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index 01ef5c5776d..db0643c7305 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -84,6 +84,7 @@ panfrost_resource_from_handle(struct pipe_screen *pscreen,
rsc->bo = panfrost_bo_import(screen, whandle->handle);
rsc->slices[0].stride = whandle->stride;
+ rsc->slices[0].offset = whandle->offset;
rsc->slices[0].initialized = true;
panfrost_resource_reset_damage(rsc);
@@ -117,6 +118,7 @@ panfrost_resource_get_handle(struct pipe_screen *pscreen,
handle->handle = rsrc->bo->gem_handle;
handle->stride = rsrc->slices[0].stride;
+ handle->offset = rsrc->slices[0].offset;
return TRUE;
} else if (handle->type == WINSYS_HANDLE_TYPE_FD) {
if (scanout) {
@@ -141,6 +143,7 @@ panfrost_resource_get_handle(struct pipe_screen *pscreen,
handle->handle = fd;
handle->stride = rsrc->slices[0].stride;
+ handle->offset = rsrc->slices[0].offset;
return true;
}
}
More information about the mesa-commit
mailing list