xf86-video-intel: 5 commits - src/sna/sna_glyphs.c tools/virtual.c
Chris Wilson
ickle at kemper.freedesktop.org
Tue Mar 25 02:00:36 PDT 2014
src/sna/sna_glyphs.c | 223 ++++++++++++++++++++++++++-------------------------
tools/virtual.c | 18 ++--
2 files changed, 129 insertions(+), 112 deletions(-)
New commits:
commit bfd51e205639b468479985c3c631e5d9c76d5fa7
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Mar 25 08:59:58 2014 +0000
intel-virtual-output: Add a little more DBG around damaging clones
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/tools/virtual.c b/tools/virtual.c
index f153523..9d01884 100644
--- a/tools/virtual.c
+++ b/tools/virtual.c
@@ -1301,6 +1301,9 @@ ungrab:
if (clone->dst.rr_crtc == 0)
continue;
+ DBG(("%s-%s: added to active list\n",
+ DisplayString(dst->dpy), dst->name));
+
clone->active = ctx->active;
ctx->active = clone;
}
@@ -1659,12 +1662,17 @@ static void clone_damage(struct clone *c, const XRectangle *rec)
{
if (rec->x < c->damaged.x1)
c->damaged.x1 = rec->x;
- if (rec->x + rec->width > c->damaged.x2)
- c->damaged.x2 = rec->x + rec->width;
+ if (rec->width > c->damaged.x2 - rec->x)
+ c->damaged.x2 = (int)rec->x + rec->width;
if (rec->y < c->damaged.y1)
c->damaged.y1 = rec->y;
- if (rec->y + rec->height > c->damaged.y2)
- c->damaged.y2 = rec->y + rec->height;
+ if (rec->height > c->damaged.y2 - rec->y)
+ c->damaged.y2 = (int)rec->y + rec->height;
+
+ DBG(("%s-%s damaged: (%d, %d), (%d, %d)\n",
+ DisplayString(c->dst->dpy), c->dst->name,
+ c->damaged.x1, c->damaged.y1,
+ c->damaged.x2, c->damaged.y2));
}
static void usage(const char *arg0)
commit 278ef8f7bc0c7f63737ad5f5e967ca253c2571cb
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Mar 25 08:33:46 2014 +0000
intel-virtual-output: Do not detach with DBG enabled
Since DBG is sent to stdout, we only see it if we do not daemonize
(which closes stdout).
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/tools/virtual.c b/tools/virtual.c
index 5883950..f153523 100644
--- a/tools/virtual.c
+++ b/tools/virtual.c
@@ -2789,7 +2789,7 @@ int main(int argc, char **argv)
struct context ctx;
const char *src_name = NULL;
uint64_t count;
- int daemonize = 1, bumblebee = 0, all = 0, singleton = 1;
+ int daemonize = !EXTRA_DBG, bumblebee = 0, all = 0, singleton = 1;
int i, ret, open, fail;
signal(SIGPIPE, SIG_IGN);
commit 7addfcbf0f2f609ce2a5b8e9a75ee7efb483531c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Mon Mar 24 12:51:11 2014 +0000
sna: Remove one conditional from rendering glyphs into a mask
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_glyphs.c b/src/sna/sna_glyphs.c
index fff648a..93b3eb6 100644
--- a/src/sna/sna_glyphs.c
+++ b/src/sna/sna_glyphs.c
@@ -81,6 +81,7 @@
#define GLYPH_CACHE_SIZE (CACHE_PICTURE_SIZE * CACHE_PICTURE_SIZE / (GLYPH_MIN_SIZE * GLYPH_MIN_SIZE))
#define N_STACK_GLYPHS 512
+#define NO_ATLAS ((PicturePtr)-1)
#define glyph_valid(g) *((uint32_t *)&(g)->info.width)
#define glyph_copy_size(r, g) *(uint32_t *)&(r)->width = *(uint32_t *)&g->info.width
@@ -719,7 +720,6 @@ glyphs0_to_dst(struct sna *sna,
INT16 src_x, INT16 src_y,
int nlist, GlyphListPtr list, GlyphPtr *glyphs)
{
-#define NO_ATLAS ((PicturePtr)-1)
struct sna_composite_op tmp;
ScreenPtr screen = dst->pDrawable->pScreen;
PicturePtr glyph_atlas = NO_ATLAS;
@@ -1083,10 +1083,9 @@ glyphs_via_mask(struct sna *sna,
int nlist, GlyphListPtr list, GlyphPtr *glyphs)
{
ScreenPtr screen = dst->pDrawable->pScreen;
- struct sna_composite_op tmp;
CARD32 component_alpha;
PixmapPtr pixmap;
- PicturePtr glyph_atlas, mask;
+ PicturePtr mask;
int16_t x, y, width, height;
int error;
bool ret = false;
@@ -1308,6 +1307,9 @@ next_image:
ValidatePicture(mask);
} else {
+ struct sna_composite_op tmp;
+ PicturePtr glyph_atlas = NO_ATLAS;
+
pixmap = screen->CreatePixmap(screen,
width, height, format->depth,
SNA_CREATE_SCRATCH);
@@ -1324,34 +1326,30 @@ next_image:
if (!clear_pixmap(sna, pixmap))
goto err_mask;
- glyph_atlas = NULL;
do {
int n = list->len;
x += list->xOff;
y += list->yOff;
while (n--) {
GlyphPtr glyph = *glyphs++;
- struct sna_glyph *p;
+ struct sna_glyph *p = sna_glyph(glyph);
struct sna_composite_rectangles r;
- p = sna_glyph(glyph);
- if (unlikely(p->atlas == NULL)) {
+ if (unlikely(p->atlas != glyph_atlas)) {
+ bool ok;
+
if (unlikely(!glyph_valid(glyph)))
goto next_glyph;
- if (glyph_atlas) {
+ if (glyph_atlas != NO_ATLAS) {
tmp.done(sna, &tmp);
- glyph_atlas = NULL;
+ glyph_atlas = NO_ATLAS;
}
- if (!glyph_cache(screen, &sna->render, glyph))
- goto next_glyph;
- }
- if (p->atlas != glyph_atlas) {
- bool ok;
-
- if (glyph_atlas)
- tmp.done(sna, &tmp);
+ if (unlikely(p->atlas == NULL)) {
+ if (!glyph_cache(screen, &sna->render, glyph))
+ goto next_glyph;
+ }
DBG(("%s: atlas format=%08x, mask format=%08x\n",
__FUNCTION__,
@@ -1400,7 +1398,7 @@ next_glyph:
}
list++;
} while (--nlist);
- if (glyph_atlas)
+ if (glyph_atlas != NO_ATLAS)
tmp.done(sna, &tmp);
}
commit d3050dbaf74d6a5b5123eea13bc7710efea6257f
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Mon Mar 24 12:39:37 2014 +0000
sna: Consolidate handling of uncacheable glyphs
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_glyphs.c b/src/sna/sna_glyphs.c
index ea82366..fff648a 100644
--- a/src/sna/sna_glyphs.c
+++ b/src/sna/sna_glyphs.c
@@ -379,8 +379,7 @@ glyph_cache(ScreenPtr screen,
struct sna_glyph *p;
int size, mask, pos, s;
- if (NO_GLYPH_CACHE)
- return false;
+ assert(glyph_valid(glyph));
glyph_picture = GetGlyphPicture(glyph, screen);
if (unlikely(glyph_picture == NULL)) {
@@ -388,7 +387,8 @@ glyph_cache(ScreenPtr screen,
return false;
}
- if (glyph->info.width > GLYPH_MAX_SIZE ||
+ if (NO_GLYPH_CACHE ||
+ glyph->info.width > GLYPH_MAX_SIZE ||
glyph->info.height > GLYPH_MAX_SIZE) {
PixmapPtr pixmap = (PixmapPtr)glyph_picture->pDrawable;
assert(glyph_picture->pDrawable->type == DRAWABLE_PIXMAP);
@@ -396,7 +396,12 @@ glyph_cache(ScreenPtr screen,
pixmap->usage_hint = 0;
sna_pixmap_force_to_gpu(pixmap, MOVE_READ);
}
- return false;
+
+ /* no cache for this glyph */
+ p = sna_glyph(glyph);
+ p->atlas = glyph_picture;
+ p->coordinate.x = p->coordinate.y = 0;
+ return true;
}
for (size = GLYPH_MIN_SIZE; size <= GLYPH_MAX_SIZE; size *= 2)
@@ -603,15 +608,9 @@ glyphs_to_dst(struct sna *sna,
tmp.done(sna, &tmp);
glyph_atlas = NULL;
}
- if (!glyph_cache(screen, &sna->render, glyph)) {
- /* no cache for this glyph */
- p->atlas = GetGlyphPicture(glyph, screen);
- if (unlikely(p->atlas == NULL)) {
- glyph->info.width = glyph->info.height = 0;
- goto next_glyph;
- }
- p->coordinate.x = p->coordinate.y = 0;
- }
+
+ if (!glyph_cache(screen, &sna->render, glyph))
+ goto next_glyph;
}
if (p->atlas != glyph_atlas) {
@@ -767,15 +766,8 @@ glyphs0_to_dst(struct sna *sna,
}
if (unlikely(p->atlas == NULL)) {
- if (!glyph_cache(screen, &sna->render, glyph)) {
- /* no cache for this glyph */
- p->atlas = GetGlyphPicture(glyph, screen);
- if (unlikely(p->atlas == NULL)) {
- glyph->info.width = glyph->info.height = 0;
- goto next_glyph_N;
- }
- p->coordinate.x = p->coordinate.y = 0;
- }
+ if (!glyph_cache(screen, &sna->render, glyph))
+ goto next_glyph_N;
}
if (!sna->render.composite(sna,
@@ -866,15 +858,8 @@ next_glyph_N:
}
if (unlikely(p->atlas == NULL)) {
- if (!glyph_cache(screen, &sna->render, glyph)) {
- /* no cache for this glyph */
- p->atlas = GetGlyphPicture(glyph, screen);
- if (unlikely(p->atlas == NULL)) {
- glyph->info.width = glyph->info.height = 0;
- goto next_glyph_0;
- }
- p->coordinate.x = p->coordinate.y = 0;
- }
+ if (!glyph_cache(screen, &sna->render, glyph))
+ goto next_glyph_0;
}
if (!sna->render.composite(sna,
@@ -963,15 +948,8 @@ glyphs_slow(struct sna *sna,
if (unlikely(!glyph_valid(glyph)))
goto next_glyph;
- if (!glyph_cache(screen, &sna->render, glyph)) {
- /* no cache for this glyph */
- p->atlas = GetGlyphPicture(glyph, screen);
- if (unlikely(p->atlas == NULL)) {
- glyph->info.width = glyph->info.height = 0;
- goto next_glyph;
- }
- p->coordinate.x = p->coordinate.y = 0;
- }
+ if (!glyph_cache(screen, &sna->render, glyph))
+ goto next_glyph;
}
DBG(("%s: glyph=(%d, %d)x(%d, %d), src=(%d, %d), mask=(%d, %d)\n",
@@ -1365,15 +1343,9 @@ next_image:
tmp.done(sna, &tmp);
glyph_atlas = NULL;
}
- if (!glyph_cache(screen, &sna->render, glyph)) {
- /* no cache for this glyph */
- p->atlas = GetGlyphPicture(glyph, screen);
- if (unlikely(p->atlas == NULL)) {
- glyph->info.width = glyph->info.height = 0;
- goto next_glyph;
- }
- p->coordinate.x = p->coordinate.y = 0;
- }
+
+ if (!glyph_cache(screen, &sna->render, glyph))
+ goto next_glyph;
}
if (p->atlas != glyph_atlas) {
bool ok;
commit 79399ff9264ff23da0ab95131a67d2ac85651b3d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Mon Mar 24 10:46:57 2014 +0000
sna: Eliminate a few conditionals in glyph fast path
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_glyphs.c b/src/sna/sna_glyphs.c
index 563bbb4..ea82366 100644
--- a/src/sna/sna_glyphs.c
+++ b/src/sna/sna_glyphs.c
@@ -720,9 +720,10 @@ glyphs0_to_dst(struct sna *sna,
INT16 src_x, INT16 src_y,
int nlist, GlyphListPtr list, GlyphPtr *glyphs)
{
+#define NO_ATLAS ((PicturePtr)-1)
struct sna_composite_op tmp;
ScreenPtr screen = dst->pDrawable->pScreen;
- PicturePtr glyph_atlas;
+ PicturePtr glyph_atlas = NO_ATLAS;
BoxPtr rects;
int nrect;
int x, y;
@@ -736,64 +737,59 @@ glyphs0_to_dst(struct sna *sna,
__FUNCTION__, op, src_x, src_y, nlist,
list->xOff, list->yOff, dst->pDrawable->x, dst->pDrawable->y));
- if (clipped_glyphs(dst, nlist, list, glyphs)) {
- rects = REGION_RECTS(dst->pCompositeClip);
- nrect = REGION_NUM_RECTS(dst->pCompositeClip);
- } else
- nrect = 0;
-
x = dst->pDrawable->x;
y = dst->pDrawable->y;
src_x -= list->xOff + x;
src_y -= list->yOff + y;
- glyph_atlas = NULL;
- while (nlist--) {
- int n = list->len;
- x += list->xOff;
- y += list->yOff;
- while (n--) {
- GlyphPtr glyph = *glyphs++;
- struct sna_glyph *p;
- int i;
+ if (clipped_glyphs(dst, nlist, list, glyphs)) {
+ rects = REGION_RECTS(dst->pCompositeClip);
+ nrect = REGION_NUM_RECTS(dst->pCompositeClip);
+ if (nrect == 0)
+ return true;
- p = sna_glyph0(glyph);
- if (unlikely(p->atlas == NULL)) {
- if (unlikely(!glyph_valid(glyph)))
- goto next_glyph;
+ while (nlist--) {
+ int n = list->len;
+ x += list->xOff;
+ y += list->yOff;
+ while (n--) {
+ GlyphPtr glyph = *glyphs++;
+ struct sna_glyph *p = sna_glyph0(glyph);
+ int i, xi, yi;
- if (glyph_atlas) {
- tmp.done(sna, &tmp);
- glyph_atlas = NULL;
- }
- if (!glyph_cache(screen, &sna->render, glyph)) {
- /* no cache for this glyph */
- p->atlas = GetGlyphPicture(glyph, screen);
- if (unlikely(p->atlas == NULL)) {
- glyph->info.width = glyph->info.height = 0;
- goto next_glyph;
+ if (unlikely(p->atlas != glyph_atlas)) {
+ if (unlikely(!glyph_valid(glyph)))
+ goto next_glyph_N;
+
+ if (glyph_atlas != NO_ATLAS) {
+ tmp.done(sna, &tmp);
+ glyph_atlas = NO_ATLAS;
}
- p->coordinate.x = p->coordinate.y = 0;
- }
- }
- if (p->atlas != glyph_atlas) {
- if (glyph_atlas)
- tmp.done(sna, &tmp);
+ if (unlikely(p->atlas == NULL)) {
+ if (!glyph_cache(screen, &sna->render, glyph)) {
+ /* no cache for this glyph */
+ p->atlas = GetGlyphPicture(glyph, screen);
+ if (unlikely(p->atlas == NULL)) {
+ glyph->info.width = glyph->info.height = 0;
+ goto next_glyph_N;
+ }
+ p->coordinate.x = p->coordinate.y = 0;
+ }
+ }
- if (!sna->render.composite(sna,
- op, src, p->atlas, dst,
- 0, 0, 0, 0, 0, 0,
- 0, 0,
- COMPOSITE_PARTIAL, &tmp))
- return false;
+ if (!sna->render.composite(sna,
+ op, src, p->atlas, dst,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0,
+ COMPOSITE_PARTIAL, &tmp))
+ goto next_glyph_N;
- glyph_atlas = p->atlas;
- }
+ glyph_atlas = p->atlas;
+ }
- if (nrect) {
- int xi = x - glyph->info.x;
- int yi = y - glyph->info.y;
+ xi = x - glyph->info.x;
+ yi = y - glyph->info.y;
if (xi < dst->pCompositeClip->extents.x2 &&
yi < dst->pCompositeClip->extents.y2 &&
@@ -844,32 +840,75 @@ glyphs0_to_dst(struct sna *sna,
}
}
}
- } else {
- struct sna_composite_rectangles r;
- r.dst.x = x - glyph->info.x;
- r.dst.y = y - glyph->info.y;
- r.src.x = r.dst.x + src_x;
- r.src.y = r.dst.y + src_y;
- r.mask = p->coordinate;
- glyph_copy_size(&r, glyph);
+next_glyph_N:
+ x += glyph->info.xOff;
+ y += glyph->info.yOff;
+ }
+ list++;
+ }
+ } else while (nlist--) {
+ int n = list->len;
+ x += list->xOff;
+ y += list->yOff;
+ while (n--) {
+ GlyphPtr glyph = *glyphs++;
+ struct sna_glyph *p = sna_glyph0(glyph);
+ struct sna_composite_rectangles r;
- DBG(("%s: glyph=(%d, %d)x(%d, %d), unclipped\n",
- __FUNCTION__,
- r.dst.x, r.dst.y,
- r.width, r.height));
+ if (unlikely(p->atlas != glyph_atlas)) {
+ if (unlikely(!glyph_valid(glyph)))
+ goto next_glyph_0;
- tmp.blt(sna, &tmp, &r);
- apply_damage_clipped_to_dst(&tmp, &r, dst->pDrawable);
+ if (glyph_atlas != NO_ATLAS) {
+ tmp.done(sna, &tmp);
+ glyph_atlas = NO_ATLAS;
+ }
+
+ if (unlikely(p->atlas == NULL)) {
+ if (!glyph_cache(screen, &sna->render, glyph)) {
+ /* no cache for this glyph */
+ p->atlas = GetGlyphPicture(glyph, screen);
+ if (unlikely(p->atlas == NULL)) {
+ glyph->info.width = glyph->info.height = 0;
+ goto next_glyph_0;
+ }
+ p->coordinate.x = p->coordinate.y = 0;
+ }
+ }
+
+ if (!sna->render.composite(sna,
+ op, src, p->atlas, dst,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0,
+ COMPOSITE_PARTIAL, &tmp))
+ goto next_glyph_0;
+
+ glyph_atlas = p->atlas;
}
-next_glyph:
+ r.dst.x = x - glyph->info.x;
+ r.dst.y = y - glyph->info.y;
+ r.src.x = r.dst.x + src_x;
+ r.src.y = r.dst.y + src_y;
+ r.mask = p->coordinate;
+ glyph_copy_size(&r, glyph);
+
+ DBG(("%s: glyph=(%d, %d)x(%d, %d), unclipped\n",
+ __FUNCTION__,
+ r.dst.x, r.dst.y,
+ r.width, r.height));
+
+ tmp.blt(sna, &tmp, &r);
+ apply_damage(&tmp, &r);
+
+next_glyph_0:
x += glyph->info.xOff;
y += glyph->info.yOff;
}
list++;
}
- if (glyph_atlas)
+ if (glyph_atlas != NO_ATLAS)
tmp.done(sna, &tmp);
return true;
More information about the xorg-commit
mailing list