From d682ebec0bb8716dfa7747c46d5bfad732ead06c Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 18 Aug 2014 17:20:21 -0700 Subject: [PATCH] i965,meta: Stop unlocking the texture to try and prevent deadlocks. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Unlocking the texture is not safe: another thread could come in and grab it. Now that we use a recursive mutex, this should work. This also fixes texture lock deadlocks in the new meta fast clear path. Signed-off-by: Kenneth Graunke Reviewed-by: Kristian Høgsberg Tested-by: Chris Forbes --- src/mesa/drivers/common/meta.c | 18 ------------------ src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 4 ---- 2 files changed, 22 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 485128696c5..90befd42dd0 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -2773,7 +2773,6 @@ copytexsubimage_using_blit_framebuffer(struct gl_context *ctx, GLuint dims, GLint x, GLint y, GLsizei width, GLsizei height) { - struct gl_texture_object *texObj = texImage->TexObject; GLuint fbo; bool success = false; GLbitfield mask; @@ -2782,8 +2781,6 @@ copytexsubimage_using_blit_framebuffer(struct gl_context *ctx, GLuint dims, if (!ctx->Extensions.ARB_framebuffer_object) return false; - _mesa_unlock_texture(ctx, texObj); - _mesa_meta_begin(ctx, MESA_META_ALL & ~MESA_META_DRAW_BUFFERS); _mesa_GenFramebuffers(1, &fbo); @@ -2834,7 +2831,6 @@ copytexsubimage_using_blit_framebuffer(struct gl_context *ctx, GLuint dims, success = mask == 0x0; out: - _mesa_lock_texture(ctx, texObj); _mesa_DeleteFramebuffers(1, &fbo); _mesa_meta_end(ctx); return success; @@ -2852,7 +2848,6 @@ _mesa_meta_CopyTexSubImage(struct gl_context *ctx, GLuint dims, GLint x, GLint y, GLsizei width, GLsizei height) { - struct gl_texture_object *texObj = texImage->TexObject; GLenum format, type; GLint bpp; void *buf; @@ -2897,8 +2892,6 @@ _mesa_meta_CopyTexSubImage(struct gl_context *ctx, GLuint dims, return; } - _mesa_unlock_texture(ctx, texObj); /* need to unlock first */ - /* * Read image from framebuffer (disable pixel transfer ops) */ @@ -2927,8 +2920,6 @@ _mesa_meta_CopyTexSubImage(struct gl_context *ctx, GLuint dims, _mesa_meta_end(ctx); - _mesa_lock_texture(ctx, texObj); /* re-lock */ - free(buf); } @@ -3206,12 +3197,9 @@ _mesa_meta_GetTexImage(struct gl_context *ctx, struct gl_texture_image *texImage) { if (_mesa_is_format_compressed(texImage->TexFormat)) { - struct gl_texture_object *texObj = texImage->TexObject; GLuint slice; bool result; - /* Need to unlock the texture here to prevent deadlock... */ - _mesa_unlock_texture(ctx, texObj); for (slice = 0; slice < texImage->Depth; slice++) { void *dst; if (texImage->TexObject->Target == GL_TEXTURE_2D_ARRAY @@ -3236,8 +3224,6 @@ _mesa_meta_GetTexImage(struct gl_context *ctx, if (!result) break; } - /* ... and relock it */ - _mesa_lock_texture(ctx, texObj); if (result) return; @@ -3539,15 +3525,11 @@ _mesa_meta_ClearTexSubImage(struct gl_context *ctx, { bool res; - _mesa_unlock_texture(ctx, texImage->TexObject); - res = cleartexsubimage_using_fbo(ctx, texImage, xoffset, yoffset, zoffset, width, height, depth, clearValue); - _mesa_lock_texture(ctx, texImage->TexObject); - if (res) return; diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp index 1cf2d186462..92c92aa6e00 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp @@ -266,8 +266,6 @@ brw_blorp_copytexsubimage(struct brw_context *brw, int dst_slice = slice + dst_image->TexObject->MinLayer + dst_image->Face; int dst_level = dst_image->Level + dst_image->TexObject->MinLevel; - _mesa_unlock_texture(ctx, dst_image->TexObject); - brw_blorp_blit_miptrees(brw, src_mt, src_irb->mt_level, src_irb->mt_layer, dst_mt, dst_level, dst_slice, @@ -275,8 +273,6 @@ brw_blorp_copytexsubimage(struct brw_context *brw, dstX0, dstY0, dstX1, dstY1, GL_NEAREST, false, mirror_y); - _mesa_lock_texture(ctx, dst_image->TexObject); - /* If we're copying to a packed depth stencil texture and the source * framebuffer has separate stencil, we need to also copy the stencil data * over. -- 2.30.2