[cairo-commit] 5 commits - perf/cairo-perf-trace.c src/drm
Chris Wilson
ickle at kemper.freedesktop.org
Sat Mar 6 08:17:10 PST 2010
perf/cairo-perf-trace.c | 8 ++++
src/drm/cairo-drm-i915-shader.c | 59 +++++++++++++++++++++-----------
src/drm/cairo-drm-i915-spans.c | 71 +++++++++++++++++++++++----------------
src/drm/cairo-drm-i915-surface.c | 10 +++++
4 files changed, 101 insertions(+), 47 deletions(-)
New commits:
commit f79b2ceea4722b5059563be1eb55de617fecc004
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu Mar 4 19:52:58 2010 +0000
drm/i915: Discard redundant solitary clips during fill
diff --git a/src/drm/cairo-drm-i915-surface.c b/src/drm/cairo-drm-i915-surface.c
index 3071ee3..08eef58 100644
--- a/src/drm/cairo-drm-i915-surface.c
+++ b/src/drm/cairo-drm-i915-surface.c
@@ -1343,6 +1343,16 @@ i915_surface_fill (void *abstract_dst,
if (_cairo_clip_contains_rectangle (clip, &extents))
clip = NULL;
+ if (extents.is_bounded && clip != NULL) {
+ cairo_clip_path_t *clip_path;
+
+ if (((clip_path = _clip_get_solitary_path (clip)) != NULL) &&
+ _cairo_path_fixed_equal (&clip_path->path, path))
+ {
+ clip = NULL;
+ }
+ }
+
if (clip != NULL) {
clip = _cairo_clip_init_copy (&local_clip, clip);
have_clip = TRUE;
commit 7cea9ae290ba24e4d2f87cef4228cce5fcb3181b
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu Mar 4 17:23:55 2010 +0000
drm/i915: Apply more micro-optimisations when targetting CONTENT_ALPHA
diff --git a/src/drm/cairo-drm-i915-shader.c b/src/drm/cairo-drm-i915-shader.c
index 5f2b55a..1435737 100644
--- a/src/drm/cairo-drm-i915-shader.c
+++ b/src/drm/cairo-drm-i915-shader.c
@@ -742,23 +742,37 @@ i915_set_shader_program (i915_device_t *device,
if (mask_reg != ~0U) {
if (! shader->need_combine &&
shader->clip.type.fragment != FS_TEXTURE &&
- shader->content != CAIRO_CONTENT_ALPHA)
+ (shader->content != CAIRO_CONTENT_ALPHA || source_reg == ~0U))
{
out_reg = FS_OC;
}
if (source_reg == ~0U) {
if (source_pure) {
if (shader->mask.type.fragment == FS_SPANS) {
- i915_fs_mov (out_reg,
- i915_fs_operand_impure (mask_reg, X, source_pure));
+ if (out_reg == FS_OC && shader->content == CAIRO_CONTENT_ALPHA) {
+ if (source_pure & (1 << 3))
+ i915_fs_mov (out_reg, i915_fs_operand (mask_reg, X, X, X, X));
+ else
+ i915_fs_mov (out_reg, i915_fs_operand_zero ());
+ } else {
+ i915_fs_mov (out_reg,
+ i915_fs_operand_impure (mask_reg, X, source_pure));
+ }
} else {
/* XXX ComponentAlpha
i915_fs_mov (out_reg,
i915_fs_operand_pure (mask_reg,
shader->source.solid.pure));
*/
- i915_fs_mov (out_reg,
- i915_fs_operand_impure (mask_reg, W, source_pure));
+ if (out_reg == FS_OC && shader->content == CAIRO_CONTENT_ALPHA) {
+ if (source_pure & (1 << 3))
+ i915_fs_mov (out_reg, i915_fs_operand (mask_reg, W, W, W, W));
+ else
+ i915_fs_mov (out_reg, i915_fs_operand_zero ());
+ } else {
+ i915_fs_mov (out_reg,
+ i915_fs_operand_impure (mask_reg, W, source_pure));
+ }
}
source_reg = out_reg;
} else if (shader->mask.type.fragment == FS_SPANS) {
@@ -770,18 +784,30 @@ i915_set_shader_program (i915_device_t *device,
}
} else {
if (shader->mask.type.fragment == FS_SPANS) {
- i915_fs_mul (out_reg,
- i915_fs_operand_reg (source_reg),
- i915_fs_operand (mask_reg, X, X, X, X));
+ if (out_reg == FS_OC && shader->content == CAIRO_CONTENT_ALPHA) {
+ i915_fs_mul (out_reg,
+ i915_fs_operand (source_reg, W, W, W, W),
+ i915_fs_operand (mask_reg, X, X, X, X));
+ } else {
+ i915_fs_mul (out_reg,
+ i915_fs_operand_reg (source_reg),
+ i915_fs_operand (mask_reg, X, X, X, X));
+ }
} else {
/* XXX ComponentAlpha
i915_fs_mul (FS_R0,
i915_fs_operand_reg (source_reg),
i915_fs_operand_reg (mask_reg));
*/
- i915_fs_mul (out_reg,
- i915_fs_operand_reg (source_reg),
- i915_fs_operand (mask_reg, W, W, W, W));
+ if (out_reg == FS_OC && shader->content == CAIRO_CONTENT_ALPHA) {
+ i915_fs_mul (out_reg,
+ i915_fs_operand (source_reg, W, W, W, W),
+ i915_fs_operand (mask_reg, W, W, W, W));
+ } else {
+ i915_fs_mul (out_reg,
+ i915_fs_operand_reg (source_reg),
+ i915_fs_operand (mask_reg, W, W, W, W));
+ }
}
source_reg = out_reg;
@@ -977,9 +1003,6 @@ i915_set_shader_program (i915_device_t *device,
} else {
i915_fs_mov (FS_OC, i915_fs_operand_reg (source_reg));
}
- } else {
- if ((shader->content & CAIRO_CONTENT_COLOR) == 0)
- i915_fs_mov (FS_OC, i915_fs_operand (FS_OC, W, W, W, W));
}
FS_END ();
commit dce8b028cd5b249054e8197a536c29f6ba4110da
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu Mar 4 17:13:53 2010 +0000
drm/i915: Adjust clip matrix for clip origin.
diff --git a/src/drm/cairo-drm-i915-shader.c b/src/drm/cairo-drm-i915-shader.c
index 5bd3ff2..5f2b55a 100644
--- a/src/drm/cairo-drm-i915-shader.c
+++ b/src/drm/cairo-drm-i915-shader.c
@@ -2407,14 +2407,13 @@ i915_shader_set_clip (i915_shader_t *shader,
SS3_NORMALIZED_COORDS |
i915_texture_extend (CAIRO_EXTEND_NONE);
+ clip_extents = _cairo_clip_get_extents (clip);
cairo_matrix_init_scale (&shader->clip.base.matrix,
1. / s->intel.drm.width,
1. / s->intel.drm.height);
-
- clip_extents = _cairo_clip_get_extents (clip);
cairo_matrix_translate (&shader->clip.base.matrix,
- NEAREST_BIAS + clip_extents->x,
- NEAREST_BIAS + clip_extents->y);
+ NEAREST_BIAS - clip_extents->x,
+ NEAREST_BIAS - clip_extents->y);
}
static cairo_status_t
@@ -2534,7 +2533,6 @@ i915_shader_setup_dst (i915_shader_t *shader)
cairo_matrix_init_scale (&shader->dst.base.matrix,
1. / s->intel.drm.width,
1. / s->intel.drm.height);
-
cairo_matrix_translate (&shader->dst.base.matrix,
NEAREST_BIAS,
NEAREST_BIAS);
commit 8e702044b3816002011488c56f1ec9c6b9682eee
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu Mar 4 17:13:02 2010 +0000
drm/i915: Handle clip/combine coords for spans.
diff --git a/src/drm/cairo-drm-i915-spans.c b/src/drm/cairo-drm-i915-spans.c
index 38bdfed..6ede4cc 100644
--- a/src/drm/cairo-drm-i915-spans.c
+++ b/src/drm/cairo-drm-i915-spans.c
@@ -280,8 +280,13 @@ i915_span_generic (i915_spans_t *spans,
*vertices++ = alpha;
if (spans->need_clip_surface) {
s = x1, t = y1;
- cairo_matrix_transform_point (&spans->shader.source.base.matrix, &s, &t);
- *vertices++ = s; *vertices++ = t;
+ cairo_matrix_transform_point (&spans->shader.clip.base.matrix, &s, &t);
+ *vertices++ = texcoord_2d_16 (s, t);
+ }
+ if (spans->shader.need_combine) {
+ s = x1, t = y1;
+ cairo_matrix_transform_point (&spans->shader.dst.base.matrix, &s, &t);
+ *vertices++ = texcoord_2d_16 (s, t);
}
/* bottom left */
@@ -305,8 +310,13 @@ i915_span_generic (i915_spans_t *spans,
*vertices++ = alpha;
if (spans->need_clip_surface) {
s = x0, t = y1;
- cairo_matrix_transform_point (&spans->shader.source.base.matrix, &s, &t);
- *vertices++ = s; *vertices++ = t;
+ cairo_matrix_transform_point (&spans->shader.clip.base.matrix, &s, &t);
+ *vertices++ = texcoord_2d_16 (s, t);
+ }
+ if (spans->shader.need_combine) {
+ s = x0, t = y1;
+ cairo_matrix_transform_point (&spans->shader.dst.base.matrix, &s, &t);
+ *vertices++ = texcoord_2d_16 (s, t);
}
/* top left */
@@ -330,8 +340,13 @@ i915_span_generic (i915_spans_t *spans,
*vertices++ = alpha;
if (spans->need_clip_surface) {
s = x0, t = y0;
- cairo_matrix_transform_point (&spans->shader.source.base.matrix, &s, &t);
- *vertices++ = s; *vertices++ = t;
+ cairo_matrix_transform_point (&spans->shader.clip.base.matrix, &s, &t);
+ *vertices++ = texcoord_2d_16 (s, t);
+ }
+ if (spans->shader.need_combine) {
+ s = x0, t = y0;
+ cairo_matrix_transform_point (&spans->shader.dst.base.matrix, &s, &t);
+ *vertices++ = texcoord_2d_16 (s, t);
}
}
@@ -543,28 +558,6 @@ i915_spans_init (i915_spans_t *spans,
if (unlikely (status))
return status;
- if (! spans->need_clip_surface) {
- switch (spans->shader.source.type.vertex) {
- case VS_CONSTANT:
- spans->span = i915_span_constant;
- break;
- case VS_LINEAR:
- spans->span = i915_span_linear;
- break;
- case VS_TEXTURE:
- spans->span = i915_span_texture;
- break;
- case VS_TEXTURE_16:
- spans->span = i915_span_texture16;
- break;
- default:
- spans->span = i915_span_generic;
- break;
- }
- } else {
- spans->span = i915_span_generic;
- }
-
spans->rectangle_size = 3 * (2 + i915_shader_num_texcoords (&spans->shader));
return CAIRO_STATUS_SUCCESS;
}
@@ -626,6 +619,28 @@ i915_clip_and_composite_spans (i915_surface_t *dst,
if (unlikely (status))
goto CLEANUP_DEVICE;
+ if (!spans.shader.need_combine && ! spans.need_clip_surface) {
+ switch (spans.shader.source.type.vertex) {
+ case VS_CONSTANT:
+ spans.span = i915_span_constant;
+ break;
+ case VS_LINEAR:
+ spans.span = i915_span_linear;
+ break;
+ case VS_TEXTURE:
+ spans.span = i915_span_texture;
+ break;
+ case VS_TEXTURE_16:
+ spans.span = i915_span_texture16;
+ break;
+ default:
+ spans.span = i915_span_generic;
+ break;
+ }
+ } else {
+ spans.span = i915_span_generic;
+ }
+
status = draw_func (draw_closure, &spans.renderer, spans.extents);
if (spans.clip_region != NULL && status == CAIRO_STATUS_SUCCESS) {
intel_bo_unmap (spans.tail->bo);
commit e1f0c2e73fa8cda9e38ab182288201fa27a3b363
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu Mar 4 17:11:58 2010 +0000
perf: Check for and include unistd.h
isatty() and access() require unistd.h, so include it!
diff --git a/perf/cairo-perf-trace.c b/perf/cairo-perf-trace.c
index 5487eaf..cc01158 100644
--- a/perf/cairo-perf-trace.c
+++ b/perf/cairo-perf-trace.c
@@ -53,6 +53,10 @@
#include <sys/stat.h>
#include <dirent.h>
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
#include <signal.h>
#if HAVE_FCFINI
@@ -671,8 +675,10 @@ parse_options (cairo_perf_t *perf, int argc, char *argv[])
if (verbose && perf->summary == NULL)
perf->summary = stderr;
+#if HAVE_UNISTD_H
if (perf->summary && isatty (fileno (perf->summary)))
perf->summary_continuous = TRUE;
+#endif
if (optind < argc) {
perf->names = &argv[optind];
@@ -702,9 +708,11 @@ have_trace_filenames (cairo_perf_t *perf)
if (perf->num_names == 0)
return FALSE;
+#if HAVE_UNISTD_H
for (i = 0; i < perf->num_names; i++)
if (access (perf->names[i], R_OK) == 0)
return TRUE;
+#endif
return FALSE;
}
More information about the cairo-commit
mailing list