summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/i830.h4
-rw-r--r--src/i830_render.c151
-rw-r--r--src/i915_render.c28
3 files changed, 105 insertions, 78 deletions
diff --git a/src/i830.h b/src/i830.h
index 3b2d1661..c8002b48 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -467,7 +467,8 @@ typedef struct _I830Rec {
float scale_units[2][2];
/** Transform pointers for src/mask, or NULL if identity */
PictTransform *transform[2];
- float coord_adjust;
+ float src_coord_adjust;
+ float mask_coord_adjust;
/* i830 render accel state */
PixmapPtr render_src, render_mask, render_dst;
@@ -483,7 +484,6 @@ typedef struct _I830Rec {
struct {
int op;
uint32_t dst_format;
- Bool is_nearest;
Bool needs_emit;
} i915_render_state;
diff --git a/src/i830_render.c b/src/i830_render.c
index 74031253..af6fb6ed 100644
--- a/src/i830_render.c
+++ b/src/i830_render.c
@@ -143,8 +143,6 @@ static struct formatinfo i830_tex_formats[] = {
static Bool i830_get_dest_format(PicturePtr pDstPicture, uint32_t *dst_format)
{
- ScrnInfoPtr pScrn = xf86Screens[pDstPicture->pDrawable->pScreen->myNum];
-
switch (pDstPicture->format) {
case PICT_a8r8g8b8:
case PICT_x8r8g8b8:
@@ -165,10 +163,15 @@ static Bool i830_get_dest_format(PicturePtr pDstPicture, uint32_t *dst_format)
*dst_format = COLR_BUF_ARGB4444;
break;
default:
- I830FALLBACK("Unsupported dest format 0x%x\n",
- (int)pDstPicture->format);
- }
+ {
+ ScrnInfoPtr pScrn;
+ pScrn = xf86Screens[pDstPicture->pDrawable->pScreen->myNum];
+ I830FALLBACK("Unsupported dest format 0x%x\n",
+ (int)pDstPicture->format);
+ }
+ }
+ *dst_format |= DSTORG_HORT_BIAS (0x8) | DSTORG_VERT_BIAS (0x8);
return TRUE;
}
@@ -395,7 +398,6 @@ i830_prepare_composite(int op, PicturePtr pSrcPicture,
{
ScrnInfoPtr pScrn = xf86Screens[pSrcPicture->pDrawable->pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
- Bool is_nearest = FALSE;
pI830->render_src_picture = pSrcPicture;
pI830->render_src = pSrc;
@@ -412,22 +414,19 @@ i830_prepare_composite(int op, PicturePtr pSrcPicture,
if (!i830_get_dest_format(pDstPicture, &pI830->render_dst_format))
return FALSE;
+ pI830->src_coord_adjust = 0;
if (pSrcPicture->filter == PictFilterNearest)
- is_nearest = TRUE;
+ pI830->src_coord_adjust = 0.375;
if (pMask != NULL) {
+ pI830->mask_coord_adjust = 0;
if (pMaskPicture->filter == PictFilterNearest)
- is_nearest = TRUE;
+ pI830->mask_coord_adjust = 0.375;
} else {
pI830->transform[1] = NULL;
pI830->scale_units[1][0] = -1;
pI830->scale_units[1][1] = -1;
}
- if (is_nearest)
- pI830->coord_adjust = -0.125;
- else
- pI830->coord_adjust = 0;
-
{
uint32_t cblend, ablend, blendctl;
@@ -593,9 +592,11 @@ i830_emit_composite_state(ScrnInfoPtr pScrn)
* This function is shared between i830 and i915 generation code.
*/
void
-i830_emit_composite_primitive(PixmapPtr pDst, int srcX, int srcY,
+i830_emit_composite_primitive(PixmapPtr pDst,
+ int srcX, int srcY,
int maskX, int maskY,
- int dstX, int dstY, int w, int h)
+ int dstX, int dstY,
+ int w, int h)
{
ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
@@ -605,72 +606,98 @@ i830_emit_composite_primitive(PixmapPtr pDst, int srcX, int srcY,
per_vertex = 2; /* dest x/y */
- is_affine_src = i830_transform_is_affine (pI830->transform[0]);
- if (is_affine_src)
{
- if (!i830_get_transformed_coordinates(srcX, srcY,
- pI830->transform[0],
- &src_x[0], &src_y[0]))
- return;
- if (!i830_get_transformed_coordinates(srcX, srcY + h,
- pI830->transform[0],
- &src_x[1], &src_y[1]))
- return;
- if (!i830_get_transformed_coordinates(srcX + w, srcY + h,
- pI830->transform[0],
- &src_x[2], &src_y[2]))
- return;
- per_vertex += 2; /* src x/y */
- } else {
- if (!i830_get_transformed_coordinates_3d(srcX, srcY,
- pI830->transform[0],
- &src_x[0], &src_y[0],
- &src_w[0]))
- return;
- if (!i830_get_transformed_coordinates_3d(srcX, srcY + h,
- pI830->transform[0],
- &src_x[1], &src_y[1],
- &src_w[1]))
- return;
- if (!i830_get_transformed_coordinates_3d(srcX + w, srcY + h,
- pI830->transform[0],
- &src_x[2], &src_y[2],
- &src_w[2]))
- return;
- per_vertex += 4; /* src x/y/z/w */
+ float x = srcX + pI830->src_coord_adjust;
+ float y = srcY + pI830->src_coord_adjust;
+
+ is_affine_src = i830_transform_is_affine (pI830->transform[0]);
+ if (is_affine_src) {
+ if (!i830_get_transformed_coordinates(x, y,
+ pI830->transform[0],
+ &src_x[0], &src_y[0]))
+ return;
+
+ if (!i830_get_transformed_coordinates(x, y + h,
+ pI830->transform[0],
+ &src_x[1], &src_y[1]))
+ return;
+
+ if (!i830_get_transformed_coordinates(x + w, y + h,
+ pI830->transform[0],
+ &src_x[2], &src_y[2]))
+ return;
+
+ per_vertex += 2; /* src x/y */
+ } else {
+ if (!i830_get_transformed_coordinates_3d(x, y,
+ pI830->transform[0],
+ &src_x[0],
+ &src_y[0],
+ &src_w[0]))
+ return;
+
+ if (!i830_get_transformed_coordinates_3d(x, y + h,
+ pI830->transform[0],
+ &src_x[1],
+ &src_y[1],
+ &src_w[1]))
+ return;
+
+ if (!i830_get_transformed_coordinates_3d(x + w, y + h,
+ pI830->transform[0],
+ &src_x[2],
+ &src_y[2],
+ &src_w[2]))
+ return;
+
+ per_vertex += 4; /* src x/y/z/w */
+ }
}
+
if (pI830->render_mask) {
+ float x = maskX + pI830->mask_coord_adjust;
+ float y = maskY + pI830->mask_coord_adjust;
+
is_affine_mask = i830_transform_is_affine (pI830->transform[1]);
if (is_affine_mask) {
- if (!i830_get_transformed_coordinates(maskX, maskY,
+ if (!i830_get_transformed_coordinates(x, y,
pI830->transform[1],
&mask_x[0], &mask_y[0]))
return;
- if (!i830_get_transformed_coordinates(maskX, maskY + h,
+
+ if (!i830_get_transformed_coordinates(x, y + h,
pI830->transform[1],
&mask_x[1], &mask_y[1]))
return;
- if (!i830_get_transformed_coordinates(maskX + w, maskY + h,
+
+ if (!i830_get_transformed_coordinates(x + w, y + h,
pI830->transform[1],
&mask_x[2], &mask_y[2]))
return;
+
per_vertex += 2; /* mask x/y */
} else {
- if (!i830_get_transformed_coordinates_3d(maskX, maskY,
+ if (!i830_get_transformed_coordinates_3d(x, y,
pI830->transform[1],
- &mask_x[0], &mask_y[0],
+ &mask_x[0],
+ &mask_y[0],
&mask_w[0]))
return;
- if (!i830_get_transformed_coordinates_3d(maskX, maskY + h,
+
+ if (!i830_get_transformed_coordinates_3d(x, y + h,
pI830->transform[1],
- &mask_x[1], &mask_y[1],
+ &mask_x[1],
+ &mask_y[1],
&mask_w[1]))
return;
- if (!i830_get_transformed_coordinates_3d(maskX + w, maskY + h,
+
+ if (!i830_get_transformed_coordinates_3d(x + w, y + h,
pI830->transform[1],
- &mask_x[2], &mask_y[2],
+ &mask_x[2],
+ &mask_y[2],
&mask_w[2]))
return;
+
per_vertex += 4; /* mask x/y/z/w */
}
}
@@ -680,8 +707,8 @@ i830_emit_composite_primitive(PixmapPtr pDst, int srcX, int srcY,
BEGIN_BATCH(1 + num_floats);
OUT_BATCH(PRIM3D_INLINE | PRIM3D_RECTLIST | (num_floats-1));
- OUT_BATCH_F(pI830->coord_adjust + dstX + w);
- OUT_BATCH_F(pI830->coord_adjust + dstY + h);
+ OUT_BATCH_F(dstX + w);
+ OUT_BATCH_F(dstY + h);
OUT_BATCH_F(src_x[2] / pI830->scale_units[0][0]);
OUT_BATCH_F(src_y[2] / pI830->scale_units[0][1]);
if (!is_affine_src) {
@@ -697,8 +724,8 @@ i830_emit_composite_primitive(PixmapPtr pDst, int srcX, int srcY,
}
}
- OUT_BATCH_F(pI830->coord_adjust + dstX);
- OUT_BATCH_F(pI830->coord_adjust + dstY + h);
+ OUT_BATCH_F(dstX);
+ OUT_BATCH_F(dstY + h);
OUT_BATCH_F(src_x[1] / pI830->scale_units[0][0]);
OUT_BATCH_F(src_y[1] / pI830->scale_units[0][1]);
if (!is_affine_src) {
@@ -714,8 +741,8 @@ i830_emit_composite_primitive(PixmapPtr pDst, int srcX, int srcY,
}
}
- OUT_BATCH_F(pI830->coord_adjust + dstX);
- OUT_BATCH_F(pI830->coord_adjust + dstY);
+ OUT_BATCH_F(dstX);
+ OUT_BATCH_F(dstY);
OUT_BATCH_F(src_x[0] / pI830->scale_units[0][0]);
OUT_BATCH_F(src_y[0] / pI830->scale_units[0][1]);
if (!is_affine_src) {
diff --git a/src/i915_render.c b/src/i915_render.c
index c81366ae..c7858aec 100644
--- a/src/i915_render.c
+++ b/src/i915_render.c
@@ -138,8 +138,6 @@ static uint32_t i915_get_blend_cntl(int op, PicturePtr pMask,
static Bool i915_get_dest_format(PicturePtr pDstPicture, uint32_t *dst_format)
{
- ScrnInfoPtr pScrn = xf86Screens[pDstPicture->pDrawable->pScreen->myNum];
-
switch (pDstPicture->format) {
case PICT_a8r8g8b8:
case PICT_x8r8g8b8:
@@ -160,10 +158,15 @@ static Bool i915_get_dest_format(PicturePtr pDstPicture, uint32_t *dst_format)
*dst_format = COLR_BUF_ARGB4444;
break;
default:
- I830FALLBACK("Unsupported dest format 0x%x\n",
- (int)pDstPicture->format);
- }
+ {
+ ScrnInfoPtr pScrn;
+ pScrn = xf86Screens[pDstPicture->pDrawable->pScreen->myNum];
+ I830FALLBACK("Unsupported dest format 0x%x\n",
+ (int)pDstPicture->format);
+ }
+ }
+ *dst_format |= DSTORG_HORT_BIAS (0x8) | DSTORG_VERT_BIAS (0x8);
return TRUE;
}
@@ -341,16 +344,19 @@ i915_prepare_composite(int op, PicturePtr pSrcPicture,
if (!i830_get_aperture_space(pScrn, bo_table, ARRAY_SIZE(bo_table)))
return FALSE;
- pI830->i915_render_state.is_nearest = FALSE;
if (!i915_texture_setup(pSrcPicture, pSrc, 0))
I830FALLBACK("fail to setup src texture\n");
+
+ pI830->src_coord_adjust = 0;
if (pSrcPicture->filter == PictFilterNearest)
- pI830->i915_render_state.is_nearest = TRUE;
+ pI830->src_coord_adjust = 0.375;
if (pMask != NULL) {
if (!i915_texture_setup(pMaskPicture, pMask, 1))
I830FALLBACK("fail to setup mask texture\n");
+
+ pI830->mask_coord_adjust = 0;
if (pMaskPicture->filter == PictFilterNearest)
- pI830->i915_render_state.is_nearest = TRUE;
+ pI830->mask_coord_adjust = 0.375;
} else {
pI830->transform[1] = NULL;
pI830->scale_units[1][0] = -1;
@@ -379,7 +385,6 @@ i915_emit_composite_setup(ScrnInfoPtr pScrn)
int out_reg = FS_OC;
FS_LOCALS(20);
Bool is_affine_src, is_affine_mask;
- Bool is_nearest = pI830->i915_render_state.is_nearest;
pI830->i915_render_state.needs_emit = FALSE;
@@ -391,11 +396,6 @@ i915_emit_composite_setup(ScrnInfoPtr pScrn)
is_affine_src = i830_transform_is_affine (pI830->transform[0]);
is_affine_mask = i830_transform_is_affine (pI830->transform[1]);
- if (is_nearest)
- pI830->coord_adjust = -0.125;
- else
- pI830->coord_adjust = 0;
-
if (pMask == NULL) {
BEGIN_BATCH(10);
OUT_BATCH(_3DSTATE_MAP_STATE | 3);