summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Tretter <m.tretter@pengutronix.de>2017-01-26 18:07:00 +0100
committerRobert Foss <robert.foss@collabora.com>2017-05-09 16:13:26 -0400
commit3c1257cfff81fbbff3dc10b86071eb289661ad90 (patch)
tree07a482a9655674d6bb219c1ad288c53811a1071a
parent273e2def1aa8cb28d0e51d0272cdf550fc7f53fb (diff)
downloadmesa-lucas.tar.gz
mesa-lucas.tar.xz
etnaviv: Fix handling of imported tiled bufferslucas
etnaviv assumes that imported buffers are renderable, i.e., in tiled order. Treat all resources that are imported from handles as tiled buffers unless explicitly marked as linear. Buffers allocated by imx_drm are linear. Therefore, mark them as linear. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
-rw-r--r--src/gallium/auxiliary/renderonly/renderonly.c7
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_resource.c19
2 files changed, 25 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/renderonly/renderonly.c b/src/gallium/auxiliary/renderonly/renderonly.c
index 0b363ba..d8a0997 100644
--- a/src/gallium/auxiliary/renderonly/renderonly.c
+++ b/src/gallium/auxiliary/renderonly/renderonly.c
@@ -88,6 +88,7 @@ renderonly_create_kms_dumb_buffer_for_resource(struct pipe_resource *rsc,
.bpp = 32,
};
struct drm_mode_destroy_dumb destroy_dumb = { };
+ struct pipe_resource tmpl;
scanout = CALLOC_STRUCT(renderonly_scanout);
if (!scanout)
@@ -119,7 +120,11 @@ renderonly_create_kms_dumb_buffer_for_resource(struct pipe_resource *rsc,
handle.handle = prime_fd;
handle.stride = create_dumb.pitch;
- scanout->prime = screen->resource_from_handle(screen, rsc,
+ /* tell the import function that the created dumb buffer is linear */
+ tmpl = *rsc;
+ tmpl.bind |= PIPE_BIND_LINEAR;
+
+ scanout->prime = screen->resource_from_handle(screen, &tmpl,
&handle, PIPE_HANDLE_USAGE_READ_WRITE);
if (!scanout->prime) {
diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c b/src/gallium/drivers/etnaviv/etnaviv_resource.c
index 5d7b748..d17b8eb 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
@@ -504,6 +504,25 @@ etna_resource_from_handle(struct pipe_screen *pscreen,
return ptiled;
}
+ /* etnaviv assumes that all buffers are tiled unless explicitly marked */
+ if (!(tmpl->bind & PIPE_BIND_LINEAR)) {
+ bool want_multitiled = screen->specs.pixel_pipes > 1;
+ bool want_supertiled = screen->specs.can_supertile && !DBG_ENABLED(ETNA_DBG_NO_SUPERTILE);
+
+ rsc->layout = ETNA_LAYOUT_BIT_TILE;
+ if (want_multitiled)
+ rsc->layout |= ETNA_LAYOUT_BIT_MULTI;
+ if (want_supertiled)
+ rsc->layout |= ETNA_LAYOUT_BIT_SUPER;
+
+ /* fix padding and halign based on expected layout assuming that the
+ * imported resource is always a render target */
+ etna_layout_multiple(rsc->layout, screen->specs.pixel_pipes, true,
+ &paddingX, &paddingY, &rsc->halign);
+ level->padded_width = align(level->width, paddingX);
+ level->padded_height = align(level->height, paddingY);
+ }
+
return prsc;
fail: