summaryrefslogtreecommitdiff
path: root/src/sna/sna_render.h
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-01-26 14:41:04 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2013-01-27 13:06:46 +0000
commit8178cff5718e69e14d3953a7f754d7585a06838f (patch)
tree563a6e806e898ed928c6ba4cf683f1cb990c46c5 /src/sna/sna_render.h
parent8ffb3f50b3b4601401da76e2848e059ab63231f4 (diff)
sna: Begin sketching out a threaded rasteriser for spans
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_render.h')
-rw-r--r--src/sna/sna_render.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/sna/sna_render.h b/src/sna/sna_render.h
index 13a3e7df..6a0b1d8a 100644
--- a/src/sna/sna_render.h
+++ b/src/sna/sna_render.h
@@ -7,6 +7,8 @@
#include <stdbool.h>
#include <stdint.h>
+#include <pthread.h>
+#include "atomic.h"
#define GRADIENT_CACHE_SIZE 16
@@ -142,6 +144,11 @@ struct sna_composite_op {
void *priv;
};
+struct sna_opacity_box {
+ BoxRec box;
+ float alpha;
+} __packed__;
+
struct sna_composite_spans_op {
struct sna_composite_op base;
@@ -153,6 +160,12 @@ struct sna_composite_spans_op {
const struct sna_composite_spans_op *op,
const BoxRec *box, int nbox,
float opacity);
+
+ fastcall void (*thread_boxes)(struct sna *sna,
+ const struct sna_composite_spans_op *op,
+ const struct sna_opacity_box *box,
+ int nbox);
+
fastcall void (*done)(struct sna *sna,
const struct sna_composite_spans_op *op);
@@ -160,6 +173,9 @@ struct sna_composite_spans_op {
const struct sna_composite_spans_op *op,
const BoxRec *box,
float opacity);
+ fastcall void (*emit_boxes)(const struct sna_composite_spans_op *op,
+ const struct sna_opacity_box *box, int nbox,
+ float *v);
};
struct sna_fill_op {
@@ -188,6 +204,10 @@ struct sna_copy_op {
};
struct sna_render {
+ pthread_mutex_t lock;
+ pthread_cond_t wait;
+ int active;
+
int max_3d_size;
int max_3d_pitch;
@@ -714,4 +734,34 @@ sna_render_copy_boxes__overlap(struct sna *sna, uint8_t alu,
bool
sna_composite_mask_is_opaque(PicturePtr mask);
+void sna_vertex_init(struct sna *sna);
+
+static inline void sna_vertex_lock(struct sna_render *r)
+{
+ pthread_mutex_lock(&r->lock);
+}
+
+static inline void sna_vertex_acquire__locked(struct sna_render *r)
+{
+ r->active++;
+}
+
+static inline void sna_vertex_unlock(struct sna_render *r)
+{
+ pthread_mutex_unlock(&r->lock);
+}
+
+static inline void sna_vertex_release__locked(struct sna_render *r)
+{
+ assert(r->active > 0);
+ if (--r->active == 0)
+ pthread_cond_signal(&r->wait);
+}
+
+static inline void sna_vertex_wait__locked(struct sna_render *r)
+{
+ while (r->active)
+ pthread_cond_wait(&r->wait, &r->lock);
+}
+
#endif /* SNA_RENDER_H */