diff options
-rw-r--r-- | src/Makefile.am | 6 | ||||
-rw-r--r-- | src/common.h | 11 | ||||
-rw-r--r-- | src/i830_exa.c | 109 | ||||
-rw-r--r-- | src/i830_render.c (renamed from src/i830_exa_render.c) | 97 | ||||
-rw-r--r-- | src/i915_render.c (renamed from src/i915_exa_render.c) | 0 | ||||
-rw-r--r-- | src/i915_video.c | 12 | ||||
-rw-r--r-- | src/i965_render.c (renamed from src/i965_exa_render.c) | 0 |
7 files changed, 111 insertions, 124 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index ba126357..7656e02e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -92,9 +92,9 @@ i810_drv_la_SOURCES = \ i965_video.c \ i830_exa.c \ i830_xaa.c \ - i830_exa_render.c \ - i915_exa_render.c \ - i965_exa_render.c + i830_render.c \ + i915_render.c \ + i965_render.c if HAVE_GEN4ASM sf_prog.h: packed_yuv_sf.g4a diff --git a/src/common.h b/src/common.h index 561dfac7..91e31b5f 100644 --- a/src/common.h +++ b/src/common.h @@ -130,6 +130,17 @@ extern void I830DPRINTF_stub(const char *filename, int line, outring &= ringmask; \ } while (0) +union intfloat { + float f; + unsigned int ui; +}; + +#define OUT_RING_F(x) do { \ + union intfloat tmp; \ + tmp.f = (float)(x); \ + OUT_RING(tmp.ui); \ +} while(0) + #define ADVANCE_LP_RING() do { \ if (ringused > needed) \ FatalError("%s: ADVANCE_LP_RING: exceeded allocation %d/%d\n ", \ diff --git a/src/i830_exa.c b/src/i830_exa.c index 02d2dcfe..8a1577af 100644 --- a/src/i830_exa.c +++ b/src/i830_exa.c @@ -97,18 +97,6 @@ const int I830PatternROP[16] = ROP_1 }; -/* move to common.h */ -union intfloat { - float f; - unsigned int ui; -}; - -#define OUT_RING_F(x) do { \ - union intfloat tmp; \ - tmp.f = (float)(x); \ - OUT_RING(tmp.ui); \ -} while(0) - /** * I830EXASync - wait for a command to finish * @pScreen: current screen @@ -309,103 +297,6 @@ i830_get_transformed_coordinates(int x, int y, PictTransformPtr transform, } } -/** - * Do a single rectangle composite operation. - * - * This function is shared between i830 and i915 generation code. - */ -void -IntelEXAComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY, - int dstX, int dstY, int w, int h) -{ - ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum]; - I830Ptr pI830 = I830PTR(pScrn); - Bool has_mask; - float src_x[3], src_y[3], mask_x[3], mask_y[3]; - - i830_get_transformed_coordinates(srcX, srcY, - pI830->transform[0], - &src_x[0], &src_y[0]); - i830_get_transformed_coordinates(srcX, srcY + h, - pI830->transform[0], - &src_x[1], &src_y[1]); - i830_get_transformed_coordinates(srcX + w, srcY + h, - pI830->transform[0], - &src_x[2], &src_y[2]); - - if (pI830->scale_units[1][0] == -1 || pI830->scale_units[1][1] == -1) { - has_mask = FALSE; - } else { - has_mask = TRUE; - i830_get_transformed_coordinates(maskX, maskY, - pI830->transform[1], - &mask_x[0], &mask_y[0]); - i830_get_transformed_coordinates(maskX, maskY + h, - pI830->transform[1], - &mask_x[1], &mask_y[1]); - i830_get_transformed_coordinates(maskX + w, maskY + h, - pI830->transform[1], - &mask_x[2], &mask_y[2]); - } - - { - int vertex_count; - - if (has_mask) - vertex_count = 3*6; - else - vertex_count = 3*4; - - BEGIN_LP_RING(6+vertex_count); - - OUT_RING(MI_NOOP); - OUT_RING(MI_NOOP); - OUT_RING(MI_NOOP); - OUT_RING(MI_NOOP); - OUT_RING(MI_NOOP); - - OUT_RING(PRIM3D_INLINE | PRIM3D_RECTLIST | (vertex_count-1)); - - OUT_RING_F(dstX); - OUT_RING_F(dstY); - OUT_RING_F(src_x[0] / pI830->scale_units[0][0]); - OUT_RING_F(src_y[0] / pI830->scale_units[0][1]); - if (has_mask) { - OUT_RING_F(mask_x[0] / pI830->scale_units[1][0]); - OUT_RING_F(mask_y[0] / pI830->scale_units[1][1]); - } - - OUT_RING_F(dstX); - OUT_RING_F(dstY + h); - OUT_RING_F(src_x[1] / pI830->scale_units[0][0]); - OUT_RING_F(src_y[1] / pI830->scale_units[0][1]); - if (has_mask) { - OUT_RING_F(mask_x[1] / pI830->scale_units[1][0]); - OUT_RING_F(mask_y[1] / pI830->scale_units[1][1]); - } - - OUT_RING_F(dstX + w); - OUT_RING_F(dstY + h); - OUT_RING_F(src_x[2] / pI830->scale_units[0][0]); - OUT_RING_F(src_y[2] / pI830->scale_units[0][1]); - if (has_mask) { - OUT_RING_F(mask_x[2] / pI830->scale_units[1][0]); - OUT_RING_F(mask_y[2] / pI830->scale_units[1][1]); - } - ADVANCE_LP_RING(); - } -} - -void -IntelEXADoneComposite(PixmapPtr pDst) -{ -#if ALWAYS_SYNC - ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum]; - - I830Sync(pScrn); -#endif -} - /* * TODO: * - Dual head? diff --git a/src/i830_exa_render.c b/src/i830_render.c index bf521b45..c335f6d0 100644 --- a/src/i830_exa_render.c +++ b/src/i830_render.c @@ -492,3 +492,100 @@ I830EXAPrepareComposite(int op, PicturePtr pSrcPicture, return TRUE; } + +/** + * Do a single rectangle composite operation. + * + * This function is shared between i830 and i915 generation code. + */ +void +IntelEXAComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY, + int dstX, int dstY, int w, int h) +{ + ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum]; + I830Ptr pI830 = I830PTR(pScrn); + Bool has_mask; + float src_x[3], src_y[3], mask_x[3], mask_y[3]; + + i830_get_transformed_coordinates(srcX, srcY, + pI830->transform[0], + &src_x[0], &src_y[0]); + i830_get_transformed_coordinates(srcX, srcY + h, + pI830->transform[0], + &src_x[1], &src_y[1]); + i830_get_transformed_coordinates(srcX + w, srcY + h, + pI830->transform[0], + &src_x[2], &src_y[2]); + + if (pI830->scale_units[1][0] == -1 || pI830->scale_units[1][1] == -1) { + has_mask = FALSE; + } else { + has_mask = TRUE; + i830_get_transformed_coordinates(maskX, maskY, + pI830->transform[1], + &mask_x[0], &mask_y[0]); + i830_get_transformed_coordinates(maskX, maskY + h, + pI830->transform[1], + &mask_x[1], &mask_y[1]); + i830_get_transformed_coordinates(maskX + w, maskY + h, + pI830->transform[1], + &mask_x[2], &mask_y[2]); + } + + { + int vertex_count; + + if (has_mask) + vertex_count = 3*6; + else + vertex_count = 3*4; + + BEGIN_LP_RING(6+vertex_count); + + OUT_RING(MI_NOOP); + OUT_RING(MI_NOOP); + OUT_RING(MI_NOOP); + OUT_RING(MI_NOOP); + OUT_RING(MI_NOOP); + + OUT_RING(PRIM3D_INLINE | PRIM3D_RECTLIST | (vertex_count-1)); + + OUT_RING_F(dstX); + OUT_RING_F(dstY); + OUT_RING_F(src_x[0] / pI830->scale_units[0][0]); + OUT_RING_F(src_y[0] / pI830->scale_units[0][1]); + if (has_mask) { + OUT_RING_F(mask_x[0] / pI830->scale_units[1][0]); + OUT_RING_F(mask_y[0] / pI830->scale_units[1][1]); + } + + OUT_RING_F(dstX); + OUT_RING_F(dstY + h); + OUT_RING_F(src_x[1] / pI830->scale_units[0][0]); + OUT_RING_F(src_y[1] / pI830->scale_units[0][1]); + if (has_mask) { + OUT_RING_F(mask_x[1] / pI830->scale_units[1][0]); + OUT_RING_F(mask_y[1] / pI830->scale_units[1][1]); + } + + OUT_RING_F(dstX + w); + OUT_RING_F(dstY + h); + OUT_RING_F(src_x[2] / pI830->scale_units[0][0]); + OUT_RING_F(src_y[2] / pI830->scale_units[0][1]); + if (has_mask) { + OUT_RING_F(mask_x[2] / pI830->scale_units[1][0]); + OUT_RING_F(mask_y[2] / pI830->scale_units[1][1]); + } + ADVANCE_LP_RING(); + } +} + +void +IntelEXADoneComposite(PixmapPtr pDst) +{ +#if ALWAYS_SYNC + ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum]; + + I830Sync(pScrn); +#endif +} diff --git a/src/i915_exa_render.c b/src/i915_render.c index 2fb41ad1..2fb41ad1 100644 --- a/src/i915_exa_render.c +++ b/src/i915_render.c diff --git a/src/i915_video.c b/src/i915_video.c index 591b6f82..e837097d 100644 --- a/src/i915_video.c +++ b/src/i915_video.c @@ -39,18 +39,6 @@ #include "i915_reg.h" #include "i915_3d.h" -union intfloat { - CARD32 ui; - float f; -}; - -#define OUT_RING_F(x) do { \ - union intfloat _tmp; \ - _tmp.f = x; \ - OUT_RING(_tmp.ui); \ -} while (0) - - void I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id, RegionPtr dstRegion, diff --git a/src/i965_exa_render.c b/src/i965_render.c index 99bd6284..99bd6284 100644 --- a/src/i965_exa_render.c +++ b/src/i965_render.c |