summaryrefslogtreecommitdiff
path: root/lib/mesa/src/gallium/drivers/vc4
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2021-09-09 09:59:16 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2021-09-09 09:59:16 +0000
commit884abe30143f8f6bceb6f3fc7febec2c07d51821 (patch)
tree21cfa7f0f49cdb4a078e8bfd76b4cc5a8711c444 /lib/mesa/src/gallium/drivers/vc4
parent17251c8fe97e6c8f1f6e21767313ce4bfa80a547 (diff)
Merge Mesa 21.1.8
Diffstat (limited to 'lib/mesa/src/gallium/drivers/vc4')
-rw-r--r--lib/mesa/src/gallium/drivers/vc4/vc4_resource.c43
1 files changed, 35 insertions, 8 deletions
diff --git a/lib/mesa/src/gallium/drivers/vc4/vc4_resource.c b/lib/mesa/src/gallium/drivers/vc4/vc4_resource.c
index 61e5fd7e5..3e725aaf7 100644
--- a/lib/mesa/src/gallium/drivers/vc4/vc4_resource.c
+++ b/lib/mesa/src/gallium/drivers/vc4/vc4_resource.c
@@ -283,6 +283,15 @@ vc4_resource_destroy(struct pipe_screen *pscreen,
free(rsc);
}
+static uint64_t
+vc4_resource_modifier(struct vc4_resource *rsc)
+{
+ if (rsc->tiled)
+ return DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED;
+ else
+ return DRM_FORMAT_MOD_LINEAR;
+}
+
static bool
vc4_resource_get_handle(struct pipe_screen *pscreen,
struct pipe_context *pctx,
@@ -295,6 +304,7 @@ vc4_resource_get_handle(struct pipe_screen *pscreen,
whandle->stride = rsc->slices[0].stride;
whandle->offset = 0;
+ whandle->modifier = vc4_resource_modifier(rsc);
/* If we're passing some reference to our BO out to some other part of
* the system, then we can't do any optimizations about only us being
@@ -302,11 +312,6 @@ vc4_resource_get_handle(struct pipe_screen *pscreen,
*/
rsc->bo->private = false;
- if (rsc->tiled)
- whandle->modifier = DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED;
- else
- whandle->modifier = DRM_FORMAT_MOD_LINEAR;
-
switch (whandle->type) {
case WINSYS_HANDLE_TYPE_SHARED:
if (screen->ro) {
@@ -320,7 +325,6 @@ vc4_resource_get_handle(struct pipe_screen *pscreen,
return vc4_bo_flink(rsc->bo, &whandle->handle);
case WINSYS_HANDLE_TYPE_KMS:
if (screen->ro) {
- assert(rsc->scanout);
return renderonly_get_handle(rsc->scanout, whandle);
}
whandle->handle = rsc->bo->handle;
@@ -335,6 +339,30 @@ vc4_resource_get_handle(struct pipe_screen *pscreen,
return false;
}
+static bool
+vc4_resource_get_param(struct pipe_screen *pscreen,
+ struct pipe_context *pctx, struct pipe_resource *prsc,
+ unsigned plane, unsigned layer, unsigned level,
+ enum pipe_resource_param param,
+ unsigned usage, uint64_t *value)
+{
+ struct vc4_resource *rsc = vc4_resource(prsc);
+
+ switch (param) {
+ case PIPE_RESOURCE_PARAM_STRIDE:
+ *value = rsc->slices[level].stride;
+ return true;
+ case PIPE_RESOURCE_PARAM_OFFSET:
+ *value = 0;
+ return true;
+ case PIPE_RESOURCE_PARAM_MODIFIER:
+ *value = vc4_resource_modifier(rsc);
+ return true;
+ default:
+ return false;
+ }
+}
+
static void
vc4_setup_slices(struct vc4_resource *rsc, const char *caller)
{
@@ -689,8 +717,6 @@ vc4_resource_from_handle(struct pipe_screen *pscreen,
renderonly_create_gpu_import_for_resource(prsc,
screen->ro,
NULL);
- if (!rsc->scanout)
- goto fail;
}
if (rsc->tiled && whandle->stride != slice->stride) {
@@ -1123,6 +1149,7 @@ vc4_resource_screen_init(struct pipe_screen *pscreen)
pscreen->resource_from_handle = vc4_resource_from_handle;
pscreen->resource_destroy = u_resource_destroy_vtbl;
pscreen->resource_get_handle = vc4_resource_get_handle;
+ pscreen->resource_get_param = vc4_resource_get_param;
pscreen->resource_destroy = vc4_resource_destroy;
pscreen->transfer_helper = u_transfer_helper_create(&transfer_vtbl,
false, false,