summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-02-22 12:44:16 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2014-02-22 14:35:10 +0000
commitaae3bfeb28ca86b416a6a4de71eb23cdb46cf9de (patch)
treee944bc43ed59824dfcef2f0759a37fc46ec3ed36 /src
parent75cff26ebad33aca7ade7aa5a650235a7d42e47c (diff)
sna: Assert that sigtrap is active
Curiouser and curiouser. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/sna/sna.h5
-rw-r--r--src/sna/sna_accel.c6
-rw-r--r--src/sna/sna_composite.c3
3 files changed, 9 insertions, 5 deletions
diff --git a/src/sna/sna.h b/src/sna/sna.h
index 0b5de8e5..329853dd 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -1035,12 +1035,13 @@ void sna_image_composite(pixman_op_t op,
extern jmp_buf sigjmp[4];
extern volatile sig_atomic_t sigtrap;
-#define sigtrap_assert() assert(sigtrap == 0)
+#define sigtrap_assert_inactive() assert(sigtrap == 0)
+#define sigtrap_assert_active() assert(sigtrap > 0 && sigtrap <= ARRAY_SIZE(sigjmp))
#define sigtrap_get() sigsetjmp(sigjmp[sigtrap++], 1)
static inline void sigtrap_put(void)
{
- assert(sigtrap > 0);
+ sigtrap_assert_active();
--sigtrap;
}
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 0dac5611..64b60c2d 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -17071,7 +17071,7 @@ void sna_accel_close(struct sna *sna)
void sna_accel_block_handler(struct sna *sna, struct timeval **tv)
{
- sigtrap_assert();
+ sigtrap_assert_inactive();
if (sna->kgem.need_retire)
kgem_retire(&sna->kgem);
@@ -17158,11 +17158,11 @@ void sna_accel_wakeup_handler(struct sna *sna)
_kgem_submit(&sna->kgem);
}
- sigtrap_assert();
+ sigtrap_assert_inactive();
}
void sna_accel_free(struct sna *sna)
{
DBG(("%s\n", __FUNCTION__));
- sigtrap_assert();
+ sigtrap_assert_inactive();
}
diff --git a/src/sna/sna_composite.c b/src/sna/sna_composite.c
index 6a2eff6a..5b61f952 100644
--- a/src/sna/sna_composite.c
+++ b/src/sna/sna_composite.c
@@ -570,6 +570,7 @@ sna_composite_fb(CARD8 op,
assert(box->x2 > box->x1 && box->y2 > box->y1);
+ sigtrap_assert_active();
memcpy_blt(src_pixmap->devPrivate.ptr,
dst_pixmap->devPrivate.ptr,
dst_pixmap->drawable.bitsPerPixel,
@@ -593,6 +594,7 @@ sna_composite_fb(CARD8 op,
if (src_image && dest_image && !(mask && !mask_image)) {
if (sigtrap_get() == 0) {
+ sigtrap_assert_active();
sna_image_composite(op, src_image, mask_image, dest_image,
src_x + src_xoff, src_y + src_yoff,
msk_x + msk_xoff, msk_y + msk_yoff,
@@ -1094,6 +1096,7 @@ fallback:
dst->format))
goto fallback_composite;
+ sigtrap_assert_active();
if (pixel == 0 &&
box->x2 - box->x1 == pixmap->drawable.width &&
box->y2 - box->y1 == pixmap->drawable.height) {