[Intel-gfx] [PATCH 1/7] Remove NoAccel support

Keith Packard keithp at keithp.com
Sat Jul 11 02:14:54 CEST 2009


This removes yet another 'debugging' option that hasn't seen real use in a
long time, and wasn't supported under KMS in any case.

Signed-off-by: Keith Packard <keithp at keithp.com>
---
 src/drmmode_display.c |   16 ++++--
 src/i830.h            |   15 +----
 src/i830_accel.c      |   11 +---
 src/i830_dri.c        |    5 --
 src/i830_driver.c     |  142 +++++++-----------------------------------------
 src/i830_memory.c     |   22 ++++----
 src/i830_uxa.c        |   27 +++-------
 7 files changed, 54 insertions(+), 184 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index e9296dc..7cfdc5b 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -329,8 +329,6 @@ drmmode_crtc_shadow_allocate(xf86CrtcPtr crtc, int width, int height)
 		return NULL;
 	}
 
-	drm_intel_gem_bo_map_gtt(drmmode_crtc->rotate_bo);
-
 	ret = drmModeAddFB(drmmode->fd, width, height, crtc->scrn->depth,
 			   crtc->scrn->bitsPerPixel, rotate_pitch,
 			   drmmode_crtc->rotate_bo->handle,
@@ -341,7 +339,7 @@ drmmode_crtc_shadow_allocate(xf86CrtcPtr crtc, int width, int height)
 		return NULL;
 	}
 
-	return drmmode_crtc->rotate_bo->virtual;
+	return drmmode_crtc->rotate_bo;
 }
 
 static PixmapPtr
@@ -353,8 +351,14 @@ drmmode_crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height)
 	unsigned long rotate_pitch;
 	PixmapPtr rotate_pixmap;
 
-	if (!data)
+	if (!data) {
 		data = drmmode_crtc_shadow_allocate (crtc, width, height);
+		if (!data) {
+			xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+				   "Couldn't allocate shadow pixmap for rotated CRTC\n");
+			return NULL;
+		}
+	}
 
 	rotate_pitch =
 		i830_pad_drawable_width(width, drmmode->cpp) * drmmode->cpp;
@@ -363,11 +367,12 @@ drmmode_crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height)
 					       pScrn->depth,
 					       pScrn->bitsPerPixel,
 					       rotate_pitch,
-					       data);
+					       NULL);
 
 	if (rotate_pixmap == NULL) {
 		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 			   "Couldn't allocate shadow pixmap for rotated CRTC\n");
+		return NULL;
 	}
 
 	if (drmmode_crtc->rotate_bo)
@@ -393,7 +398,6 @@ drmmode_crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *dat
 		 * unbound. */
 		drmModeRmFB(drmmode->fd, drmmode_crtc->rotate_fb_id);
 		drmmode_crtc->rotate_fb_id = 0;
-		drm_intel_gem_bo_unmap_gtt(drmmode_crtc->rotate_bo);
 		dri_bo_unreference(drmmode_crtc->rotate_bo);
 		drmmode_crtc->rotate_bo = NULL;
 	}
diff --git a/src/i830.h b/src/i830.h
index dc5e0c8..f7ca687 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -317,12 +317,6 @@ enum backlight_control {
     BCM_KERNEL,
 };
 
