xf86-video-intel: 2 commits - src/i965_render.c

Carl Worth cworth at kemper.freedesktop.org
Wed Oct 1 15:33:51 PDT 2008


 src/i965_render.c |   35 ++++++++++++++++++++++++++++-------
 1 file changed, 28 insertions(+), 7 deletions(-)

New commits:
commit 128223ee9b7880e640056475462eca9a88415492
Author: Carl Worth <cworth at cworth.org>
Date:   Wed Oct 1 15:29:04 2008 -0700

    Add support for RepeatPad and RepeatReflect.
    
    It's quite simple to support these modes---we simply need to
    turn on the support for them in the hardware.
    
    These changes have been verified with the extend-pad and
    extend-reflect tests in cairo's test suite. However, this
    currently required using a custom-modified version of cairo.
    The issue is that released versions of cairo, (and even
    cairo master so far), don't pass RepeatPad and RepeatReflect
    to Render, (due to various bugs and workarounds in cairo
    and pixman). I do plan to fix those issues in cairo, so that
    in a future release of cairo, (1.8.2 perhaps?), the cairo
    test suite will usefully test these new repeat modes in our
    driver.

diff --git a/src/i965_render.c b/src/i965_render.c
index b4a2a73..498fa1f 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -209,7 +209,7 @@ static Bool i965_check_composite_texture(PicturePtr pPict, int unit)
         I830FALLBACK("Unsupported picture format 0x%x\n",
 		     (int)pPict->format);
 
-    if (pPict->repeat && pPict->repeatType != RepeatNormal)
+    if (pPict->repeat && pPict->repeatType > RepeatReflect)
 	I830FALLBACK("extended repeat (%d) not supported\n",
 		     pPict->repeatType);
 
@@ -427,6 +427,8 @@ typedef enum {
 typedef enum {
     SAMPLER_STATE_EXTEND_NONE,
     SAMPLER_STATE_EXTEND_REPEAT,
+    SAMPLER_STATE_EXTEND_PAD,
+    SAMPLER_STATE_EXTEND_REFLECT,
     SAMPLER_STATE_EXTEND_COUNT
 } sampler_state_extend_t;
 
@@ -596,6 +598,16 @@ sampler_state_init (struct brw_sampler_state *sampler_state,
 	sampler_state->ss1.s_wrap_mode = BRW_TEXCOORDMODE_WRAP;
 	sampler_state->ss1.t_wrap_mode = BRW_TEXCOORDMODE_WRAP;
 	break;
+    case SAMPLER_STATE_EXTEND_PAD:
+	sampler_state->ss1.r_wrap_mode = BRW_TEXCOORDMODE_CLAMP;
+	sampler_state->ss1.s_wrap_mode = BRW_TEXCOORDMODE_CLAMP;
+	sampler_state->ss1.t_wrap_mode = BRW_TEXCOORDMODE_CLAMP;
+	break;
+    case SAMPLER_STATE_EXTEND_REFLECT:
+	sampler_state->ss1.r_wrap_mode = BRW_TEXCOORDMODE_MIRROR;
+	sampler_state->ss1.s_wrap_mode = BRW_TEXCOORDMODE_MIRROR;
+	sampler_state->ss1.t_wrap_mode = BRW_TEXCOORDMODE_MIRROR;
+	break;
     }
 
     assert((default_color_offset & 31) == 0);
@@ -838,6 +850,10 @@ sampler_state_extend_from_picture (int repeat, int repeat_type)
 	return SAMPLER_STATE_EXTEND_NONE;
     case RepeatNormal:
 	return SAMPLER_STATE_EXTEND_REPEAT;
+    case RepeatPad:
+	return SAMPLER_STATE_EXTEND_PAD;
+    case RepeatReflect:
+	return SAMPLER_STATE_EXTEND_REFLECT;
     default:
 	return -1;
     }
commit b7279f1be1b913c1c6ee8ebfb95c97800217a821
Author: Carl Worth <cworth at cworth.org>
Date:   Wed Oct 1 15:26:39 2008 -0700

    Examine picture repeatType as well as repeat field.
    
    The existing switch statement was switching on the Boolean
    repeat field rather than the correct repeatType field. This
    had not caused any problem before as only two possible repeat
    values were supported (RepeatNone = 0 and RepeatNormal = 1)
    so they were always the same as the repeat field.
    
    Soon, however, we'll be supporting more repeat types, so we'll
    need to switch on the correct value.

diff --git a/src/i965_render.c b/src/i965_render.c
index 7dee5f3..b4a2a73 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -828,9 +828,12 @@ sampler_state_filter_from_picture (int filter)
 }
 
 static sampler_state_extend_t
-sampler_state_extend_from_picture (int repeat)
+sampler_state_extend_from_picture (int repeat, int repeat_type)
 {
-    switch (repeat) {
+    if (repeat == 0)
+	return SAMPLER_STATE_EXTEND_NONE;
+
+    switch (repeat_type) {
     case RepeatNone:
 	return SAMPLER_STATE_EXTEND_NONE;
     case RepeatNormal:
@@ -1010,17 +1013,19 @@ i965_prepare_composite(int op, PicturePtr pSrcPicture,
     src_filter = sampler_state_filter_from_picture (pSrcPicture->filter);
     if (src_filter < 0)
 	I830FALLBACK ("Bad src filter 0x%x\n", pSrcPicture->filter);
-    src_extend = sampler_state_extend_from_picture (pSrcPicture->repeat);
+    src_extend = sampler_state_extend_from_picture (pSrcPicture->repeat,
+						    pSrcPicture->repeatType);
     if (src_extend < 0)
-	I830FALLBACK ("Bad src repeat 0x%x\n", pSrcPicture->repeat);
+	I830FALLBACK ("Bad src repeat 0x%x\n", pSrcPicture->repeatType);
 
     if (pMaskPicture) {
 	mask_filter = sampler_state_filter_from_picture (pMaskPicture->filter);
 	if (mask_filter < 0)
 	    I830FALLBACK ("Bad mask filter 0x%x\n", pMaskPicture->filter);
-	mask_extend = sampler_state_extend_from_picture (pMaskPicture->repeat);
+	mask_extend = sampler_state_extend_from_picture (pMaskPicture->repeat,
+							 pMaskPicture->repeatType);
 	if (mask_extend < 0)
-	    I830FALLBACK ("Bad mask repeat 0x%x\n", pMaskPicture->repeat);
+	    I830FALLBACK ("Bad mask repeat 0x%x\n", pMaskPicture->repeatType);
     } else {
 	mask_filter = SAMPLER_STATE_FILTER_NEAREST;
 	mask_extend = SAMPLER_STATE_EXTEND_NONE;


More information about the xorg-commit mailing list