[PATCH v2] Add a option to prefer overlay over textured video in intel driver

Maxim Levitsky maximlevitsky at gmail.com
Sat Mar 22 08:50:25 PDT 2008


From fd78464091f2b7fe4640f9c84dd2bc693cbe69cd Mon Sep 17 00:00:00 2001
From: Maxim Levitsky <maximlevitsky at gmail.com>
Date: Fri, 21 Mar 2008 22:06:35 +0200
Subject: [PATCH] Add a option to prefer overlay over textured video in intel driver

---
 man/intel.man     |    5 +++++
 src/i830.h        |    1 +
 src/i830_driver.c |    4 ++++
 src/i830_video.c  |   12 ++++++++++--
 4 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/man/intel.man b/man/intel.man
index c26264f..dc92931 100644
--- a/man/intel.man
+++ b/man/intel.man
@@ -124,6 +124,11 @@ other drivers.
 Disable or enable XVideo support.
 Default: XVideo is enabled for configurations where it is supported.
 .TP
+.BI "Option \*qXvPreferOverlay\*q \*q" boolean \*q
+Make hardware overlay be first XV adapter.
+Some applications assume only one XV adapter present thus use first one.
+Default: Textured video adapter is first and overlay second.
+.TP
 .BI "Option \*qLegacy3D\*q \*q" boolean \*q
 Enable support for the legacy i915_dri.so 3D driver.
 This will, among other things, make the 2D driver tell libGL to
diff --git a/src/i830.h b/src/i830.h
index 1319c6a..6a37d2e 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -512,6 +512,7 @@ typedef struct _I830Rec {
 
    Bool XvDisabled;			/* Xv disabled in PreInit. */
    Bool XvEnabled;			/* Xv enabled for this generation. */
+   Bool XvPreferOverlay;
 
 #ifdef I830_XV
    int colorKey;
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 98f4261..6f67f85 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -307,6 +307,7 @@ typedef enum {
 #ifdef INTEL_XVMC
    OPTION_XVMC,
 #endif
+   OPTION_PREFER_OVERLAY
 } I830Opts;
 
 static OptionInfoRec I830Options[] = {
@@ -333,6 +334,7 @@ static OptionInfoRec I830Options[] = {
 #ifdef INTEL_XVMC
    {OPTION_XVMC,	"XvMC",		OPTV_BOOLEAN,	{0},	TRUE},
 #endif
+   {OPTION_PREFER_OVERLAY, "XvPreferOverlay", OPTV_BOOLEAN, {0}, TRUE},
    {-1,			NULL,		OPTV_NONE,	{0},	FALSE}
 };
 /* *INDENT-ON* */
@@ -1593,6 +1595,8 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
    pI830->XvDisabled =
 	!xf86ReturnOptValBool(pI830->Options, OPTION_XVIDEO, TRUE);
 
+   pI830->XvPreferOverlay = xf86ReturnOptValBool(pI830->Options, OPTION_PREFER_OVERLAY, FALSE);
+
 #ifdef I830_XV
    if (xf86GetOptValInteger(pI830->Options, OPTION_VIDEO_KEY,
 			    &(pI830->colorKey))) {
diff --git a/src/i830_video.c b/src/i830_video.c
index 14d48af..5819256 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -604,7 +604,6 @@ I830InitVideo(ScreenPtr pScreen)
     {
 	texturedAdaptor = I830SetupImageVideoTextured(pScreen);
 	if (texturedAdaptor != NULL) {
-	    adaptors[num_adaptors++] = texturedAdaptor;
 	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Set up textured video\n");
 	} else {
 	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -617,7 +616,6 @@ I830InitVideo(ScreenPtr pScreen)
     {
 	overlayAdaptor = I830SetupImageVideoOverlay(pScreen);
 	if (overlayAdaptor != NULL) {
-	    adaptors[num_adaptors++] = overlayAdaptor;
 	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Set up overlay video\n");
 	} else {
 	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -625,6 +623,16 @@ I830InitVideo(ScreenPtr pScreen)
 	}
 	I830InitOffscreenImages(pScreen);
     }
+
+    if (overlayAdaptor && pI830->XvPreferOverlay)
+       adaptors[num_adaptors++] = overlayAdaptor;
+
+    if (texturedAdaptor)
+       adaptors[num_adaptors++] = texturedAdaptor;
+
+    if (overlayAdaptor && !pI830->XvPreferOverlay)
+       adaptors[num_adaptors++] = overlayAdaptor;
+
 #ifdef INTEL_XVMC
     Bool ret = FALSE;
     if (intel_xvmc_probe(pScrn)) {
-- 
1.5.4.3




More information about the xorg mailing list