diff options
author | Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> | 2007-04-16 16:04:12 +0200 |
---|---|---|
committer | Thomas Hellstrom <thomas-at-tungstengraphics-dot-com> | 2007-04-16 16:04:12 +0200 |
commit | da56df9d722a2eb8223434d130436bcb6ea47188 (patch) | |
tree | 46bae3654d37cf286ab03df10de2a9e3ff776a25 /src/mesa/drivers/dri/i915tex | |
parent | 9519785e298c665f8aafe57a6a1b2d5c5d484a6d (diff) |
Make sure we are locked when creating drm buffer objects.
Don't place buffer objects on unfenced list when newly created.
Fix a buffer object wait-for-idle deadlock.
Diffstat (limited to 'src/mesa/drivers/dri/i915tex')
-rw-r--r-- | src/mesa/drivers/dri/i915tex/intel_batchpool.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915tex/intel_buffer_objects.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915tex/intel_regions.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915tex/intel_screen.c | 14 |
4 files changed, 27 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i915tex/intel_batchpool.c b/src/mesa/drivers/dri/i915tex/intel_batchpool.c index 3c17c50204..2503b8a62a 100644 --- a/src/mesa/drivers/dri/i915tex/intel_batchpool.c +++ b/src/mesa/drivers/dri/i915tex/intel_batchpool.c @@ -96,7 +96,7 @@ createBPool(int fd, unsigned long bufSize, unsigned numBufs, unsigned flags, _glthread_INIT_MUTEX(p->mutex); if (drmBOCreate(fd, 0, numBufs * bufSize, 0, NULL, drm_bo_type_dc, - flags, 0, &p->kernelBO)) { + flags, DRM_BO_HINT_DONT_FENCE, &p->kernelBO)) { free(p->bufs); free(p); return NULL; diff --git a/src/mesa/drivers/dri/i915tex/intel_buffer_objects.c b/src/mesa/drivers/dri/i915tex/intel_buffer_objects.c index ba3c7f0c1f..91c45ad95b 100644 --- a/src/mesa/drivers/dri/i915tex/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/i915tex/intel_buffer_objects.c @@ -76,7 +76,9 @@ intel_bufferobj_release_region(struct intel_context *intel, */ driGenBuffers(intel->intelScreen->regionPool, "buffer object", 1, &intel_obj->buffer, 64, 0, 0); + LOCK_HARDWARE(intel); driBOData(intel_obj->buffer, intel_obj->Base.Size, NULL, 0); + UNLOCK_HARDWARE(intel); } /* Break the COW tie to the region. Both the pbo and the region end @@ -137,7 +139,9 @@ intel_bufferobj_data(GLcontext * ctx, if (intel_obj->region) intel_bufferobj_release_region(intel, intel_obj); + LOCK_HARDWARE(intel); driBOData(intel_obj->buffer, size, data, 0); + UNLOCK_HARDWARE(intel); } diff --git a/src/mesa/drivers/dri/i915tex/intel_regions.c b/src/mesa/drivers/dri/i915tex/intel_regions.c index a114bdf896..7d19bd07d3 100644 --- a/src/mesa/drivers/dri/i915tex/intel_regions.c +++ b/src/mesa/drivers/dri/i915tex/intel_regions.c @@ -90,6 +90,7 @@ intel_region_alloc(intelScreenPrivate *intelScreen, GLuint cpp, GLuint pitch, GLuint height) { struct intel_region *region = calloc(sizeof(*region), 1); + struct intel_context *intel = intelScreenContext(intelScreen); DBG("%s\n", __FUNCTION__); @@ -107,7 +108,9 @@ intel_region_alloc(intelScreenPrivate *intelScreen, 0, #endif 0); + LOCK_HARDWARE(intel); driBOData(region->buffer, pitch * cpp * height, NULL, 0); + UNLOCK_HARDWARE(intel); return region; } @@ -392,6 +395,8 @@ void intel_region_release_pbo(intelScreenPrivate *intelScreen, struct intel_region *region) { + struct intel_context *intel = intelScreenContext(intelScreen); + assert(region->buffer == region->pbo->buffer); region->pbo->region = NULL; region->pbo = NULL; @@ -400,8 +405,11 @@ intel_region_release_pbo(intelScreenPrivate *intelScreen, driGenBuffers(intelScreen->regionPool, "region", 1, ®ion->buffer, 64, 0, 0); + + LOCK_HARDWARE(intel); driBOData(region->buffer, region->cpp * region->pitch * region->height, NULL, 0); + UNLOCK_HARDWARE(intel); } /* Break the COW tie to the pbo. Both the pbo and the region end up diff --git a/src/mesa/drivers/dri/i915tex/intel_screen.c b/src/mesa/drivers/dri/i915tex/intel_screen.c index 9034ee1b22..87a5aeb17c 100644 --- a/src/mesa/drivers/dri/i915tex/intel_screen.c +++ b/src/mesa/drivers/dri/i915tex/intel_screen.c @@ -878,9 +878,19 @@ __driCreateNewScreen_20050727(__DRInativeDisplay * dpy, int scrn, static const __DRIversion ddx_expected = { 1, 5, 0 }; static const __DRIversion dri_expected = { 4, 0, 0 }; static const __DRIversion drm_expected = { 1, 7, 0 }; + int tmpContextID; + GLuint tmpContext; dri_interface = interface; + if (!(*dri_interface->createContext)(dpy, modes->screen, + modes->fbconfigID, + &tmpContextID, &tmpContext)) { + fprintf(stderr, "Could not create temporary context.\n"); + return NULL; + } + DRM_LIGHT_LOCK(fd, &((drm_sarea_t *)pSAREA)->lock, tmpContext); + if (!driCheckDriDdxDrmVersions2("i915", dri_version, &dri_expected, ddx_version, &ddx_expected, @@ -892,6 +902,10 @@ __driCreateNewScreen_20050727(__DRInativeDisplay * dpy, int scrn, ddx_version, dri_version, drm_version, frame_buffer, pSAREA, fd, internal_api_version, &intelAPI); + + DRM_UNLOCK(fd, &((drm_sarea_t *)pSAREA)->lock, tmpContext); + (void) (*dri_interface->destroyContext)(dpy, modes->screen, tmpContextID); + if (psp != NULL) { I830DRIPtr dri_priv = (I830DRIPtr) psp->pDevPriv; *driver_modes = intelFillInModes(dri_priv->cpp * 8, |