4573c50ea6ab91c41c899c004083d9490e92556b
[mesa.git] / src / egl / drivers / dri / egldri.h
1 #ifndef EGLDRI_INCLUDED
2 #define EGLDRI_INCLUDED
3
4 #include "egldisplay.h"
5 #include "eglscreen.h"
6 #include "eglsurface.h"
7 #include "eglcontext.h"
8 #include "mtypes.h"
9 #include "dri_util.h"
10 #include "drm_sarea.h"
11
12 /**
13 * dri display-specific driver class derived from _EGLDisplay
14 */
15 typedef struct dri_display
16 {
17 _EGLDisplay Base; /* base class/object */
18 void *pFB;
19 int drmFD; /**< \brief DRM device file descriptor */
20 int minor;
21 unsigned long hFrameBuffer;
22
23 int virtualWidth;
24 int virtualHeight;
25 int fbSize;
26 int bpp;
27 int cpp;
28 int isPCI;
29 int SAREASize;
30 drm_sarea_t *pSAREA;
31 unsigned int serverContext; /**< \brief DRM context only active on server */
32 unsigned long FBStart; /**< \brief physical address of the framebuffer */
33 void *driverClientMsg;
34 int driverClientMsgSize;
35 int chipset;
36 void *driverPrivate;
37 drm_magic_t magic;
38
39 __GLcontextModes *driver_modes;
40 __DRIscreen driScreen;
41
42 } driDisplay;
43
44 /**
45 * dri driver-specific screen class derived from _EGLScreen
46 */
47 typedef struct dri_screen
48 {
49 _EGLScreen Base;
50 char fb[NAME_MAX];
51 } driScreen;
52
53
54 /**
55 * dri driver-specific surface class derived from _EGLSurface
56 */
57 typedef struct dri_surface
58 {
59 _EGLSurface Base; /* base class/object */
60 __DRIdrawable drawable;
61 } driSurface;
62
63
64 /**
65 * dri driver-specific context class derived from _EGLContext
66 */
67 typedef struct dri_context
68 {
69 _EGLContext Base; /* base class/object */
70 __DRIcontext driContext; /**< \brief context dependent methods */
71 } driContext;
72
73
74
75 static inline driDisplay *
76 Lookup_driDisplay(EGLDisplay dpy)
77 {
78 _EGLDisplay *d = _eglLookupDisplay(dpy);
79 return (driDisplay *) d;
80 }
81
82
83 static inline driScreen *
84 Lookup_driScreen(EGLDisplay dpy, EGLScreenMESA screen)
85 {
86 _EGLScreen *s = _eglLookupScreen(dpy, screen);
87 return (driScreen *) s;
88 }
89
90
91 static inline driContext *
92 Lookup_driContext(EGLContext ctx)
93 {
94 _EGLContext *c = _eglLookupContext(ctx);
95 return (driContext *) c;
96 }
97
98
99 static inline driSurface *
100 Lookup_driSurface(EGLSurface surf)
101 {
102 _EGLSurface *s = _eglLookupSurface(surf);
103 return (driSurface *) s;
104 }
105
106 extern void _eglDRIInitDriverFallbacks(_EGLDriver *drv);
107 extern EGLBoolean _eglDRIShowSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLSurface surface, EGLModeMESA m);
108 extern EGLBoolean _eglDRIInitialize(_EGLDriver *drv, EGLDisplay dpy, EGLint *major, EGLint *minor);
109 extern EGLBoolean _eglDRIGetDisplayInfo(driDisplay *dpy);
110 extern EGLBoolean _eglDRICreateDisplay(driDisplay *dpy, __DRIframebuffer *framebuffer);
111 extern EGLBoolean _eglDRICreateScreen(driDisplay *dpy);
112
113 #endif /* EGLDRI_INCLUDED */