-typedef enum accel_method {
-    ACCEL_UNINIT = 0,
-    ACCEL_NONE,
-    ACCEL_UXA
-} accel_method_t;
-
 enum dri_type {
     DRI_DISABLED,
     DRI_NONE,
@@ -431,7 +425,6 @@ typedef struct _I830Rec {
 
    Bool fence_used[FENCE_NEW_NR];
 
-   accel_method_t accel;
    CloseScreenProcPtr CloseScreen;
 
    void (*batch_flush_notify)(ScrnInfoPtr pScrn);
@@ -827,8 +820,7 @@ i830_wait_ring_idle(ScrnInfoPtr pScrn)
 {
    I830Ptr pI830 = I830PTR(pScrn);
 
-   if (pI830->accel != ACCEL_NONE)
-       I830WaitLpRing(pScrn, pI830->ring.mem->size - 8, 0);
+   I830WaitLpRing(pScrn, pI830->ring.mem->size - 8, 0);
 }
 
 static inline int i830_fb_compression_supported(I830Ptr pI830)
@@ -841,10 +833,9 @@ static inline int i830_fb_compression_supported(I830Ptr pI830)
 	return FALSE;
     if (IS_IGDNG(pI830))
 	return FALSE;
-    /* fbc depends on tiled surface. And we don't support tiled
-     * front buffer with unaccelerated.
+    /* fbc depends on tiled surface.
      */
-    if (!pI830->tiling || (IS_I965G(pI830) && pI830->accel == ACCEL_NONE))
+    if (!pI830->tiling)
 	return FALSE;
     /* We have not gotten FBC to work consistently on 965GM. Our best
      * working theory right now is that FBC simply isn't reliable on
diff --git a/src/i830_accel.c b/src/i830_accel.c
index b365e3f..96a7bde 100644
--- a/src/i830_accel.c
+++ b/src/i830_accel.c
@@ -136,7 +136,7 @@ I830Sync(ScrnInfoPtr pScrn)
    if (I810_DEBUG & (DEBUG_VERBOSE_ACCEL | DEBUG_VERBOSE_SYNC))
       ErrorF("I830Sync\n");
 
-   if (pI830->accel == ACCEL_NONE || !pScrn->vtSema || !pI830->batch_bo)
+   if (!pScrn->vtSema || !pI830->batch_bo)
        return;
 
    I830EmitFlush(pScrn);
@@ -236,12 +236,5 @@ I830AccelInit(ScreenPtr pScreen)
     if (pI830->directRenderingType >= DRI_DRI2)
 	pI830->accel_pixmap_pitch_alignment = 512;
 
-    switch (pI830->accel) {
-    case ACCEL_UXA:
-	return i830_uxa_init(pScreen);
-    case ACCEL_UNINIT:
-    case ACCEL_NONE:
-	break;
-    }
-    return FALSE;
+    return i830_uxa_init(pScreen);
 }
diff --git a/src/i830_dri.c b/src/i830_dri.c
index 240c519..40d11e4 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -373,11 +373,6 @@ Bool I830DRI2ScreenInit(ScreenPtr pScreen)
     int dri2_minor = 0;
 #endif
 
-    if (pI830->accel != ACCEL_UXA) {
-	xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "DRI2 requires UXA\n");
-	return FALSE;
-    }
-
 #ifdef USE_DRI2_1_1_0
     if (xf86LoaderCheckSymbol("DRI2Version")) {
 	DRI2Version(& dri2_major, & dri2_minor);
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 257bd6c..cc0a1f6 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -598,49 +598,6 @@ I830LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
    }
 }
 
-static void
-i830_update_front_offset(ScrnInfoPtr pScrn)
-{
-   ScreenPtr pScreen = pScrn->pScreen;
-   I830Ptr pI830 = I830PTR(pScrn);
-   int pitch = pScrn->displayWidth * pI830->cpp;
-   pointer data = NULL;
-
-   /* Update buffer locations, which may have changed as a result of
-    * i830_bind_all_memory().
-    */
-   pScrn->fbOffset = pI830->front_buffer->offset;
-
-   if (pI830->starting || pI830->accel == ACCEL_UXA)
-       return;
-
-   /* If we are still in ScreenInit, there is no screen pixmap to be updated
-    * yet.  We'll fix it up at CreateScreenResources.
-    */
-   if (!pI830->have_gem) {
-       data = pI830->FbBase + pScrn->fbOffset; /* default to legacy */
-   } else {
-      dri_bo *bo = pI830->front_buffer->bo;
-
-      if (bo) {
-	  if (pI830->kernel_exec_fencing) {
-	      if (drm_intel_gem_bo_map_gtt(bo))
-		  xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "%s: bo map failed\n",
-			     __FUNCTION__);
-	      data = bo->virtual;
-	  } else {
-	      /* Will already be pinned by bind_all_memory in this case */
-	      drm_intel_gem_bo_start_gtt_access(bo, 1);
-	      data = pI830->FbBase + bo->offset;
-	  }
-      }
-   }
-   if (!pScreen->ModifyPixmapHeader(pScreen->GetScreenPixmap(pScreen),
-				       pScrn->virtualX, pScrn->virtualY, -1, -1,
-				       pitch, data))
-       FatalError("Couldn't adjust screen pixmap\n");
-}
-
 /**
  * Adjust the screen pixmap for the current location of the front buffer.
  * This is done at EnterVT when buffers are bound as long as the resources
@@ -657,10 +614,7 @@ i830CreateScreenResources(ScreenPtr pScreen)
    if (!(*pScreen->CreateScreenResources)(pScreen))
       return FALSE;
 
-   i830_update_front_offset(pScrn);
-
-   if (pI830->accel == ACCEL_UXA)
-      i830_uxa_create_screen_resources(pScreen);
+   i830_uxa_create_screen_resources(pScreen);
 
    return TRUE;
 }
@@ -1265,13 +1219,6 @@ i830_detect_chipset(ScrnInfoPtr pScrn)
     return TRUE;
 }
 
-static const char *accel_name[] = 
-{
-   "unspecified",
-   "no",
-   "UXA",
-};
-
 static Bool
 I830LoadSyms(ScrnInfoPtr pScrn)
 {
@@ -1358,26 +1305,13 @@ static Bool
 I830AccelMethodInit(ScrnInfoPtr pScrn)
 {
     I830Ptr pI830 = I830PTR(pScrn);
-    MessageType from = X_PROBED;
     int i, num_pipe;
 
-    if (xf86ReturnOptValBool(pI830->Options, OPTION_NOACCEL, FALSE)) {
-	pI830->accel = ACCEL_NONE;
-    } else {
-       pI830->accel = ACCEL_UXA;
-	xf86DrvMsg(pScrn->scrnIndex, from, "Using %s for acceleration\n",
-		   accel_name[pI830->accel]);
-    }
-
     pI830->directRenderingType = DRI_NONE;
     if (!xf86ReturnOptValBool(pI830->Options, OPTION_DRI, TRUE))
 	pI830->directRenderingType = DRI_DISABLED;
 
-    if (pI830->accel == ACCEL_NONE) {
-	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "DRI is disabled because it "
-		"needs 2D acceleration.\n");
-	pI830->directRenderingType = DRI_DISABLED;
-    } else if (pScrn->depth != 16 && pScrn->depth != 24) {
+    if (pScrn->depth != 16 && pScrn->depth != 24) {
 	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "DRI is disabled because it "
 		"runs only at depths 16 and 24.\n");
 	pI830->directRenderingType = DRI_DISABLED;
@@ -1501,8 +1435,6 @@ I830DrmModeInit(ScrnInfoPtr pScrn)
 {
     I830Ptr pI830 = I830PTR(pScrn);
 
-    pI830->accel = ACCEL_UXA;
-
     if (drmmode_pre_init(pScrn, pI830->drmSubFD, pI830->cpp) == FALSE) {
 	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 		   "Kernel modesetting setup failed\n");
@@ -1681,11 +1613,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
    }
    pScrn->currentMode = pScrn->modes;
 
-   if (!IS_I965G(pI830) && pScrn->virtualY > 2048) {
-      xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Cannot support > 2048 vertical lines. disabling acceleration.\n");
-      pI830->accel = ACCEL_NONE;
-   }
-
    /* Set display resolution */
    xf86SetDpi(pScrn, 0, 0);
 
