diff mbox

[3/3] Xv overlay: further cleanups

Message ID 2664d0b49e754833be15e3beb1758242cbc50d1a.1255528349.git.daniel.vetter@ffwll.ch (mailing list archive)
State Accepted
Headers show

Commit Message

Daniel Vetter Oct. 14, 2009, 1:56 p.m. UTC
None
diff mbox

Patch

diff --git a/src/i830_video.c b/src/i830_video.c
index 69276de..aaaf78f 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -140,17 +140,13 @@  static XF86VideoFormatRec Formats[NUM_FORMATS] = {
 	{15, TrueColor}, {16, TrueColor}, {24, TrueColor}
 };
 
-#define CLONE_ATTRIBUTES 1
-static XF86AttributeRec CloneAttributes[CLONE_ATTRIBUTES] = {
-	{XvSettable | XvGettable, -1, 1, "XV_PIPE"}
-};
-
-#define NUM_ATTRIBUTES 4
+#define NUM_ATTRIBUTES 5
 static XF86AttributeRec Attributes[NUM_ATTRIBUTES] = {
 	{XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"},
 	{XvSettable | XvGettable, -128, 127, "XV_BRIGHTNESS"},
 	{XvSettable | XvGettable, 0, 255, "XV_CONTRAST"},
-	{XvSettable | XvGettable, 0, 1023, "XV_SATURATION"}
+	{XvSettable | XvGettable, 0, 1023, "XV_SATURATION"},
+	{XvSettable | XvGettable, -1, 1, "XV_PIPE"}
 };
 
 #define NUM_TEXTURED_ATTRIBUTES 3
@@ -205,6 +201,7 @@  static XF86ImageRec Images[NUM_IMAGES] = {
 };
 
 /* kernel modesetting overlay functions */
+#define DRM_MODE_OVERLAY_LANDED
 static Bool drmmode_has_overlay(ScrnInfoPtr scrn)
 {
 #ifdef DRM_MODE_OVERLAY_LANDED
@@ -390,18 +387,16 @@  void I830InitVideo(ScreenPtr screen)
 		}
 	}
 
-	/* Set up overlay video if we can do it at this depth. */
-	if (!OVERLAY_NOEXIST(intel) && scrn->bitsPerPixel != 8) {
-		intel->use_drmmode_overlay = drmmode_has_overlay(scrn);
-		if (intel->use_drmmode_overlay) {
-			overlayAdaptor = I830SetupImageVideoOverlay(screen);
-			if (overlayAdaptor != NULL) {
-				xf86DrvMsg(scrn->scrnIndex, X_INFO,
-					   "Set up overlay video\n");
-			} else {
-				xf86DrvMsg(scrn->scrnIndex, X_ERROR,
-					   "Failed to set up overlay video\n");
-			}
+	/* Set up overlay video if it is available */
+	intel->use_drmmode_overlay = drmmode_has_overlay(scrn);
+	if (intel->use_drmmode_overlay) {
+		overlayAdaptor = I830SetupImageVideoOverlay(screen);
+		if (overlayAdaptor != NULL) {
+			xf86DrvMsg(scrn->scrnIndex, X_INFO,
+				   "Set up overlay video\n");
+		} else {
+			xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+				   "Failed to set up overlay video\n");
 		}
 	}
 
@@ -470,7 +465,6 @@  static XF86VideoAdaptorPtr I830SetupImageVideoOverlay(ScreenPtr screen)
 
 	adapt->pPortPrivates[0].ptr = (pointer) (adaptor_priv);
 	adapt->nAttributes = NUM_ATTRIBUTES;
-	adapt->nAttributes += CLONE_ATTRIBUTES;
 	if (IS_I9XX(intel))
 		adapt->nAttributes += GAMMA_ATTRIBUTES;	/* has gamma */
 	adapt->pAttributes =
@@ -480,9 +474,6 @@  static XF86VideoAdaptorPtr I830SetupImageVideoOverlay(ScreenPtr screen)
 	memcpy((char *)att, (char *)Attributes,
 	       sizeof(XF86AttributeRec) * NUM_ATTRIBUTES);
 	att += NUM_ATTRIBUTES;
-	memcpy((char *)att, (char *)CloneAttributes,
-	       sizeof(XF86AttributeRec) * CLONE_ATTRIBUTES);
-	att += CLONE_ATTRIBUTES;
 	if (IS_I9XX(intel)) {
 		memcpy((char *)att, (char *)GammaAttributes,
 		       sizeof(XF86AttributeRec) * GAMMA_ATTRIBUTES);