xf86-video-intel: 3 commits - src/brw_defines.h src/brw_structs.h src/i965_render.c
Carl Worth
cworth at kemper.freedesktop.org
Mon Oct 6 13:23:47 PDT 2008
src/brw_defines.h | 3 ++
src/brw_structs.h | 22 ++++++++++++++---
src/i965_render.c | 69 ++++++++++++++----------------------------------------
3 files changed, 40 insertions(+), 54 deletions(-)
New commits:
commit 260cbcfe61868175ba3e649ce07d43f57601f9be
Author: Carl Worth <cworth at cworth.org>
Date: Mon Oct 6 13:17:59 2008 -0700
Document and use 'legacy' border color mode
It's very convenient that the hardware supports this non-default
mode since it's exactly what is specified by the Render extension.
This provides a more efficient means of fixing bug #16820:
[EXA] Composition result in black for areas outside of source-surface bo
https://bugs.freedesktop.org/show_bug.cgi?id=16820
without the software fallback we had in the earlier fix,
(commit 76c9ece36e6400fd10f364ee330faea470e2da64 ).
diff --git a/src/brw_defines.h b/src/brw_defines.h
index 13cb439..0df2491 100644
--- a/src/brw_defines.h
+++ b/src/brw_defines.h
@@ -466,6 +466,9 @@
#define BRW_SURFACE_BUFFER 4
#define BRW_SURFACE_NULL 7
+#define BRW_BORDER_COLOR_MODE_DEFAULT 0
+#define BRW_BORDER_COLOR_MODE_LEGACY 1
+
#define BRW_TEXCOORDMODE_WRAP 0
#define BRW_TEXCOORDMODE_MIRROR 1
#define BRW_TEXCOORDMODE_CLAMP 2
diff --git a/src/brw_structs.h b/src/brw_structs.h
index 553aeeb..022915d 100644
--- a/src/brw_structs.h
+++ b/src/brw_structs.h
@@ -840,10 +840,26 @@ struct brw_wm_unit_state
float global_depth_offset_scale;
};
-struct brw_sampler_border_color {
+/* The hardware supports two different modes for border color. The
+ * default (OpenGL) mode uses floating-point color channels, while the
+ * legacy mode uses 4 bytes.
+ *
+ * More significantly, the legacy mode respects the components of the
+ * border color for channels not present in the source, (whereas the
+ * default mode will ignore the border color's alpha channel and use
+ * alpha==1 for an RGB source, for example).
+ *
+ * The legacy mode matches the semantics specified by the Render
+ * extension.
+ */
+struct brw_sampler_default_border_color {
float color[4];
};
+struct brw_sampler_legacy_border_color {
+ uint8_t color[4];
+};
+
struct brw_sampler_state
{
diff --git a/src/i965_render.c b/src/i965_render.c
index 4bffe0d..9ee273c 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -496,8 +496,8 @@ typedef struct _gen4_state {
[SAMPLER_STATE_FILTER_COUNT]
[SAMPLER_STATE_EXTEND_COUNT][2];
- struct brw_sampler_border_color sampler_border_color;
- PAD64 (brw_sampler_border_color, 0);
+ struct brw_sampler_legacy_border_color sampler_border_color;
+ PAD64 (brw_sampler_legacy_border_color, 0);
/* Index by [src_blend][dst_blend] */
brw_cc_unit_state_padded cc_state[BRW_BLENDFACTOR_COUNT]
@@ -572,7 +572,10 @@ sampler_state_init (struct brw_sampler_state *sampler_state,
memset(sampler_state, 0, sizeof(*sampler_state));
sampler_state->ss0.lod_preclamp = 1; /* GL mode */
- sampler_state->ss0.border_color_mode = 0; /* GL mode */
+
+ /* We use the legacy mode to get the semantics specified by
+ * the Render extension. */
+ sampler_state->ss0.border_color_mode = BRW_BORDER_COLOR_MODE_LEGACY;
switch(filter) {
default:
@@ -734,13 +737,13 @@ gen4_state_init (struct gen4_render_state *render_state)
card_state->vs_state.vs6.vs_enable = 0;
card_state->vs_state.vs6.vert_cache_disable = 1;
- /* Set up the sampler default color (always transparent black) */
+ /* Set up the sampler border color (always transparent black) */
memset(&card_state->sampler_border_color, 0,
sizeof(card_state->sampler_border_color));
- card_state->sampler_border_color.color[0] = 0.0; /* R */
- card_state->sampler_border_color.color[1] = 0.0; /* G */
- card_state->sampler_border_color.color[2] = 0.0; /* B */
- card_state->sampler_border_color.color[3] = 0.0; /* A */
+ card_state->sampler_border_color.color[0] = 0; /* R */
+ card_state->sampler_border_color.color[1] = 0; /* G */
+ card_state->sampler_border_color.color[2] = 0; /* B */
+ card_state->sampler_border_color.color[3] = 0; /* A */
card_state->cc_viewport.min_depth = -1.e35;
card_state->cc_viewport.max_depth = 1.e35;
commit 98ca9e2af1b0a67ed91e10cf661af70dfba44d43
Author: Carl Worth <cworth at cworth.org>
Date: Mon Oct 6 13:16:37 2008 -0700
Rename default_color to border_color
This is consistent with the documentation, (and just plain makes
more sense).
diff --git a/src/brw_structs.h b/src/brw_structs.h
index ef7906b..553aeeb 100644
--- a/src/brw_structs.h
+++ b/src/brw_structs.h
@@ -840,7 +840,7 @@ struct brw_wm_unit_state
float global_depth_offset_scale;
};
-struct brw_sampler_default_color {
+struct brw_sampler_border_color {
float color[4];
};
@@ -857,7 +857,7 @@ struct brw_sampler_state
unsigned int base_level:5;
unsigned int pad:1;
unsigned int lod_preclamp:1;
- unsigned int default_color_mode:1;
+ unsigned int border_color_mode:1;
unsigned int pad0:1;
unsigned int disable:1;
} ss0;
@@ -876,7 +876,7 @@ struct brw_sampler_state
struct
{
unsigned int pad:5;
- unsigned int default_color_pointer:27;
+ unsigned int border_color_pointer:27;
} ss2;
struct
diff --git a/src/i965_render.c b/src/i965_render.c
index 2b59e91..4bffe0d 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -496,8 +496,8 @@ typedef struct _gen4_state {
[SAMPLER_STATE_FILTER_COUNT]
[SAMPLER_STATE_EXTEND_COUNT][2];
- struct brw_sampler_default_color sampler_default_color;
- PAD64 (brw_sampler_default_color, 0);
+ struct brw_sampler_border_color sampler_border_color;
+ PAD64 (brw_sampler_border_color, 0);
/* Index by [src_blend][dst_blend] */
brw_cc_unit_state_padded cc_state[BRW_BLENDFACTOR_COUNT]
@@ -566,13 +566,13 @@ static void
sampler_state_init (struct brw_sampler_state *sampler_state,
sampler_state_filter_t filter,
sampler_state_extend_t extend,
- int default_color_offset)
+ int border_color_offset)
{
/* PS kernel use this sampler */
memset(sampler_state, 0, sizeof(*sampler_state));
sampler_state->ss0.lod_preclamp = 1; /* GL mode */
- sampler_state->ss0.default_color_mode = 0; /* GL mode */
+ sampler_state->ss0.border_color_mode = 0; /* GL mode */
switch(filter) {
default:
@@ -610,8 +610,8 @@ sampler_state_init (struct brw_sampler_state *sampler_state,
break;
}
- assert((default_color_offset & 31) == 0);
- sampler_state->ss2.default_color_pointer = default_color_offset >> 5;
+ assert((border_color_offset & 31) == 0);
+ sampler_state->ss2.border_color_pointer = border_color_offset >> 5;
sampler_state->ss3.chroma_key_enable = 0; /* disable chromakey */
}
@@ -735,12 +735,12 @@ gen4_state_init (struct gen4_render_state *render_state)
card_state->vs_state.vs6.vert_cache_disable = 1;
/* Set up the sampler default color (always transparent black) */
- memset(&card_state->sampler_default_color, 0,
- sizeof(card_state->sampler_default_color));
- card_state->sampler_default_color.color[0] = 0.0; /* R */
- card_state->sampler_default_color.color[1] = 0.0; /* G */
- card_state->sampler_default_color.color[2] = 0.0; /* B */
- card_state->sampler_default_color.color[3] = 0.0; /* A */
+ memset(&card_state->sampler_border_color, 0,
+ sizeof(card_state->sampler_border_color));
+ card_state->sampler_border_color.color[0] = 0.0; /* R */
+ card_state->sampler_border_color.color[1] = 0.0; /* G */
+ card_state->sampler_border_color.color[2] = 0.0; /* B */
+ card_state->sampler_border_color.color[3] = 0.0; /* A */
card_state->cc_viewport.min_depth = -1.e35;
card_state->cc_viewport.max_depth = 1.e35;
@@ -760,12 +760,12 @@ gen4_state_init (struct gen4_render_state *render_state)
i, j,
state_base_offset +
offsetof (gen4_state_t,
- sampler_default_color));
+ sampler_border_color));
sampler_state_init (&card_state->sampler_state[i][j][k][l][1],
k, l,
state_base_offset +
offsetof (gen4_state_t,
- sampler_default_color));
+ sampler_border_color));
}
}
}
commit 175b30e3828266a89021c2439119545099d72715
Author: Carl Worth <cworth at cworth.org>
Date: Mon Oct 6 12:48:07 2008 -0700
Revert "Fallback to software for RepeatNone with transformed RGB-only pictures."
This reverts commit 76c9ece36e6400fd10f364ee330faea470e2da64.
We've learned a new technique that should let us avoid this fallback
to software. See following commit.
diff --git a/src/i965_render.c b/src/i965_render.c
index 709f3fd..2b59e91 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -254,42 +254,6 @@ i965_check_composite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
if (!i965_get_dest_format(pDstPicture, &tmp1))
I830FALLBACK("Get Color buffer format\n");
- /* There's an infelicity of the 965 with respect to implementing
- * RepeatNone for a source picture without alpha. The hardware's
- * CLAMP_BORDER mode in this case doesn't match what Render, (and
- * everyone, really), wants. Render expects that samples outside
- * the bounds of the source picture will be transparent, but the
- * hardware is documented as follows:
- *
- * For surface formats with one or more channels missing, the
- * value from the border color is not used for the missing
- * channels, resulting in these channels resulting in the
- * overall default value (0 for colors and 1 for alpha)
- * regardless of whether border color is chosen.
- *
- * [Intel 965 PRM; Volume 4; Section 4.7.4 SAMPLER_BORDER_COLOR_STATE]
- *
- * It's that hard-coding of "1 for alpha" that kills us. Until we
- * figure out a way to get the hardware to do what we want, we'll
- * fall back to software. We fall back only if the operator uses
- * the source alpha, the source format has no alpha, and there's
- * a transform.
- *
- * For more complicated scenarios where there's a transform, but
- * it won't actually result in any sampling outside the source
- * picture, we'll have to rely on a higher layer,
- * (ReduceCompositeOp in render/picture.c), that actually has
- * access to the coordinates, to simplify the operator from Over
- * to Source, for example.
- */
- if (i965_blend_op[op].src_alpha &&
- (PICT_FORMAT_A(pSrcPicture->format) == 0) &&
- pSrcPicture->transform)
- {
- I830FALLBACK("No support for alpha (RepeatNone) for an RGB-only picture\n");
- }
-
-
return TRUE;
}
More information about the xorg-commit
mailing list