mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-09 06:10:12 +01:00
etnaviv: don't prepare relocs in etna_surface
Fill the reloc data when the framebuffer state is set. Now that pipe_surface is no longer a CSO, it doesn't matter that we need to pay the price for the computation at state set time instead of surface_create time. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35406>
This commit is contained in:
parent
162a1cadd0
commit
324cf6c305
3 changed files with 14 additions and 25 deletions
|
|
@ -180,7 +180,10 @@ etna_set_framebuffer_state(struct pipe_context *pctx,
|
|||
target_16bpp = true;
|
||||
|
||||
for (int i = 0; i < screen->specs.pixel_pipes; i++) {
|
||||
cs->PE_RT_PIPE_COLOR_ADDR[rt][i] = cbuf->reloc[i];
|
||||
cs->PE_RT_PIPE_COLOR_ADDR[rt][i].bo = res->bo;
|
||||
cs->PE_RT_PIPE_COLOR_ADDR[rt][i].offset = cbuf->level->offset + fb->cbufs[i].first_layer * cbuf->level->layer_stride;
|
||||
if (!screen->specs.single_buffer)
|
||||
cs->PE_RT_PIPE_COLOR_ADDR[rt][i].offset += cbuf->level->layer_stride / screen->specs.pixel_pipes * i;
|
||||
cs->PE_RT_PIPE_COLOR_ADDR[rt][i].flags = ETNA_RELOC_READ | ETNA_RELOC_WRITE;
|
||||
}
|
||||
|
||||
|
|
@ -222,7 +225,8 @@ etna_set_framebuffer_state(struct pipe_context *pctx,
|
|||
cs->TS_COLOR_CLEAR_VALUE = cbuf->level->clear_value;
|
||||
cs->TS_COLOR_CLEAR_VALUE_EXT = cbuf->level->clear_value >> 32;
|
||||
|
||||
cs->TS_COLOR_STATUS_BASE = cbuf->ts_reloc;
|
||||
cs->TS_COLOR_STATUS_BASE.bo = res->ts_bo;
|
||||
cs->TS_COLOR_STATUS_BASE.offset = cbuf->level->ts_offset;
|
||||
cs->TS_COLOR_STATUS_BASE.flags = ETNA_RELOC_READ | ETNA_RELOC_WRITE;
|
||||
|
||||
pe_mem_config |= VIVS_PE_MEM_CONFIG_COLOR_TS_MODE(cbuf->level->ts_mode);
|
||||
|
|
@ -257,7 +261,8 @@ etna_set_framebuffer_state(struct pipe_context *pctx,
|
|||
cs->RT_TS_COLOR_CLEAR_VALUE[rt - 1] = cbuf->level->clear_value;
|
||||
cs->RT_TS_COLOR_CLEAR_VALUE_EXT[rt - 1] = cbuf->level->clear_value >> 32;
|
||||
|
||||
cs->RT_TS_COLOR_STATUS_BASE[rt - 1] = cbuf->ts_reloc;
|
||||
cs->RT_TS_COLOR_STATUS_BASE[rt - 1].bo = res->ts_bo;
|
||||
cs->RT_TS_COLOR_STATUS_BASE[rt - 1].offset = cbuf->level->ts_offset;
|
||||
cs->RT_TS_COLOR_STATUS_BASE[rt - 1].flags = ETNA_RELOC_READ | ETNA_RELOC_WRITE;
|
||||
} else {
|
||||
if (VIV_FEATURE(screen, ETNA_FEATURE_CACHE128B256BPERLINE))
|
||||
|
|
@ -348,7 +353,10 @@ etna_set_framebuffer_state(struct pipe_context *pctx,
|
|||
/* merged with depth_stencil_alpha */
|
||||
|
||||
for (int i = 0; i < screen->specs.pixel_pipes; i++) {
|
||||
cs->PE_PIPE_DEPTH_ADDR[i] = zsbuf->reloc[i];
|
||||
cs->PE_PIPE_DEPTH_ADDR[i].bo = res->bo;
|
||||
cs->PE_PIPE_DEPTH_ADDR[i].offset = zsbuf->level->offset + fb->zsbuf.first_layer * zsbuf->level->layer_stride;
|
||||
if (!screen->specs.single_buffer)
|
||||
cs->PE_PIPE_DEPTH_ADDR[i].offset += cbuf->level->layer_stride / screen->specs.pixel_pipes * i;
|
||||
cs->PE_PIPE_DEPTH_ADDR[i].flags = ETNA_RELOC_READ | ETNA_RELOC_WRITE;
|
||||
}
|
||||
|
||||
|
|
@ -359,7 +367,8 @@ etna_set_framebuffer_state(struct pipe_context *pctx,
|
|||
if (zsbuf->level->ts_size) {
|
||||
cs->TS_DEPTH_CLEAR_VALUE = zsbuf->level->clear_value;
|
||||
|
||||
cs->TS_DEPTH_STATUS_BASE = zsbuf->ts_reloc;
|
||||
cs->TS_DEPTH_STATUS_BASE.bo = res->ts_bo;
|
||||
cs->TS_DEPTH_STATUS_BASE.offset = zsbuf->level->ts_offset;
|
||||
cs->TS_DEPTH_STATUS_BASE.flags = ETNA_RELOC_READ | ETNA_RELOC_WRITE;
|
||||
|
||||
pe_mem_config |= VIVS_PE_MEM_CONFIG_DEPTH_TS_MODE(zsbuf->level->ts_mode);
|
||||
|
|
|
|||
|
|
@ -101,27 +101,9 @@ etna_create_surface(struct pipe_context *pctx, struct pipe_resource *prsc,
|
|||
/* XXX we don't really need a copy but it's convenient */
|
||||
surf->offset = lev->offset + layer * lev->layer_stride;
|
||||
|
||||
/* Setup template relocations for this surface */
|
||||
for (unsigned pipe = 0; pipe < screen->specs.pixel_pipes; ++pipe) {
|
||||
surf->reloc[pipe].bo = rsc->bo;
|
||||
surf->reloc[pipe].offset = surf->offset;
|
||||
surf->reloc[pipe].flags = 0;
|
||||
}
|
||||
|
||||
/* In single buffer mode, both pixel pipes must point to the same address,
|
||||
* for multi-tiled surfaces on the other hand the second pipe is expected to
|
||||
* point halfway the image vertically.
|
||||
*/
|
||||
if (rsc->layout & ETNA_LAYOUT_BIT_MULTI)
|
||||
surf->reloc[1].offset = surf->offset + lev->stride * lev->padded_height / 2;
|
||||
|
||||
if (surf->level->ts_size) {
|
||||
assert(layer == 0);
|
||||
|
||||
surf->ts_reloc.bo = rsc->ts_bo;
|
||||
surf->ts_reloc.offset = surf->level->ts_offset;
|
||||
surf->ts_reloc.flags = 0;
|
||||
|
||||
if (!screen->specs.use_blt) {
|
||||
/* This (ab)uses the RS as a plain buffer memset().
|
||||
* Currently uses a fixed row size of 64 bytes. Some benchmarking with
|
||||
|
|
|
|||
|
|
@ -39,8 +39,6 @@ struct etna_surface {
|
|||
struct compiled_rs_state ts_clear_command;
|
||||
/* Keep pointer to resource level, for fast clear */
|
||||
struct etna_resource_level *level;
|
||||
struct etna_reloc reloc[ETNA_MAX_PIXELPIPES];
|
||||
struct etna_reloc ts_reloc;
|
||||
uint32_t offset; /* pre-calculated level + layer offset */
|
||||
/* keep pointer to original resource (for when a render compatible resource is used) */
|
||||
struct pipe_resource *prsc;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue