vrend,blitter: Sync when switching context.

When switching context, if we want to use shared objects from previous
context, we need to insert glWaitSync to make sure the GL commands
are executed in sequences. This fixes 8 dEQP tests on mali:

dEQP-GLES2.functional.texture.mipmap.2d.generate.a8_fastest
dEQP-GLES2.functional.texture.mipmap.2d.generate.a8_nicest
dEQP-GLES2.functional.texture.mipmap.cube.generate.a8_fastest
dEQP-GLES2.functional.texture.mipmap.cube.generate.a8_nicest
dEQP-GLES2.functional.texture.specification.basic_copyteximage2d.2d_rgb
dEQP-GLES2.functional.texture.specification.basic_copyteximage2d.cube_rgb
dEQP-GLES2.functional.texture.specification.basic_copytexsubimage2d.2d_rgb
dEQP-GLES2.functional.texture.specification.basic_copytexsubimage2d.cube_rgb

Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
macos/master
Lepton Wu 5 years ago
parent 4dd3e61a99
commit e54bfe8961
  1. 4
      src/vrend_blitter.c
  2. 9
      src/vrend_renderer.c
  3. 2
      src/vrend_renderer.h

@ -451,7 +451,7 @@ static void vrend_renderer_init_blit_ctx(struct vrend_blitter_ctx *blit_ctx)
struct virgl_gl_ctx_param ctx_params; struct virgl_gl_ctx_param ctx_params;
int i; int i;
if (blit_ctx->initialised) { if (blit_ctx->initialised) {
vrend_clicbs->make_current(blit_ctx->gl_context); vrend_sync_make_current(blit_ctx->gl_context);
return; return;
} }
@ -467,7 +467,7 @@ static void vrend_renderer_init_blit_ctx(struct vrend_blitter_ctx *blit_ctx)
break; break;
} }
vrend_clicbs->make_current(blit_ctx->gl_context); vrend_sync_make_current(blit_ctx->gl_context);
glGenVertexArrays(1, &blit_ctx->vaoid); glGenVertexArrays(1, &blit_ctx->vaoid);
glGenFramebuffers(1, &blit_ctx->fb_id); glGenFramebuffers(1, &blit_ctx->fb_id);

@ -1701,6 +1701,13 @@ static void vrend_destroy_streamout_object(struct vrend_streamout_object *obj)
FREE(obj); FREE(obj);
} }
void vrend_sync_make_current(virgl_gl_context gl_cxt) {
GLsync sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
vrend_clicbs->make_current(gl_cxt);
glWaitSync(sync, 0, GL_TIMEOUT_IGNORED);
glDeleteSync(sync);
}
int vrend_create_surface(struct vrend_context *ctx, int vrend_create_surface(struct vrend_context *ctx,
uint32_t handle, uint32_t handle,
uint32_t res_handle, uint32_t format, uint32_t res_handle, uint32_t format,
@ -8419,7 +8426,7 @@ static void vrend_renderer_blit_int(struct vrend_context *ctx,
has_feature(feat_texture_srgb_decode), has_feature(feat_texture_srgb_decode),
has_feature(feat_srgb_write_control), has_feature(feat_srgb_write_control),
skip_dest_swizzle); skip_dest_swizzle);
vrend_clicbs->make_current(ctx->sub->gl_context); vrend_sync_make_current(ctx->sub->gl_context);
goto cleanup; goto cleanup;
} }

@ -467,4 +467,6 @@ extern struct vrend_if_cbs *vrend_clicbs;
int vrend_renderer_execute(void *execute_args, uint32_t execute_size); int vrend_renderer_execute(void *execute_args, uint32_t execute_size);
void vrend_sync_make_current(virgl_gl_context);
#endif #endif

Loading…
Cancel
Save