asahi: Minify width/height in create_surface

Otherwise framebuffer->width ends up being wrong with u_blitter, this is what
other drivers do. If we needed to render to depth/stencil with u_blitter, this
would cause us trouble.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22891>
This commit is contained in:
Alyssa Rosenzweig
2023-04-07 15:02:32 -04:00
parent e9b471d1b3
commit a2546b71ed
+9 -3
View File
@@ -878,16 +878,22 @@ agx_create_surface(struct pipe_context *ctx, struct pipe_resource *texture,
if (!surface)
return NULL;
unsigned level = surf_tmpl->u.tex.level;
pipe_reference_init(&surface->reference, 1);
pipe_resource_reference(&surface->texture, texture);
assert(texture->target != PIPE_BUFFER && "buffers are not renderable");
surface->context = ctx;
surface->format = surf_tmpl->format;
surface->width = texture->width0;
surface->height = texture->height0;
surface->width = u_minify(texture->width0, level);
surface->height = u_minify(texture->height0, level);
surface->texture = texture;
surface->u.tex.first_layer = surf_tmpl->u.tex.first_layer;
surface->u.tex.last_layer = surf_tmpl->u.tex.last_layer;
surface->u.tex.level = surf_tmpl->u.tex.level;
surface->u.tex.level = level;
return surface;
}