mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 07:20:10 +01:00
vc4: set stride alignment when using simulator
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com> Signed-off-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com> Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37887>
This commit is contained in:
parent
aec701d094
commit
977d4f34dd
1 changed files with 17 additions and 4 deletions
|
|
@ -378,8 +378,8 @@ vc4_resource_get_param(struct pipe_screen *pscreen,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vc4_setup_slices(struct vc4_resource *rsc, const char *caller,
|
vc4_setup_slices(struct vc4_screen *screen, struct vc4_resource *rsc,
|
||||||
bool force_format_t)
|
const char *caller, bool force_format_t)
|
||||||
{
|
{
|
||||||
struct pipe_resource *prsc = &rsc->base;
|
struct pipe_resource *prsc = &rsc->base;
|
||||||
uint32_t width = prsc->width0;
|
uint32_t width = prsc->width0;
|
||||||
|
|
@ -435,6 +435,19 @@ vc4_setup_slices(struct vc4_resource *rsc, const char *caller,
|
||||||
slice->offset = offset;
|
slice->offset = offset;
|
||||||
slice->stride = (level_width * rsc->cpp *
|
slice->stride = (level_width * rsc->cpp *
|
||||||
MAX2(prsc->nr_samples, 1));
|
MAX2(prsc->nr_samples, 1));
|
||||||
|
|
||||||
|
#ifdef USE_VC4_SIMULATOR
|
||||||
|
/* Ensure stride alignment matches the one required by the GPU
|
||||||
|
* that drives the display.
|
||||||
|
*/
|
||||||
|
if (slice->tiling == VC4_TILING_FORMAT_LINEAR &&
|
||||||
|
prsc->target == PIPE_TEXTURE_2D) {
|
||||||
|
slice->stride =
|
||||||
|
align(slice->stride,
|
||||||
|
vc4_simulator_get_raster_stride_align(screen->fd));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
slice->size = level_height * slice->stride;
|
slice->size = level_height * slice->stride;
|
||||||
|
|
||||||
offset += slice->size;
|
offset += slice->size;
|
||||||
|
|
@ -583,7 +596,7 @@ vc4_resource_create_with_modifiers(struct pipe_screen *pscreen,
|
||||||
if (tmpl->target != PIPE_BUFFER)
|
if (tmpl->target != PIPE_BUFFER)
|
||||||
rsc->vc4_format = get_resource_texture_format(prsc);
|
rsc->vc4_format = get_resource_texture_format(prsc);
|
||||||
|
|
||||||
vc4_setup_slices(rsc, "create", tmpl->bind & PIPE_BIND_SHARED);
|
vc4_setup_slices(screen, rsc, "create", tmpl->bind & PIPE_BIND_SHARED);
|
||||||
if (!vc4_resource_bo_alloc(rsc))
|
if (!vc4_resource_bo_alloc(rsc))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
|
@ -698,7 +711,7 @@ vc4_resource_from_handle(struct pipe_screen *pscreen,
|
||||||
}
|
}
|
||||||
|
|
||||||
rsc->vc4_format = get_resource_texture_format(prsc);
|
rsc->vc4_format = get_resource_texture_format(prsc);
|
||||||
vc4_setup_slices(rsc, "import", true);
|
vc4_setup_slices(screen, rsc, "import", true);
|
||||||
|
|
||||||
if (whandle->offset != 0) {
|
if (whandle->offset != 0) {
|
||||||
if (rsc->tiled) {
|
if (rsc->tiled) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue