glamor_pixmap_priv: Always return a valid private pixmap.
If a pixmap doesn't have a private, then set its type to GLAMOR_MEMORY, and thus it will get a valid private. Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
This commit is contained in:
parent
420af44a3a
commit
bd53e24dc3
@ -67,7 +67,8 @@ glamor_set_pixmap_type(PixmapPtr pixmap, glamor_pixmap_type_t type)
|
|||||||
glamor_screen_private *glamor_priv =
|
glamor_screen_private *glamor_priv =
|
||||||
glamor_get_screen_private(pixmap->drawable.pScreen);
|
glamor_get_screen_private(pixmap->drawable.pScreen);
|
||||||
|
|
||||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
pixmap_priv = dixLookupPrivate(&pixmap->devPrivates,
|
||||||
|
glamor_pixmap_private_key);
|
||||||
if (pixmap_priv == NULL) {
|
if (pixmap_priv == NULL) {
|
||||||
pixmap_priv = calloc(sizeof(*pixmap_priv), 1);
|
pixmap_priv = calloc(sizeof(*pixmap_priv), 1);
|
||||||
glamor_set_pixmap_private(pixmap, pixmap_priv);
|
glamor_set_pixmap_private(pixmap, pixmap_priv);
|
||||||
|
@ -370,8 +370,15 @@ glamor_set_screen_private(ScreenPtr screen, glamor_screen_private *priv)
|
|||||||
static inline glamor_pixmap_private *
|
static inline glamor_pixmap_private *
|
||||||
glamor_get_pixmap_private(PixmapPtr pixmap)
|
glamor_get_pixmap_private(PixmapPtr pixmap)
|
||||||
{
|
{
|
||||||
return dixLookupPrivate(&pixmap->devPrivates,
|
glamor_pixmap_private *priv;
|
||||||
|
priv = dixLookupPrivate(&pixmap->devPrivates,
|
||||||
glamor_pixmap_private_key);
|
glamor_pixmap_private_key);
|
||||||
|
if (!priv) {
|
||||||
|
glamor_set_pixmap_type(pixmap, GLAMOR_MEMORY);
|
||||||
|
priv = dixLookupPrivate(&pixmap->devPrivates,
|
||||||
|
glamor_pixmap_private_key);
|
||||||
|
}
|
||||||
|
return priv;
|
||||||
}
|
}
|
||||||
|
|
||||||
void glamor_set_pixmap_private(PixmapPtr pixmap, glamor_pixmap_private *priv);
|
void glamor_set_pixmap_private(PixmapPtr pixmap, glamor_pixmap_private *priv);
|
||||||
|
@ -757,7 +757,6 @@ static inline void _glamor_dump_pixmap_byte(PixmapPtr pixmap, int x, int y, int
|
|||||||
int stride = pixmap->devKind;
|
int stride = pixmap->devKind;
|
||||||
|
|
||||||
p = p + y * stride + x;
|
p = p + y * stride + x;
|
||||||
ErrorF("devKind %d, x %d y %d w %d h %d width %d height %d\n", stride, x, y, w, h, pixmap->drawable.width, pixmap->drawable.height);
|
|
||||||
|
|
||||||
for (i = 0; i < h; i++)
|
for (i = 0; i < h; i++)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user