[PATCH] Translate XV dstBox X coords to pipe-local coordinates.

JM Ibanez jm at orangeandbronze.com
Mon Apr 16 11:55:49 PDT 2007


As it stands, the dstBox is set against the coordinates of the *whole*
screen (i.e. the virtual framebuffer). However, when displaying via
the pipe selection code, the dstBox coordinates were clipped against
pScrn->currentMode, which is invalid as ->currentMode only points to
the first initial display's mode (the laptop LCD panel in my case).

So, as apparently the hardware needs to have a dstBox relative to the
pipe's output, the code now simply translates the coordinates relative
to the other pipe's mode boundaries.
---
 src/i830_video.c |   29 +++++++++++++++++++++++++----
 1 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/src/i830_video.c b/src/i830_video.c
index aad65f3..6b5cdf5 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -1619,6 +1619,8 @@ I830DisplayVideo(ScrnInfoPtr pScrn, int id, short width, short height,
    I830PortPrivPtr pPriv = pI830->adaptor->pPortPrivates[0].ptr;
    I830OverlayRegPtr overlay =
 	 (I830OverlayRegPtr) (pI830->FbBase + pI830->overlay_regs->offset);
+   xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+
    unsigned int swidth;
    unsigned int mask, shift, offsety, offsetu;
    int tmp;
@@ -1758,16 +1760,35 @@ I830DisplayVideo(ScrnInfoPtr pScrn, int id, short width, short height,
       if (dstBox->x2 < 0) dstBox->x2 = 0;
       if (dstBox->y1 > vactive) dstBox->y1 = vactive;
       if (dstBox->y2 > vactive) dstBox->y2 = vactive;
-      if (dstBox->x1 > pScrn->currentMode->HDisplay) dstBox->x1 = pScrn->currentMode->HDisplay - 1;
-      if (dstBox->x2 > pScrn->currentMode->HDisplay) dstBox->x2 = pScrn->currentMode->HDisplay - 1;
+
+      /*
+       * #10645: We should really translate the actual dstBox
+       * coordinates from dual-head to pipe/output-local.
+       */
+      tmp = pPriv->pipe ^ 1;
+
+      if(dstBox->x1 > (xf86_config->crtc[tmp]->mode.HDisplay)
+         && dstBox->x2 > (xf86_config->crtc[tmp]->mode.HDisplay)) {
+
+         int currHDisplay = xf86_config->crtc[tmp]->mode.HDisplay;
+         /* Translate backward */
+         dstBox->x1 = dstBox->x1 - currHDisplay;
+         dstBox->x2 = dstBox->x2 - currHDisplay;
+      }
+
+      if (dstBox->x1 > xf86_config->crtc[pPriv->pipe]->mode.HDisplay)
+         dstBox->x1 = xf86_config->crtc[pPriv->pipe]->mode.HDisplay - 1;
+      if (dstBox->x2 > xf86_config->crtc[pPriv->pipe]->mode.HDisplay)
+         dstBox->x2 = xf86_config->crtc[pPriv->pipe]->mode.HDisplay - 1;
 
       /* nothing do to */
       if ((!dstBox->x1 && !dstBox->x2) || (!dstBox->y1 && !dstBox->y2)) {
          OVERLAY_DEBUG("NOTHING TO DO\n");
          return;
       }
-      if ((dstBox->x1 == (pScrn->currentMode->HDisplay - 1) && 
-           dstBox->x2 == (pScrn->currentMode->HDisplay - 1)) || 
+
+      if ((dstBox->x1 == (xf86_config->crtc[pPriv->pipe]->mode.HDisplay - 1) && 
+           dstBox->x2 == (xf86_config->crtc[pPriv->pipe]->mode.HDisplay - 1)) ||
           (dstBox->y1 == vactive && 
            dstBox->y2 == vactive)) {
          OVERLAY_DEBUG("NOTHING TO DO\n");
-- 
1.5.0.5




More information about the xorg mailing list