summaryrefslogtreecommitdiff
path: root/src/i830_dri.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/i830_dri.c')
-rw-r--r--src/i830_dri.c39
1 files changed, 31 insertions, 8 deletions
diff --git a/src/i830_dri.c b/src/i830_dri.c
index d40ada56..ca3bc621 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -159,7 +159,7 @@ I830InitDma(ScrnInfoPtr pScrn)
info.func = I830_INIT_DMA;
/* Initialize fields that are used in the absence of GEM */
- if (!pI830->memory_manager) {
+ if (!pI830->memory_manager && !pI830->use_drm_mode) {
info.ring_start = ring->mem->offset + pI830->LinearAddr;
info.ring_end = ring->mem->end + pI830->LinearAddr;
info.ring_size = ring->mem->size;
@@ -766,20 +766,22 @@ I830InitTextureHeap(ScrnInfoPtr pScrn)
}
}
-/**
- * Sets up mappings for static, lifetime-fixed allocations, and inital SAREA
- * setup.
+/*
+ * Map registers & ring buffer
*/
-Bool
-I830DRIDoMappings(ScreenPtr pScreen)
+static Bool
+I830DRIMapHW(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
DRIInfoPtr pDRIInfo = pI830->pDRIInfo;
I830DRIPtr pI830DRI = pDRIInfo->devPrivate;
- drmI830Sarea *sarea = (drmI830Sarea *) DRIGetSAREAPrivate(pScreen);
- DPRINTF(PFX, "I830DRIDoMappings\n");
+ /* Kernel deals with direct hw access in this case */
+ if (pI830->use_drm_mode)
+ return TRUE;
+
+ DPRINTF(PFX, "I830DRIMapHW\n");
pI830DRI->regsSize = I830_REG_SIZE;
if (drmAddMap(pI830->drmSubFD, (drm_handle_t)pI830->MMIOAddr,
pI830DRI->regsSize, DRM_REGISTERS, 0,
@@ -806,6 +808,27 @@ I830DRIDoMappings(ScreenPtr pScreen)
(int)pI830->ring_map);
}
+ return TRUE;
+}
+
+/**
+ * Sets up mappings for static, lifetime-fixed allocations, and inital SAREA
+ * setup.
+ */
+Bool
+I830DRIDoMappings(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ I830Ptr pI830 = I830PTR(pScrn);
+ DRIInfoPtr pDRIInfo = pI830->pDRIInfo;
+ I830DRIPtr pI830DRI = pDRIInfo->devPrivate;
+ drmI830Sarea *sarea = (drmI830Sarea *) DRIGetSAREAPrivate(pScreen);
+
+ if (!I830DRIMapHW(pScreen)) {
+ DRICloseScreen(pScreen);
+ return FALSE;
+ }
+
if (!I830InitDma(pScrn)) {
DRICloseScreen(pScreen);
return FALSE;