@@ -1731,19 +1658,17 @@ i830_stop_ring(ScrnInfoPtr pScrn, Bool flush)
 
    DPRINTF(PFX, "ResetState: flush is %s\n", BOOLTOSTRING(flush));
 
-   /* Flush the ring buffer (if enabled), then disable it. */
-   if (pI830->accel != ACCEL_NONE) {
-      temp = INREG(LP_RING + RING_LEN);
-      if (temp & RING_VALID) {
-	 i830_refresh_ring(pScrn);
-	 i830_wait_ring_idle(pScrn);
-      }
-
-      OUTREG(LP_RING + RING_LEN, 0);
-      OUTREG(LP_RING + RING_HEAD, 0);
-      OUTREG(LP_RING + RING_TAIL, 0);
-      OUTREG(LP_RING + RING_START, 0);
+   /* Flush the ring buffer, then disable it. */
+   temp = INREG(LP_RING + RING_LEN);
+   if (temp & RING_VALID) {
+      i830_refresh_ring(pScrn);
+      i830_wait_ring_idle(pScrn);
    }
+
+   OUTREG(LP_RING + RING_LEN, 0);
+   OUTREG(LP_RING + RING_HEAD, 0);
+   OUTREG(LP_RING + RING_TAIL, 0);
+   OUTREG(LP_RING + RING_START, 0);
 }
 
 static void
@@ -1754,9 +1679,6 @@ i830_start_ring(ScrnInfoPtr pScrn)
 
    DPRINTF(PFX, "SetRingRegs\n");
 
