dix/pixmap: track dirty pixmaps in server. (v4)

This adds two functions for drivers to use directly to keep a
linked list of slave pixmaps to do damage tracking on and keep
updated. It also adds a helper function that drivers may optionally
call to do a simple copy area damage update.

v2: use damage.h not damagestr.h, fixes ephyr build.

v3: address ajax review: use slave_dst, drop unused dst member.

v4: check DamageCreate return, add SourceValidate comment,
add a comment addressing possible optimisation possibility

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-14 15:24:46 +01:00
commit 9b8217f9ef
5 changed files with 133 additions and 0 deletions

View file

@ -49,6 +49,7 @@ SOFTWARE.
#include "misc.h"
#include "screenint.h"
#include "regionstr.h"
/* types for Drawable */
#define DRAWABLE_WINDOW 0
@ -73,6 +74,8 @@ SOFTWARE.
typedef struct _Drawable *DrawablePtr;
typedef struct _Pixmap *PixmapPtr;
typedef struct _PixmapDirtyUpdate *PixmapDirtyUpdatePtr;
typedef union _PixUnion {
PixmapPtr pixmap;
unsigned long pixel;
@ -112,4 +115,17 @@ extern _X_EXPORT void FreePixmap(PixmapPtr /*pPixmap */ );
extern _X_EXPORT PixmapPtr
PixmapShareToSlave(PixmapPtr pixmap, ScreenPtr slave);
extern _X_EXPORT Bool
PixmapStartDirtyTracking(PixmapPtr src,
PixmapPtr slave_dst,
int x, int y);
extern _X_EXPORT Bool
PixmapStopDirtyTracking(PixmapPtr src, PixmapPtr slave_dst);
/* helper function, drivers can do this themselves if they can do it more
efficently */
extern _X_EXPORT Bool
PixmapSyncDirtyHelper(PixmapDirtyUpdatePtr dirty, RegionPtr dirty_region);
#endif /* PIXMAP_H */

View file

@ -50,6 +50,7 @@ SOFTWARE.
#include "screenint.h"
#include "regionstr.h"
#include "privates.h"
#include "damage.h"
typedef struct _Drawable {
unsigned char type; /* DRAWABLE_<type> */
@ -84,6 +85,13 @@ typedef struct _Pixmap {
PixmapPtr master_pixmap; /* pointer to master copy of pixmap for pixmap sharing */
} PixmapRec;
typedef struct _PixmapDirtyUpdate {
PixmapPtr src, slave_dst;
int x, y;
DamagePtr damage;
struct xorg_list ent;
} PixmapDirtyUpdateRec;
static inline void
PixmapBox(BoxPtr box, PixmapPtr pixmap)
{

View file

@ -505,6 +505,8 @@ typedef struct _Screen {
StartPixmapTrackingProcPtr StartPixmapTracking;
StopPixmapTrackingProcPtr StopPixmapTracking;
struct xorg_list pixmap_dirty_list;
} ScreenRec;
static inline RegionPtr