$NetBSD: patch-cf,v 1.1 2006/06/17 12:33:53 markd Exp $

--- programs/Xserver/hw/xfree86/drivers/i810/i830_video.c.orig	2006-06-06 21:36:40.000000000 +1200
+++ programs/Xserver/hw/xfree86/drivers/i810/i830_video.c
@@ -617,7 +617,7 @@ I830SetupImageVideo(ScreenPtr pScreen)
    adapt->nAttributes = NUM_ATTRIBUTES;
    if (pI830->Clone)
       adapt->nAttributes += CLONE_ATTRIBUTES;
-   if (IS_I915G(pI830) || IS_I915GM(pI830) || IS_I945G(pI830))
+   if (IS_I9X5(pI830))
       adapt->nAttributes += GAMMA_ATTRIBUTES; /* has gamma */
    adapt->pAttributes = xnfalloc(sizeof(XF86AttributeRec) * adapt->nAttributes);
    /* Now copy the attributes */
@@ -628,7 +628,7 @@ I830SetupImageVideo(ScreenPtr pScreen)
       memcpy((char*)att, (char*)CloneAttributes, sizeof(XF86AttributeRec) * CLONE_ATTRIBUTES);
       att+=CLONE_ATTRIBUTES;
    }
-   if (IS_I915G(pI830) || IS_I915GM(pI830) || IS_I945G(pI830)) {
+   if (IS_I9X5(pI830)) {
       memcpy((char*)att, (char*)GammaAttributes, sizeof(XF86AttributeRec) * GAMMA_ATTRIBUTES);
       att+=GAMMA_ATTRIBUTES;
    }
@@ -688,7 +688,7 @@ I830SetupImageVideo(ScreenPtr pScreen)
    if (pI830->Clone)
      xvPipe = MAKE_ATOM("XV_PIPE");
 
-   if (IS_I915G(pI830) || IS_I915GM(pI830) || IS_I945G(pI830)) {
+   if (IS_I9X5(pI830)) {
      xvGamma0 = MAKE_ATOM("XV_GAMMA0");
      xvGamma1 = MAKE_ATOM("XV_GAMMA1");
      xvGamma2 = MAKE_ATOM("XV_GAMMA2");
@@ -806,7 +806,7 @@ I830SetPortAttribute(ScrnInfoPtr pScrn,
          overlay->OCONFIG |= OVERLAY_PIPE_B;
       if (pPriv->overlayOK)
          OVERLAY_UPDATE;
-   } else if (attribute == xvGamma0 && (IS_I915G(pI830) || IS_I915GM(pI830) || IS_I945G(pI830))) {
+   } else if (attribute == xvGamma0 && (IS_I9X5(pI830))) {
       /* Avoid video anomalies, so set gamma registers when overlay is off */
       /* We also clamp the values if they are outside the ranges */
       if (!*pI830->overlayOn) {
@@ -815,35 +815,35 @@ I830SetPortAttribute(ScrnInfoPtr pScrn,
 	   pPriv->gamma1 = pPriv->gamma0 + 0x7d;
       } else
          return BadRequest;
-   } else if (attribute == xvGamma1 && (IS_I915G(pI830) || IS_I915GM(pI830) || IS_I945G(pI830))) {
+   } else if (attribute == xvGamma1 && (IS_I9X5(pI830))) {
       if (!*pI830->overlayOn) {
          pPriv->gamma1 = value;
          if (pPriv->gamma1 - pPriv->gamma0 > 0x7d)
            pPriv->gamma0 = pPriv->gamma1 - 0x7d;
       } else
          return BadRequest;
-   } else if (attribute == xvGamma2 && (IS_I915G(pI830) || IS_I915GM(pI830) || IS_I945G(pI830))) {
+   } else if (attribute == xvGamma2 && (IS_I9X5(pI830))) {
       if (!*pI830->overlayOn) {
          pPriv->gamma2 = value;
          if (pPriv->gamma3 - pPriv->gamma2 > 0x7d)
             pPriv->gamma3 = pPriv->gamma2 + 0x7d;
       } else
          return BadRequest;
-   } else if (attribute == xvGamma3 && (IS_I915G(pI830) || IS_I915GM(pI830) || IS_I945G(pI830))) {
+   } else if (attribute == xvGamma3 && (IS_I9X5(pI830))) {
       if (!*pI830->overlayOn) {
          pPriv->gamma3 = value;
          if (pPriv->gamma3 - pPriv->gamma2 > 0x7d)
             pPriv->gamma2 = pPriv->gamma3 - 0x7d;
       } else
          return BadRequest;
-   } else if (attribute == xvGamma4 && (IS_I915G(pI830) || IS_I915GM(pI830) || IS_I945G(pI830))) {
+   } else if (attribute == xvGamma4 && (IS_I9X5(pI830))) {
       if (!*pI830->overlayOn) {
          pPriv->gamma4 = value;
          if (pPriv->gamma5 - pPriv->gamma4 > 0x7d)
             pPriv->gamma5 = pPriv->gamma4 + 0x7d;
       } else
          return BadRequest;
-   } else if (attribute == xvGamma5 && (IS_I915G(pI830) || IS_I915GM(pI830) || IS_I945G(pI830))) {
+   } else if (attribute == xvGamma5 && (IS_I9X5(pI830))) {
       if (!*pI830->overlayOn) {
          pPriv->gamma5 = value;
          if (pPriv->gamma5 - pPriv->gamma4 > 0x7d)
@@ -875,7 +875,7 @@ I830SetPortAttribute(ScrnInfoPtr pScrn,
         attribute == xvGamma2 ||
         attribute == xvGamma3 ||
         attribute == xvGamma4 ||
-        attribute == xvGamma5) && (IS_I915G(pI830) || IS_I915GM(pI830) || IS_I945G(pI830))) {
+        attribute == xvGamma5) && (IS_I9X5(pI830))) {
 	I830UpdateGamma(pScrn);
    }
 
@@ -895,17 +895,17 @@ I830GetPortAttribute(ScrnInfoPtr pScrn,
       *value = pPriv->contrast;
    } else if (pI830->Clone && attribute == xvPipe) {
       *value = pPriv->pipe;
-   } else if (attribute == xvGamma0 && (IS_I915G(pI830) || IS_I915GM(pI830) || IS_I945G(pI830))) {
+   } else if (attribute == xvGamma0 && (IS_I9X5(pI830))) {
       *value = pPriv->gamma0;
-   } else if (attribute == xvGamma1 && (IS_I915G(pI830) || IS_I915GM(pI830) || IS_I945G(pI830))) {
+   } else if (attribute == xvGamma1 && (IS_I9X5(pI830))) {
       *value = pPriv->gamma1;
-   } else if (attribute == xvGamma2 && (IS_I915G(pI830) || IS_I915GM(pI830) || IS_I945G(pI830))) {
+   } else if (attribute == xvGamma2 && (IS_I9X5(pI830))) {
       *value = pPriv->gamma2;
-   } else if (attribute == xvGamma3 && (IS_I915G(pI830) || IS_I915GM(pI830) || IS_I945G(pI830))) {
+   } else if (attribute == xvGamma3 && (IS_I9X5(pI830))) {
       *value = pPriv->gamma3;
-   } else if (attribute == xvGamma4 && (IS_I915G(pI830) || IS_I915GM(pI830) || IS_I945G(pI830))) {
+   } else if (attribute == xvGamma4 && (IS_I9X5(pI830))) {
       *value = pPriv->gamma4;
-   } else if (attribute == xvGamma5 && (IS_I915G(pI830) || IS_I915GM(pI830) || IS_I945G(pI830))) {
+   } else if (attribute == xvGamma5 && (IS_I9X5(pI830))) {
       *value = pPriv->gamma5;
    } else if (attribute == xvColorKey) {
       *value = pPriv->colorKey;
@@ -1182,7 +1182,7 @@ I830DisplayVideo(ScrnInfoPtr pScrn, int 
    if (!pPriv->overlayOK)
       return;
 
-   if (IS_I915G(pI830) || IS_I915GM(pI830)) {
+   if (IS_I9X5(pI830)) {
       shift = 6;
       mask = 0x3f;
    } else {
@@ -1221,7 +1221,7 @@ I830DisplayVideo(ScrnInfoPtr pScrn, int 
       swidth = ((offsety + width + mask) >> shift) -
 	    (offsety >> shift);
 
-      if (IS_I915G(pI830) || IS_I915GM(pI830))
+      if (IS_I9X5(pI830))
          swidth <<= 1;
 
       swidth -= 1;
@@ -1233,7 +1233,7 @@ I830DisplayVideo(ScrnInfoPtr pScrn, int 
       swidth = ((offsetu + (width / 2) + mask) >> shift) -
 	    (offsetu >> shift);
 
-      if (IS_I915G(pI830) || IS_I915GM(pI830))
+      if (IS_I9X5(pI830))
          swidth <<= 1;
 
       swidth -= 1;
@@ -1257,7 +1257,7 @@ I830DisplayVideo(ScrnInfoPtr pScrn, int 
       swidth = ((offsety + (width << 1) + mask) >> shift) -
 	    (offsety >> shift);
 
-      if (IS_I915G(pI830) || IS_I915GM(pI830))
+      if (IS_I9X5(pI830))
          swidth <<= 1;
 
       swidth -= 1;
