intel: Make LOCK_HARDWARE recursive to avoid hand-rolling recursiveness.
This commit is contained in:
@@ -1255,10 +1255,8 @@ intel_meta_draw_poly(struct intel_context *intel,
|
||||
{
|
||||
union fi *vb;
|
||||
GLint i;
|
||||
GLboolean was_locked = intel->locked;
|
||||
unsigned int saved_vertex_size = intel->vertex_size;
|
||||
|
||||
if (!was_locked)
|
||||
LOCK_HARDWARE(intel);
|
||||
|
||||
intel->vertex_size = 6;
|
||||
@@ -1283,7 +1281,6 @@ intel_meta_draw_poly(struct intel_context *intel,
|
||||
|
||||
intel->vertex_size = saved_vertex_size;
|
||||
|
||||
if (!was_locked)
|
||||
UNLOCK_HARDWARE(intel);
|
||||
}
|
||||
|
||||
|
@@ -195,7 +195,6 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file,
|
||||
{
|
||||
struct intel_context *intel = batch->intel;
|
||||
GLuint used = batch->ptr - batch->map;
|
||||
GLboolean was_locked = intel->locked;
|
||||
|
||||
if (used == 0) {
|
||||
batch->cliprect_mode = IGNORE_CLIPRECTS;
|
||||
@@ -243,12 +242,8 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file,
|
||||
/* TODO: Just pass the relocation list and dma buffer up to the
|
||||
* kernel.
|
||||
*/
|
||||
if (!was_locked)
|
||||
LOCK_HARDWARE(intel);
|
||||
|
||||
do_flush_locked(batch, used, GL_FALSE);
|
||||
|
||||
if (!was_locked)
|
||||
UNLOCK_HARDWARE(intel);
|
||||
|
||||
if (INTEL_DEBUG & DEBUG_SYNC) {
|
||||
|
@@ -252,12 +252,7 @@ intelEmitCopyBlit(struct intel_context *intel,
|
||||
} while (pass < 2);
|
||||
|
||||
if (pass >= 2) {
|
||||
GLboolean locked = GL_FALSE;
|
||||
if (!intel->locked) {
|
||||
LOCK_HARDWARE(intel);
|
||||
locked = GL_TRUE;
|
||||
}
|
||||
|
||||
dri_bo_map(dst_buffer, GL_TRUE);
|
||||
dri_bo_map(src_buffer, GL_FALSE);
|
||||
_mesa_copy_rect((GLubyte *)dst_buffer->virtual + dst_offset,
|
||||
@@ -271,8 +266,6 @@ intelEmitCopyBlit(struct intel_context *intel,
|
||||
|
||||
dri_bo_unmap(src_buffer);
|
||||
dri_bo_unmap(dst_buffer);
|
||||
|
||||
if (locked)
|
||||
UNLOCK_HARDWARE(intel);
|
||||
|
||||
return GL_TRUE;
|
||||
|
@@ -994,7 +994,6 @@ intelContendedLock(struct intel_context *intel, GLuint flags)
|
||||
int me = intel->hHWContext;
|
||||
|
||||
drmGetLock(intel->driFd, intel->hHWContext, flags);
|
||||
intel->locked = 1;
|
||||
|
||||
if (INTEL_DEBUG & DEBUG_LOCK)
|
||||
_mesa_printf("%s - got contended lock\n", __progname);
|
||||
@@ -1051,9 +1050,11 @@ void LOCK_HARDWARE( struct intel_context *intel )
|
||||
struct intel_framebuffer *intel_fb = NULL;
|
||||
struct intel_renderbuffer *intel_rb = NULL;
|
||||
|
||||
intel->locked++;
|
||||
if (intel->locked >= 2)
|
||||
return;
|
||||
|
||||
_glthread_LOCK_MUTEX(lockMutex);
|
||||
assert(!intel->locked);
|
||||
intel->locked = 1;
|
||||
|
||||
if (intel->driDrawable) {
|
||||
intel_fb = intel->driDrawable->driverPrivate;
|
||||
@@ -1101,7 +1102,11 @@ void UNLOCK_HARDWARE( struct intel_context *intel )
|
||||
__DRIscreen *sPriv = intel->driScreen;
|
||||
|
||||
intel->vtbl.note_unlock( intel );
|
||||
intel->locked = 0;
|
||||
intel->locked--;
|
||||
if (intel->locked > 0)
|
||||
return;
|
||||
|
||||
assert(intel->locked == 0);
|
||||
|
||||
if (!sPriv->dri2.enabled)
|
||||
DRM_UNLOCK(intel->driFd, intel->driHwLock, intel->hHWContext);
|
||||
|
@@ -325,8 +325,6 @@ intel_region_data(struct intel_context *intel,
|
||||
const void *src, GLuint src_pitch,
|
||||
GLuint srcx, GLuint srcy, GLuint width, GLuint height)
|
||||
{
|
||||
GLboolean locked = GL_FALSE;
|
||||
|
||||
_DBG("%s\n", __FUNCTION__);
|
||||
|
||||
if (intel == NULL)
|
||||
@@ -340,21 +338,14 @@ intel_region_data(struct intel_context *intel,
|
||||
intel_region_cow(intel, dst);
|
||||
}
|
||||
|
||||
if (!intel->locked) {
|
||||
LOCK_HARDWARE(intel);
|
||||
locked = GL_TRUE;
|
||||
}
|
||||
|
||||
_mesa_copy_rect(intel_region_map(intel, dst) + dst_offset,
|
||||
dst->cpp,
|
||||
dst->pitch,
|
||||
dstx, dsty, width, height, src, src_pitch, srcx, srcy);
|
||||
|
||||
intel_region_unmap(intel, dst);
|
||||
|
||||
if (locked)
|
||||
UNLOCK_HARDWARE(intel);
|
||||
|
||||
}
|
||||
|
||||
/* Copy rectangular sub-regions. Need better logic about when to
|
||||
@@ -459,10 +450,6 @@ void
|
||||
intel_region_cow(struct intel_context *intel, struct intel_region *region)
|
||||
{
|
||||
struct intel_buffer_object *pbo = region->pbo;
|
||||
GLboolean was_locked = intel->locked;
|
||||
|
||||
if (intel == NULL)
|
||||
return;
|
||||
|
||||
intel_region_release_pbo(intel, region);
|
||||
|
||||
@@ -473,10 +460,7 @@ intel_region_cow(struct intel_context *intel, struct intel_region *region)
|
||||
/* Now blit from the texture buffer to the new buffer:
|
||||
*/
|
||||
|
||||
was_locked = intel->locked;
|
||||
if (!was_locked)
|
||||
LOCK_HARDWARE(intel);
|
||||
|
||||
assert(intelEmitCopyBlit(intel,
|
||||
region->cpp,
|
||||
region->pitch, pbo->buffer, 0, region->tiling,
|
||||
@@ -484,8 +468,6 @@ intel_region_cow(struct intel_context *intel, struct intel_region *region)
|
||||
0, 0, 0, 0,
|
||||
region->pitch, region->height,
|
||||
GL_COPY));
|
||||
|
||||
if (!was_locked)
|
||||
UNLOCK_HARDWARE(intel);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user