-   if (pI830->accel == ACCEL_NONE)
-      return;
-
    OUTREG(LP_RING + RING_LEN, 0);
    OUTREG(LP_RING + RING_TAIL, 0);
    OUTREG(LP_RING + RING_HEAD, 0);
@@ -2253,9 +2175,6 @@ IntelEmitInvarientState(ScrnInfoPtr pScrn)
 {
    I830Ptr pI830 = I830PTR(pScrn);
 
-   if (pI830->accel == ACCEL_NONE)
-      return;
-
    /* If we've emitted our state since the last clobber by another client,
     * skip it.
     */
@@ -2286,13 +2205,13 @@ I830BlockHandler(int i,
     pI830->BlockHandler = pScreen->BlockHandler;
     pScreen->BlockHandler = I830BlockHandler;
 
-    if (pScrn->vtSema && pI830->accel != ACCEL_NONE) {
+    if (pScrn->vtSema) {
        Bool flushed = FALSE;
        /* Emit a flush of the rendering cache, or on the 965 and beyond
 	* rendering results may not hit the framebuffer until significantly
 	* later.
 	*/
-       if (pI830->accel != ACCEL_NONE && (pI830->need_mi_flush || pI830->batch_used))
+       if (pI830->need_mi_flush || pI830->batch_used)
        {
 	  flushed = TRUE;
 	  I830EmitFlush(pScrn);
@@ -2308,8 +2227,7 @@ I830BlockHandler(int i,
        pI830->need_mi_flush = FALSE;
     }
 
-    if (pI830->accel == ACCEL_UXA)
-	i830_uxa_block_handler (pScreen);
+    i830_uxa_block_handler (pScreen);
 
     I830VideoBlockHandler(i, blockData, pTimeout, pReadmask);
 }
@@ -2778,20 +2696,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
    if (!miSetPixmapDepths())
       return FALSE;
 
-   if (pI830->accel == ACCEL_NONE) {
-      xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Xv is disabled because it "
-		 "needs 2D acceleration.\n");
-      pI830->XvEnabled = FALSE;
-   }
-
-   if (pI830->accel != ACCEL_NONE && !pI830->use_drm_mode) {
-      if (!pI830->have_gem && pI830->ring.mem->size == 0) {
-	  xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-		     "Disabling acceleration because the ring buffer "
-		      "allocation failed.\n");
-	   pI830->accel = ACCEL_NONE;
-      }
-   }
    i830_init_bufmgr(pScrn);
 
    pScrn->fbOffset = pI830->front_buffer->offset;
@@ -2837,11 +2741,10 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 
    xf86DiDGAInit (pScreen, pI830->LinearAddr + pScrn->fbOffset);
 
-   if (pI830->accel != ACCEL_NONE) {
-      if (!I830AccelInit(pScreen)) {
-	 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		    "Hardware acceleration initialization failed\n");
-      }
+   if (!I830AccelInit(pScreen)) {
+      xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+		 "Hardware acceleration initialization failed\n");
+      return FALSE;
    }
 
    if (IS_I965G(pI830))
@@ -3036,7 +2939,7 @@ I830LeaveVT(int scrnIndex, int flags)
 	 FatalError("DRM_I915_LEAVEVT failed: %s\n", strerror(ret));
    }
 
-   if (pI830->accel == ACCEL_UXA && IS_I965G(pI830))
+   if (IS_I965G(pI830))
       gen4_render_state_cleanup(pScrn);
 
    ret = drmDropMaster(pI830->drmSubFD);
@@ -3121,12 +3024,9 @@ I830EnterVT(int scrnIndex, int flags)
 
    i830_describe_allocations(pScrn, 1, "");
 
-   /* Update the screen pixmap in case the buffer moved */
-   i830_update_front_offset(pScrn);
-
    intel_batch_init(pScrn);
 
