Mesa (master): etnaviv: fill in modifier in etna_resource_get_handle
Lucas Stach
lynxeye at kemper.freedesktop.org
Wed Jul 19 14:38:50 UTC 2017
Module: Mesa
Branch: master
Commit: d06cfaf4fc21d45d09045af9ea2a248ef3968767
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d06cfaf4fc21d45d09045af9ea2a248ef3968767
Author: Lucas Stach <l.stach at pengutronix.de>
Date: Thu Jun 22 13:56:24 2017 +0200
etnaviv: fill in modifier in etna_resource_get_handle
This allows the state trackers to know the tiling layout of the
resource and pass this through the various userspace protocols.
Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
Reviewed-by: Wladimir J. van der Laan <laanwj at gmail.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner at gmail.com>
Reviewed-by: Daniel Stone <daniels at collabora.com>
---
src/gallium/drivers/etnaviv/etnaviv_resource.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c b/src/gallium/drivers/etnaviv/etnaviv_resource.c
index c7eef96a6e..63ed8bacf0 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
@@ -59,6 +59,24 @@ static enum etna_surface_layout modifier_to_layout(uint64_t modifier)
}
}
+static uint64_t layout_to_modifier(enum etna_surface_layout layout)
+{
+ switch (layout) {
+ case ETNA_LAYOUT_TILED:
+ return DRM_FORMAT_MOD_VIVANTE_TILED;
+ case ETNA_LAYOUT_SUPER_TILED:
+ return DRM_FORMAT_MOD_VIVANTE_SUPER_TILED;
+ case ETNA_LAYOUT_MULTI_TILED:
+ return DRM_FORMAT_MOD_VIVANTE_SPLIT_TILED;
+ case ETNA_LAYOUT_MULTI_SUPERTILED:
+ return DRM_FORMAT_MOD_VIVANTE_SPLIT_SUPER_TILED;
+ case ETNA_LAYOUT_LINEAR:
+ return DRM_FORMAT_MOD_LINEAR;
+ default:
+ return DRM_FORMAT_MOD_INVALID;
+ }
+}
+
/* A tile is 4x4 pixels, having 'screen->specs.bits_per_tile' of tile status.
* So, in a buffer of N pixels, there are N / (4 * 4) tiles.
* We need N * screen->specs.bits_per_tile / (4 * 4) bits of tile status, or
@@ -480,6 +498,7 @@ etna_resource_get_handle(struct pipe_screen *pscreen,
rsc = etna_resource(rsc->external);
handle->stride = rsc->levels[0].stride;
+ handle->modifier = layout_to_modifier(rsc->layout);
if (handle->type == DRM_API_HANDLE_TYPE_SHARED) {
return etna_bo_get_name(rsc->bo, &handle->handle) == 0;
More information about the mesa-commit
mailing list