[Intel-gfx] [PATCH] intel: Nuke shared-entity support (zaphod mode).

Eric Anholt eric at anholt.net
Sat Feb 28 09:54:04 CET 2009


It's been broken for years now, and KMS offers a much better chance of getting
this working sensibly without making a mess of the 2D driver.
---
 src/i810_driver.c      |   67 -----------------
 src/i830.h             |   25 +-----
 src/i830_accel.c       |    4 +-
 src/i830_batchbuffer.c |    2 +-
 src/i830_debug.c       |   10 +--
 src/i830_display.c     |    5 +-
 src/i830_dri.c         |    8 +-
 src/i830_driver.c      |  194 ++++++++----------------------------------------
 src/i830_memory.c      |   54 ++-----------
 src/i830_render.c      |    2 +-
 src/i830_ring.h        |   14 ++--
 src/i830_video.c       |   59 ++-------------
 src/i830_xaa.c         |   69 ++---------------
 src/i915_render.c      |    2 +-
 src/i915_video.c       |    2 +-
 src/i965_render.c      |    2 +-
 src/i965_video.c       |    2 +-
 17 files changed, 82 insertions(+), 439 deletions(-)

diff --git a/src/i810_driver.c b/src/i810_driver.c
index c10e15b..6ae388d 100644
--- a/src/i810_driver.c
+++ b/src/i810_driver.c
@@ -620,8 +620,6 @@ static Bool intel_pci_probe (DriverPtr		driver,
 {
     ScrnInfoPtr	    scrn = NULL;
     EntityInfoPtr   entity;
-    I830EntPtr	    i830_ent = NULL;
-    DevUnion	    *private;
 
     scrn = xf86ConfigPciEntity (scrn, 0, entity_num, I810PciChipsets,
 				NULL,
@@ -651,44 +649,7 @@ static Bool intel_pci_probe (DriverPtr		driver,
 	    scrn->ValidMode = I810ValidMode;
 	    break;
 #endif
-	case PCI_CHIP_845_G:
-	case PCI_CHIP_I865_G:
-	    /*
-	     * These two chips have only one pipe, and
-	     * cannot do dual-head
-	     */
-	    I830InitpScrn(scrn);
-	    break;
 	default:
-	    /*
-	     * Everything else is an i830-ish dual-pipe chip
-	     */
-	    xf86SetEntitySharable(entity_num);
-
-	    /* Allocate an entity private if necessary */		
-	    if (I830EntityIndex < 0)					
-		I830EntityIndex = xf86AllocateEntityPrivateIndex();	
-
-	    private = xf86GetEntityPrivate(scrn->entityList[0],
-					   I830EntityIndex);	
-	    i830_ent = private->ptr;
-	    if (!i830_ent)
-	    {
-		private->ptr = xnfcalloc(sizeof(I830EntRec), 1);
-		i830_ent = private->ptr;
-		i830_ent->lastInstance = -1;
-	    }
-
-	    /*
-	     * Set the entity instance for this instance of the driver.
-	     * For dual head per card, instance 0 is the "master"
-	     * instance, driving the primary head, and instance 1 is
-	     * the "slave".
-	     */
-	    i830_ent->lastInstance++;
-	    xf86SetEntityInstanceForScreen(scrn,			
-					   scrn->entityList[0],
-					   i830_ent->lastInstance);	
 	    I830InitpScrn(scrn);
 	    break;
 	}
@@ -708,7 +669,6 @@ static Bool
 I810Probe(DriverPtr drv, int flags)
 {
    int i, numUsed, numDevSections, *usedChips;
-   I830EntPtr pI830Ent = NULL;					
    DevUnion *pPriv;						
    GDevPtr *devSections;
    Bool foundScreen = FALSE;
@@ -790,8 +750,6 @@ I810Probe(DriverPtr drv, int flags)
 	    switch (pEnt->chipset) {
 	    case PCI_CHIP_845_G:
 	    case PCI_CHIP_I865_G:
-	       I830InitpScrn(pScrn);
-               break;
 	    case PCI_CHIP_I830_M:
 	    case PCI_CHIP_I855_GM:
 	    case PCI_CHIP_I915_G:
@@ -816,31 +774,6 @@ I810Probe(DriverPtr drv, int flags)
 	    case PCI_CHIP_G45_G:
 	    case PCI_CHIP_Q45_G:
 	    case PCI_CHIP_G41_G:
-    	       xf86SetEntitySharable(usedChips[i]);
-
-    	       /* Allocate an entity private if necessary */		
-    	       if (I830EntityIndex < 0)					
-		  I830EntityIndex = xf86AllocateEntityPrivateIndex();	
-
-    	       pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
-						I830EntityIndex);	
-    	       if (!pPriv->ptr) {
-		  pPriv->ptr = xnfcalloc(sizeof(I830EntRec), 1);
-		  pI830Ent = pPriv->ptr;
-		  pI830Ent->lastInstance = -1;
-    	       } else {
-		   pI830Ent = pPriv->ptr;
-    	       }
-
-    	       /*
-		* Set the entity instance for this instance of the driver.
-     	        * For dual head per card, instance 0 is the "master"
-     	        * instance, driving the primary head, and instance 1 is
-     	        * the "slave".
-     	        */
-    	       pI830Ent->lastInstance++;
-               xf86SetEntityInstanceForScreen(pScrn,			
-			pScrn->entityList[0], pI830Ent->lastInstance);	
 	       I830InitpScrn(pScrn);
 	       break;
 #ifndef I830_ONLY
diff --git a/src/i830.h b/src/i830.h
index cd9c38a..3d1a30a 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -212,17 +212,6 @@ typedef struct {
    int space;
 } I830RingBuffer;
 
-typedef struct {
-   int            lastInstance;
-   int            refCount;
-   ScrnInfoPtr    pScrn_1;
-   ScrnInfoPtr    pScrn_2;
-   int            RingRunning;
-#ifdef I830_XV
-   int            XvInUse;
-#endif
-} I830EntRec, *I830EntPtr;
-
 /* store information about an Ixxx DVO */
 /* The i830->i865 use multiple DVOs with multiple i2cs */
 /* the i915, i945 have a single sDVO i2c bus - which is different */
@@ -381,9 +370,6 @@ typedef struct _I830Rec {
    unsigned char *FbBase;
    int cpp;
 
-   I830EntPtr entityPrivate;	
-   int init;
-
    unsigned int bufferOffset;		/* for I830SelectBuffer */
    BoxRec FbMemBox;
    BoxRec FbMemBox2;
@@ -404,7 +390,6 @@ typedef struct _I830Rec {
    int gtt_acquired;		/**< whether we currently own the AGP */
 
    i830_memory *front_buffer;
-   i830_memory *front_buffer_2;
    i830_memory *compressed_front_buffer;
    i830_memory *compressed_ll_buffer;
    /* One big buffer for all cursors for kernels that support this */
@@ -413,14 +398,13 @@ typedef struct _I830Rec {
    i830_memory *cursor_mem_classic[2];
    i830_memory *cursor_mem_argb[2];
    i830_memory *xaa_scratch;
-   i830_memory *xaa_scratch_2;
 #ifdef I830_USE_EXA
    i830_memory *exa_offscreen;
 #endif
    i830_memory *fake_bufmgr_mem;
 
    /* Regions allocated either from the above pools, or from agpgart. */
-   I830RingBuffer *LpRing;
+   I830RingBuffer ring;
 
    /** Number of bytes being emitted in the current BEGIN_LP_RING */
    unsigned int ring_emitting;
@@ -562,7 +546,7 @@ typedef struct _I830Rec {
    int colorKey;
    XF86VideoAdaptorPtr adaptor;
    ScreenBlockHandlerProcPtr BlockHandler;
-   Bool *overlayOn;
+   Bool overlayOn;
 
    struct {
       drm_intel_bo *gen4_vs_bo;
@@ -723,7 +707,7 @@ typedef struct _I830Rec {
    uint32_t saveRAMCLK_GATE_D;
    uint32_t savePWRCTXA;
 
-   enum last_3d *last_3d;
+   enum last_3d last_3d;
 
    Bool use_drm_mode;
    Bool kernel_exec_fencing;
@@ -875,7 +859,6 @@ Bool i830_allocate_xvmc_buffer(ScrnInfoPtr pScrn, const char *name,
 extern void i830_update_front_offset(ScrnInfoPtr pScrn);
 extern uint32_t i830_create_new_fb(ScrnInfoPtr pScrn, int width, int height,
 				   int *pitch);
-extern Bool I830IsPrimary(ScrnInfoPtr pScrn);
 
 Bool
 i830_tiled_width(I830Ptr i830, int *width, int cpp);
@@ -985,7 +968,7 @@ i830_wait_ring_idle(ScrnInfoPtr pScrn)
    I830Ptr pI830 = I830PTR(pScrn);
 
    if (pI830->accel != ACCEL_NONE)
-       I830WaitLpRing(pScrn, pI830->LpRing->mem->size - 8, 0);
+       I830WaitLpRing(pScrn, pI830->ring.mem->size - 8, 0);
 }
 
 static inline int i830_fb_compression_supported(I830Ptr pI830)
diff --git a/src/i830_accel.c b/src/i830_accel.c
index 9155c92..9f5bcb5 100644
--- a/src/i830_accel.c
+++ b/src/i830_accel.c
@@ -96,7 +96,7 @@ int
 I830WaitLpRing(ScrnInfoPtr pScrn, int n, int timeout_millis)
 {
    I830Ptr pI830 = I830PTR(pScrn);
-   I830RingBuffer *ring = pI830->LpRing;
+   I830RingBuffer *ring = &pI830->ring;
    int iters = 0;
    unsigned int start = 0;
    unsigned int now = 0;
@@ -188,8 +188,6 @@ I830Sync(ScrnInfoPtr pScrn)
    }
 #endif
 
-   if (pI830->entityPrivate && !pI830->entityPrivate->RingRunning) return;
-
    I830EmitFlush(pScrn);
 
    intel_batch_flush(pScrn, TRUE);
diff --git a/src/i830_batchbuffer.c b/src/i830_batchbuffer.c
index 671e8c8..dca1616 100644
--- a/src/i830_batchbuffer.c
+++ b/src/i830_batchbuffer.c
@@ -122,7 +122,7 @@ intel_next_batch(ScrnInfoPtr pScrn)
      * so we have to reinitialize our 3D state per batch.
      */
     if (pI830->directRenderingType == DRI_DRI2)
-	*pI830->last_3d = LAST_3D_OTHER;
+	pI830->last_3d = LAST_3D_OTHER;
 }
 
 void
diff --git a/src/i830_debug.c b/src/i830_debug.c
index d99af57..ed8843e 100644
--- a/src/i830_debug.c
+++ b/src/i830_debug.c
@@ -1481,9 +1481,9 @@ i830_valid_chain (ScrnInfoPtr pScrn, unsigned int ring, unsigned int end)
     
     head = (INREG (LP_RING + RING_HEAD)) & I830_HEAD_MASK;
     tail = INREG (LP_RING + RING_TAIL) & I830_TAIL_MASK;
-    mask = pI830->LpRing->tail_mask;
+    mask = pI830->ring.tail_mask;
     
-    virt = pI830->LpRing->virtual_start;
+    virt = pI830->ring.virtual_start;
     ErrorF ("Ring at virtual %p head 0x%x tail 0x%x count %d\n",
 	    virt, head, tail, (((tail + mask + 1) - head) & mask) >> 2);
 
@@ -1581,9 +1581,9 @@ i830_dump_ring(ScrnInfoPtr pScrn, uint32_t acthd)
     
     head = (INREG (LP_RING + RING_HEAD)) & I830_HEAD_MASK;
     tail = INREG (LP_RING + RING_TAIL) & I830_TAIL_MASK;
-    mask = pI830->LpRing->tail_mask;
+    mask = pI830->ring.tail_mask;
     
-    virt = pI830->LpRing->virtual_start;
+    virt = pI830->ring.virtual_start;
     ErrorF ("Ring at virtual %p head 0x%x tail 0x%x count %d acthd 0x%x\n",
 	    virt, head, tail, (((tail + mask + 1) - head) & mask) >> 2, acthd);
 
@@ -1729,8 +1729,6 @@ i830_check_error_state(ScrnInfoPtr pScrn)
     int errors = 0;
     unsigned long temp, head, tail;
 
-    if (!I830IsPrimary(pScrn)) return TRUE;
-
     temp = INREG16(ESR);
     if (temp != 0) {
 	Bool vertex_max = !IS_I965G(pI830) && (temp & ERR_VERTEX_MAX);
diff --git a/src/i830_display.c b/src/i830_display.c
index e243bfd..3139d40 100644
--- a/src/i830_display.c
+++ b/src/i830_display.c
@@ -469,11 +469,8 @@ i830PipeSetBase(xf86CrtcPtr crtc, int x, int y)
 	Start = (char *)crtc->rotatedData - (char *)pI830->FbBase;
 	Offset = 0;
 	Stride = intel_crtc->rotate_mem->pitch;
-    } else if (I830IsPrimary(pScrn)) {
-	Start = pI830->front_buffer->offset;
     } else {
-	I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1);
-	Start = pI8301->front_buffer_2->offset;
+	Start = pI830->front_buffer->offset;
     }
 
     crtc->x = x;
diff --git a/src/i830_dri.c b/src/i830_dri.c
index 96c711e..b7ebd92 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -146,7 +146,7 @@ static Bool
 I830InitDma(ScrnInfoPtr pScrn)
 {
    I830Ptr pI830 = I830PTR(pScrn);
-   I830RingBuffer *ring = pI830->LpRing;
+   I830RingBuffer *ring = &pI830->ring;
    I830DRIPtr pI830DRI = (I830DRIPtr) pI830->pDRIInfo->devPrivate;
    drmI830Init info;
 
@@ -773,9 +773,9 @@ I830DRIMapHW(ScreenPtr pScreen)
 
    if (!pI830->memory_manager) {
        if (drmAddMap(pI830->drmSubFD,
-		     (drm_handle_t)pI830->LpRing->mem->offset +
+		     (drm_handle_t)pI830->ring.mem->offset +
 		     pI830->LinearAddr,
-		     pI830->LpRing->mem->size, DRM_AGP, 0,
+		     pI830->ring.mem->size, DRM_AGP, 0,
 		     (drmAddress) &pI830->ring_map) < 0) {
 	   xf86DrvMsg(pScreen->myNum, X_ERROR,
 		      "[drm] drmAddMap(ring_map) failed. Disabling DRI\n");
@@ -1004,7 +1004,7 @@ I830DRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
       if (I810_DEBUG & DEBUG_VERBOSE_DRI)
 	 ErrorF("i830DRISwapContext (in)\n");
 
-      *pI830->last_3d = LAST_3D_OTHER;
+      pI830->last_3d = LAST_3D_OTHER;
 
       if (!pScrn->vtSema)
      	 return;
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 342a059..8c18f97 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -713,9 +713,8 @@ I830MapMem(ScrnInfoPtr pScrn)
       return FALSE;
 #endif
 
-   if (I830IsPrimary(pScrn) && pI830->LpRing->mem != NULL) {
-      pI830->LpRing->virtual_start =
-	 pI830->FbBase + pI830->LpRing->mem->offset;
+   if (pI830->ring.mem != NULL) {
+      pI830->ring.virtual_start = pI830->FbBase + pI830->ring.mem->offset;
    }
 
    return TRUE;
@@ -1064,32 +1063,11 @@ PreInitCleanup(ScrnInfoPtr pScrn)
 {
    I830Ptr pI830 = I830PTR(pScrn);
 
-   if (I830IsPrimary(pScrn)) {
-      if (pI830->entityPrivate)
-	 pI830->entityPrivate->pScrn_1 = NULL;
-   } else {
-      if (pI830->entityPrivate)
-         pI830->entityPrivate->pScrn_2 = NULL;
-   }
    if (pI830->MMIOBase)
       I830UnmapMMIO(pScrn);
    I830FreeRec(pScrn);
 }
 
-Bool
-I830IsPrimary(ScrnInfoPtr pScrn)
-{
-   I830Ptr pI830 = I830PTR(pScrn);
-
-   if (xf86IsEntityShared(pScrn->entityList[0])) {
-	if (pI830->init == 0) return TRUE;
-	else return FALSE;
-   }
-
-   return TRUE;
-}
-
-
 /*
  * Adjust *width to allow for tiling if possible
  */
@@ -1827,7 +1805,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
    I830Ptr pI830;
    rgb defaultWeight = { 0, 0, 0 };
    EntityInfoPtr pEnt;
-   I830EntPtr pI830Ent = NULL;
    int flags24;
    Gamma zeros = { 0.0, 0.0, 0.0 };
    int drm_mode_setting;
@@ -1873,43 +1850,11 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
 			  pI830->PciInfo->func);
 #endif
 
-    /* Allocate an entity private if necessary */
-    if (xf86IsEntityShared(pScrn->entityList[0])) {
-	pI830Ent = xf86GetEntityPrivate(pScrn->entityList[0],
-					I830EntityIndex)->ptr;
-        pI830->entityPrivate = pI830Ent;
-    } else
-        pI830->entityPrivate = NULL;
-
    if (xf86RegisterResources(pI830->pEnt->index, NULL, ResNone)) {
       PreInitCleanup(pScrn);
       return FALSE;
    }
 
-   if (xf86IsEntityShared(pScrn->entityList[0])) {
-      if (xf86IsPrimInitDone(pScrn->entityList[0])) {
-	 pI830->init = 1;
-
-         if (!pI830Ent->pScrn_1) {
-            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- 		 "Failed to setup second head due to primary head failure.\n");
-	    return FALSE;
-         }
-      } else {
-         xf86SetPrimInitDone(pScrn->entityList[0]);
-	 pI830->init = 0;
-      }
-   }
-
-   if (xf86IsEntityShared(pScrn->entityList[0])) {
-      if (!I830IsPrimary(pScrn)) {
-         pI830Ent->pScrn_2 = pScrn;
-      } else {
-         pI830Ent->pScrn_1 = pScrn;
-         pI830Ent->pScrn_2 = NULL;
-      }
-   }
-
    pScrn->racMemFlags = RAC_FB | RAC_COLORMAP;
    pScrn->monitor = pScrn->confScreen->monitor;
    pScrn->progClock = TRUE;
@@ -1976,14 +1921,7 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
     * XXX If we knew the pre-initialised GTT format for certain, we could
     * probably figure out the physical address even in the StolenOnly case.
     */
-   if (!I830IsPrimary(pScrn)) {
-        I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1);
-	if (!pI8301->SWCursor) {
-          xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
-		 "Using HW Cursor because it's enabled on primary head.\n");
-          pI830->SWCursor = FALSE;
-        }
-   } else if (pI830->StolenOnly && pI830->CursorNeedsPhysical &&
+   if (pI830->StolenOnly && pI830->CursorNeedsPhysical &&
 	      !pI830->SWCursor) {
       xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
 		 "HW Cursor disabled because it needs agpgart memory.\n");
@@ -2105,11 +2043,6 @@ i830_stop_ring(ScrnInfoPtr pScrn, Bool flush)
 
    DPRINTF(PFX, "ResetState: flush is %s\n", BOOLTOSTRING(flush));
 
-   if (!I830IsPrimary(pScrn)) return;
-
-   if (pI830->entityPrivate)
-      pI830->entityPrivate->RingRunning = 0;
-
    /* Flush the ring buffer (if enabled), then disable it. */
    if (pI830->accel != ACCEL_NONE) {
       temp = INREG(LP_RING + RING_LEN);
@@ -2136,31 +2069,26 @@ i830_start_ring(ScrnInfoPtr pScrn)
    if (pI830->accel == ACCEL_NONE)
       return;
 
-   if (!I830IsPrimary(pScrn)) return;
-
-   if (pI830->entityPrivate)
-      pI830->entityPrivate->RingRunning = 1;
-
    OUTREG(LP_RING + RING_LEN, 0);
    OUTREG(LP_RING + RING_TAIL, 0);
    OUTREG(LP_RING + RING_HEAD, 0);
 
-   assert((pI830->LpRing->mem->offset & I830_RING_START_MASK) ==
-	   pI830->LpRing->mem->offset);
+   assert((pI830->ring.mem->offset & I830_RING_START_MASK) ==
+	   pI830->ring.mem->offset);
 
    /* Don't care about the old value.  Reserved bits must be zero anyway. */
-   itemp = pI830->LpRing->mem->offset;
+   itemp = pI830->ring.mem->offset;
    OUTREG(LP_RING + RING_START, itemp);
 
-   if (((pI830->LpRing->mem->size - 4096) & I830_RING_NR_PAGES) !=
-       pI830->LpRing->mem->size - 4096) {
+   if (((pI830->ring.mem->size - 4096) & I830_RING_NR_PAGES) !=
+       pI830->ring.mem->size - 4096) {
       xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 		 "I830SetRingRegs: Ring buffer size - 4096 (%lx) violates its "
-		 "mask (%x)\n", pI830->LpRing->mem->size - 4096,
+		 "mask (%x)\n", pI830->ring.mem->size - 4096,
 		 I830_RING_NR_PAGES);
    }
    /* Don't care about the old value.  Reserved bits must be zero anyway. */
-   itemp = (pI830->LpRing->mem->size - 4096) & I830_RING_NR_PAGES;
+   itemp = (pI830->ring.mem->size - 4096) & I830_RING_NR_PAGES;
    itemp |= (RING_NO_REPORT | RING_VALID);
    OUTREG(LP_RING + RING_LEN, itemp);
    i830_refresh_ring(pScrn);
@@ -2174,14 +2102,14 @@ i830_refresh_ring(ScrnInfoPtr pScrn)
    /* If we're reaching RefreshRing as a result of grabbing the DRI lock
     * before we've set up the ringbuffer, don't bother.
     */
-   if (pI830->LpRing->mem == NULL)
+   if (pI830->ring.mem == NULL)
        return;
 
-   pI830->LpRing->head = INREG(LP_RING + RING_HEAD) & I830_HEAD_MASK;
-   pI830->LpRing->tail = INREG(LP_RING + RING_TAIL);
-   pI830->LpRing->space = pI830->LpRing->head - (pI830->LpRing->tail + 8);
-   if (pI830->LpRing->space < 0)
-      pI830->LpRing->space += pI830->LpRing->mem->size;
+   pI830->ring.head = INREG(LP_RING + RING_HEAD) & I830_HEAD_MASK;
+   pI830->ring.tail = INREG(LP_RING + RING_TAIL);
+   pI830->ring.space = pI830->ring.head - (pI830->ring.tail + 8);
+   if (pI830->ring.space < 0)
+      pI830->ring.space += pI830->ring.mem->size;
    i830MarkSync(pScrn);
 }
 
@@ -2697,7 +2625,7 @@ IntelEmitInvarientState(ScrnInfoPtr pScrn)
    /* If we've emitted our state since the last clobber by another client,
     * skip it.
     */
-   if (*pI830->last_3d != LAST_3D_OTHER)
+   if (pI830->last_3d != LAST_3D_OTHER)
       return;
 
    if (!IS_I965G(pI830))
@@ -3053,7 +2981,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
    vgaHWPtr hwp = NULL;
    I830Ptr pI830;
    VisualPtr visual;
-   I830Ptr pI8301 = NULL;
    MessageType from;
 
    pScrn = xf86Screens[pScreen->myNum];
@@ -3171,31 +3098,8 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
    xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Tiling %sabled\n", pI830->tiling ?
 	      "en" : "dis");
 
-   if (I830IsPrimary(pScrn)) {
-      /* Alloc our pointers for the primary head */
-      if (!pI830->LpRing)
-         pI830->LpRing = xcalloc(1, sizeof(I830RingBuffer));
-      if (!pI830->overlayOn)
-         pI830->overlayOn = xalloc(sizeof(Bool));
-      if (!pI830->last_3d)
-         pI830->last_3d = xalloc(sizeof(enum last_3d));
-      if (!pI830->LpRing || !pI830->overlayOn || !pI830->last_3d) {
-         xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		 "Could not allocate primary data structures.\n");
-         return FALSE;
-      }
-      *pI830->last_3d = LAST_3D_OTHER;
-      *pI830->overlayOn = FALSE;
-      if (pI830->entityPrivate)
-         pI830->entityPrivate->XvInUse = -1;
-   } else {
-      /* Make our second head point to the first heads structures */
-      pI8301 = I830PTR(pI830->entityPrivate->pScrn_1);
-      pI830->LpRing = pI8301->LpRing;
-      pI830->overlay_regs = pI8301->overlay_regs;
-      pI830->overlayOn = pI8301->overlayOn;
-      pI830->last_3d = pI8301->last_3d;
-   }
+   pI830->last_3d = LAST_3D_OTHER;
+   pI830->overlayOn = FALSE;
 
 #ifdef I830_XV
     /*
@@ -3233,12 +3137,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 #ifdef I830_XV
    pI830->XvEnabled = !pI830->XvDisabled;
    if (pI830->XvEnabled) {
-      if (!I830IsPrimary(pScrn)) {
-         if (!pI8301->XvEnabled || pI830->accel == ACCEL_NONE) {
-            pI830->XvEnabled = FALSE;
-	    xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Xv is disabled.\n");
-         }
-      } else
       if (pI830->accel == ACCEL_NONE || pI830->StolenOnly) {
 	 xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Xv is disabled because it "
 		    "needs 2D accel and AGPGART.\n");
@@ -3250,7 +3148,7 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 #endif
 
    if (pI830->accel != ACCEL_NONE && !pI830->use_drm_mode) {
-      if (pI830->memory_manager == NULL && pI830->LpRing->mem->size == 0) {
+      if (pI830->memory_manager == NULL && pI830->ring.mem->size == 0) {
 	  xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
 		     "Disabling acceleration because the ring buffer "
 		      "allocation failed.\n");
@@ -3283,7 +3181,7 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
     * InitGLXVisuals call back.
     */
    if (pI830->directRenderingType == DRI_XF86DRI) {
-      if (pI830->accel == ACCEL_NONE || pI830->SWCursor || (pI830->StolenOnly && I830IsPrimary(pScrn))) {
+      if (pI830->accel == ACCEL_NONE || pI830->SWCursor || pI830->StolenOnly) {
 	 xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "DRI is disabled because it "
 		    "needs HW cursor, 2D accel and AGPGART.\n");
 	 pI830->directRenderingType = DRI_NONE;
@@ -3303,11 +3201,7 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
        I830SwapPipes(pScrn);
 #endif
 
-   if (I830IsPrimary(pScrn)) {
-        pScrn->fbOffset = pI830->front_buffer->offset;
-   } else {
-       pScrn->fbOffset = pI8301->front_buffer_2->offset;
-   }
+   pScrn->fbOffset = pI830->front_buffer->offset;
 
    pI830->xoffset = (pScrn->fbOffset / pI830->cpp) % pScrn->displayWidth;
    pI830->yoffset = (pScrn->fbOffset / pI830->cpp) / pScrn->displayWidth;
@@ -3323,16 +3217,9 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
    DPRINTF(PFX, "assert( if(!I830EnterVT(scrnIndex, 0)) )\n");
 
    if (pI830->accel <= ACCEL_XAA) {
-      if (I830IsPrimary(pScrn)) {
-	 if (!I830InitFBManager(pScreen, &(pI830->FbMemBox))) {
-	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		       "Failed to init memory manager\n");
-	 }
-      } else {
-	 if (!I830InitFBManager(pScreen, &(pI8301->FbMemBox2))) {
-	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		       "Failed to init memory manager\n");
-	 }
+      if (!I830InitFBManager(pScreen, &(pI830->FbMemBox))) {
+	 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+		    "Failed to init memory manager\n");
       }
    }
 
@@ -3551,13 +3438,6 @@ I830LeaveVT(int scrnIndex, int flags)
 
    i830SetHotkeyControl(pScrn, HOTKEY_BIOS_SWITCH);
 
-   if (!I830IsPrimary(pScrn)) {
-   	I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1);
-	if (!pI8301->gtt_acquired) {
-		return;
-	}
-   }
-
 #ifdef XF86DRI
    if (pI830->directRenderingOpen &&
        pI830->directRenderingType == DRI_XF86DRI) {
@@ -3608,8 +3488,7 @@ I830LeaveVT(int scrnIndex, int flags)
 
    intel_batch_teardown(pScrn);
 
-   if (I830IsPrimary(pScrn))
-      i830_unbind_all_memory(pScrn);
+   i830_unbind_all_memory(pScrn);
 
 #ifdef XF86DRI
    if (pI830->memory_manager && !pI830->use_drm_mode) {
@@ -3670,9 +3549,8 @@ I830EnterVT(int scrnIndex, int flags)
    }
 #endif /* XF86DRI */
 
-   if (I830IsPrimary(pScrn))
-      if (!i830_bind_all_memory(pScrn))
-         return FALSE;
+   if (!i830_bind_all_memory(pScrn))
+      return FALSE;
 
    i830_describe_allocations(pScrn, 1, "");
 
@@ -3779,7 +3657,7 @@ I830EnterVT(int scrnIndex, int flags)
    i830SetHotkeyControl(pScrn, HOTKEY_DRIVER_NOTIFY);
 
    /* Mark 3D state as being clobbered and setup the basics */
-   *pI830->last_3d = LAST_3D_OTHER;
+   pI830->last_3d = LAST_3D_OTHER;
    IntelEmitInvarientState(pScrn);
 
    return TRUE;
@@ -3871,16 +3749,7 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
    }
 #endif
 
-   if (I830IsPrimary(pScrn)) {
-      xf86GARTCloseScreen(scrnIndex);
-
-      xfree(pI830->LpRing);
-      pI830->LpRing = NULL;
-      xfree(pI830->overlayOn);
-      pI830->overlayOn = NULL;
-      xfree(pI830->last_3d);
-      pI830->last_3d = NULL;
-   }
+   xf86GARTCloseScreen(scrnIndex);
 
    pScrn->PointerMoved = pI830->PointerMoved;
    pScrn->vtSema = FALSE;
@@ -3958,9 +3827,6 @@ I830PMEvent(int scrnIndex, pmEvent event, Bool undo)
       break;
    /* This is currently used for ACPI */
    case XF86_APM_CAPABILITY_CHANGED:
-      if (!I830IsPrimary(pScrn))
-         return TRUE;
-
       ErrorF("I830PMEvent: Capability change\n");
 
       SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset);
diff --git a/src/i830_memory.c b/src/i830_memory.c
index 62765d6..96f4008 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -377,9 +377,7 @@ i830_reset_allocations(ScrnInfoPtr pScrn)
 	pI830->cursor_mem_argb[p] = NULL;
     }
     pI830->front_buffer = NULL;
-    pI830->front_buffer_2 = NULL;
     pI830->xaa_scratch = NULL;
-    pI830->xaa_scratch_2 = NULL;
     pI830->exa_offscreen = NULL;
     pI830->overlay_regs = NULL;
     pI830->power_context = NULL;
@@ -388,7 +386,7 @@ i830_reset_allocations(ScrnInfoPtr pScrn)
     pI830->depth_buffer = NULL;
     pI830->textures = NULL;
 #endif
-    pI830->LpRing->mem = NULL;
+    pI830->ring.mem = NULL;
     pI830->fake_bufmgr_mem = NULL;
 }
 
@@ -1054,23 +1052,23 @@ i830_allocate_ringbuffer(ScrnInfoPtr pScrn)
 {
     I830Ptr pI830 = I830PTR(pScrn);
 
-    if (pI830->accel == ACCEL_NONE || pI830->memory_manager || pI830->LpRing->mem != NULL)
+    if (pI830->accel == ACCEL_NONE || pI830->memory_manager || pI830->ring.mem != NULL)
 	return TRUE;
 
     /* We don't have any mechanism in the DRM yet to alert it that we've moved
      * the ringbuffer since init time, so allocate it fixed for its lifetime.
      */
-    pI830->LpRing->mem = i830_allocate_memory(pScrn, "ring buffer",
-					      PRIMARY_RINGBUFFER_SIZE, PITCH_NONE,
-					      GTT_PAGE_SIZE,
-					      NEED_LIFETIME_FIXED, TILE_NONE);
-    if (pI830->LpRing->mem == NULL) {
+    pI830->ring.mem = i830_allocate_memory(pScrn, "ring buffer",
+					   PRIMARY_RINGBUFFER_SIZE, PITCH_NONE,
+					   GTT_PAGE_SIZE,
+					   NEED_LIFETIME_FIXED, TILE_NONE);
+    if (pI830->ring.mem == NULL) {
 	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 		   "Failed to allocate Ring Buffer space\n");
 	return FALSE;
     }
 
-    pI830->LpRing->tail_mask = pI830->LpRing->mem->size - 1;
+    pI830->ring.tail_mask = pI830->ring.mem->size - 1;
     return TRUE;
 }
 
@@ -1473,20 +1471,10 @@ i830_allocate_2d_memory(ScrnInfoPtr pScrn)
     /* Allocate overlay register space and optional XAA linear allocator
      * space.  The second head in zaphod mode will share the space.
      */
-    if (I830IsPrimary(pScrn) && !pI830->use_drm_mode)
+    if (!pI830->use_drm_mode)
 	i830_allocate_overlay(pScrn);
 #endif
 
-    if (pI830->entityPrivate && pI830->entityPrivate->pScrn_2) {
-	I830EntPtr pI830Ent = pI830->entityPrivate;
-	I830Ptr pI8302 = I830PTR(pI830Ent->pScrn_2);
-
-	pI830->front_buffer_2 =
-	    i830_allocate_framebuffer(pI830Ent->pScrn_2, pI8302,
-				      &pI830->FbMemBox2, TRUE);
-	if (pI830->front_buffer_2 == NULL)
-	    return FALSE;
-    }
     pI830->front_buffer =
 	i830_allocate_framebuffer(pScrn, pI830, &pI830->FbMemBox, FALSE);
     if (pI830->front_buffer == NULL)
@@ -1543,30 +1531,6 @@ i830_allocate_2d_memory(ScrnInfoPtr pScrn)
 		return FALSE;
 	    }
 	}
-
-	/* Let's allocate another scratch buffer for the second head */
-	/* Again, this code won't execute on the dry run pass */
-	if (pI830->entityPrivate && pI830->entityPrivate->pScrn_2)
-	{
-	    pI830->xaa_scratch_2 =
-		i830_allocate_memory(pScrn, "xaa scratch 2",
-				     MAX_SCRATCH_BUFFER_SIZE, PITCH_NONE,
-				     GTT_PAGE_SIZE, NEED_LIFETIME_FIXED,
-				     TILE_NONE);
-	    if (pI830->xaa_scratch_2 == NULL) {
-		pI830->xaa_scratch_2 =
-		    i830_allocate_memory(pScrn, "xaa scratch 2",
-					 MIN_SCRATCH_BUFFER_SIZE, PITCH_NONE,
-					 GTT_PAGE_SIZE, NEED_LIFETIME_FIXED,
-					 TILE_NONE);
-		if (pI830->xaa_scratch_2 == NULL) {
-		    xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-			       "Failed to allocate secondary scratch "
-			       "buffer space\n");
-		    return FALSE;
-		}
-	    }
-	}
     }
 
     return TRUE;
