[cairo-commit] 2 commits - src/drm

Chris Wilson ickle at kemper.freedesktop.org
Thu Jun 24 09:29:29 PDT 2010


 src/drm/cairo-drm-i915-private.h          |    2 +-
 src/drm/cairo-drm-i915-shader.c           |    2 +-
 src/drm/cairo-drm-i915-surface.c          |   24 ++++++------------------
 src/drm/cairo-drm-i965-shader.c           |   17 +++++++----------
 src/drm/cairo-drm-intel-command-private.h |    4 ++--
 src/drm/cairo-drm-intel.c                 |    3 +--
 6 files changed, 18 insertions(+), 34 deletions(-)

New commits:
commit 1099a3515b6a69e2ff360d8e6b1df71e3ea5c213
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Jun 24 17:22:34 2010 +0100

    drm/intel: Fix common off-by-one by rewriting the [XY]MAX macro.
    
    Many rectangles in the command stream are specified as inclusive rects,
    i.e. the max values are (width-1, height-1), which is easy to neglect.

diff --git a/src/drm/cairo-drm-i915-private.h b/src/drm/cairo-drm-i915-private.h
index f03d5d7..1581cab 100644
--- a/src/drm/cairo-drm-i915-private.h
+++ b/src/drm/cairo-drm-i915-private.h
@@ -705,7 +705,7 @@ struct i915_device {
 
     cairo_list_t image_caches[2];
 
-    uint32_t batch_header[18];
+    uint32_t batch_header[13];
     uint32_t batch_base[I915_BATCH_SIZE / sizeof (uint32_t)];
     uint8_t vbo_base[I915_VBO_SIZE];
 };
