diff options
author | Eric Anholt <[email protected]> | 2008-09-06 03:09:43 +0100 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2008-09-10 13:59:45 -0700 |
commit | 3628185f566e178a12b493fb89abf52b4b281f99 (patch) | |
tree | c370b246afc90e886210f12e1694363562873368 /src/mesa/drivers/dri/intel | |
parent | 7e0bbdcf033981282978554c2e68ce48b55aa291 (diff) |
intel: track bufmgr move to libdrm_intel and bufmgr_fake irq emit/wait change.
Diffstat (limited to 'src/mesa/drivers/dri/intel')
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_batchbuffer.c | 12 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_batchbuffer.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_blit.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_buffer_objects.c | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_context.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_context.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_ioctl.c | 60 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_ioctl.h | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_regions.c | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_regions.h | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_screen.c | 47 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_screen.h | 5 |
12 files changed, 22 insertions, 121 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c index 550f467f830..9671232343b 100644 --- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c @@ -261,13 +261,9 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file, UNLOCK_HARDWARE(intel); if (INTEL_DEBUG & DEBUG_SYNC) { - int irq; - fprintf(stderr, "waiting for idle\n"); - LOCK_HARDWARE(intel); - irq = intelEmitIrqLocked(intel->intelScreen); - UNLOCK_HARDWARE(intel); - intelWaitIrq(intel->intelScreen, irq); + dri_bo_map(batch->buf, GL_TRUE); + dri_bo_unmap(batch->buf); } /* Reset the buffer: @@ -289,8 +285,8 @@ intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch, if (batch->ptr - batch->map > batch->buf->size) _mesa_printf ("bad relocation ptr %p map %p offset %d size %d\n", batch->ptr, batch->map, batch->ptr - batch->map, batch->buf->size); - ret = intel_bo_emit_reloc(batch->buf, read_domains, write_domain, - delta, batch->ptr - batch->map, buffer); + ret = dri_bo_emit_reloc(batch->buf, read_domains, write_domain, + delta, batch->ptr - batch->map, buffer); /* * Using the old buffer offset, write in what the right data would be, in case diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.h b/src/mesa/drivers/dri/intel/intel_batchbuffer.h index 52d6ecc2238..7ede1b89035 100644 --- a/src/mesa/drivers/dri/intel/intel_batchbuffer.h +++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.h @@ -3,7 +3,7 @@ #include "mtypes.h" -#include "dri_bufmgr.h" +#include "intel_bufmgr.h" #include "intel_reg.h" struct intel_context; diff --git a/src/mesa/drivers/dri/intel/intel_blit.h b/src/mesa/drivers/dri/intel/intel_blit.h index 0881cc4fdc7..60e30f21e8e 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.h +++ b/src/mesa/drivers/dri/intel/intel_blit.h @@ -30,7 +30,6 @@ #include "intel_context.h" #include "intel_ioctl.h" -#include "dri_bufmgr.h" extern void intelCopyBuffer(const __DRIdrawablePrivate * dpriv, const drm_clip_rect_t * rect); diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c index 1923a21516c..88484a07af6 100644 --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c @@ -34,7 +34,6 @@ #include "intel_buffer_objects.h" #include "intel_batchbuffer.h" #include "intel_regions.h" -#include "dri_bufmgr.h" static GLboolean intel_bufferobj_unmap(GLcontext * ctx, GLenum target, diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 15ab9cbf358..591b5216648 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -278,7 +278,7 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) } if (rb->region) { - intel_bo_flink(rb->region->buffer, &name); + dri_bo_flink(rb->region->buffer, &name); if (name == buffers[i].name) continue; } @@ -614,8 +614,6 @@ intelInitContext(struct intel_context *intel, GLcontext *shareCtx = (GLcontext *) sharedContextPrivate; __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; intelScreenPrivate *intelScreen = (intelScreenPrivate *) sPriv->private; - volatile struct drm_i915_sarea *saPriv = (struct drm_i915_sarea *) - (((GLubyte *) sPriv->pSAREA) + intelScreen->sarea_priv_offset); int fthrottle_mode; if (!_mesa_initialize_context(&intel->ctx, mesaVis, shareCtx, @@ -627,7 +625,7 @@ intelInitContext(struct intel_context *intel, driContextPriv->driverPrivate = intel; intel->intelScreen = intelScreen; intel->driScreen = sPriv; - intel->sarea = saPriv; + intel->sarea = intelScreen->sarea; intel->driContext = driContextPriv; /* Dri stuff */ diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index 04a20278d1e..8bd75753ea6 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -34,7 +34,6 @@ #include "drm.h" #include "mm.h" #include "texmem.h" -#include "dri_bufmgr.h" #include "intel_bufmgr.h" #include "intel_screen.h" diff --git a/src/mesa/drivers/dri/intel/intel_ioctl.c b/src/mesa/drivers/dri/intel/intel_ioctl.c index ac9e9337d6f..c58a8035056 100644 --- a/src/mesa/drivers/dri/intel/intel_ioctl.c +++ b/src/mesa/drivers/dri/intel/intel_ioctl.c @@ -50,66 +50,6 @@ #define FILE_DEBUG_FLAG DEBUG_IOCTL int -intelEmitIrqLocked(intelScreenPrivate *intelScreen) -{ - __DRIscreenPrivate *spriv = intelScreen->driScrnPriv; - struct drm_i915_irq_emit ie; - int ret, seq = 1; - - if (intelScreen->no_hw) - return 1; - - /* - assert(((*(int *)intelScreen->driHwLock) & ~DRM_LOCK_CONT) == - (DRM_LOCK_HELD|intelScreen->hHWContext)); - */ - - ie.irq_seq = &seq; - - ret = drmCommandWriteRead(spriv->fd, DRM_I915_IRQ_EMIT, &ie, sizeof(ie)); - if (ret) { - fprintf(stderr, "%s: drm_i915_irq_emit: %d\n", __FUNCTION__, ret); - exit(1); - } - - DBG("%s --> %d\n", __FUNCTION__, seq); - - return seq; -} - -void -intelWaitIrq(intelScreenPrivate *intelScreen, int seq) -{ - __DRIscreenPrivate *spriv = intelScreen->driScrnPriv; - struct drm_i915_irq_wait iw; - int ret, lastdispatch; - volatile struct drm_i915_sarea *sarea = (struct drm_i915_sarea *) - (((GLubyte *) spriv->pSAREA) + intelScreen->sarea_priv_offset); - - if (intelScreen->no_hw) - return; - - DBG("%s %d\n", __FUNCTION__, seq); - - iw.irq_seq = seq; - - do { - lastdispatch = sarea->last_dispatch; - ret = drmCommandWrite(spriv->fd, DRM_I915_IRQ_WAIT, &iw, sizeof(iw)); - } while (ret == -EAGAIN || - ret == -EINTR || - (ret == -EBUSY && lastdispatch != sarea->last_dispatch) || - (ret == 0 && seq > sarea->last_dispatch) || - (ret == 0 && sarea->last_dispatch - seq >= (1 << 24))); - - if (ret) { - fprintf(stderr, "%s: drm_i915_irq_wait: %d\n", __FUNCTION__, ret); - exit(1); - } -} - - -int intel_batch_ioctl(struct intel_context *intel, GLuint start_offset, GLuint used, diff --git a/src/mesa/drivers/dri/intel/intel_ioctl.h b/src/mesa/drivers/dri/intel/intel_ioctl.h index 2ea40001db9..6736856dbd4 100644 --- a/src/mesa/drivers/dri/intel/intel_ioctl.h +++ b/src/mesa/drivers/dri/intel/intel_ioctl.h @@ -30,9 +30,6 @@ #include "intel_context.h" -void intelWaitIrq(intelScreenPrivate *intelScreen, int seq); -int intelEmitIrqLocked(intelScreenPrivate *intelScreen); - int intel_batch_ioctl(struct intel_context *intel, GLuint start_offset, GLuint used, diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c index c86c1034a9f..1cfc8ddd64c 100644 --- a/src/mesa/drivers/dri/intel/intel_regions.c +++ b/src/mesa/drivers/dri/intel/intel_regions.c @@ -46,7 +46,6 @@ #include "intel_regions.h" #include "intel_blit.h" #include "intel_buffer_objects.h" -#include "dri_bufmgr.h" #include "intel_bufmgr.h" #include "intel_batchbuffer.h" #include "intel_chipset.h" diff --git a/src/mesa/drivers/dri/intel/intel_regions.h b/src/mesa/drivers/dri/intel/intel_regions.h index 1285f250a77..a561de485e2 100644 --- a/src/mesa/drivers/dri/intel/intel_regions.h +++ b/src/mesa/drivers/dri/intel/intel_regions.h @@ -34,8 +34,10 @@ * the basic structure for rectangular collections of pixels stored in a dri_bo. */ +#include <xf86drm.h> + #include "mtypes.h" -#include "dri_bufmgr.h" +#include "intel_bufmgr.h" struct intel_context; struct intel_buffer_object; diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 5cfb8933056..2355eafeca2 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -274,9 +274,9 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) intelScreen->driScrnPriv = sPriv; sPriv->private = (void *) intelScreen; - intelScreen->sarea_priv_offset = gDRIPriv->sarea_priv_offset; sarea = (struct drm_i915_sarea *) - (((GLubyte *) sPriv->pSAREA) + intelScreen->sarea_priv_offset); + (((GLubyte *) sPriv->pSAREA) + gDRIPriv->sarea_priv_offset); + intelScreen->sarea = sarea; intelScreen->deviceID = gDRIPriv->deviceID; @@ -289,8 +289,6 @@ static GLboolean intelInitDriver(__DRIscreenPrivate *sPriv) return GL_FALSE; } - intelScreen->sarea_priv_offset = gDRIPriv->sarea_priv_offset; - if (0) intelPrintDRIInfo(intelScreen, sPriv, gDRIPriv); @@ -551,34 +549,6 @@ intelFillInModes(__DRIscreenPrivate *psp, return configs; } - -/** Driver-specific fence emit implementation for the fake memory manager. */ -static unsigned int -intel_fence_emit(void *private) -{ - intelScreenPrivate *intelScreen = (intelScreenPrivate *)private; - unsigned int fence; - - /* XXX: Need to emit a flush, if we haven't already (at least with the - * current batchbuffer implementation, we have). - */ - - fence = intelEmitIrqLocked(intelScreen); - - return fence; -} - -/** Driver-specific fence wait implementation for the fake memory manager. */ -static int -intel_fence_wait(void *private, unsigned int cookie) -{ - intelScreenPrivate *intelScreen = (intelScreenPrivate *)private; - - intelWaitIrq(intelScreen, cookie); - - return 0; -} - static GLboolean intel_init_bufmgr(intelScreenPrivate *intelScreen) { @@ -628,12 +598,13 @@ intel_init_bufmgr(intelScreenPrivate *intelScreen) return GL_FALSE; } - intelScreen->bufmgr = intel_bufmgr_fake_init(intelScreen->tex.offset, - intelScreen->tex.map, - intelScreen->tex.size, - intel_fence_emit, - intel_fence_wait, - intelScreen); + intelScreen->bufmgr = + intel_bufmgr_fake_init(spriv->fd, + intelScreen->tex.offset, + intelScreen->tex.map, + intelScreen->tex.size, + (unsigned int * volatile) + &intelScreen->sarea->last_dispatch); } /* XXX bufmgr should be per-screen, not per-context */ diff --git a/src/mesa/drivers/dri/intel/intel_screen.h b/src/mesa/drivers/dri/intel/intel_screen.h index 299da872100..daf2ab4c582 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.h +++ b/src/mesa/drivers/dri/intel/intel_screen.h @@ -30,7 +30,7 @@ #include <sys/time.h> #include "dri_util.h" -#include "dri_bufmgr.h" +#include "intel_bufmgr.h" #include "i915_drm.h" #include "xmlconfig.h" @@ -68,7 +68,8 @@ typedef struct int logTextureGranularity; __DRIscreenPrivate *driScrnPriv; - unsigned int sarea_priv_offset; + + volatile struct drm_i915_sarea *sarea; int drmMinor; |