[Mesa-dev] [PATCH] etnaviv: implement check_resource_capability
Christian Gmeiner
christian.gmeiner at gmail.com
Fri Dec 28 10:04:22 UTC 2018
Am Di., 18. Dez. 2018 um 19:09 Uhr schrieb Lucas Stach <l.stach at pengutronix.de>:
>
> We try to avoid sharing all resources with KMS side of renderonly, as this
> adds some overhead that isn't really needed for most resources. If
> someone tries to validate a resource for scanout, this is a good indication
> that the sharing with the KMS side is actually needed.
>
> Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
> ---
> .../drivers/etnaviv/etnaviv_resource.c | 22 +++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> index c00912880309..cd846e3ae36e 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
> @@ -624,6 +624,27 @@ etna_resource_get_handle(struct pipe_screen *pscreen,
> }
> }
>
> +static bool
> +etna_check_resource_capability(struct pipe_screen *pscreen,
> + struct pipe_resource *prsc,
> + unsigned bind)
> +{
> + struct etna_screen *screen = etna_screen(pscreen);
> + struct etna_resource *rsc = etna_resource(prsc);
> +
> + if ((bind & PIPE_BIND_LINEAR) && rsc->layout != ETNA_LAYOUT_LINEAR)
> + return false;
> +
> + if ((bind & PIPE_BIND_SCANOUT) && !rsc->scanout) {
> + rsc->scanout = renderonly_create_gpu_import_for_resource(prsc, screen->ro,
> + NULL);
Can you explain me why the
renderonly_create_gpu_import_for_resource(..) call ends up here? Are
there really any cases where !rsc->scanout? I looked at the relevant
code parts and I have the feeling
the renderonly_create_gpu_import_for_resource(..) call happens much
earlier in the call chain. I could be
wrong as I am running out of coffee right now :)
> + if (!rsc->scanout)
> + return false;
> + }
> +
> + return true;
> +}
> +
> void
> etna_resource_used(struct etna_context *ctx, struct pipe_resource *prsc,
> enum etna_resource_status status)
> @@ -667,4 +688,5 @@ etna_resource_screen_init(struct pipe_screen *pscreen)
> pscreen->resource_get_handle = etna_resource_get_handle;
> pscreen->resource_changed = etna_resource_changed;
> pscreen->resource_destroy = etna_resource_destroy;
> + pscreen->check_resource_capability = etna_check_resource_capability;
> }
> --
> 2.19.1
>
> _______________________________________________
> etnaviv mailing list
> etnaviv at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
--
greets
--
Christian Gmeiner, MSc
https://christian-gmeiner.info
More information about the mesa-dev
mailing list