diff --git a/src/i830_render.c b/src/i830_render.c
index d3b0f7c..5696fa3 100644
--- a/src/i830_render.c
+++ b/src/i830_render.c
@@ -404,7 +404,7 @@ i830_prepare_composite(int op, PicturePtr pSrcPicture,
     i830_exa_check_pitch_3d(pDst);
 
     IntelEmitInvarientState(pScrn);
-    *pI830->last_3d = LAST_3D_RENDER;
+    pI830->last_3d = LAST_3D_RENDER;
 
     if (!i830_get_dest_format(pDstPicture, &dst_format))
 	return FALSE;
diff --git a/src/i830_ring.h b/src/i830_ring.h
index c296d41..062b7ea 100644
--- a/src/i830_ring.h
+++ b/src/i830_ring.h
@@ -34,12 +34,12 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     if (I810_DEBUG & DEBUG_VERBOSE_RING)				\
 	ErrorF("OUT_RING 0x%08x: 0x%08x, (mask %x)\n",			\
 	       pI830->ring_next, (unsigned int)(n),			\
-	       pI830->LpRing->tail_mask);				\
-    *(volatile uint32_t *)(pI830->LpRing->virtual_start +		\
+	       pI830->ring.tail_mask);					\
+    *(volatile uint32_t *)(pI830->ring.virtual_start +			\
 			   pI830->ring_next) = n;			\
     pI830->ring_used += 4;						\
     pI830->ring_next += 4;						\
-    pI830->ring_next &= pI830->LpRing->tail_mask;			\
+    pI830->ring_next &= pI830->ring.tail_mask;				\
 } while (0)
 
 #define OUT_RING_F(x) do {			\
