Skip to content

Commit

Permalink
Use scaling blit to fix glCopyBufferSubData and drastically reduce tr…
Browse files Browse the repository at this point in the history
…iangle corruption (but more flickering)
  • Loading branch information
MarijnS95 committed Oct 25, 2022
1 parent 0c4080d commit c05cbe3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/freedreno/perfcntrs/fd5_perfcntr.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ static const struct fd_perfcntr_countable vsc_countables[] = {
COUNTABLE(PERF_VSC_EOT_NUM, UINT64, AVERAGE),
};

/* VBIF counters probably not too userful for userspace, and they make
/* VBIF counters probably not too useful for userspace, and they make
* frameretrace take many more passes to collect all the metrics, so
* for now let's hide them.
*/
Expand Down
26 changes: 24 additions & 2 deletions src/gallium/drivers/freedreno/a5xx/fd5_blitter.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ emit_blit_buffer(struct fd_ringbuffer *ring, const struct pipe_blit_info *info)
assert((doff + w) <= fd_bo_size(dst->bo));

OUT_PKT7(ring, CP_SET_RENDER_MODE, 1);
OUT_RING(ring, CP_SET_RENDER_MODE_0_MODE(BLIT2D));
OUT_RING(ring, CP_SET_RENDER_MODE_0_MODE(BLIT2DSCALE));

/*
* Emit source:
Expand All @@ -267,6 +267,28 @@ emit_blit_buffer(struct fd_ringbuffer *ring, const struct pipe_blit_info *info)
OUT_RING(ring, A5XX_GRAS_2D_SRC_INFO_COLOR_FORMAT(RB5_R8_UNORM) |
A5XX_GRAS_2D_SRC_INFO_COLOR_SWAP(WZYX));

/*
* Blend?
*/

OUT_PKT4(ring, REG_A5XX_RB_2D_BLEND_INFO, 10);
OUT_RING(ring, A5XX_RB_2D_BLEND_INFO_COLOR_FORMAT(RB5_R8_UNORM) |
A5XX_RB_2D_BLEND_INFO_TILE_MODE(TILE5_3) |
A5XX_RB_2D_BLEND_INFO_COLOR_SWAP(WZYX) |
A5XX_RB_2D_BLEND_INFO_FLAGS |
A5XX_RB_2D_BLEND_INFO_UNK_0 |
A5XX_RB_2D_BLEND_INFO_UNK_1);
OUT_RING(ring, A5XX_RB_2D_SRC_DIMS_WIDTH(info->src.resource->width0) |
A5XX_RB_2D_SRC_DIMS_HEIGHT(info->src.resource->height0)); /* RB_2D_SRC_DIMS */
OUT_RELOC(ring, src->bo, soff, 0, 0); /* RB_2D_BLEND_LO/HI */
// OUT_RING(ring, fd_bo_size(src->bo) * 8);
OUT_RING(ring, info->src.resource->width0 * info->src.resource->height0 * 8);
OUT_RING(ring, 0x00000000);
OUT_RING(ring, 0x00000000);
OUT_RING(ring, 0x00000000);
OUT_RING(ring, 0x00000000);
OUT_RING(ring, 0x00000000);

/*
* Emit destination:
*/
Expand All @@ -291,7 +313,7 @@ emit_blit_buffer(struct fd_ringbuffer *ring, const struct pipe_blit_info *info)
* Blit command:
*/
OUT_PKT7(ring, CP_BLIT, 5);
OUT_RING(ring, CP_BLIT_0_OP(BLIT_OP_COPY));
OUT_RING(ring, CP_BLIT_0_OP(BLIT_OP_SCALE));
OUT_RING(ring, CP_BLIT_1_SRC_X1(sshift) | CP_BLIT_1_SRC_Y1(0));
OUT_RING(ring, CP_BLIT_2_SRC_X2(sshift + w - 1) | CP_BLIT_2_SRC_Y2(0));
OUT_RING(ring, CP_BLIT_3_DST_X1(dshift) | CP_BLIT_3_DST_Y1(0));
Expand Down

0 comments on commit c05cbe3

Please sign in to comment.