summaryrefslogtreecommitdiff
path: root/hw/kdrive/neomagic/backend.h
blob: 33eae2680d0f6db37320a70d758c97f59b85c9c0 (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
/*
 * Generic card driving functions.
 * Essentially, cascades calls to fbdev and vesa to initialize cards that
 * do not have hardware-specific routines yet. Copied from the ati driver.
 *
 * Copyright (c) 2004 Brent Cook <busterb@mail.utexas.edu>
 *
 * This code is licensed under the GPL.  See the file COPYING in the root
 * directory of the sources for details.
 */

#ifndef _BACKEND_H_
#define _BACKEND_H_
#include "kdrive.h"

#ifdef KDRIVEFBDEV
#include <fbdev.h>
#endif
#ifdef KDRIVEVESA
#include <vesa.h>
#endif

typedef enum _BackendType {VESA, FBDEV} BackendType;

typedef struct _BackendInfo {
    // backend info
    BackendType type;

    // backend internal structures
    union {
#ifdef KDRIVEFBDEV
        FbdevPriv fbdev;
#endif
#ifdef KDRIVEVESA
        VesaCardPrivRec vesa;
#endif
    } priv;

    // pointers to helper functions for this backend
    void (*cardfini)(KdCardInfo *);
    void (*scrfini)(KdScreenInfo *);
    Bool (*initScreen)(ScreenPtr);
    Bool (*finishInitScreen)(ScreenPtr pScreen);
    Bool (*createRes)(ScreenPtr);
    void (*preserve)(KdCardInfo *);
    void (*restore)(KdCardInfo *);
    Bool (*dpms)(ScreenPtr, int);
    Bool (*enable)(ScreenPtr);
    void (*disable)(ScreenPtr);
    void (*getColors)(ScreenPtr, int, int, xColorItem *);
    void (*putColors)(ScreenPtr, int, int, xColorItem *);
} BackendInfo;

typedef union _BackendScreen {
#ifdef KDRIVEFBDEV
    FbdevScrPriv fbdev;
#endif
#ifdef KDRIVEVESA
    VesaScreenPrivRec vesa;
#endif
} BackendScreen;

Bool
backendInitialize(KdCardInfo *card, BackendInfo *backend);

Bool
backendScreenInitialize(KdScreenInfo *screen, BackendScreen *backendScreen,
                        BackendInfo *backendCard);

#endif