@@ -60,8 +60,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 	FatalError("%s: ADVANCE_LP_RING: under-used allocation %d/%d\n ", \
 		   __FUNCTION__, pI830->ring_used,			\
 		   pI830->ring_emitting);				\
-    pI830->LpRing->tail = pI830->ring_next;				\
-    pI830->LpRing->space -= pI830->ring_used;				\
+    pI830->ring.tail = pI830->ring_next;				\
+    pI830->ring.space -= pI830->ring_used;				\
     if (pI830->ring_next & 0x07)					\
 	FatalError("%s: ADVANCE_LP_RING: "				\
 		   "ring_next (0x%x) isn't on a QWord boundary\n",	\
@@ -80,9 +80,9 @@ do {									\
     pI830->ring_emitting = (n) * 4;					\
     if ((n) & 1)							\
 	pI830->ring_emitting += 4;					\
-    if (pI830->LpRing->space < pI830->ring_emitting)			\
+    if (pI830->ring.space < pI830->ring_emitting)			\
 	WaitRingFunc(pScrn, pI830->ring_emitting, 0);			\
-    pI830->ring_next = pI830->LpRing->tail;				\
+    pI830->ring_next = pI830->ring.tail;				\
     if (I810_DEBUG & DEBUG_VERBOSE_RING)				\
 	ErrorF( "BEGIN_LP_RING %d in %s\n", n, FUNCTION_NAME);		\
     pI830->ring_used = 0;						\
diff --git a/src/i830_video.c b/src/i830_video.c
index cdb1072..7967f99 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -446,7 +446,7 @@ i830_overlay_on(ScrnInfoPtr pScrn)
     I830PortPrivPtr	pPriv = pI830->adaptor->pPortPrivates[0].ptr;
     Bool		deactivate = FALSE;
     
-    if (*pI830->overlayOn)
+    if (pI830->overlayOn)
 	return;
 
     /*
@@ -480,7 +480,7 @@ i830_overlay_on(ScrnInfoPtr pScrn)
 	i830_pipe_a_require_deactivate (pScrn);
 
     OVERLAY_DEBUG("overlay_on\n");
-    *pI830->overlayOn = TRUE;
+    pI830->overlayOn = TRUE;
 
     overlay->OCMD |= OVERLAY_ENABLE;
 }
@@ -492,7 +492,7 @@ i830_overlay_continue(ScrnInfoPtr pScrn, Bool update_filter)
     uint32_t		flip_addr;
     I830OverlayRegPtr	overlay = I830OVERLAYREG(pI830);
 
-    if (!*pI830->overlayOn)
+    if (!pI830->overlayOn)
 	return;
 
     if (OVERLAY_NOPHYSICAL(pI830))
@@ -518,7 +518,7 @@ i830_overlay_off(ScrnInfoPtr pScrn)
     I830Ptr pI830 = I830PTR(pScrn);
     I830OverlayRegPtr	overlay = I830OVERLAYREG(pI830);
 
-    if (!*pI830->overlayOn)
+    if (!pI830->overlayOn)
 	return;
 
     /*
@@ -556,7 +556,7 @@ i830_overlay_off(ScrnInfoPtr pScrn)
 	ADVANCE_BATCH();
 	i830WaitSync(pScrn);
     }
-    *pI830->overlayOn = FALSE;
+    pI830->overlayOn = FALSE;
     OVERLAY_DEBUG("overlay_off\n");
 }
 
@@ -1063,7 +1063,6 @@ static void
 I830StopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown)
 {
     I830PortPrivPtr pPriv = (I830PortPrivPtr) data;
-    I830Ptr pI830 = I830PTR(pScrn);
 
     if (pPriv->textured)
 	return;
@@ -1075,8 +1074,6 @@ I830StopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown)
     if (shutdown) {
 	if (pPriv->videoStatus & CLIENT_VIDEO_ON) {
 	    i830_overlay_off(pScrn);
-	    if (pI830->entityPrivate)
-		pI830->entityPrivate->XvInUse = -1;
 	}
 	if (!pPriv->textured)
 	    drm_intel_bo_unpin(pPriv->buf);
@@ -1186,7 +1183,7 @@ I830SetPortAttribute(ScrnInfoPtr pScrn,
 	if ((value < 0) || (value > 1))
 	    return BadValue;
 	/* Do not allow buffer change while playing video */
-	if(!*pI830->overlayOn)
+	if(!pI830->overlayOn)
 	    pPriv->doubleBuffer = value;
     } else
 	return BadMatch;
@@ -2264,22 +2261,6 @@ I830PutImage(ScrnInfoPtr pScrn,
 	   drw_w, drw_h, width, height);
 #endif
 
-    if (pI830->entityPrivate) {
-	if (pI830->entityPrivate->XvInUse != -1 &&
-	    pI830->entityPrivate->XvInUse != i830_crtc_pipe (pPriv->current_crtc)) {
-#ifdef PANORAMIX
-	    if (!noPanoramiXExtension) {
-		return Success; /* faked for trying to share it */
-	    } else
-#endif
-	    {
-		return BadAlloc;
-	    }
-	}
-
-	pI830->entityPrivate->XvInUse = i830_crtc_pipe (pPriv->current_crtc);;
-    }
-
     if (!pPriv->textured) {
         /* If dst width and height are less than 1/8th the src size, the
          * src/dst scale factor becomes larger than 8 and doesn't fit in
@@ -2471,7 +2452,7 @@ I830PutImage(ScrnInfoPtr pScrn,
 #endif
 
     /* Pick the idle buffer */
-    if (!pPriv->textured && *pI830->overlayOn && pPriv->doubleBuffer)
+    if (!pPriv->textured && pI830->overlayOn && pPriv->doubleBuffer)
 	pPriv->currentBuf = !((INREG(DOVSTA) & OC_BUF) >> 20);
 
     /* copy data */
@@ -2699,9 +2680,6 @@ I830VideoBlockHandler(int i, pointer blockData, pointer pTimeout,
 
 		pPriv->videoStatus = FREE_TIMER;
 		pPriv->freeTime = now + FREE_DELAY;
-
-		if (pI830->entityPrivate)
-		    pI830->entityPrivate->XvInUse = -1;
 	    }
 	} else {				/* FREE_TIMER */
 	    if (pPriv->freeTime < now) {
@@ -2785,15 +2763,10 @@ I830StopSurface(XF86SurfacePtr surface)
     ScrnInfoPtr pScrn = surface->pScrn;
 
     if (pPriv->isOn) {
-	I830Ptr pI830 = I830PTR(pScrn);
-
 	OVERLAY_DEBUG("StopSurface\n");
 
 	i830_overlay_off (pScrn);
 
-	if (pI830->entityPrivate)
-	    pI830->entityPrivate->XvInUse = -1;
-
 	pPriv->isOn = FALSE;
     }
 
@@ -2841,22 +2814,6 @@ I830DisplaySurface(XF86SurfacePtr surface,
 
     OVERLAY_DEBUG("I830DisplaySurface\n");
 
-    if (pI830->entityPrivate) {
-	if (pI830->entityPrivate->XvInUse != -1 &&
-	    pI830->entityPrivate->XvInUse != i830_crtc_pipe (pI830Priv->current_crtc)) {
-#ifdef PANORAMIX
-	    if (!noPanoramiXExtension) {
-		return Success; /* faked for trying to share it */
-	    } else
-#endif
-	    {
-		return BadAlloc;
-	    }
-	}
-
-	pI830->entityPrivate->XvInUse = i830_crtc_pipe (pI830Priv->current_crtc);
-    }
-
     x1 = src_x;
     x2 = src_x + src_w;
     y1 = src_y;
@@ -2877,7 +2834,7 @@ I830DisplaySurface(XF86SurfacePtr surface,
     pI830Priv->YBuf1offset = pI830Priv->YBuf0offset;
 
     /* Pick the idle buffer */
-    if (!pI830Priv->textured && *pI830->overlayOn && pI830Priv->doubleBuffer) 
+    if (!pI830Priv->textured && pI830->overlayOn && pI830Priv->doubleBuffer)
 	pI830Priv->currentBuf = !((INREG(DOVSTA) & OC_BUF) >> 20);
 
     i830_display_video(pScrn, crtc, surface->id, surface->width, surface->height,
diff --git a/src/i830_xaa.c b/src/i830_xaa.c
index 7684978..1f82840 100644
--- a/src/i830_xaa.c
+++ b/src/i830_xaa.c
@@ -91,7 +91,6 @@ static void I830SubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn,
 						 int skipleft);
 static void I830SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno);
 #endif
-static void I830RestoreAccelState(ScrnInfoPtr pScrn);
 
 void
 i830_xaa_composite(CARD8	op,
@@ -160,23 +159,10 @@ I830XAAInit(ScreenPtr pScreen)
 
     }
 
-    /* On the primary screen */
-    if (pI830->init == 0) {
-	if (pI830->xaa_scratch->size != 0) {
-	    width = ((pScrn->displayWidth + 31) & ~31) / 8;
-	    nr_buffers = pI830->xaa_scratch->size / width;
-	    ptr = pI830->FbBase + pI830->xaa_scratch->offset;
-	}
-    } else {
-	/* On the secondary screen */
-	I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1);
-	if (pI8301->xaa_scratch_2->size != 0) {
-	    width = ((pScrn->displayWidth + 31) & ~31) / 8;
-	    nr_buffers = pI8301->xaa_scratch_2->size / width;
-	    /* We have to use the primary screen's FbBase, as that's where
-	     * we allocated xaa_scratch_2, so we get the correct pointer */
-	    ptr = pI8301->FbBase + pI8301->xaa_scratch_2->offset;
-	}
+    if (pI830->xaa_scratch->size != 0) {
+	width = ((pScrn->displayWidth + 31) & ~31) / 8;
+	nr_buffers = pI830->xaa_scratch->size / width;
+	ptr = pI830->FbBase + pI830->xaa_scratch->offset;
     }
 
     if (nr_buffers) {
@@ -223,17 +209,6 @@ I830XAAInit(ScreenPtr pScreen)
 #endif
     }
 
-    {
-	Bool shared_accel = FALSE;
-
-	for(i = 0; i < pScrn->numEntities; i++) {
-	    if(xf86IsEntityShared(pScrn->entityList[i]))
-		shared_accel = TRUE;
-	}
-	if(shared_accel == TRUE)
-	    infoPtr->RestoreAccelState = I830RestoreAccelState;
-    }
-
     /* Set up pI830->bufferOffset */
     I830SelectBuffer(pScrn, I830_SELECT_FRONT);
 
@@ -607,17 +582,8 @@ I830SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
     I830Ptr pI830 = I830PTR(pScrn);
     unsigned int tiled = I830CheckTiling(pScrn);
 
-    if (pI830->init == 0) {
-	pI830->BR[12] = (pI830->AccelInfoRec->ScanlineColorExpandBuffers[0] -
-			 pI830->FbBase);
-    } else {
-	I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1);
-
-	/* We have to use the primary screen's FbBase, as that's where
-	 * we allocated xaa_scratch_2, so we get the correct pointer */
-	pI830->BR[12] = (pI830->AccelInfoRec->ScanlineColorExpandBuffers[0] -
-			 pI8301->FbBase);
-    }
+    pI830->BR[12] = (pI830->AccelInfoRec->ScanlineColorExpandBuffers[0] -
+		     pI830->FbBase);
 
     if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
 	ErrorF("I830SubsequentColorExpandScanline %d (addr %x)\n",
@@ -707,17 +673,8 @@ I830SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno)
     I830Ptr pI830 = I830PTR(pScrn);
     unsigned int tiled = I830CheckTiling(pScrn);
 
-    if (pI830->init == 0) {
-	pI830->BR[12] = (pI830->AccelInfoRec->ScanlineColorExpandBuffers[0] -
-			 pI830->FbBase);
-    } else {
-	I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1);
-
-	/* We have to use the primary screen's FbBase, as that's where
-	 * we allocated xaa_scratch_2, so we get the correct pointer */
-	pI830->BR[12] = (pI830->AccelInfoRec->ScanlineColorExpandBuffers[0] -
-			 pI8301->FbBase);
-    }
+    pI830->BR[12] = (pI830->AccelInfoRec->ScanlineColorExpandBuffers[0] -
+		     pI830->FbBase);
 
     if (I810_DEBUG & DEBUG_VERBOSE_ACCEL)
 	ErrorF("I830SubsequentImageWriteScanline %d (addr %x)\n",
@@ -870,13 +827,3 @@ fallback:
     pI830->saved_composite = ps->Composite;
     ps->Composite = i830_xaa_composite;
 }
-
-static void
-I830RestoreAccelState(ScrnInfoPtr pScrn)
-{
-#if 0
-   /* might be needed, but everything is on a ring, so I don't think so */
-   I830Sync(pScrn);
-#endif
-}
-
diff --git a/src/i915_render.c b/src/i915_render.c
index 4190808..268dd8a 100644
--- a/src/i915_render.c
+++ b/src/i915_render.c
@@ -383,7 +383,7 @@ i915_emit_composite_setup(ScrnInfoPtr pScrn)
     pI830->i915_render_state.needs_emit = FALSE;
 
     IntelEmitInvarientState(pScrn);
-    *pI830->last_3d = LAST_3D_RENDER;
+    pI830->last_3d = LAST_3D_RENDER;
 
     dst_pitch = intel_get_pixmap_pitch(pDst);
 
diff --git a/src/i915_video.c b/src/i915_video.c
index 81a0f87..93e0c86 100644
--- a/src/i915_video.c
+++ b/src/i915_video.c
@@ -76,7 +76,7 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
    intel_batch_start_atomic(pScrn, 200 + 20 * nbox);
 
    IntelEmitInvarientState(pScrn);
-   *pI830->last_3d = LAST_3D_VIDEO;
+   pI830->last_3d = LAST_3D_VIDEO;
 
    BEGIN_BATCH(20);
 
diff --git a/src/i965_render.c b/src/i965_render.c
index de1c8b3..77428f9 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -1012,7 +1012,7 @@ i965_emit_composite_state(ScrnInfoPtr pScrn)
     render_state->needs_state_emit = FALSE;
 
     IntelEmitInvarientState(pScrn);
-    *pI830->last_3d = LAST_3D_RENDER;
+    pI830->last_3d = LAST_3D_RENDER;
 
     urb_vs_start = 0;
     urb_vs_size = URB_VS_ENTRIES * URB_VS_ENTRY_SIZE;
diff --git a/src/i965_video.c b/src/i965_video.c
index 0fc9c42..f6020d4 100644
--- a/src/i965_video.c
+++ b/src/i965_video.c
@@ -718,7 +718,7 @@ i965_emit_video_setup(ScrnInfoPtr pScrn, drm_intel_bo *bind_bo, int n_src_surf)
     int urb_cs_start, urb_cs_size;
 
     IntelEmitInvarientState(pScrn);
-    *pI830->last_3d = LAST_3D_VIDEO;
+    pI830->last_3d = LAST_3D_VIDEO;
 
     urb_vs_start = 0;
     urb_vs_size = URB_VS_ENTRIES * URB_VS_ENTRY_SIZE;
-- 
1.5.6.5




More information about the Intel-gfx mailing list