summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/i830_video.c81
-rw-r--r--src/i830_video.h2
-rw-r--r--src/i915_video.c17
-rw-r--r--src/i965_video.c36
4 files changed, 43 insertions, 93 deletions
diff --git a/src/i830_video.c b/src/i830_video.c
index a4cb11e9..afe02cbb 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -1805,23 +1805,6 @@ i830_update_dst_box_to_crtc_coords(ScrnInfoPtr pScrn, xf86CrtcPtr crtc,
return;
}
-static int
-is_planar_fourcc(int id)
-{
- switch (id) {
- case FOURCC_YV12:
- case FOURCC_I420:
-#ifdef INTEL_XVMC
- case FOURCC_XVMC:
-#endif
- return 1;
- case FOURCC_UYVY:
- case FOURCC_YUY2:
- default:
- return 0;
- }
-}
-
static void
i830_store_coeffs_in_overlay_regs(uint16_t *reg_coeffs, coeffPtr new_coeffs,
int max_taps)
@@ -1991,6 +1974,25 @@ i830_update_scaling_factors(I830OverlayRegPtr overlay,
return scaleChanged;
}
+int
+is_planar_fourcc(int id)
+{
+ switch (id) {
+ case FOURCC_YV12:
+ case FOURCC_I420:
+#ifdef INTEL_XVMC
+ case FOURCC_XVMC:
+#endif
+ return 1;
+ case FOURCC_UYVY:
+ case FOURCC_YUY2:
+ return 0;
+ default:
+ ErrorF("Unknown format 0x%x\n", id);
+ return 0;
+ }
+}
+
static void
i830_display_overlay(ScrnInfoPtr pScrn, xf86CrtcPtr crtc,
int id, short width, short height,
@@ -2278,23 +2280,11 @@ I830PutImage(ScrnInfoPtr pScrn,
}
destId = id;
- switch (id) {
- case FOURCC_YV12:
- case FOURCC_I420:
+ if (is_planar_fourcc(id)) {
srcPitch = (width + 0x3) & ~0x3;
srcPitch2 = ((width >> 1) + 0x3) & ~0x3;
- break;
-#ifdef INTEL_XVMC
- case FOURCC_XVMC:
- srcPitch = (width + 0x3) & ~0x3;
- srcPitch2 = ((width >> 1) + 0x3) & ~0x3;
- break;
-#endif
- case FOURCC_UYVY:
- case FOURCC_YUY2:
- default:
+ } else {
srcPitch = width << 1;
- break;
}
/* Only needs to be DWORD-aligned for textured on i915, but overlay has
@@ -2438,33 +2428,18 @@ I830PutImage(ScrnInfoPtr pScrn,
left = (x1 >> 16) & ~1;
npixels = ((((x2 + 0xffff) >> 16) + 1) & ~1) - left;
- switch (id) {
- case FOURCC_YV12:
- case FOURCC_I420:
- top &= ~1;
- nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top;
- I830CopyPlanarData(pScrn, pPriv, buf, srcPitch, srcPitch2, dstPitch,
- height, top, left, nlines, npixels, id);
- break;
- case FOURCC_UYVY:
- case FOURCC_YUY2:
- nlines = ((y2 + 0xffff) >> 16) - top;
- I830CopyPackedData(pScrn, pPriv, buf, srcPitch, dstPitch, top, left,
- nlines, npixels);
- break;
-#ifdef INTEL_XVMC
- case FOURCC_XVMC:
- if (pPriv->rotation != RR_Rotate_0) {
+ if (is_planar_fourcc(id)) {
+ if (id != FOURCC_XVMC
+ || pPriv->rotation != RR_Rotate_0) {
top &= ~1;
nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top;
I830CopyPlanarData(pScrn, pPriv, buf, srcPitch, srcPitch2, dstPitch,
height, top, left, nlines, npixels, id);
}
-
- break;
-#endif
- default:
- break;
+ } else {
+ nlines = ((y2 + 0xffff) >> 16) - top;
+ I830CopyPackedData(pScrn, pPriv, buf, srcPitch, dstPitch, top, left,
+ nlines, npixels);
}
if (!pPriv->textured) {
diff --git a/src/i830_video.h b/src/i830_video.h
index 03e2ba93..fb4ad291 100644
--- a/src/i830_video.h
+++ b/src/i830_video.h
@@ -91,3 +91,5 @@ void I965DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv,
void I830VideoBlockHandler(int i, pointer blockData, pointer pTimeout,
pointer pReadmask);
void i965_free_video(ScrnInfoPtr scrn);
+
+int is_planar_fourcc(int id);
diff --git a/src/i915_video.c b/src/i915_video.c
index 3b4247cf..b978a43d 100644
--- a/src/i915_video.c
+++ b/src/i915_video.c
@@ -53,27 +53,12 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
int nbox_total = REGION_NUM_RECTS(dstRegion);
int nbox_this_time;
int dxo, dyo, pix_xoff, pix_yoff;
- Bool planar;
#if 0
ErrorF("I915DisplayVideo: %dx%d (pitch %d)\n", width, height,
video_pitch);
#endif
- switch (id) {
- case FOURCC_UYVY:
- case FOURCC_YUY2:
- planar = FALSE;
- break;
- case FOURCC_YV12:
- case FOURCC_I420:
- planar = TRUE;
- break;
- default:
- ErrorF("Unknown format 0x%x\n", id);
- return;
- }
-
#define BYTES_FOR_BOXES(n) ((200 + (n) * 20) * 4)
#define BOXES_IN_BYTES(s) ((((s)/4) - 200) / 20)
#define BATCH_BYTES(p) ((p)->batch_bo->size - 16)
@@ -147,7 +132,7 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
OUT_RELOC_PIXMAP(pPixmap, I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, 0);
ADVANCE_BATCH();
- if (!planar) {
+ if (!is_planar_fourcc(id)) {
FS_LOCALS(10);
BEGIN_BATCH(16);
diff --git a/src/i965_video.c b/src/i965_video.c
index 46a461f7..810b761b 100644
--- a/src/i965_video.c
+++ b/src/i965_video.c
@@ -1008,26 +1008,7 @@ I965DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
src_surf_base[0], src_surf_base[1], src_surf_base[2]);
#endif
- switch (id) {
- case FOURCC_UYVY:
- src_surf_format = BRW_SURFACEFORMAT_YCRCB_SWAPY;
- n_src_surf = 1;
- src_width[0] = width;
- src_height[0] = height;
- src_pitch[0] = video_pitch;
- break;
- case FOURCC_YUY2:
- src_surf_format = BRW_SURFACEFORMAT_YCRCB_NORMAL;
- src_width[0] = width;
- src_height[0] = height;
- src_pitch[0] = video_pitch;
- n_src_surf = 1;
- break;
-#ifdef INTEL_XVMC
- case FOURCC_XVMC:
-#endif
- case FOURCC_I420:
- case FOURCC_YV12:
+ if (is_planar_fourcc(id)) {
src_surf_format = BRW_SURFACEFORMAT_R8_UNORM;
src_width[1] = src_width[0] = width;
src_height[1] = src_height[0] = height;
@@ -1036,10 +1017,17 @@ I965DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
src_height[4] = src_height[5] = src_height[2] = src_height[3] = height / 2;
src_pitch[4] = src_pitch[5] = src_pitch[2] = src_pitch[3] = video_pitch;
n_src_surf = 6;
- break;
- default:
- return;
- }
+ } else {
+ if (id == FOURCC_UYVY)
+ src_surf_format = BRW_SURFACEFORMAT_YCRCB_SWAPY;
+ else
+ src_surf_format = BRW_SURFACEFORMAT_YCRCB_NORMAL;
+
+ src_width[0] = width;
+ src_height[0] = height;
+ src_pitch[0] = video_pitch;
+ n_src_surf = 1;
+ }
#if 0
ErrorF("dst surf: 0x%08x\n", state_base_offset + dest_surf_offset);