freedreno: add a fd_resource_pitch helper
[mesa.git] / src / gallium / drivers / freedreno / a4xx / fd4_emit.c
index 256167298e6d67588894899230cad9ad36a05054..9fe94395328a632c1e5dda446869a6562a3620be 100644 (file)
@@ -327,7 +327,6 @@ fd4_emit_gmem_restore_tex(struct fd_ringbuffer *ring, unsigned nr_bufs,
 
                        /* note: PIPE_BUFFER disallowed for surfaces */
                        unsigned lvl = bufs[i]->u.tex.level;
-                       struct fdl_slice *slice = fd_resource_slice(rsc, lvl);
                        unsigned offset = fd_resource_offset(rsc, lvl, bufs[i]->u.tex.first_layer);
 
                        /* z32 restore is accomplished using depth write.  If there is
@@ -349,7 +348,7 @@ fd4_emit_gmem_restore_tex(struct fd_ringbuffer *ring, unsigned nr_bufs,
                                                        PIPE_SWIZZLE_Z, PIPE_SWIZZLE_W));
                        OUT_RING(ring, A4XX_TEX_CONST_1_WIDTH(bufs[i]->width) |
                                        A4XX_TEX_CONST_1_HEIGHT(bufs[i]->height));
-                       OUT_RING(ring, A4XX_TEX_CONST_2_PITCH(slice->pitch) |
+                       OUT_RING(ring, A4XX_TEX_CONST_2_PITCH(fd_resource_pitch(rsc, lvl)) |
                                        A4XX_TEX_CONST_2_FETCHSIZE(fd4_pipe2fetchsize(format)));
                        OUT_RING(ring, 0x00000000);
                        OUT_RELOC(ring, rsc->bo, offset, 0, 0);