randr: add initial scanout pixmap support (v3)

When randr notices a crtc configuration request for a slave device,
it checks if the slave allocated pixmap exists and is suitable,
if not it allocates a new shared pixmap from the master, shares
it to the slave, and starts the master tracking damage to it,
to keep it updated from the current front pixmap.

If the resize means the crtc is no longer used it will destroy
the slave pixmap.

This adds the concept of a scanout_pixmap to the randr_crtc object,
and also adds a master pixmap pointer to the pixmap object, along
with defining some pixmap helper functions for getting pixmap box/regions.

v2: split out pixmap sharing to a separate function.

v3: update for void *

Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Dave Airlie
2012-06-20 12:37:12 +01:00
parent 0b0e714892
commit f2da2c1204
5 changed files with 237 additions and 0 deletions

View File

@@ -80,6 +80,28 @@ typedef struct _Pixmap {
short screen_y;
#endif
unsigned usage_hint; /* see CREATE_PIXMAP_USAGE_* */
PixmapPtr master_pixmap; /* pointer to master copy of pixmap for pixmap sharing */
} PixmapRec;
static inline void
PixmapBox(BoxPtr box, PixmapPtr pixmap)
{
box->x1 = 0;
box->x2 = pixmap->drawable.width;
box->y1 = 0;
box->y2 = pixmap->drawable.height;
}
static inline void
PixmapRegionInit(RegionPtr region, PixmapPtr pixmap)
{
BoxRec box;
PixmapBox(&box, pixmap);
RegionInit(region, &box, 1);
}
#endif /* PIXMAPSTRUCT_H */