xf86-video-intel: 3 commits - src/i830.h src/i830_render.c src/i915_render.c
Chris Wilson
ickle at kemper.freedesktop.org
Sat Sep 5 03:17:45 PDT 2009
src/i830.h | 4 -
src/i830_render.c | 175 +++++++++++++++++++++++++++++++-----------------------
src/i915_render.c | 28 ++++----
3 files changed, 118 insertions(+), 89 deletions(-)
New commits:
commit 94fc93d4e2b88565dca17f72903d8991213c9ee8
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sat Sep 5 09:35:10 2009 +0100
i830/i915: Set the sample position to the pixel center.
And in particular we apply the nearest sample bias separately for
src/mask.
Fixes cairo/test:
device-offset-scale
finer-grained-fallbacks
mask-transformed-{similar,image}
meta-surface-pattern
pixman-rotate
surface-pattern-big-scale-down
text-transform
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/i830.h b/src/i830.h
index 3b2d166..c8002b4 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 7403125..af6fb6e 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 c81366a..c7858ae 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);
commit ced0cc8bb28106c18473777bb184872786325e99
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sat Sep 5 09:05:36 2009 +0100
i830: Update comments
i830_composite() is no longer shared with i915 but
i830_emit_composite_primitive() is.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/i830_render.c b/src/i830_render.c
index ada2c1f..7403125 100644
--- a/src/i830_render.c
+++ b/src/i830_render.c
@@ -588,6 +588,10 @@ i830_emit_composite_state(ScrnInfoPtr pScrn)
}
}
+/* Emit the vertices for a single composite rectangle.
+ *
+ * This function is shared between i830 and i915 generation code.
+ */
void
i830_emit_composite_primitive(PixmapPtr pDst, int srcX, int srcY,
int maskX, int maskY,
@@ -733,8 +737,6 @@ i830_emit_composite_primitive(PixmapPtr pDst, int srcX, int srcY,
/**
* Do a single rectangle composite operation.
- *
- * This function is shared between i830 and i915 generation code.
*/
void
i830_composite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY,
commit 8863706e25a73f68993d946e2f1c1040bae0f9c5
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sat Sep 5 09:03:56 2009 +0100
i830: Trim composite setup
Remove a couple of redundant NOOPs from the setup and correct the required
space checking for atomic batch operation.
diff --git a/src/i830_render.c b/src/i830_render.c
index 5046ad4..ada2c1f 100644
--- a/src/i830_render.c
+++ b/src/i830_render.c
@@ -529,14 +529,13 @@ i830_emit_composite_state(ScrnInfoPtr pScrn)
IntelEmitInvarientState(pScrn);
pI830->last_3d = LAST_3D_RENDER;
- BEGIN_BATCH(24);
+ BEGIN_BATCH(22);
OUT_BATCH(_3DSTATE_BUF_INFO_CMD);
OUT_BATCH(BUF_3D_ID_COLOR_BACK| BUF_3D_USE_FENCE |
BUF_3D_PITCH(intel_get_pixmap_pitch(pI830->render_dst)));
OUT_RELOC_PIXMAP(pI830->render_dst,
I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, 0);
- OUT_BATCH(MI_NOOP);
OUT_BATCH(_3DSTATE_DST_BUF_VARS_CMD);
OUT_BATCH(pI830->render_dst_format);
@@ -550,20 +549,21 @@ i830_emit_composite_state(ScrnInfoPtr pScrn)
OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 |
I1_LOAD_S(2) |
- I1_LOAD_S(3) | 1);
+ I1_LOAD_S(3) |
+ I1_LOAD_S(8) |
+ 2);
if (pI830->render_mask)
vf2 = 2 << 12; /* 2 texture coord sets */
else
vf2 = 1 << 12;
OUT_BATCH(vf2); /* TEXCOORDFMT_2D */
OUT_BATCH(S3_CULLMODE_NONE | S3_VERTEXHAS_XY);
-
- OUT_BATCH(_3DSTATE_INDPT_ALPHA_BLEND_CMD | DISABLE_INDPT_ALPHA_BLEND);
- OUT_BATCH(MI_NOOP);
- OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | I1_LOAD_S(8) | 0);
OUT_BATCH(S8_ENABLE_COLOR_BLEND | S8_BLENDFUNC_ADD | pI830->s8_blendctl |
S8_ENABLE_COLOR_BUFFER_WRITE);
+ OUT_BATCH(_3DSTATE_INDPT_ALPHA_BLEND_CMD | DISABLE_INDPT_ALPHA_BLEND);
+ OUT_BATCH(0);
+
OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_2 |
LOAD_TEXTURE_BLEND_STAGE(0)|1);
OUT_BATCH(pI830->cblend);
@@ -745,9 +745,9 @@ i830_composite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY,
intel_batch_start_atomic(pScrn,
58 + /* invarient */
- 24 + /* setup */
+ 22 + /* setup */
20 + /* 2 * setup_texture */
- 6 + 30 /* verts */);
+ 1 + 30 /* verts */);
if (pI830->needs_render_state_emit)
i830_emit_composite_state(pScrn);
More information about the xorg-commit
mailing list