summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2009-11-09 18:01:55 -0500
committerZack Rusin <[email protected]>2009-11-09 18:04:21 -0500
commita6d527d7b82579feae9db20657d47a3f86115bb4 (patch)
tree8670a87d2b616b4a7ca838e37ae470af62ddfa06 /src/gallium/state_trackers
parent216319fc0fe5dc3f298dd602812afa0f28a4ee60 (diff)
st/xorg: fix composite batching
quite a large performance optimization (text demo from 1.6fps to 9fps)
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/xorg/xorg_composite.c10
-rw-r--r--src/gallium/state_trackers/xorg/xorg_renderer.c9
-rw-r--r--src/gallium/state_trackers/xorg/xorg_renderer.h4
3 files changed, 18 insertions, 5 deletions
diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c
index 8947d0a67c4..4f4b02cdbc8 100644
--- a/src/gallium/state_trackers/xorg/xorg_composite.c
+++ b/src/gallium/state_trackers/xorg/xorg_composite.c
@@ -287,6 +287,14 @@ bind_samplers(struct exa_context *exa, int op,
exa->num_bound_samplers = 0;
+#if 0
+ if ((pSrc && (exa->pipe->is_texture_referenced(exa->pipe, pSrc->tex, 0, 0) &
+ PIPE_REFERENCED_FOR_WRITE)) ||
+ (pMask && (exa->pipe->is_texture_referenced(exa->pipe, pMask->tex, 0, 0) &
+ PIPE_REFERENCED_FOR_WRITE)))
+ xorg_exa_flush(exa, PIPE_FLUSH_RENDER_CACHE, NULL);
+#endif
+
memset(&src_sampler, 0, sizeof(struct pipe_sampler_state));
memset(&mask_sampler, 0, sizeof(struct pipe_sampler_state));
@@ -461,7 +469,7 @@ void xorg_composite(struct exa_context *exa,
if (exa->transform.has_mask)
mask_matrix = exa->transform.mask;
-#if 1
+#if 0
renderer_draw_textures(exa->renderer,
pos, width, height,
exa->bound_textures,
diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c
index 947f4ca5313..c7a04836a5e 100644
--- a/src/gallium/state_trackers/xorg/xorg_renderer.c
+++ b/src/gallium/state_trackers/xorg/xorg_renderer.c
@@ -21,6 +21,8 @@ enum AxisOrientation {
#define floatsEqual(x, y) (fabs(x - y) <= 0.00001f * MIN2(fabs(x), fabs(y)))
#define floatIsZero(x) (floatsEqual((x) + 1, 1))
+#define NUM_COMPONENTS 4
+
static INLINE boolean is_affine(float *matrix)
{
return floatIsZero(matrix[2]) && floatIsZero(matrix[5])
@@ -62,6 +64,7 @@ renderer_draw(struct xorg_renderer *r)
{
struct pipe_context *pipe = r->pipe;
struct pipe_buffer *buf = 0;
+ int num_verts = r->num_vertices/(r->num_attributes * NUM_COMPONENTS);
if (!r->num_vertices)
return;
@@ -72,7 +75,7 @@ renderer_draw(struct xorg_renderer *r)
if (buf) {
util_draw_vertex_buffer(pipe, buf, 0,
PIPE_PRIM_QUADS,
- 4, /* verts */
+ num_verts, /* verts */
r->num_attributes); /* attribs/vert */
pipe_buffer_reference(&buf, NULL);
@@ -84,8 +87,9 @@ renderer_draw_conditional(struct xorg_renderer *r,
int next_batch)
{
if (r->num_vertices + next_batch >= BUF_SIZE ||
- (next_batch == 0 && r->num_vertices))
+ (next_batch == 0 && r->num_vertices)) {
renderer_draw(r);
+ }
}
static void
@@ -892,6 +896,7 @@ void renderer_begin_textures(struct xorg_renderer *r,
int num_textures)
{
r->num_attributes = 1 + num_textures;
+ r->num_vertices = 0;
}
void renderer_texture(struct xorg_renderer *r,
diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.h b/src/gallium/state_trackers/xorg/xorg_renderer.h
index 780d97fe85a..4cd929342ea 100644
--- a/src/gallium/state_trackers/xorg/xorg_renderer.h
+++ b/src/gallium/state_trackers/xorg/xorg_renderer.h
@@ -11,9 +11,9 @@ struct exa_pixmap_priv;
* max number of attributes per vertex *
* max number of components per attribute
*
- * currently the max is 5 quads
+ * currently the max is 100 quads
*/
-#define BUF_SIZE (20 * 3 * 4)
+#define BUF_SIZE (100 * 4 * 3 * 4)
struct xorg_renderer {
struct pipe_context *pipe;