glamor_utils: Added debug function to dump depth 15/16 pixmap.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
This commit is contained in:
parent
57e29ebdc1
commit
55fdc7b196
|
@ -658,6 +658,24 @@ static inline void _glamor_dump_pixmap_byte(PixmapPtr pixmap, int x, int y, int
|
|||
}
|
||||
}
|
||||
|
||||
static inline void _glamor_dump_pixmap_sword(PixmapPtr pixmap, int x, int y, int w, int h)
|
||||
{
|
||||
int i,j;
|
||||
unsigned short * p = pixmap->devPrivate.ptr;
|
||||
int stride = pixmap->devKind / 2;
|
||||
|
||||
p = p + y * stride + x;
|
||||
|
||||
for (i = 0; i < h; i++)
|
||||
{
|
||||
ErrorF("line %3d: ", i);
|
||||
for(j = 0; j < w; j++)
|
||||
ErrorF("%2x ", p[j]);
|
||||
p += stride;
|
||||
ErrorF("\n");
|
||||
}
|
||||
}
|
||||
|
||||
static inline void _glamor_dump_pixmap_word(PixmapPtr pixmap, int x, int y, int w, int h)
|
||||
{
|
||||
int i,j;
|
||||
|
@ -678,17 +696,25 @@ static inline void _glamor_dump_pixmap_word(PixmapPtr pixmap, int x, int y, int
|
|||
|
||||
static inline void glamor_dump_pixmap(PixmapPtr pixmap, int x, int y, int w, int h)
|
||||
{
|
||||
w = ((x + w) > pixmap->drawable.width) ? (pixmap->drawable.width - x) : w;
|
||||
h = ((y + h) > pixmap->drawable.height) ? (pixmap->drawable.height - y) : h;
|
||||
|
||||
glamor_prepare_access(&pixmap->drawable, GLAMOR_ACCESS_RO);
|
||||
switch (pixmap->drawable.depth) {
|
||||
case 8:
|
||||
_glamor_dump_pixmap_byte(pixmap, x, y, w, h);
|
||||
break;
|
||||
case 15:
|
||||
case 16:
|
||||
_glamor_dump_pixmap_sword(pixmap, x, y, w, h);
|
||||
break;
|
||||
|
||||
case 24:
|
||||
case 32:
|
||||
_glamor_dump_pixmap_word(pixmap, x, y, w, h);
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
ErrorF("dump depth %d, not implemented.\n", pixmap->drawable.depth);
|
||||
}
|
||||
glamor_finish_access(&pixmap->drawable, GLAMOR_ACCESS_RO);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user