Pitch_bytes is in bytes, but pitch_tile_max is in multiples of 8 pixels. I think a proper conversion is needed, so that there's no overallocation: fmask_pitch_bytes = (color_pitch_bytes/(color_bpe*color_nsamples))*fmask_bpe*fmask_nsamples. On the other hand, I think you can ignore that and just copy nblk_x from the color surface, because nblk_x is your pitch in pixels and it's also used for computation of fmask slice_tile_max, so it's very important to get it right.
Marek On Tue, Dec 16, 2014 at 1:03 AM, Dave Airlie <airl...@gmail.com> wrote: > From: Dave Airlie <airl...@redhat.com> > > libdrm patch: but mesa seems more suited to discussion. > > According to a tcore statement, the fmask needs to share > pitch with the color surface, and since we pass that color > surface pitch in already, we should use it if the one we > calculate is less. > > Now I've no idea if this applies to evergreen/cayman, > or if this is just an r6xx/r7xx, maybe someone at AMD > has a newer version tcore can check. > > Signed-off-by: Dave Airlie <airl...@redhat.com> > --- > radeon/radeon_surface.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/radeon/radeon_surface.c b/radeon/radeon_surface.c > index 930017e..7fc0535 100644 > --- a/radeon/radeon_surface.c > +++ b/radeon/radeon_surface.c > @@ -165,6 +165,8 @@ static void surf_minify(struct radeon_surface *surf, > uint32_t xalign, uint32_t yalign, uint32_t zalign, > unsigned offset) > { > + uint32_t pitch_bytes; > + > surflevel->npix_x = mip_minify(surf->npix_x, level); > surflevel->npix_y = mip_minify(surf->npix_y, level); > surflevel->npix_z = mip_minify(surf->npix_z, level); > @@ -183,7 +185,13 @@ static void surf_minify(struct radeon_surface *surf, > surflevel->nblk_z = ALIGN(surflevel->nblk_z, zalign); > > surflevel->offset = offset; > - surflevel->pitch_bytes = surflevel->nblk_x * bpe * surf->nsamples; > + pitch_bytes = surflevel->nblk_x * bpe * surf->nsamples; > + if (surf->flags & RADEON_SURF_FMASK) { > + if (surflevel->pitch_bytes > pitch_bytes) > + pitch_bytes = surflevel->pitch_bytes; > + } > + surflevel->pitch_bytes = pitch_bytes; > + > surflevel->slice_size = surflevel->pitch_bytes * surflevel->nblk_y; > > surf->bo_size = offset + surflevel->slice_size * surflevel->nblk_z * > surf->array_size; > -- > 2.1.0 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev