mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 09:08:10 +02:00
etnaviv: rs: Factor out box alignment function
Introduce etna_align_box_for_rs(..) that allows us to apply RS restrictions to a pipe_box. Switch etna_transfer_map(..) to it. Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com> Reviewed-by: Lucas Stach <l.stach@pengutronix.de> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33226>
This commit is contained in:
parent
6b6a4cb1e2
commit
98b9cc6d5a
3 changed files with 24 additions and 16 deletions
|
|
@ -905,6 +905,23 @@ manual:
|
|||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
etna_align_box_for_rs(const struct etna_context *ctx,
|
||||
const struct etna_resource *rsc,
|
||||
struct pipe_box *box)
|
||||
{
|
||||
unsigned w_align, h_align;
|
||||
|
||||
etna_get_rs_alignment_mask(ctx, rsc->layout, &w_align, &h_align);
|
||||
|
||||
box->width += box->x & w_align;
|
||||
box->x = box->x & ~w_align;
|
||||
box->width = align(box->width, (ETNA_RS_WIDTH_MASK + 1));
|
||||
box->height += box->y & h_align;
|
||||
box->y = box->y & ~h_align;
|
||||
box->height = align(box->height, ETNA_RS_HEIGHT_MASK + 1);
|
||||
}
|
||||
|
||||
void
|
||||
etna_clear_blit_rs_init(struct pipe_context *pctx)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -87,6 +87,11 @@ void
|
|||
etna_compile_rs_state(struct etna_context *ctx, struct compiled_rs_state *cs,
|
||||
const struct rs_state *rs);
|
||||
|
||||
void
|
||||
etna_align_box_for_rs(const struct etna_context *ctx,
|
||||
const struct etna_resource *rsc,
|
||||
struct pipe_box *box);
|
||||
|
||||
/* Context initialization for RS clear_blit functions. */
|
||||
void
|
||||
etna_clear_blit_rs_init(struct pipe_context *pctx);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "etnaviv_context.h"
|
||||
#include "etnaviv_debug.h"
|
||||
#include "etnaviv_etc2.h"
|
||||
#include "etnaviv_rs.h"
|
||||
#include "etnaviv_screen.h"
|
||||
|
||||
#include "pipe/p_defines.h"
|
||||
|
|
@ -297,22 +298,7 @@ etna_transfer_map(struct pipe_context *pctx, struct pipe_resource *prsc,
|
|||
/* Need to align the transfer region to satisfy RS restrictions, as we
|
||||
* really want to hit the RS blit path here.
|
||||
*/
|
||||
unsigned w_align, h_align;
|
||||
|
||||
if (rsc->layout & ETNA_LAYOUT_BIT_SUPER) {
|
||||
w_align = 64;
|
||||
h_align = 64 * ctx->screen->specs.pixel_pipes;
|
||||
} else {
|
||||
w_align = ETNA_RS_WIDTH_MASK + 1;
|
||||
h_align = ETNA_RS_HEIGHT_MASK + 1;
|
||||
}
|
||||
|
||||
ptrans->box.width += ptrans->box.x & (w_align - 1);
|
||||
ptrans->box.x = ptrans->box.x & ~(w_align - 1);
|
||||
ptrans->box.width = align(ptrans->box.width, (ETNA_RS_WIDTH_MASK + 1));
|
||||
ptrans->box.height += ptrans->box.y & (h_align - 1);
|
||||
ptrans->box.y = ptrans->box.y & ~(h_align - 1);
|
||||
ptrans->box.height = align(ptrans->box.height, ETNA_RS_HEIGHT_MASK + 1);
|
||||
etna_align_box_for_rs(ctx, rsc, &ptrans->box);
|
||||
}
|
||||
|
||||
if ((usage & PIPE_MAP_READ) || !(usage & ETNA_PIPE_MAP_DISCARD_LEVEL))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue