summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-01-05 22:16:31 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-01-05 23:44:13 +0000
commit8a9baa59e9d0c0761b82f23734514f6847a9bcc1 (patch)
tree509e60d25493552cf222137d9e502bb771af2d80
parentd4dad6e3723d70d78247f29f86079862af175266 (diff)
sna: Quickly handle the common case of using a GPU source pixmap
For the common case of glyphs, the pixmap is entirely on the GPU which can be quickly tested before performing the more complex transformations to determine how much pixel data we need to upload. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_render.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c
index 8355d409..cd01b68a 100644
--- a/src/sna/sna_render.c
+++ b/src/sna/sna_render.c
@@ -441,11 +441,25 @@ sna_render_pixmap_bo(struct sna *sna,
int16_t w, int16_t h,
int16_t dst_x, int16_t dst_y)
{
- struct kgem_bo *bo = NULL;
+ struct kgem_bo *bo;
struct sna_pixmap *priv;
BoxRec box;
- DBG(("%s (%d, %d)x(%d, %d)\n", __FUNCTION__, x, y, w,h));
+ DBG(("%s (%d, %d)x(%d, %d)/(%d, %d)\n", __FUNCTION__,
+ x, y, w,h, pixmap->drawable.height, pixmap->drawable.width));
+
+ channel->height = pixmap->drawable.height;
+ channel->width = pixmap->drawable.width;
+ channel->scale[0] = 1.f / pixmap->drawable.width;
+ channel->scale[1] = 1.f / pixmap->drawable.height;
+ channel->offset[0] = x - dst_x;
+ channel->offset[1] = y - dst_y;
+
+ priv = sna_pixmap(pixmap);
+ if (priv && priv->gpu_damage && priv->gpu_damage->mode == DAMAGE_ALL) {
+ channel->bo = kgem_bo_reference(priv->gpu_bo);
+ return 1;
+ }
/* XXX handle transformed repeat */
if (w == 0 || h == 0 || channel->transform) {
@@ -490,13 +504,6 @@ sna_render_pixmap_bo(struct sna *sna,
return 0;
}
- channel->height = pixmap->drawable.height;
- channel->width = pixmap->drawable.width;
- channel->scale[0] = 1.f / pixmap->drawable.width;
- channel->scale[1] = 1.f / pixmap->drawable.height;
- channel->offset[0] = x - dst_x;
- channel->offset[1] = y - dst_y;
-
DBG(("%s: offset=(%d, %d), size=(%d, %d)\n",
__FUNCTION__,
channel->offset[0], channel->offset[1],