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,
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
*/
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) {
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)
{
vc4_resource_create_with_modifiers;
pscreen->resource_from_handle = vc4_resource_from_handle;
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,