From 63b4c80c90b576673427d6f18c3d69cd5890242b Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Wed, 24 May 2023 17:43:57 +0200 Subject: [PATCH] virgl: Fix IB upload when a start >0 is given We don't need to add an offset in the buffer, because we submit the offset where the data was written to to the host. The correction of this offset is also not needed and results in draw errors. Fixes: 0cf5d1f22620d67659bbd632a2400c3a6956a011 gallium: remove PIPE_CAP_INFO_START_WITH_USER_INDICES and fix all drivers Signed-off-by: Gert Wollny Part-of: (cherry picked from commit d4fc35974816a9a6e0a19a05e9b7ff384ee31306) --- .pick_status.json | 2 +- src/gallium/drivers/virgl/ci/virpipe-gl-fails.txt | 1 - src/gallium/drivers/virgl/virgl_context.c | 6 ++---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 9a3acb2cf3b..77da8ad6f70 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2425,7 +2425,7 @@ "description": "virgl: Fix IB upload when a start >0 is given", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "0cf5d1f22620d67659bbd632a2400c3a6956a011" }, diff --git a/src/gallium/drivers/virgl/ci/virpipe-gl-fails.txt b/src/gallium/drivers/virgl/ci/virpipe-gl-fails.txt index d47b352f219..d3d44afd2a8 100644 --- a/src/gallium/drivers/virgl/ci/virpipe-gl-fails.txt +++ b/src/gallium/drivers/virgl/ci/virpipe-gl-fails.txt @@ -210,7 +210,6 @@ spec@!opengl 1.2@texwrap 3d bordercolor@GL_RGBA8- border color only,Fail spec@!opengl 1.2@texwrap 3d proj bordercolor,Fail spec@!opengl 1.2@texwrap 3d proj bordercolor@GL_RGBA8- projected- border color only,Fail spec@!opengl 1.5@depth-tex-compare,Fail -spec@!opengl 1.5@draw-elements-user,Fail spec@!opengl 2.0@gl-2.0-edgeflag,Fail spec@!opengl 2.0@gl-2.0-edgeflag-immediate,Fail spec@!opengl 3.2@layered-rendering@clear-color-mismatched-layer-count,Fail diff --git a/src/gallium/drivers/virgl/virgl_context.c b/src/gallium/drivers/virgl/virgl_context.c index 8bd8b278980..12c9e511caa 100644 --- a/src/gallium/drivers/virgl/virgl_context.c +++ b/src/gallium/drivers/virgl/virgl_context.c @@ -981,13 +981,13 @@ static void virgl_draw_vbo(struct pipe_context *ctx, if (ib.user_buffer) { unsigned start_offset = draws[0].start * ib.index_size; - u_upload_data(vctx->uploader, start_offset, + u_upload_data(vctx->uploader, 0, draws[0].count * ib.index_size, 4, (char*)ib.user_buffer + start_offset, &ib.offset, &ib.buffer); - ib.offset -= start_offset; ib.user_buffer = NULL; } + virgl_hw_set_index_buffer(vctx, &ib); } if (!vctx->num_draws) @@ -995,8 +995,6 @@ static void virgl_draw_vbo(struct pipe_context *ctx, vctx->num_draws++; virgl_hw_set_vertex_buffers(vctx); - if (info.index_size) - virgl_hw_set_index_buffer(vctx, &ib); virgl_encoder_draw_vbo(vctx, &info, drawid_offset, indirect, &draws[0]);