mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
freedreno: Move guardband calc to bind time
No point in re-calculating this at emit time. Even more so when there are multiple viewports. Signed-off-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19236>
This commit is contained in:
parent
d9150eab28
commit
23b7948a72
3 changed files with 30 additions and 8 deletions
|
|
@ -34,7 +34,6 @@
|
|||
#include "util/u_string.h"
|
||||
#include "util/u_viewport.h"
|
||||
|
||||
#include "common/freedreno_guardband.h"
|
||||
#include "freedreno_query_hw.h"
|
||||
#include "freedreno_resource.h"
|
||||
#include "freedreno_state.h"
|
||||
|
|
@ -982,13 +981,8 @@ fd6_emit_non_ring(struct fd_ringbuffer *ring, struct fd6_emit *emit) assert_dt
|
|||
A6XX_GRAS_SC_VIEWPORT_SCISSOR_BR(0, .x = scissor->maxx,
|
||||
.y = scissor->maxy));
|
||||
|
||||
unsigned guardband_x = fd_calc_guardband(vp->translate[0],
|
||||
vp->scale[0], false);
|
||||
unsigned guardband_y = fd_calc_guardband(vp->translate[1],
|
||||
vp->scale[1], false);
|
||||
|
||||
OUT_REG(ring, A6XX_GRAS_CL_GUARDBAND_CLIP_ADJ(.horz = guardband_x,
|
||||
.vert = guardband_y));
|
||||
OUT_REG(ring, A6XX_GRAS_CL_GUARDBAND_CLIP_ADJ(.horz = ctx->guardband.x,
|
||||
.vert = ctx->guardband.y));
|
||||
}
|
||||
|
||||
/* The clamp ranges are only used when the rasterizer wants depth
|
||||
|
|
|
|||
|
|
@ -404,6 +404,9 @@ struct fd_context {
|
|||
struct pipe_poly_stipple stipple dt;
|
||||
struct pipe_viewport_state viewport[PIPE_MAX_VIEWPORTS] dt;
|
||||
struct pipe_scissor_state viewport_scissor[PIPE_MAX_VIEWPORTS] dt;
|
||||
struct {
|
||||
unsigned x, y;
|
||||
} guardband dt;
|
||||
struct fd_constbuf_stateobj constbuf[PIPE_SHADER_TYPES] dt;
|
||||
struct fd_shaderbuf_stateobj shaderbuf[PIPE_SHADER_TYPES] dt;
|
||||
struct fd_shaderimg_stateobj shaderimg[PIPE_SHADER_TYPES] dt;
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@
|
|||
#include "util/u_string.h"
|
||||
#include "util/u_upload_mgr.h"
|
||||
|
||||
#include "common/freedreno_guardband.h"
|
||||
|
||||
#include "freedreno_context.h"
|
||||
#include "freedreno_gmem.h"
|
||||
#include "freedreno_query_hw.h"
|
||||
|
|
@ -407,6 +409,29 @@ fd_set_viewport_states(struct pipe_context *pctx, unsigned start_slot,
|
|||
}
|
||||
|
||||
fd_context_dirty(ctx, FD_DIRTY_VIEWPORT);
|
||||
|
||||
/* Guardband is only used on a6xx so far: */
|
||||
if (!is_a6xx(ctx->screen))
|
||||
return;
|
||||
|
||||
ctx->guardband.x = ~0;
|
||||
ctx->guardband.y = ~0;
|
||||
|
||||
bool is3x = is_a3xx(ctx->screen);
|
||||
|
||||
for (unsigned i = 0; i < PIPE_MAX_VIEWPORTS; i++) {
|
||||
const struct pipe_viewport_state *vp = & ctx->viewport[i];
|
||||
|
||||
/* skip unused viewports: */
|
||||
if (vp->scale[0] == 0)
|
||||
continue;
|
||||
|
||||
unsigned gx = fd_calc_guardband(vp->translate[0], vp->scale[0], is3x);
|
||||
unsigned gy = fd_calc_guardband(vp->translate[1], vp->scale[1], is3x);
|
||||
|
||||
ctx->guardband.x = MIN2(ctx->guardband.x, gx);
|
||||
ctx->guardband.y = MIN2(ctx->guardband.y, gy);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue