mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-21 22:20:14 +01:00
radeonsi,radv: fix usages of surf_pitch
For linear textures, pitch[level] should be used instead. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14454>
This commit is contained in:
parent
2f8982df0e
commit
86262b6eac
4 changed files with 13 additions and 11 deletions
|
|
@ -2882,14 +2882,14 @@ uint64_t ac_surface_get_plane_offset(enum chip_class chip_class,
|
||||||
|
|
||||||
uint64_t ac_surface_get_plane_stride(enum chip_class chip_class,
|
uint64_t ac_surface_get_plane_stride(enum chip_class chip_class,
|
||||||
const struct radeon_surf *surf,
|
const struct radeon_surf *surf,
|
||||||
unsigned plane)
|
unsigned plane, unsigned level)
|
||||||
{
|
{
|
||||||
switch (plane) {
|
switch (plane) {
|
||||||
case 0:
|
case 0:
|
||||||
if (chip_class >= GFX9) {
|
if (chip_class >= GFX9) {
|
||||||
return surf->u.gfx9.surf_pitch * surf->bpe;
|
return (surf->is_linear ? surf->u.gfx9.pitch[level] : surf->u.gfx9.surf_pitch) * surf->bpe;
|
||||||
} else {
|
} else {
|
||||||
return surf->u.legacy.level[0].nblk_x * surf->bpe;
|
return surf->u.legacy.level[level].nblk_x * surf->bpe;
|
||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
return 1 + (surf->display_dcc_offset ?
|
return 1 + (surf->display_dcc_offset ?
|
||||||
|
|
|
||||||
|
|
@ -465,7 +465,7 @@ uint64_t ac_surface_get_plane_offset(enum chip_class chip_class,
|
||||||
unsigned plane, unsigned layer);
|
unsigned plane, unsigned layer);
|
||||||
uint64_t ac_surface_get_plane_stride(enum chip_class chip_class,
|
uint64_t ac_surface_get_plane_stride(enum chip_class chip_class,
|
||||||
const struct radeon_surf *surf,
|
const struct radeon_surf *surf,
|
||||||
unsigned plane);
|
unsigned plane, unsigned level);
|
||||||
/* Of the whole miplevel, not an individual layer */
|
/* Of the whole miplevel, not an individual layer */
|
||||||
uint64_t ac_surface_get_plane_size(const struct radeon_surf *surf,
|
uint64_t ac_surface_get_plane_size(const struct radeon_surf *surf,
|
||||||
unsigned plane);
|
unsigned plane);
|
||||||
|
|
|
||||||
|
|
@ -2363,7 +2363,7 @@ radv_GetImageSubresourceLayout(VkDevice _device, VkImage _image,
|
||||||
pLayout->offset = ac_surface_get_plane_offset(device->physical_device->rad_info.chip_class,
|
pLayout->offset = ac_surface_get_plane_offset(device->physical_device->rad_info.chip_class,
|
||||||
surface, mem_plane_id, 0);
|
surface, mem_plane_id, 0);
|
||||||
pLayout->rowPitch = ac_surface_get_plane_stride(device->physical_device->rad_info.chip_class,
|
pLayout->rowPitch = ac_surface_get_plane_stride(device->physical_device->rad_info.chip_class,
|
||||||
surface, mem_plane_id);
|
surface, mem_plane_id, level);
|
||||||
pLayout->arrayPitch = 0;
|
pLayout->arrayPitch = 0;
|
||||||
pLayout->depthPitch = 0;
|
pLayout->depthPitch = 0;
|
||||||
pLayout->size = ac_surface_get_plane_size(surface, mem_plane_id);
|
pLayout->size = ac_surface_get_plane_size(surface, mem_plane_id);
|
||||||
|
|
|
||||||
|
|
@ -593,15 +593,17 @@ static bool si_resource_get_param(struct pipe_screen *screen, struct pipe_contex
|
||||||
*value = 0;
|
*value = 0;
|
||||||
else
|
else
|
||||||
*value = ac_surface_get_plane_stride(sscreen->info.chip_class,
|
*value = ac_surface_get_plane_stride(sscreen->info.chip_class,
|
||||||
&tex->surface, plane);
|
&tex->surface, plane, level);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case PIPE_RESOURCE_PARAM_OFFSET:
|
case PIPE_RESOURCE_PARAM_OFFSET:
|
||||||
if (resource->target == PIPE_BUFFER)
|
if (resource->target == PIPE_BUFFER) {
|
||||||
*value = 0;
|
*value = 0;
|
||||||
else
|
} else {
|
||||||
|
uint64_t level_offset = tex->surface.is_linear ? tex->surface.u.gfx9.offset[level] : 0;
|
||||||
*value = ac_surface_get_plane_offset(sscreen->info.chip_class,
|
*value = ac_surface_get_plane_offset(sscreen->info.chip_class,
|
||||||
&tex->surface, plane, layer);
|
&tex->surface, plane, layer) + level_offset;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case PIPE_RESOURCE_PARAM_MODIFIER:
|
case PIPE_RESOURCE_PARAM_MODIFIER:
|
||||||
|
|
@ -685,7 +687,7 @@ static bool si_texture_get_handle(struct pipe_screen *screen, struct pipe_contex
|
||||||
whandle->offset = ac_surface_get_plane_offset(sscreen->info.chip_class,
|
whandle->offset = ac_surface_get_plane_offset(sscreen->info.chip_class,
|
||||||
&tex->surface, plane, 0);
|
&tex->surface, plane, 0);
|
||||||
whandle->stride = ac_surface_get_plane_stride(sscreen->info.chip_class,
|
whandle->stride = ac_surface_get_plane_stride(sscreen->info.chip_class,
|
||||||
&tex->surface, plane);
|
&tex->surface, plane, 0);
|
||||||
whandle->modifier = tex->surface.modifier;
|
whandle->modifier = tex->surface.modifier;
|
||||||
return sscreen->ws->buffer_get_handle(sscreen->ws, res->buf, whandle);
|
return sscreen->ws->buffer_get_handle(sscreen->ws, res->buf, whandle);
|
||||||
}
|
}
|
||||||
|
|
@ -1586,7 +1588,7 @@ static struct pipe_resource *si_texture_from_winsys_buffer(struct si_screen *ssc
|
||||||
ptex->offset != ac_surface_get_plane_offset(sscreen->info.chip_class,
|
ptex->offset != ac_surface_get_plane_offset(sscreen->info.chip_class,
|
||||||
&tex->surface, plane, 0) ||
|
&tex->surface, plane, 0) ||
|
||||||
ptex->stride != ac_surface_get_plane_stride(sscreen->info.chip_class,
|
ptex->stride != ac_surface_get_plane_stride(sscreen->info.chip_class,
|
||||||
&tex->surface, plane)) {
|
&tex->surface, plane, 0)) {
|
||||||
si_texture_reference(&tex, NULL);
|
si_texture_reference(&tex, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue