sna: Add some more debug commentary to render picture source migration

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2011-06-07 00:24:17 +01:00
parent 367298c510
commit 4e443cbef5
3 changed files with 40 additions and 11 deletions

View File

@ -614,7 +614,7 @@ fastcall struct sna_damage *_sna_damage_subtract_box(struct sna_damage *damage,
#endif
static int _sna_damage_contains_box(struct sna_damage *damage,
const BoxPtr box)
const BoxRec *box)
{
if (!damage)
return PIXMAN_REGION_OUT;;
@ -625,12 +625,12 @@ static int _sna_damage_contains_box(struct sna_damage *damage,
if (damage->n)
__sna_damage_reduce(damage);
return pixman_region_contains_rectangle(&damage->region, box);
return pixman_region_contains_rectangle(&damage->region, (BoxPtr)box);
}
#if DEBUG_DAMAGE
int sna_damage_contains_box(struct sna_damage *damage,
const BoxPtr box)
const BoxRec *box)
{
char damage_buf[1000];
int ret;
@ -640,13 +640,17 @@ int sna_damage_contains_box(struct sna_damage *damage,
box->x1, box->y1, box->x2, box->y2));
ret = _sna_damage_contains_box(damage, box);
ErrorF(" = %d\n", ret);
ErrorF(" = %d", ret);
if (ret)
ErrorF(" [(%d, %d), (%d, %d)...]",
box->x1, box->y1, box->x2, box->y2);
ErrorF("\n");
return ret;
}
#else
int sna_damage_contains_box(struct sna_damage *damage,
const BoxPtr box)
const BoxRec *box)
{
return _sna_damage_contains_box(damage, box);
}

View File

@ -53,7 +53,7 @@ static inline void sna_damage_subtract(struct sna_damage **damage,
fastcall struct sna_damage *_sna_damage_subtract_box(struct sna_damage *damage,
const BoxRec *box);
static inline void sna_damage_subtract_box(struct sna_damage **damage,
BoxPtr box)
const BoxRec *box)
{
*damage = _sna_damage_subtract_box(*damage, box);
}
@ -62,7 +62,7 @@ Bool sna_damage_intersect(struct sna_damage *damage,
RegionPtr region, RegionPtr result);
int sna_damage_contains_box(struct sna_damage *damage,
const BoxPtr box);
const BoxRec *box);
int sna_damage_get_boxes(struct sna_damage *damage, BoxPtr *boxes);

View File

@ -238,18 +238,26 @@ void no_render_init(struct sna *sna)
}
static Bool
move_to_gpu(PixmapPtr pixmap, const BoxPtr box)
move_to_gpu(PixmapPtr pixmap, const BoxRec *box)
{
struct sna_pixmap *priv;
int count, w, h;
if (pixmap->usage_hint)
if (pixmap->usage_hint) {
DBG(("%s: not migrating pixmap due to usage_hint=%d\n",
__FUNCTION__, pixmap->usage_hint));
return FALSE;
}
w = box->x2 - box->x1;
h = box->y2 - box->y1;
if (w == pixmap->drawable.width || h == pixmap->drawable.height)
if (w == pixmap->drawable.width || h == pixmap->drawable.height) {
DBG(("%s: migrating whole pixmap (%dx%d) for source\n",
__FUNCTION__,
pixmap->drawble->width,
pixmap->drawable.height));
return TRUE;
}
count = SOURCE_BIAS;
priv = sna_pixmap(pixmap);
@ -267,7 +275,7 @@ move_to_gpu(PixmapPtr pixmap, const BoxPtr box)
}
static Bool
texture_is_cpu(PixmapPtr pixmap, const BoxPtr box)
_texture_is_cpu(PixmapPtr pixmap, const BoxRec *box)
{
struct sna_pixmap *priv = sna_pixmap(pixmap);
@ -289,6 +297,23 @@ texture_is_cpu(PixmapPtr pixmap, const BoxPtr box)
return sna_damage_contains_box(priv->cpu_damage, box) != PIXMAN_REGION_OUT;
}
#if DEBUG_RENDER
static Bool
texture_is_cpu(PixmapPtr pixmap, const BoxRec *box)
{
Bool ret = _texture_is_cpu(pixmap, box);
ErrorF("%s(pixmap=%p, box=((%d, %d), (%d, %d)) = %d\n",
__FUNCTION__, pixmap, box, ret);
return ret;
}
#else
static Bool
texture_is_cpu(PixmapPtr pixmap, const BoxRec *box)
{
return _texture_is_cpu(pixmap, box);
}
#endif
static struct kgem_bo *upload(struct sna *sna,
struct sna_composite_channel *channel,
PixmapPtr pixmap,