dummy.h 1.62 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12

/* All drivers should typically include these */
#include "xf86.h"
#include "xf86_OSproc.h"

#include "xf86Cursor.h"

#ifdef XvExtension
#include "xf86xv.h"
#include <X11/extensions/Xv.h>
#endif
#include <string.h>
13
#include <time.h>
14

15
16
17
#define GLAMOR_FOR_XORG 1
#include "glamor.h"

18
19
#include "compat-api.h"

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* Supported chipsets */
typedef enum {
    DUMMY_CHIP
} DUMMYType;

/* function prototypes */

extern Bool DUMMYSwitchMode(SWITCH_MODE_ARGS_DECL);
extern void DUMMYAdjustFrame(ADJUST_FRAME_ARGS_DECL);

/* in dummy_cursor.c */
extern Bool DUMMYCursorInit(ScreenPtr pScrn);
extern void DUMMYShowCursor(ScrnInfoPtr pScrn);
extern void DUMMYHideCursor(ScrnInfoPtr pScrn);

35
36
37
38
void dummy_dri2_close_screen(ScreenRec * screen);
Bool dummy_dri2_screen_init(ScreenRec * screen);
Bool dummy_present_screen_init(ScreenRec * screen);

39
/* globals */
40
typedef struct _color {
41
42
43
44
45
    int red;
    int green;
    int blue;
} dummy_colors;

46
typedef struct dummyRec {
47
48
49
50
51
52
53
54
55
56
57
58
    /* options */
    OptionInfoPtr Options;
    Bool swCursor;
    /* proc pointer */
    CloseScreenProcPtr CloseScreen;
    xf86CursorInfoPtr CursorInfo;

    Bool DummyHWCursorShown;
    int cursorX, cursorY;
    int cursorFG, cursorBG;

    dummy_colors colors[1024];
59
    Bool (*CreateWindow)();    /* wrapped CreateWindow */
60
    Bool prop;
61
62
63

    Bool glamor;
    int fd;
64
65
66
67
} DUMMYRec, *DUMMYPtr;

/* The privates of the DUMMY driver */
#define DUMMYPTR(p)	((DUMMYPtr)((p)->driverPrivate))
68
69
70
71
72
73
74
75
76
77
78
79

static inline uint64_t
dummy_gettime_us(void)
{
    struct timespec tv;

    if (clock_gettime(CLOCK_MONOTONIC, &tv)) {
        return 0;
    }

    return (uint64_t) tv.tv_sec * 1000000 + tv.tv_nsec / 1000;
}