Skip to content

Instantly share code, notes, and snippets.

@anarsoul
Created January 17, 2020 02:59
Show Gist options
  • Save anarsoul/1f85b9f705563211818a3b4f33f4b1aa to your computer and use it in GitHub Desktop.
Save anarsoul/1f85b9f705563211818a3b4f33f4b1aa to your computer and use it in GitHub Desktop.
diff --git a/src/gallium/drivers/lima/lima_draw.c b/src/gallium/drivers/lima/lima_draw.c
index 9caaf51fc30..7839d8b9a75 100644
--- a/src/gallium/drivers/lima/lima_draw.c
+++ b/src/gallium/drivers/lima/lima_draw.c
@@ -1240,6 +1240,7 @@ lima_update_gp_attribute_info(struct lima_context *ctx, const struct pipe_draw_i
MAX2(1, ve->num_elements) * 8);
int n = 0;
+
for (int i = 0; i < ve->num_elements; i++) {
struct pipe_vertex_element *pve = ve->pipe + i;
@@ -1251,9 +1252,29 @@ lima_update_gp_attribute_info(struct lima_context *ctx, const struct pipe_draw_i
lima_submit_add_bo(ctx->gp_submit, res->bo, LIMA_SUBMIT_BO_READ);
+ struct lima_bo *fake_bo;
+ uint32_t offset = 1;
+ if (1) {
+ uint32_t stride = pvb->stride;
+
+ if (!stride)
+ stride = 4;
+ printf("allocating fake BO: count: %d, stride: %d, offset: %d\n", info->count, stride, offset);
+ fake_bo = lima_bo_create(lima_screen(ctx->base.screen), info->count * stride + offset, 0);
+ void *fake_buf = lima_bo_map(fake_bo);
+ void *real_buf = lima_bo_map(res->bo);
+ lima_submit_add_bo(ctx->gp_submit, fake_bo, LIMA_SUBMIT_BO_READ);
+ memcpy(fake_buf + offset, real_buf + pvb->buffer_offset + pve->src_offset,
+ 4096 - offset);
+ memset(fake_buf, 0xff, offset);
+ }
unsigned start = info->index_size ? (ctx->min_index + info->index_bias) : info->start;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment