summaryrefslogtreecommitdiff
path: root/drv/drv_imped.h
blob: 68647c8360cf167eb40f253d1126909d71ba57b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113

#ifndef IMPED_H
#define IMPED_H

#include "drv_types.h"
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "gcstruct.h"
#include "picturestr.h"
/*
 * XFree86 empties the root BorderClip when the VT is inactive,
 * here's a macro which uses that to disable GetImage and GetSpans
 */
#define MAX_GPU 4

typedef struct _impedScreenPriv {
  DrvScreenPtr gpu[MAX_GPU];
  int num_gpu;
} impedScreenPrivRec, *impedScreenPrivPtr;

typedef struct _impedPixmapPriv {
  DrvPixmapPtr gpu[MAX_GPU];
  Bool shattered; /* the root pixmap is shattered */
} impedPixmapPrivRec, *impedPixmapPrivPtr;

typedef struct _impedGCPriv {
  DrvGCPtr gpu[MAX_GPU];
} impedGCPrivRec, *impedGCPrivPtr;

typedef struct _impedPicturePriv {
  DrvPicturePtr gpu[MAX_GPU];
} impedPictPrivRec, *impedPictPrivPtr;

DevPrivateKey impedGetScreenPrivKey(void);
DevPrivateKey impedGetPixmapPrivKey(void);
DevPrivateKey impedGetGCPrivKey(void);
DevPrivateKey impedGetPictPrivKey(void);

static inline impedScreenPrivPtr impedGetScreen(ScreenPtr pScreen)
{
    return dixLookupPrivate(&pScreen->devPrivates, impedGetScreenPrivKey());
}

static inline impedPixmapPrivPtr impedGetPixmap(PixmapPtr pPixmap)
{
    return dixLookupPrivate(&pPixmap->devPrivates, impedGetPixmapPrivKey());
}

static inline impedGCPrivPtr impedGetGC(GCPtr pGC)
{
    return dixLookupPrivate(&pGC->devPrivates, impedGetGCPrivKey());
}

static inline impedPictPrivPtr impedGetPict(PicturePtr pPicture)
{
    return dixLookupPrivate(&pPicture->devPrivates, impedGetPictPrivKey());
}

#define impedWindowEnabled(pWin) \
    RegionNotEmpty(&(pWin)->drawable.pScreen->root->borderClip)

#define impedDrawableEnabled(pDrawable) \
    ((pDrawable)->type == DRAWABLE_PIXMAP ? \
     TRUE : impedWindowEnabled((WindowPtr) pDrawable))

static inline void impedGetDrawableDeltas(DrawablePtr pDrawable, PixmapPtr pPixmap,
					  int *x_off, int *y_off)
{
    *x_off = pDrawable->x;
    *y_off = pDrawable->y;

#ifdef COMPOSITE
    if (pDrawable->type == DRAWABLE_WINDOW) {
	*x_off -= pPixmap->screen_x;
	*y_off -= pPixmap->screen_x;
    }
#endif
}

extern _X_EXPORT void impedSetGCOps(GCPtr pGC);

extern _X_EXPORT void
impedCopyNtoN (DrawablePtr	pSrcDrawable,
	       DrawablePtr	pDstDrawable,
	       GCPtr	pGC,
	       BoxPtr	pbox,
	       int		nbox,
	       int		dx,
	       int		dy,
	       Bool	reverse,
	       Bool	upsidedown,
	       Pixel	bitplane,
	       void	*closure);

extern _X_EXPORT Bool impedCreateGC(GCPtr pGC);

extern _X_EXPORT void impedScreenSetPixmapSize(ScreenPtr pScreen);

extern _X_EXPORT void impedAttachDrvScreen(ScreenPtr pScreen, DrvScreenPtr pDrvScreen);

extern _X_EXPORT Bool impedSetupScreen(int index, ScreenPtr pScreen);


extern _X_EXPORT Bool impedFinishScreenInit(ScreenPtr pScreen,
					    pointer pbits,
					    int		xsize,
					    int		ysize,
					    int		dpix,
					    int		dpiy,
					    int		width,
					    int		bpp);
extern _X_EXPORT void impedInit(void);
#endif