xf86-video-intel: 2 commits - src/sna/gen5_render.c src/sna/gen6_render.c src/sna/gen7_render.c src/sna/sna_trapezoids.c
Chris Wilson
ickle at kemper.freedesktop.org
Sun Aug 26 10:37:31 PDT 2012
src/sna/gen5_render.c | 85 ++++++++++++++++++++++-------------------------
src/sna/gen6_render.c | 76 ++++++++++++++++++------------------------
src/sna/gen7_render.c | 78 +++++++++++++++++++------------------------
src/sna/sna_trapezoids.c | 34 +++++++++++++-----
4 files changed, 136 insertions(+), 137 deletions(-)
New commits:
commit d4f7c58186849374cd929e20fa49ea2e93939a69
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sun Aug 26 17:01:55 2012 +0100
sna/gen5+: Use the common methods for choosing the render targets
This should afford us much more flexibility in where we render.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c
index b24d742..9a94421 100644
--- a/src/sna/gen5_render.c
+++ b/src/sna/gen5_render.c
@@ -1966,44 +1966,53 @@ gen5_render_composite_done(struct sna *sna,
}
static bool
-gen5_composite_set_target(PicturePtr dst, struct sna_composite_op *op)
+gen5_composite_set_target(struct sna *sna,
+ struct sna_composite_op *op,
+ PicturePtr dst,
+ int x, int y, int w, int h)
{
- struct sna_pixmap *priv;
-
- DBG(("%s: dst=%p\n", __FUNCTION__, dst));
-
- assert(gen5_check_dst_format(dst->format));
+ BoxRec box;
op->dst.pixmap = get_drawable_pixmap(dst->pDrawable);
- priv = sna_pixmap(op->dst.pixmap);
-
- op->dst.width = op->dst.pixmap->drawable.width;
- op->dst.height = op->dst.pixmap->drawable.height;
op->dst.format = dst->format;
+ op->dst.width = op->dst.pixmap->drawable.width;
+ op->dst.height = op->dst.pixmap->drawable.height;
- DBG(("%s: pixmap=%p, format=%08x\n", __FUNCTION__,
- op->dst.pixmap, (unsigned int)op->dst.format));
-
- op->dst.bo = NULL;
- if (priv && priv->gpu_bo == NULL) {
- op->dst.bo = priv->cpu_bo;
- op->damage = &priv->cpu_damage;
- }
- if (op->dst.bo == NULL) {
- priv = sna_pixmap_force_to_gpu(op->dst.pixmap, MOVE_READ | MOVE_WRITE);
- if (priv == NULL)
- return false;
-
- op->dst.bo = priv->gpu_bo;
- op->damage = &priv->gpu_damage;
+ if (w && h) {
+ box.x1 = x;
+ box.y1 = y;
+ box.x2 = x + w;
+ box.y2 = y + h;
+ } else {
+ box.x1 = dst->pDrawable->x;
+ box.y1 = dst->pDrawable->y;
+ box.x2 = box.x1 + dst->pDrawable->width;
+ box.y2 = box.y1 + dst->pDrawable->height;
}
- if (sna_damage_is_all(op->damage, op->dst.width, op->dst.height))
- op->damage = NULL;
- DBG(("%s: bo=%p, damage=%p\n", __FUNCTION__, op->dst.bo, op->damage));
+ op->dst.bo = sna_drawable_use_bo (dst->pDrawable,
+ PREFER_GPU | FORCE_GPU | RENDER_GPU,
+ &box, &op->damage);
+ if (op->dst.bo == NULL)
+ return false;
get_drawable_deltas(dst->pDrawable, op->dst.pixmap,
&op->dst.x, &op->dst.y);
+
+ DBG(("%s: pixmap=%p, format=%08x, size=%dx%d, pitch=%d, delta=(%d,%d),damage=%p\n",
+ __FUNCTION__,
+ op->dst.pixmap, (int)op->dst.format,
+ op->dst.width, op->dst.height,
+ op->dst.bo->pitch,
+ op->dst.x, op->dst.y,
+ op->damage ? *op->damage : (void *)-1));
+
+ assert(op->dst.bo->proxy == NULL);
+
+ if (too_large(op->dst.width, op->dst.height) &&
+ !sna_render_composite_redirect(sna, op, x, y, w, h))
+ return false;
+
return true;
}
@@ -2299,18 +2308,12 @@ gen5_render_composite(struct sna *sna,
width, height,
tmp);
- if (!gen5_composite_set_target(dst, tmp)) {
+ if (!gen5_composite_set_target(sna, tmp, dst,
+ dst_x, dst_y, width, height)) {
DBG(("%s: failed to set composite target\n", __FUNCTION__));
return false;
}
- sna_render_reduce_damage(tmp, dst_x, dst_y, width, height);
-
- if (too_large(tmp->dst.width, tmp->dst.height) &&
- !sna_render_composite_redirect(sna, tmp,
- dst_x, dst_y, width, height))
- return false;
-
DBG(("%s: preparing source\n", __FUNCTION__));
switch (gen5_composite_picture(sna, src, &tmp->src,
src_x, src_y,
@@ -2676,15 +2679,9 @@ gen5_render_composite_spans(struct sna *sna,
}
tmp->base.op = op;
- if (!gen5_composite_set_target(dst, &tmp->base))
+ if (!gen5_composite_set_target(sna, &tmp->base, dst,
+ dst_x, dst_y, width, height))
return false;
- sna_render_reduce_damage(&tmp->base, dst_x, dst_y, width, height);
-
- if (too_large(tmp->base.dst.width, tmp->base.dst.height)) {
- if (!sna_render_composite_redirect(sna, &tmp->base,
- dst_x, dst_y, width, height))
- return false;
- }
switch (gen5_composite_picture(sna, src, &tmp->base.src,
src_x, src_y,
diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index c364f72..8eadda7 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -2315,46 +2315,51 @@ static void gen6_render_composite_done(struct sna *sna,
static bool
gen6_composite_set_target(struct sna *sna,
struct sna_composite_op *op,
- PicturePtr dst)
+ PicturePtr dst,
+ int x, int y, int w, int h)
{
- struct sna_pixmap *priv;
+ BoxRec box;
op->dst.pixmap = get_drawable_pixmap(dst->pDrawable);
- op->dst.width = op->dst.pixmap->drawable.width;
- op->dst.height = op->dst.pixmap->drawable.height;
op->dst.format = dst->format;
+ op->dst.width = op->dst.pixmap->drawable.width;
+ op->dst.height = op->dst.pixmap->drawable.height;
- op->dst.bo = NULL;
- priv = sna_pixmap(op->dst.pixmap);
- if (priv && priv->gpu_bo == NULL &&
- I915_TILING_NONE == kgem_choose_tiling(&sna->kgem,
- I915_TILING_X,
- op->dst.width,
- op->dst.height,
- op->dst.pixmap->drawable.bitsPerPixel)) {
- op->dst.bo = priv->cpu_bo;
- op->damage = &priv->cpu_damage;
+ if (w && h) {
+ box.x1 = x;
+ box.y1 = y;
+ box.x2 = x + w;
+ box.y2 = y + h;
+ } else {
+ box.x1 = dst->pDrawable->x;
+ box.y1 = dst->pDrawable->y;
+ box.x2 = box.x1 + dst->pDrawable->width;
+ box.y2 = box.y1 + dst->pDrawable->height;
}
- if (op->dst.bo == NULL) {
- priv = sna_pixmap_force_to_gpu(op->dst.pixmap, MOVE_READ | MOVE_WRITE);
- if (priv == NULL)
- return false;
- op->dst.bo = priv->gpu_bo;
- op->damage = &priv->gpu_damage;
- }
- if (sna_damage_is_all(op->damage, op->dst.width, op->dst.height))
- op->damage = NULL;
+ op->dst.bo = sna_drawable_use_bo (dst->pDrawable,
+ PREFER_GPU | FORCE_GPU | RENDER_GPU,
+ &box, &op->damage);
+ if (op->dst.bo == NULL)
+ return false;
get_drawable_deltas(dst->pDrawable, op->dst.pixmap,
&op->dst.x, &op->dst.y);
- DBG(("%s: pixmap=%p, format=%08x, size=%dx%d, pitch=%d, delta=(%d,%d)\n",
+ DBG(("%s: pixmap=%p, format=%08x, size=%dx%d, pitch=%d, delta=(%d,%d),damage=%p\n",
__FUNCTION__,
op->dst.pixmap, (int)op->dst.format,
op->dst.width, op->dst.height,
op->dst.bo->pitch,
- op->dst.x, op->dst.y));
+ op->dst.x, op->dst.y,
+ op->damage ? *op->damage : (void *)-1));
+
+ assert(op->dst.bo->proxy == NULL);
+
+ if (too_large(op->dst.width, op->dst.height) &&
+ !sna_render_composite_redirect(sna, op, x, y, w, h))
+ return false;
+
return true;
}
@@ -2682,17 +2687,10 @@ gen6_render_composite(struct sna *sna,
if (op == PictOpClear)
op = PictOpSrc;
tmp->op = op;
- if (!gen6_composite_set_target(sna, tmp, dst))
+ if (!gen6_composite_set_target(sna, tmp, dst,
+ dst_x, dst_y, width, height))
return false;
- sna_render_reduce_damage(tmp, dst_x, dst_y, width, height);
-
- if (too_large(tmp->dst.width, tmp->dst.height)) {
- if (!sna_render_composite_redirect(sna, tmp,
- dst_x, dst_y, width, height))
- return false;
- }
-
switch (gen6_composite_picture(sna, src, &tmp->src,
src_x, src_y,
width, height,
@@ -3126,15 +3124,9 @@ gen6_render_composite_spans(struct sna *sna,
}
tmp->base.op = op;
- if (!gen6_composite_set_target(sna, &tmp->base, dst))
+ if (!gen6_composite_set_target(sna, &tmp->base, dst,
+ dst_x, dst_y, width, height))
return false;
- sna_render_reduce_damage(&tmp->base, dst_x, dst_y, width, height);
-
- if (too_large(tmp->base.dst.width, tmp->base.dst.height)) {
- if (!sna_render_composite_redirect(sna, &tmp->base,
- dst_x, dst_y, width, height))
- return false;
- }
switch (gen6_composite_picture(sna, src, &tmp->base.src,
src_x, src_y,
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index b8897d3..ea05a41 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -2412,46 +2412,53 @@ static void gen7_render_composite_done(struct sna *sna,
}
static bool
-gen7_composite_set_target(struct sna *sna, struct sna_composite_op *op, PicturePtr dst)
+gen7_composite_set_target(struct sna *sna,
+ struct sna_composite_op *op,
+ PicturePtr dst,
+ int x, int y, int w, int h)
{
- struct sna_pixmap *priv;
+ BoxRec box;
op->dst.pixmap = get_drawable_pixmap(dst->pDrawable);
- op->dst.width = op->dst.pixmap->drawable.width;
- op->dst.height = op->dst.pixmap->drawable.height;
op->dst.format = dst->format;
+ op->dst.width = op->dst.pixmap->drawable.width;
+ op->dst.height = op->dst.pixmap->drawable.height;
- op->dst.bo = NULL;
- priv = sna_pixmap(op->dst.pixmap);
- if (priv && priv->gpu_bo == NULL &&
- I915_TILING_NONE == kgem_choose_tiling(&sna->kgem,
- I915_TILING_X,
- op->dst.width,
- op->dst.height,
- op->dst.pixmap->drawable.bitsPerPixel)) {
- op->dst.bo = priv->cpu_bo;
- op->damage = &priv->cpu_damage;
+ if (w && h) {
+ box.x1 = x;
+ box.y1 = y;
+ box.x2 = x + w;
+ box.y2 = y + h;
+ } else {
+ box.x1 = dst->pDrawable->x;
+ box.y1 = dst->pDrawable->y;
+ box.x2 = box.x1 + dst->pDrawable->width;
+ box.y2 = box.y1 + dst->pDrawable->height;
}
- if (op->dst.bo == NULL) {
- priv = sna_pixmap_force_to_gpu(op->dst.pixmap, MOVE_READ | MOVE_WRITE);
- if (priv == NULL)
- return false;
- op->dst.bo = priv->gpu_bo;
- op->damage = &priv->gpu_damage;
- }
- if (sna_damage_is_all(op->damage, op->dst.width, op->dst.height))
- op->damage = NULL;
+ op->dst.bo = sna_drawable_use_bo (dst->pDrawable,
+ PREFER_GPU | FORCE_GPU | RENDER_GPU,
+ &box, &op->damage);
+ if (op->dst.bo == NULL)
+ return false;
get_drawable_deltas(dst->pDrawable, op->dst.pixmap,
&op->dst.x, &op->dst.y);
- DBG(("%s: pixmap=%p, format=%08x, size=%dx%d, pitch=%d, delta=(%d,%d)\n",
+ DBG(("%s: pixmap=%p, format=%08x, size=%dx%d, pitch=%d, delta=(%d,%d),damage=%p\n",
__FUNCTION__,
op->dst.pixmap, (int)op->dst.format,
op->dst.width, op->dst.height,
op->dst.bo->pitch,
- op->dst.x, op->dst.y));
+ op->dst.x, op->dst.y,
+ op->damage ? *op->damage : (void *)-1));
+
+ assert(op->dst.bo->proxy == NULL);
+
+ if (too_large(op->dst.width, op->dst.height) &&
+ !sna_render_composite_redirect(sna, op, x, y, w, h))
+ return false;
+
return true;
}
@@ -2785,17 +2792,10 @@ gen7_render_composite(struct sna *sna,
if (op == PictOpClear)
op = PictOpSrc;
tmp->op = op;
- if (!gen7_composite_set_target(sna, tmp, dst))
+ if (!gen7_composite_set_target(sna, tmp, dst,
+ dst_x, dst_y, width, height))
return false;
- sna_render_reduce_damage(tmp, dst_x, dst_y, width, height);
-
- if (too_large(tmp->dst.width, tmp->dst.height)) {
- if (!sna_render_composite_redirect(sna, tmp,
- dst_x, dst_y, width, height))
- return false;
- }
-
switch (gen7_composite_picture(sna, src, &tmp->src,
src_x, src_y,
width, height,
@@ -3217,15 +3217,9 @@ gen7_render_composite_spans(struct sna *sna,
}
tmp->base.op = op;
- if (!gen7_composite_set_target(sna, &tmp->base, dst))
+ if (!gen7_composite_set_target(sna, &tmp->base, dst,
+ dst_x, dst_y, width, height))
return false;
- sna_render_reduce_damage(&tmp->base, dst_x, dst_y, width, height);
-
- if (too_large(tmp->base.dst.width, tmp->base.dst.height)) {
- if (!sna_render_composite_redirect(sna, &tmp->base,
- dst_x, dst_y, width, height))
- return false;
- }
switch (gen7_composite_picture(sna, src, &tmp->base.src,
src_x, src_y,
commit 3c88b5f693c29b990d69f96508b121ce97a7209e
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Sat Aug 25 11:49:30 2012 +0100
sna: Use a fast span emitter for mono trapezoids without damage or clipping
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_trapezoids.c b/src/sna/sna_trapezoids.c
index dd438de..482abd3 100644
--- a/src/sna/sna_trapezoids.c
+++ b/src/sna/sna_trapezoids.c
@@ -1788,6 +1788,8 @@ struct mono {
struct sna_composite_op op;
pixman_region16_t clip;
+ fastcall void (*span)(struct mono *, int, int, BoxPtr);
+
struct mono_polygon polygon;
};
@@ -2040,16 +2042,9 @@ mono_merge_edges(struct mono *c, struct mono_edge *edges)
c->head.next = mono_merge_unsorted_edges(c->head.next, edges);
}
-inline static void
+fastcall static void
mono_span(struct mono *c, int x1, int x2, BoxPtr box)
{
- if (x1 < c->clip.extents.x1)
- x1 = c->clip.extents.x1;
- if (x2 > c->clip.extents.x2)
- x2 = c->clip.extents.x2;
- if (x2 <= x1)
- return;
-
__DBG(("%s [%d, %d]\n", __FUNCTION__, x1, x2));
box->x1 = x1;
@@ -2073,6 +2068,17 @@ mono_span(struct mono *c, int x1, int x2, BoxPtr box)
}
}
+fastcall static void
+mono_span__fast(struct mono *c, int x1, int x2, BoxPtr box)
+{
+ __DBG(("%s [%d, %d]\n", __FUNCTION__, x1, x2));
+
+ box->x1 = x1;
+ box->x2 = x2;
+
+ c->op.box(c->sna, &c->op, box);
+}
+
inline static void
mono_row(struct mono *c, int16_t y, int16_t h)
{
@@ -2124,7 +2130,12 @@ mono_row(struct mono *c, int16_t y, int16_t h)
if (winding == 0) {
assert(I(next->x.quo) >= xend);
if (I(next->x.quo) > xend + 1) {
- mono_span(c, xstart, xend, &box);
+ if (xstart < c->clip.extents.x1)
+ xstart = c->clip.extents.x1;
+ if (xend > c->clip.extents.x2)
+ xend = c->clip.extents.x2;
+ if (xend > xstart)
+ c->span(c, xstart, xend, &box);
xstart = INT16_MIN;
}
} else if (xstart == INT16_MIN)
@@ -2185,6 +2196,11 @@ mono_render(struct mono *mono)
struct mono_polygon *polygon = &mono->polygon;
int i, j, h = mono->clip.extents.y2 - mono->clip.extents.y1;
+ if (mono->clip.data == NULL && mono->op.damage == NULL)
+ mono->span = mono_span__fast;
+ else
+ mono->span = mono_span;
+
for (i = 0; i < h; i = j) {
j = i + 1;
More information about the xorg-commit
mailing list