mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 15:40:11 +01:00
radeonsi: fix surf_pitch for subsampled surface
gfx9.surf_pitch is supposed to be in blocks (or elements) but addrlib returns a pitch in pixels. This cause a mismatch between surface->bpe and surface.u.gfx9.surf_pitch. For subsampled formats like uyvy (bpe is 2) this breaks in various places: - sdma copy - video rendering (see issue https://gitlab.freedesktop.org/mesa/mesa/issues/2363) when the vl_compositor_gfx_render method is used Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3738>
This commit is contained in:
parent
c4197fbcdd
commit
69aadc4933
2 changed files with 15 additions and 10 deletions
|
|
@ -1071,6 +1071,11 @@ static int gfx9_compute_miptree(ADDR_HANDLE addrlib,
|
||||||
|
|
||||||
surf->u.gfx9.surf_slice_size = out.sliceSize;
|
surf->u.gfx9.surf_slice_size = out.sliceSize;
|
||||||
surf->u.gfx9.surf_pitch = out.pitch;
|
surf->u.gfx9.surf_pitch = out.pitch;
|
||||||
|
if (!compressed && surf->blk_w > 1 && out.pitch == out.pixelPitch) {
|
||||||
|
/* Adjust surf_pitch to be in elements units,
|
||||||
|
* not in pixels */
|
||||||
|
surf->u.gfx9.surf_pitch /= surf->blk_w;
|
||||||
|
}
|
||||||
surf->u.gfx9.surf_height = out.height;
|
surf->u.gfx9.surf_height = out.height;
|
||||||
surf->surf_size = out.surfSize;
|
surf->surf_size = out.surfSize;
|
||||||
surf->surf_alignment = out.baseAlign;
|
surf->surf_alignment = out.baseAlign;
|
||||||
|
|
|
||||||
|
|
@ -398,17 +398,17 @@ void si_compute_copy_image(struct si_context *sctx,
|
||||||
assert(util_format_is_subsampled_422(src_format) ==
|
assert(util_format_is_subsampled_422(src_format) ==
|
||||||
util_format_is_subsampled_422(dst_format));
|
util_format_is_subsampled_422(dst_format));
|
||||||
|
|
||||||
if (util_format_is_subsampled_422(src_format))
|
if (util_format_is_subsampled_422(src_format)) {
|
||||||
src_format = dst_format = PIPE_FORMAT_R32_UINT;
|
src_format = dst_format = PIPE_FORMAT_R32_UINT;
|
||||||
|
/* Interpreting 422 subsampled format (16 bpp) as 32 bpp
|
||||||
unsigned x_div = util_format_get_blockwidth(src->format) /
|
* should force us to divide src_box->x, dstx and width by 2.
|
||||||
util_format_get_blockwidth(src_format);
|
* But given that ac_surface allocates this format as 32 bpp
|
||||||
assert(src_box->x % x_div == 0);
|
* and that surf_size is then modified to pack the values
|
||||||
assert(width % x_div == 0);
|
* we must keep the original values to get the correct results.
|
||||||
|
*/
|
||||||
unsigned data[] = {src_box->x / x_div, src_box->y, src_box->z, 0,
|
}
|
||||||
dstx / x_div, dsty, dstz, 0};
|
unsigned data[] = {src_box->x, src_box->y, src_box->z, 0,
|
||||||
width /= x_div;
|
dstx, dsty, dstz, 0};
|
||||||
|
|
||||||
if (width == 0 || height == 0)
|
if (width == 0 || height == 0)
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue