xf86-video-intel: Branch 'modesetting' - src/i830_video.c

Eric Anholt anholt at kemper.freedesktop.org
Thu Jan 11 22:40:41 EET 2007


 src/i830_video.c |   49 +++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 39 insertions(+), 10 deletions(-)

New commits:
diff-tree 6874a6f25ac87783d3770f77b9192e2d36d083a3 (from c288aea40775a9cf561fda9912187c3cb5baa419)
Author: Eric Anholt <eric at anholt.net>
Date:   Thu Jan 11 12:34:38 2007 -0800

    Restore legacy overlay size limits, due to card hangs at larger sizes.

diff --git a/src/i830_video.c b/src/i830_video.c
index 816289e..a330eb5 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -128,12 +128,14 @@ I830FreeMemory(ScrnInfoPtr pScrn, struct
 static Atom xvBrightness, xvContrast, xvSaturation, xvColorKey, xvPipe, xvDoubleBuffer;
 static Atom xvGamma0, xvGamma1, xvGamma2, xvGamma3, xvGamma4, xvGamma5;
 
-/* Limits for the overlay/textured video source sizes.  The actual hardware
+/* Limits for the overlay/textured video source sizes.  The documented hardware
  * limits are 2048x2048 or better for overlay and both of our textured video
  * implementations.  However, we run into the bigrequests limit of (currently)
  * 4MB, which even the planar format's 2048*2048*1.5 bytes is larger than.
  * Conveniently, the HD resolution, even in packed format, takes
- * (1920*1088*2) bytes, which is just shy of 4MB.
+ * (1920*1088*2) bytes, which is just shy of 4MB.  Additionally, on the 830
+ * and 845, larger sizes resulted in the card hanging, so we keep the limits
+ * lower there.
  *
  * While the HD resolution is actually 1920x1080, we increase our advertised
  * size to 1088 because some software wants to send an image aligned to
@@ -141,6 +143,8 @@ static Atom xvGamma0, xvGamma1, xvGamma2
  */
 #define IMAGE_MAX_WIDTH		1920
 #define IMAGE_MAX_HEIGHT	1088
+#define IMAGE_MAX_WIDTH_LEGACY	1024
+#define IMAGE_MAX_HEIGHT_LEGACY	1088
 
 /* overlay debugging printf function */
 #if 0
@@ -678,6 +682,11 @@ I830SetupImageVideoOverlay(ScreenPtr pSc
    adapt->name = "Intel(R) Video Overlay";
    adapt->nEncodings = 1;
    adapt->pEncodings = DummyEncoding;
+   /* update the DummyEncoding for these two chipsets */
+   if (IS_845G(pI830) || IS_I830(pI830)) {
+      adapt->pEncodings->width = IMAGE_MAX_WIDTH_LEGACY;
+      adapt->pEncodings->height = IMAGE_MAX_HEIGHT_LEGACY;
+   }
    adapt->nFormats = NUM_FORMATS;
    adapt->pFormats = Formats;
    adapt->nPorts = 1;
@@ -2434,16 +2443,24 @@ I830QueryImageAttributes(ScrnInfoPtr pSc
 			 unsigned short *w, unsigned short *h,
 			 int *pitches, int *offsets, Bool textured)
 {
+   I830Ptr pI830 = I830PTR(pScrn);
    int size, tmp;
 
 #if 0
    ErrorF("I830QueryImageAttributes: w is %d, h is %d\n", *w, *h);
 #endif
 
-   if (*w > IMAGE_MAX_WIDTH)
-       *w = IMAGE_MAX_WIDTH;
-   if (*h > IMAGE_MAX_HEIGHT)
-       *h = IMAGE_MAX_HEIGHT;
+   if (IS_845G(pI830) || IS_I830(pI830)) {
+      if (*w > IMAGE_MAX_WIDTH_LEGACY)
+	 *w = IMAGE_MAX_WIDTH_LEGACY;
+      if (*h > IMAGE_MAX_HEIGHT_LEGACY)
+	 *h = IMAGE_MAX_HEIGHT_LEGACY;
+   } else {
+      if (*w > IMAGE_MAX_WIDTH)
+	 *w = IMAGE_MAX_WIDTH;
+      if (*h > IMAGE_MAX_HEIGHT)
+	 *h = IMAGE_MAX_HEIGHT;
+   }
 
    *w = (*w + 1) & ~1;
    if (offsets)
@@ -2581,8 +2598,13 @@ I830AllocateSurface(ScrnInfoPtr pScrn,
 
    OVERLAY_DEBUG("I830AllocateSurface\n");
 
-   if ((w > IMAGE_MAX_WIDTH) || (h > IMAGE_MAX_HEIGHT))
-       return BadAlloc;
+   if (IS_845G(pI830) || IS_I830(pI830)) {
+      if ((w > IMAGE_MAX_WIDTH_LEGACY) || (h > IMAGE_MAX_HEIGHT_LEGACY))
+         return BadAlloc;
+   } else {
+      if ((w > IMAGE_MAX_WIDTH) || (h > IMAGE_MAX_HEIGHT))
+         return BadAlloc;
+   }
 
    /* What to do when rotated ?? */
    if (pI830->rotation != RR_Rotate_0)
@@ -2784,6 +2806,8 @@ static void
 I830InitOffscreenImages(ScreenPtr pScreen)
 {
    XF86OffscreenImagePtr offscreenImages;
+   ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+   I830Ptr pI830 = I830PTR(pScrn);
 
    /* need to free this someplace */
    if (!(offscreenImages = xalloc(sizeof(XF86OffscreenImageRec)))) {
@@ -2798,8 +2822,13 @@ I830InitOffscreenImages(ScreenPtr pScree
    offscreenImages[0].stop = I830StopSurface;
    offscreenImages[0].setAttribute = I830SetSurfaceAttribute;
    offscreenImages[0].getAttribute = I830GetSurfaceAttribute;
-   offscreenImages[0].max_width = IMAGE_MAX_WIDTH;
-   offscreenImages[0].max_height = IMAGE_MAX_HEIGHT;
+   if (IS_845G(pI830) || IS_I830(pI830)) {
+      offscreenImages[0].max_width = IMAGE_MAX_WIDTH_LEGACY;
+      offscreenImages[0].max_height = IMAGE_MAX_HEIGHT_LEGACY;
+   } else {
+      offscreenImages[0].max_width = IMAGE_MAX_WIDTH;
+      offscreenImages[0].max_height = IMAGE_MAX_HEIGHT; 
+   }
    offscreenImages[0].num_attributes = 1;
    offscreenImages[0].attributes = Attributes;
 



More information about the xorg-commit mailing list