freedreno/a6xx: don't use gmem_alignw for imported buffers
authorJonathan Marek <jonathan@marek.ca>
Wed, 13 May 2020 01:31:52 +0000 (21:31 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 20 May 2020 18:24:28 +0000 (18:24 +0000)
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4611>

src/gallium/drivers/freedreno/freedreno_resource.c

index 5d8a5c76f19707cd109bbf76e2aeddeefd72b8b5..93738e20f74c3c7cabbc7e9562c5ca56c67016d7 100644 (file)
@@ -855,7 +855,7 @@ fd_resource_create_with_modifiers(struct pipe_screen *pscreen,
                struct renderonly_scanout *scanout;
                struct winsys_handle handle;
 
-               /* apply freedreno alignment requirement */
+               /* note: alignment is wrong for a6xx */
                scanout_templat.width0 = align(tmpl->width0, screen->gmem_alignw);
 
                scanout = renderonly_scanout_for_resource(&scanout_templat,
@@ -1027,6 +1027,10 @@ fd_resource_from_handle(struct pipe_screen *pscreen,
 
        uint32_t pitchalign = fd_screen(pscreen)->gmem_alignw * rsc->layout.cpp;
 
+       /* use 64 pitchalign on a6xx where gmem_alignw is not right */
+       if (is_a6xx(screen))
+               pitchalign = 64 * rsc->layout.cpp;
+
        if ((slice->pitch < align(prsc->width0 * rsc->layout.cpp, pitchalign)) ||
                        (slice->pitch & (pitchalign - 1)))
                goto fail;