-   if (pI830->accel == ACCEL_UXA && IS_I965G(pI830))
+   if (IS_I965G(pI830))
       gen4_render_state_init(pScrn);
 
    if (!pI830->use_drm_mode) {
diff --git a/src/i830_memory.c b/src/i830_memory.c
index 387e52b..2953f3b 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -445,15 +445,14 @@ i830_allocator_init(ScrnInfoPtr pScrn, unsigned long size)
 		struct drm_i915_gem_init init;
 		int ret;
 
-		if (pI830->accel == ACCEL_UXA) {
-		    sp.param = I915_SETPARAM_NUM_USED_FENCES;
-		    sp.value = 0; /* kernel gets them all */
-
-		    ret = drmCommandWrite(pI830->drmSubFD, DRM_I915_SETPARAM,
-					  &sp, sizeof(sp));
-		    if (ret == 0)
-			pI830->kernel_exec_fencing = TRUE;
-		}
+		sp.param = I915_SETPARAM_NUM_USED_FENCES;
+		sp.value = 0; /* kernel gets them all */
+
+		ret = drmCommandWrite(pI830->drmSubFD, DRM_I915_SETPARAM,
+				      &sp, sizeof(sp));
+		if (ret == 0)
+		    pI830->kernel_exec_fencing = TRUE;
+
 		init.gtt_start = pI830->memory_manager->offset;
 		init.gtt_end = pI830->memory_manager->offset +
 		    pI830->memory_manager->size;
@@ -954,7 +953,7 @@ i830_allocate_ringbuffer(ScrnInfoPtr pScrn)
 {
     I830Ptr pI830 = I830PTR(pScrn);
 
-    if (pI830->accel == ACCEL_NONE || pI830->memory_manager || pI830->ring.mem != NULL)
+    if (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
@@ -1264,7 +1263,8 @@ i830_allocate_2d_memory(ScrnInfoPtr pScrn)
 	}
 
 	/* Allocate the ring buffer first, so it ends up in stolen mem. */
-	i830_allocate_ringbuffer(pScrn);
+	if (!i830_allocate_ringbuffer(pScrn))
+	    return FALSE;
     }
 
     if (pI830->fb_compression)
diff --git a/src/i830_uxa.c b/src/i830_uxa.c
index ef7ac84..75142ed 100644
--- a/src/i830_uxa.c
+++ b/src/i830_uxa.c
@@ -452,30 +452,19 @@ i830_transform_is_affine (PictTransformPtr t)
 dri_bo *
 i830_get_pixmap_bo(PixmapPtr pixmap)
 {
-    ScreenPtr screen = pixmap->drawable.pScreen;
-    ScrnInfoPtr scrn = xf86Screens[screen->myNum];
-    I830Ptr i830 = I830PTR(scrn);
-
-    if (i830->accel == ACCEL_UXA)
-	return dixLookupPrivate(&pixmap->devPrivates, &uxa_pixmap_index);
-    else
-	return NULL;
+    return dixLookupPrivate(&pixmap->devPrivates, &uxa_pixmap_index);
 }
 
 void
 i830_set_pixmap_bo(PixmapPtr pixmap, dri_bo *bo)
 {
-    ScrnInfoPtr pScrn = xf86Screens[pixmap->drawable.pScreen->myNum];
-    I830Ptr i830 = I830PTR(pScrn);
     dri_bo  *old_bo = i830_get_pixmap_bo (pixmap);
 
     if (old_bo)
 	dri_bo_unreference (old_bo);
-    if (i830->accel == ACCEL_UXA) {
-	if (bo != NULL)
-	    dri_bo_reference(bo);
-	dixSetPrivate(&pixmap->devPrivates, &uxa_pixmap_index, bo);
-    }
+    if (bo != NULL)
+	dri_bo_reference(bo);
+    dixSetPrivate(&pixmap->devPrivates, &uxa_pixmap_index, bo);
 }
 
 static void
@@ -698,10 +687,9 @@ i830_uxa_init (ScreenPtr pScreen)
 	return FALSE;
 
     i830->uxa_driver = uxa_driver_alloc();
-    if (i830->uxa_driver == NULL) {
-	i830->accel = ACCEL_NONE;
+    if (i830->uxa_driver == NULL)
 	return FALSE;
-    }
+
     memset(i830->uxa_driver, 0, sizeof(*i830->uxa_driver));
 
     i830->bufferOffset = 0;
@@ -743,10 +731,9 @@ i830_uxa_init (ScreenPtr pScreen)
     i830->uxa_driver->pixmap_is_offscreen = i830_uxa_pixmap_is_offscreen;
 
     if(!uxa_driver_init(pScreen, i830->uxa_driver)) {
-	xf86DrvMsg(scrn->scrnIndex, X_INFO,
+	xf86DrvMsg(scrn->scrnIndex, X_ERROR,
 		   "UXA initialization failed\n");
 	xfree(i830->uxa_driver);
-	i830->accel = ACCEL_NONE;
 	return FALSE;
     }
 
-- 
1.6.3.3




More information about the Intel-gfx mailing list