diff --git a/src/drm/cairo-drm-i915-surface.c b/src/drm/cairo-drm-i915-surface.c
index b9adf92..f80612c 100644
--- a/src/drm/cairo-drm-i915-surface.c
+++ b/src/drm/cairo-drm-i915-surface.c
@@ -136,12 +136,6 @@ static const uint32_t i915_batch_setup[] = {
 	CSB_TCB (6, 6) |
 	CSB_TCB (7, 7),
 
-    _3DSTATE_RASTER_RULES_CMD |
-	ENABLE_POINT_RASTER_RULE | OGL_POINT_RASTER_RULE |
-	ENABLE_LINE_STRIP_PROVOKE_VRTX | LINE_STRIP_PROVOKE_VRTX (1) |
-	ENABLE_TRI_FAN_PROVOKE_VRTX | TRI_FAN_PROVOKE_VRTX (2) |
-	ENABLE_TEXKILL_3D_4D | TEXKILL_4D,
-
     _3DSTATE_MODES_4_CMD | ENABLE_LOGIC_OP_FUNC | LOGIC_OP_FUNC (LOGICOP_COPY),
 
     _3DSTATE_LOAD_STATE_IMMEDIATE_1 |
@@ -165,16 +159,10 @@ static const uint32_t i915_batch_setup[] = {
     S6_COLOR_WRITE_ENABLE,
 
     _3DSTATE_SCISSOR_ENABLE_CMD | DISABLE_SCISSOR_RECT,
-    _3DSTATE_DEPTH_SUBRECT_DISABLE,
 
     /* disable indirect state */
     _3DSTATE_LOAD_INDIRECT,
     0,
-
-    _3DSTATE_STIPPLE,
-    0,
-
-    _3DSTATE_BACKFACE_STENCIL_OPS | BFO_ENABLE_STENCIL_TWO_SIDE,
 };
 
 static const cairo_surface_backend_t i915_surface_backend;
@@ -559,7 +547,7 @@ i915_batch_flush (i915_device_t *device)
 	return CAIRO_STATUS_SUCCESS;
 
     i915_batch_emit_dword (device, MI_BATCH_BUFFER_END);
-    if ((device->batch.used & 1) != (sizeof (device->batch_header) & 4))
+    if ((device->batch.used & 1) != ((sizeof (device->batch_header)>>2) & 1))
 	i915_batch_emit_dword (device, MI_NOOP);
 
     length = (device->batch.used << 2) + sizeof (device->batch_header);
@@ -1091,7 +1079,7 @@ i915_blt (i915_surface_t *src,
     OUT_DWORD (cmd);
     OUT_DWORD (br13);
     OUT_DWORD ((dst_y << 16) | dst_x);
-    OUT_DWORD (((dst_y + height) << 16) | (dst_x + width));
+    OUT_DWORD (((dst_y + height - 1) << 16) | (dst_x + width - 1));
     OUT_RELOC_FENCED (dst, I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER);
     OUT_DWORD ((src_y << 16) | src_x);
     OUT_DWORD (src->intel.drm.stride);
@@ -1198,7 +1186,7 @@ i915_clear_boxes (i915_surface_t *dst,
 	    OUT_DWORD (cmd);
 	    OUT_DWORD (br13);
 	    OUT_DWORD ((y1 << 16) | x1);
-	    OUT_DWORD ((y2 << 16) | x2);
+	    OUT_DWORD (((y2 - 1) << 16) | (x2 - 1));
 	    OUT_RELOC_FENCED (dst, I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER);
 	    OUT_DWORD (clear);
 	}
@@ -1393,7 +1381,7 @@ i915_blt_boxes (i915_surface_t *dst,
 	    OUT_DWORD (cmd);
 	    OUT_DWORD (br13);
 	    OUT_DWORD ((y1 << 16) | x1);
-	    OUT_DWORD ((y2 << 16) | x2);
+	    OUT_DWORD (((y2 - 1) << 16) | (x2 - 1));
 	    OUT_RELOC_FENCED (dst, I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER);
 	    OUT_DWORD (((y1 + ty) << 16) | (x1 + tx));
 	    OUT_DWORD (src->intel.drm.stride);
@@ -1712,8 +1700,8 @@ i915_surface_clear (i915_surface_t *dst)
 	OUT_DWORD (cmd);
 	OUT_DWORD (br13);
 	OUT_DWORD (0);
-	OUT_DWORD ((dst->intel.drm.height << 16) |
-		   dst->intel.drm.width);
+	OUT_DWORD (((dst->intel.drm.height - 1) << 16) |
+		   (dst->intel.drm.width - 1));
 	OUT_RELOC_FENCED (dst,
 			  I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER);
 	OUT_DWORD (clear);
diff --git a/src/drm/cairo-drm-i965-shader.c b/src/drm/cairo-drm-i965-shader.c
index b58b8e4..515b4a6 100644
--- a/src/drm/cairo-drm-i965-shader.c
+++ b/src/drm/cairo-drm-i965-shader.c
@@ -2527,8 +2527,8 @@ i965_emit_composite (i965_device_t *device,
     /* The drawing rectangle clipping is always on.  Set it to values that
      * shouldn't do any clipping.
      */
-    draw_rectangle = DRAW_YMAX (shader->target->intel.drm.height - 1) |
-	             DRAW_XMAX (shader->target->intel.drm.width  - 1);
+    draw_rectangle = DRAW_YMAX (shader->target->intel.drm.height) |
+	             DRAW_XMAX (shader->target->intel.drm.width);
     if (draw_rectangle != device->draw_rectangle) {
 	OUT_BATCH (BRW_3DSTATE_DRAWING_RECTANGLE | 2);
 	OUT_BATCH (0x00000000);	/* ymin, xmin */
@@ -2789,8 +2789,8 @@ i965_clipped_vertices (i965_device_t *device,
 		/* XXX scissor? */
 		OUT_BATCH (BRW_3DSTATE_DRAWING_RECTANGLE | 2);
 		OUT_BATCH (DRAW_YMIN (rect.y) | DRAW_XMIN (rect.x));
-		OUT_BATCH (DRAW_YMAX (rect.y + rect.height - 1) |
-			   DRAW_XMIN (rect.x + rect.width  - 1));
+		OUT_BATCH (DRAW_YMAX (rect.y + rect.height) |
+			   DRAW_XMAX (rect.x + rect.width));
 		OUT_BATCH (0x00000000);	/* yorigin, xorigin */
 
 		OUT_BATCH (BRW_3DPRIMITIVE |
@@ -2826,8 +2826,8 @@ i965_clipped_vertices (i965_device_t *device,
 	    /* XXX scissor? */
 	    OUT_BATCH (BRW_3DSTATE_DRAWING_RECTANGLE | 2);
 	    OUT_BATCH (DRAW_YMIN (rect.y) | DRAW_XMIN (rect.x));
-	    OUT_BATCH (DRAW_YMAX (rect.y + rect.height - 1) |
-		       DRAW_XMIN (rect.x + rect.width  - 1));
+	    OUT_BATCH (DRAW_YMAX (rect.y + rect.height) |
+		       DRAW_XMAX (rect.x + rect.width));
 	    OUT_BATCH (0x00000000);	/* yorigin, xorigin */
 
 	    OUT_BATCH (BRW_3DPRIMITIVE |
diff --git a/src/drm/cairo-drm-intel-command-private.h b/src/drm/cairo-drm-intel-command-private.h
index 3860c3f..a93ac12 100644
--- a/src/drm/cairo-drm-intel-command-private.h
+++ b/src/drm/cairo-drm-intel-command-private.h
@@ -203,8 +203,8 @@
 #define DRAW_YMIN(x)			((x)<<16)
 #define DRAW_XMIN(x)			(x)
 /* Dword 3 */
-#define DRAW_YMAX(x)			((x)<<16)
-#define DRAW_XMAX(x)			(x)
+#define DRAW_YMAX(x)			((x-1)<<16)
+#define DRAW_XMAX(x)			(x-1)
 /* Dword 4 */
 #define DRAW_YORG(x)			((x)<<16)
 #define DRAW_XORG(x)			(x)
commit fb6a00571c818c738d66bc04dc75e79491878f78
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Jun 14 10:19:37 2010 +0100

    drm: _cairo_color_get_content() compilation fixes

diff --git a/src/drm/cairo-drm-i915-shader.c b/src/drm/cairo-drm-i915-shader.c
index 1ecf762..4ded89e 100644
--- a/src/drm/cairo-drm-i915-shader.c
+++ b/src/drm/cairo-drm-i915-shader.c
@@ -1111,7 +1111,7 @@ i915_shader_acquire_solid (i915_shader_t *shader,
 {
     cairo_content_t content;
 
-    content = solid->content;
+    content = CAIRO_CONTENT_COLOR_ALPHA;
     src->solid.color = solid->color;
     if (content == 0 || solid->color.alpha_short <= 0x00ff)
     {
diff --git a/src/drm/cairo-drm-i965-shader.c b/src/drm/cairo-drm-i965-shader.c
index 078fcdd..b58b8e4 100644
--- a/src/drm/cairo-drm-i965-shader.c
+++ b/src/drm/cairo-drm-i965-shader.c
@@ -123,10 +123,7 @@ i965_shader_acquire_solid (i965_shader_t *shader,
     src->type.vertex = VS_NONE;
     src->type.pattern = PATTERN_SOLID;
 
-    src->base.content = solid->content;
-    if (CAIRO_COLOR_IS_OPAQUE(&solid->color))
-	src->base.content &= ~CAIRO_CONTENT_ALPHA;
-
+    src->base.content = _cairo_color_get_content (&solid->color);
     src->base.constants[0] = solid->color.red   * solid->color.alpha;
     src->base.constants[1] = solid->color.green * solid->color.alpha;
     src->base.constants[2] = solid->color.blue  * solid->color.alpha;
diff --git a/src/drm/cairo-drm-intel.c b/src/drm/cairo-drm-intel.c
index 032647c..ab139d5 100644
--- a/src/drm/cairo-drm-intel.c
+++ b/src/drm/cairo-drm-intel.c
@@ -1584,8 +1584,7 @@ intel_gradient_render (intel_device_t *device,
 	intel_bo_destroy (device, buffer->bo);
 	/* Ensure the cache is correctly initialised for i965_device_destroy */
 	_cairo_pattern_init_solid (&device->gradient_cache.cache[i].pattern.solid,
-		                   CAIRO_COLOR_TRANSPARENT,
-				   CAIRO_CONTENT_ALPHA);
+		                   CAIRO_COLOR_TRANSPARENT);
 	return status;
     }
 


More information about the cairo-commit mailing list