[Intel-gfx] [PATCH] Fix directRenderingType check

Wang, Zhenyu Z zhenyu.z.wang at intel.com
Fri Dec 12 02:45:10 CET 2008


On 2008.12.11 10:46:55 -0800, Eric Anholt wrote:
> On Thu, 2008-12-11 at 17:02 +0800, Zhenyu Wang wrote:
> > Don't miss classic texture memory allocation in DRI.
> > ---
> >  src/i830_driver.c |   28 +++++++++++++---------------
> >  1 files changed, 13 insertions(+), 15 deletions(-)
> > 
> > diff --git a/src/i830_driver.c b/src/i830_driver.c
> > index 7590257..4ed20f1 100644
> > --- a/src/i830_driver.c
> > +++ b/src/i830_driver.c
> > @@ -1557,21 +1557,14 @@ I830AccelMethodInit(ScrnInfoPtr pScrn)
> >  	pI830->directRenderingType = DRI_DISABLED;
> >  
> >  #ifdef XF86DRI
> > -    if (pI830->directRenderingType == DRI_XF86DRI) {
> > -	if ((pI830->accel == ACCEL_NONE) || pI830->SWCursor) {
> > -	    xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "DRI is disabled because it "
> > -		       "needs HW cursor and 2D acceleration.\n");
> > -	    pI830->directRenderingType = DRI_DISABLED;
> > -	} else 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;
> > -	}
> > -
> > -	if (pI830->directRenderingType == DRI_XF86DRI) {
> > -	   pI830->allocate_classic_textures =
> > -	      xf86ReturnOptValBool(pI830->Options, OPTION_LEGACY3D, TRUE);
> > -	}
> > +    if ((pI830->accel == ACCEL_NONE) || pI830->SWCursor) {
> > +	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "DRI is disabled because it "
> > +		"needs HW cursor and 2D acceleration.\n");
> > +	pI830->directRenderingType = DRI_DISABLED;
> > +    } else 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;
> >      }
> 
> The swcursor bit certainly should stay under if == XF86DRI, as we no
> longer need hw cursor due to the client directly drawing to the
> framebuffer.
> 

ok, I was also not sure about sw cursor, just origin if == XF86DRI will
never be true, as we set DRI_NONE and only check enable/disable config.

How about this one? Also move the xvmc config check and fix log message.

diff --git a/src/i830_driver.c b/src/i830_driver.c
index 7590257..d3b539a 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1557,21 +1557,14 @@ I830AccelMethodInit(ScrnInfoPtr pScrn)
 	pI830->directRenderingType = DRI_DISABLED;
 
 #ifdef XF86DRI
-    if (pI830->directRenderingType == DRI_XF86DRI) {
-	if ((pI830->accel == ACCEL_NONE) || pI830->SWCursor) {
-	    xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "DRI is disabled because it "
-		       "needs HW cursor and 2D acceleration.\n");
-	    pI830->directRenderingType = DRI_DISABLED;
-	} else 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;
-	}
-
-	if (pI830->directRenderingType == DRI_XF86DRI) {
-	   pI830->allocate_classic_textures =
-	      xf86ReturnOptValBool(pI830->Options, OPTION_LEGACY3D, TRUE);
-	}
+    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) {
+	xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "DRI is disabled because it "
+		"runs only at depths 16 and 24.\n");
+	pI830->directRenderingType = DRI_DISABLED;
     }
 #endif /* XF86DRI */
 
@@ -1691,14 +1684,6 @@ I830XvInit(ScrnInfoPtr pScrn)
     xf86DrvMsg(pScrn->scrnIndex, from, "video overlay key set to 0x%x\n",
 	       pI830->colorKey);
 #endif
-#ifdef INTEL_XVMC
-    pI830->XvMCEnabled = FALSE;
-    from =  (pI830->directRenderingType != DRI_DISABLED &&
-	     xf86GetOptValBool(pI830->Options, OPTION_XVMC,
-			       &pI830->XvMCEnabled)) ? X_CONFIG : X_DEFAULT;
-    xf86DrvMsg(pScrn->scrnIndex, from, "Intel XvMC decoder %sabled\n",
-	       pI830->XvMCEnabled ? "en" : "dis");
-#endif
 }
 
 static void
@@ -3105,8 +3090,16 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
    /* If DRI hasn't been explicitly disabled, try to initialize it.
     * It will be used by the memory allocator.
     */
+   if (pI830->directRenderingType == DRI_NONE && pI830->SWCursor)
+       pI830->directRenderingType = DRI_DISABLED;
+
    if (pI830->directRenderingType == DRI_NONE && I830DRIScreenInit(pScreen))
        pI830->directRenderingType = DRI_XF86DRI;
+
+   if (pI830->directRenderingType == DRI_XF86DRI) {
+       pI830->allocate_classic_textures =
+	   xf86ReturnOptValBool(pI830->Options, OPTION_LEGACY3D, TRUE);
+   }
 #endif
 
    /* Enable tiling by default */
@@ -3426,6 +3418,14 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
    xf86DPMSInit(pScreen, xf86DPMSSet, 0);
 
 #ifdef I830_XV
+#ifdef INTEL_XVMC
+    pI830->XvMCEnabled = FALSE;
+    from =  (pI830->directRenderingType == DRI_XF86DRI &&
+	     xf86GetOptValBool(pI830->Options, OPTION_XVMC,
+			       &pI830->XvMCEnabled)) ? X_CONFIG : X_DEFAULT;
+    xf86DrvMsg(pScrn->scrnIndex, from, "Intel XvMC decoder %sabled\n",
+	       pI830->XvMCEnabled ? "en" : "dis");
+#endif
    /* Init video */
    if (pI830->XvEnabled && !pI830->use_drm_mode)
       I830InitVideo(pScreen);

-- 
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20081212/1e44a86a/attachment.sig>


More information about the Intel-gfx mailing list