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

Maxim Levitsky maximlevitsky at gmail.com
Sat Mar 22 07:05:27 PDT 2008


From ce20ec74f4247c5d63118b2caee21e3bc393d31a 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

---
 src/i830.h        |    1 +
 src/i830_driver.c |    4 ++++
 src/i830_video.c  |   12 ++++++++++--
 3 files changed, 15 insertions(+), 2 deletions(-)

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..0e5c04e 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* */
@@ -1592,6 +1594,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,
diff --git a/src/i830_video.c b/src/i830_video.c
index 7517e29..5f75c73 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