summaryrefslogtreecommitdiff
path: root/src/i830_video.c
diff options
context:
space:
mode:
authorZhenyu Wang <zhenyu.z.wang@intel.com>2008-03-11 14:37:41 +0800
committerZhenyu Wang <zhenyu.z.wang@intel.com>2008-03-11 14:37:41 +0800
commit31654f52b084ebb32f69854dfb1c342c9da07928 (patch)
tree415cb1ba373cc815964bd2441aa546ebd5f74a9f /src/i830_video.c
parenta03aca101d4d51ed2279a99d1137ce3b7ef364e2 (diff)
parent02c0ffb1d8112a6fb03f9c8eae9ec1a1fca123ef (diff)
Merge branch 'master' into xvmc
Conflicts: man/intel.man src/i830_driver.c
Diffstat (limited to 'src/i830_video.c')
-rw-r--r--src/i830_video.c68
1 files changed, 40 insertions, 28 deletions
diff --git a/src/i830_video.c b/src/i830_video.c
index 967fda92..6b685f0c 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -50,6 +50,7 @@
#include "config.h"
#endif
+#include <inttypes.h>
#include <math.h>
#include <string.h>
#include <assert.h>
@@ -383,7 +384,7 @@ i830_overlay_switch_to_crtc (ScrnInfoPtr pScrn, xf86CrtcPtr crtc)
I830CrtcPrivatePtr intel_crtc = crtc->driver_private;
int pipeconf_reg = intel_crtc->pipe == 0 ? PIPEACONF : PIPEBCONF;
- if (INREG(pipeconf_reg) & PIPEACONF_DOUBLE_WIDE)
+ if (!IS_I965G(pI830) && (INREG(pipeconf_reg) & PIPEACONF_DOUBLE_WIDE))
pPriv->overlayOK = FALSE;
else
pPriv->overlayOK = TRUE;
@@ -395,7 +396,7 @@ i830_overlay_switch_to_crtc (ScrnInfoPtr pScrn, xf86CrtcPtr crtc)
if (i830PipeHasType(crtc, I830_OUTPUT_LVDS))
{
- int vtotal_reg = intel_crtc->pipe ? VTOTAL_A : VTOTAL_B;
+ int vtotal_reg = intel_crtc->pipe == 0 ? VTOTAL_A : VTOTAL_B;
CARD32 size = intel_crtc->pipe ? INREG(PIPEBSRC) : INREG(PIPEASRC);
CARD32 active;
CARD32 hsize, vsize;
@@ -494,7 +495,8 @@ i830_overlay_continue(ScrnInfoPtr pScrn, Bool update_filter)
flip_addr = pI830->overlay_regs->bus_addr;
if (update_filter)
flip_addr |= OFC_UPDATE;
- OVERLAY_DEBUG ("overlay_continue cmd 0x%08lx -> 0x%08lx sta 0x%08lx\n",
+ OVERLAY_DEBUG ("overlay_continue cmd 0x%08" PRIx32 " -> 0x%08" PRIx32
+ " sta 0x%08" PRIx32 "\n",
overlay->OCMD, INREG(OCMD_REGISTER), INREG(DOVSTA));
BEGIN_LP_RING(4);
OUT_RING(MI_FLUSH | MI_WRITE_DIRTY_STATE);
@@ -534,7 +536,7 @@ i830_overlay_off(ScrnInfoPtr pScrn)
*/
{
overlay->OCMD &= ~OVERLAY_ENABLE;
- OVERLAY_DEBUG ("overlay_off cmd 0x%08lx -> 0x%08lx sta 0x%08lx\n",
+ OVERLAY_DEBUG ("overlay_off cmd 0x%08" PRIx32 " -> 0x%08" PRIx32 " sta 0x%08" PRIx32 "\n",
overlay->OCMD, INREG(OCMD_REGISTER), INREG(DOVSTA));
BEGIN_LP_RING(6);
OUT_RING(MI_FLUSH | MI_WRITE_DIRTY_STATE);
@@ -610,8 +612,7 @@ I830InitVideo(ScreenPtr pScreen)
}
/* Set up overlay video if we can do it at this depth. */
- if (!IS_I965G(pI830) && pScrn->bitsPerPixel != 8 &&
- pI830->overlay_regs != NULL)
+ if (pScrn->bitsPerPixel != 8 && pI830->overlay_regs != NULL)
{
overlayAdaptor = I830SetupImageVideoOverlay(pScreen);
if (overlayAdaptor != NULL) {
@@ -717,7 +718,7 @@ I830ResetVideo(ScrnInfoPtr pScrn)
{
int i;
for (i = 0x30000; i < 0x31000; i += 4)
- ErrorF("0x%x 0x%lx\n", i, INREG(i));
+ ErrorF("0x%x 0x%" PRIx32 "\n", i, INREG(i));
}
#endif
}
@@ -889,6 +890,8 @@ I830SetupImageVideoOverlay(ScreenPtr pScreen)
pPriv->gamma0 = 0x080808;
pPriv->doubleBuffer = 1;
+ pPriv->rotation = RR_Rotate_0;
+
/* gotta uninit this someplace */
REGION_NULL(pScreen, &pPriv->clip);
@@ -994,6 +997,8 @@ I830SetupImageVideoTextured(ScreenPtr pScreen)
pPriv->currentBuf = 0;
pPriv->doubleBuffer = 0;
+ pPriv->rotation = RR_Rotate_0;
+
/* gotta uninit this someplace, XXX: shouldn't be necessary for textured */
REGION_NULL(pScreen, &pPriv->clip);
@@ -1249,7 +1254,7 @@ I830CopyPackedData(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv,
else
dst = pI830->FbBase + pPriv->YBuf1offset;
- switch (pI830->rotation) {
+ switch (pPriv->rotation) {
case RR_Rotate_0:
w <<= 1;
for (i = 0; i < h; i++) {
@@ -1411,7 +1416,7 @@ I830CopyPlanarData(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv,
else
dst1 = pI830->FbBase + pPriv->YBuf1offset;
- switch (pI830->rotation) {
+ switch (pPriv->rotation) {
case RR_Rotate_0:
for (i = 0; i < h; i++) {
memcpy(dst1, src1, w);
@@ -1466,7 +1471,7 @@ I830CopyPlanarData(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv,
dst2 = pI830->FbBase + pPriv->VBuf1offset;
}
- switch (pI830->rotation) {
+ switch (pPriv->rotation) {
case RR_Rotate_0:
for (i = 0; i < h / 2; i++) {
memcpy(dst2, src2, w / 2);
@@ -1522,7 +1527,7 @@ I830CopyPlanarData(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv,
dst3 = pI830->FbBase + pPriv->UBuf1offset;
}
- switch (pI830->rotation) {
+ switch (pPriv->rotation) {
case RR_Rotate_0:
for (i = 0; i < h / 2; i++) {
memcpy(dst3, src3, w / 2);
@@ -1821,6 +1826,10 @@ i830_display_video(ScrnInfoPtr pScrn, xf86CrtcPtr crtc,
return;
switch (crtc->rotation & 0xf) {
+ /* for overlay, we should take it from crtc's screen
+ * coordinate to current crtc's display mode.
+ * yeah, a bit confusing.
+ */
case RR_Rotate_0:
dstBox->x1 -= crtc->x;
dstBox->x2 -= crtc->x;
@@ -1830,10 +1839,10 @@ i830_display_video(ScrnInfoPtr pScrn, xf86CrtcPtr crtc,
case RR_Rotate_90:
tmp = dstBox->x1;
dstBox->x1 = dstBox->y1 - crtc->x;
- dstBox->y1 = pScrn->virtualY - tmp - crtc->y;
+ dstBox->y1 = pScrn->virtualX - tmp - crtc->y;
tmp = dstBox->x2;
dstBox->x2 = dstBox->y2 - crtc->x;
- dstBox->y2 = pScrn->virtualY - tmp - crtc->y;
+ dstBox->y2 = pScrn->virtualX - tmp - crtc->y;
tmp = dstBox->y1;
dstBox->y1 = dstBox->y2;
dstBox->y2 = tmp;
@@ -1848,10 +1857,10 @@ i830_display_video(ScrnInfoPtr pScrn, xf86CrtcPtr crtc,
break;
case RR_Rotate_270:
tmp = dstBox->x1;
- dstBox->x1 = pScrn->virtualX - dstBox->y1 - crtc->x;
+ dstBox->x1 = pScrn->virtualY - dstBox->y1 - crtc->x;
dstBox->y1 = tmp - crtc->y;
tmp = dstBox->x2;
- dstBox->x2 = pScrn->virtualX - dstBox->y2 - crtc->x;
+ dstBox->x2 = pScrn->virtualY - dstBox->y2 - crtc->x;
dstBox->y2 = tmp - crtc->y;
tmp = dstBox->x1;
dstBox->x1 = dstBox->x2;
@@ -1947,7 +1956,7 @@ i830_display_video(ScrnInfoPtr pScrn, xf86CrtcPtr crtc,
overlay->OBUF_1V = pPriv->VBuf1offset;
}
- OVERLAY_DEBUG("pos: 0x%lx, size: 0x%lx\n",
+ OVERLAY_DEBUG("pos: 0x%" PRIx32 ", size: 0x%" PRIx32 "\n",
overlay->DWINPOS, overlay->DWINSZ);
OVERLAY_DEBUG("dst: %d x %d, src: %d x %d\n", drw_w, drw_h, src_w, src_h);
@@ -2109,7 +2118,7 @@ i830_display_video(ScrnInfoPtr pScrn, xf86CrtcPtr crtc,
OCMD |= BUFFER1;
overlay->OCMD = OCMD;
- OVERLAY_DEBUG("OCMD is 0x%lx\n", OCMD);
+ OVERLAY_DEBUG("OCMD is 0x%" PRIx32 "\n", OCMD);
/* make sure the overlay is on */
i830_overlay_on (pScrn);
@@ -2283,6 +2292,17 @@ I830PutImage(ScrnInfoPtr pScrn,
width, height))
return Success;
+ if (!pPriv->textured) {
+ /* texture video handles rotation differently. */
+ if (crtc)
+ pPriv->rotation = crtc->rotation;
+ else {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Fail to clip video to any crtc!\n");
+ return Success;
+ }
+ }
+
destId = id;
switch (id) {
case FOURCC_YV12:
@@ -2323,7 +2343,7 @@ I830PutImage(ScrnInfoPtr pScrn,
switch (destId) {
case FOURCC_YV12:
case FOURCC_I420:
- if (pI830->rotation & (RR_Rotate_90 | RR_Rotate_270)) {
+ if (pPriv->rotation & (RR_Rotate_90 | RR_Rotate_270)) {
dstPitch = ((height / 2) + pitchAlignMask) & ~pitchAlignMask;
size = dstPitch * width * 3;
} else {
@@ -2334,7 +2354,7 @@ I830PutImage(ScrnInfoPtr pScrn,
case FOURCC_UYVY:
case FOURCC_YUY2:
default:
- if (pI830->rotation & (RR_Rotate_90 | RR_Rotate_270)) {
+ if (pPriv->rotation & (RR_Rotate_90 | RR_Rotate_270)) {
dstPitch = ((height << 1) + pitchAlignMask) & ~pitchAlignMask;
size = dstPitch * width;
} else {
@@ -2384,7 +2404,7 @@ I830PutImage(ScrnInfoPtr pScrn,
/* fixup pointers */
pPriv->YBuf0offset = pPriv->buf->offset;
- if (pI830->rotation & (RR_Rotate_90 | RR_Rotate_270)) {
+ if (pPriv->rotation & (RR_Rotate_90 | RR_Rotate_270)) {
pPriv->UBuf0offset = pPriv->YBuf0offset + (dstPitch * 2 * width);
pPriv->VBuf0offset = pPriv->UBuf0offset + (dstPitch * width / 2);
if(pPriv->doubleBuffer) {
@@ -2599,10 +2619,6 @@ I830VideoBlockHandler(int i, pointer blockData, pointer pTimeout,
if (pI830->adaptor == NULL)
return;
- /* No overlay scaler on the 965. */
- if (IS_I965G(pI830))
- return;
-
pPriv = GET_PORT_PRIVATE(pScrn);
if (pPriv->videoStatus & TIMER_MASK) {
@@ -2882,10 +2898,6 @@ i830_crtc_dpms_video(xf86CrtcPtr crtc, Bool on)
if (pI830->adaptor == NULL)
return;
- /* No overlay scaler on the 965. */
- if (IS_I965G(pI830))
- return;
-
pPriv = GET_PORT_PRIVATE(pScrn);
if (crtc != pPriv->current_crtc)