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