2 * Copyright 2006 Red Hat, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 * This implements a software-only "DRI" driver. It doesn't actually speak
25 * any DRI protocol or talk to the DRM, it just looks enough like a DRI driver
26 * that libglx in the server can load it for software rendering in the
31 glcoreInitDriver(__DRIscreenPrivate
*driScreenPriv
)
36 glcoreDestroyScreen(__DRIScreenPrivate
*driScreenPriv
)
41 glcoreCreateContext(const __GLcontextModes
*glVisual
,
42 __DRIcontextPrivate
*driContextPriv
,
48 glcoreDestroyContext(__DRIcontextPrivate
*driContextPriv
)
53 glcoreCreateBuffer(__DRIscreenPrivate
*driScreenPriv
,
54 __DRIdrawablePrivate
*driDrawablePriv
,
55 const __GLcontextModes
*mesaVisual
,
61 glcoreDestroyBuffer(__DRIdrawablePrivate
*driDrawablePriv
)
66 glcoreSwapBuffers(__DRIdrawablePrivate
*driDrawablePriv
)
71 glcoreMakeCurrent(__DRIcontextPrivate
*driContextPriv
,
72 __DRIdrawablePrivate
*driDrawablePriv
,
73 __DRIdrawablePrivate
*driReadablePriv
)
78 glcoreUnbindContext(__DRIcontextPrivate
*driContextPriv
)
82 static struct __DriverAPIRec glcore_api
= {
83 .InitDriver
= glcoreInitDriver
,
84 .DestroyScreen
= glcoreDestroyScreen
,
85 .CreateContext
= glcoreCreateContext
,
86 .DestroyContext
= glcoreDestroyContext
,
87 .CreateBuffer
= glcoreCreateBuffer
,
88 .DestroyBuffer
= glcoreDestroyBuffer
,
89 .SwapBuffers
= glcoreSwapBuffers
,
90 .MakeCurrent
= glcoreMakeCurrent
,
91 .UnbindContext
= glcoreUnbindContext
,
94 static __GLcontextModes
*
95 glcoreFillInModes(unsigned pixel_bits
)
100 __driCreateNewScreen_20050727(__DRInativeDisplay
*dpy
, int scrn
,
101 __DRIscreen
*psc
, const __GLcontextModes
*modes
,
102 const __DRIversion
*ddx_version
,
103 const __DRIversion
*dri_version
,
104 const __DRIversion
*drm_version
,
105 const __DRIframebuffer
*fb
, drmAddress pSarea
,
106 int fd
, int internal_api_version
,
107 const ___DRIinterfaceMethods
*interface
,
108 __GLcontextModes
**driver_modes
)
110 __DRIscreenPrivate
*driScreenPriv
;
111 glcoreDriverPrivate
*glcoreDriverPriv
;
113 /* would normally check ddx/dri/drm versions here */
115 driScreenPriv
= __driUtilCreateNewScreen(dpy
, scrn
, psc
, NULL
, ddx_version
,
116 dri_version
, drm_version
, fb
,
117 internal_api_version
, &glcore_api
);
121 glcoreDriverPriv
= driScreenPriv
->pDrvPriv
;
123 *driver_modes
= glcoreFillInModes(glcoreDriverPriv
->bpp
);
125 driInitExtensions(NULL
, NULL
, GL_FALSE
);
127 return driScreenPriv
;