1 /**************************************************************************
3 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
30 #include "framebuffer.h"
32 #include "renderbuffer.h"
33 #include "simple_list.h"
39 #include "intel_screen.h"
41 #include "intel_tex.h"
42 #include "intel_span.h"
43 #include "intel_ioctl.h"
47 PUBLIC
const char __driConfigOptions
[] =
49 DRI_CONF_SECTION_PERFORMANCE
50 DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS
)
51 DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0
)
53 DRI_CONF_SECTION_QUALITY
54 DRI_CONF_FORCE_S3TC_ENABLE(false)
55 DRI_CONF_ALLOW_LARGE_TEXTURES(1)
58 const GLuint __driNConfigOptions
= 4;
60 #ifdef USE_NEW_INTERFACE
61 static PFNGLXCREATECONTEXTMODES create_context_modes
= NULL
;
62 #endif /*USE_NEW_INTERFACE*/
64 extern const struct dri_extension card_extensions
[];
67 * Map all the memory regions described by the screen.
68 * \return GL_TRUE if success, GL_FALSE if error.
71 intelMapScreenRegions(__DRIscreenPrivate
*sPriv
)
73 intelScreenPrivate
*intelScreen
= (intelScreenPrivate
*)sPriv
->private;
75 if (intelScreen
->front
.handle
) {
77 intelScreen
->front
.handle
,
78 intelScreen
->front
.size
,
79 (drmAddress
*)&intelScreen
->front
.map
) != 0) {
80 _mesa_problem(NULL
, "drmMap(frontbuffer) failed!");
84 /* Use the old static allocation method if the server isn't setting up
85 * a movable handle for us. Add in the front buffer offset from
86 * framebuffer start, as our span routines (unlike other drivers) expect
87 * the renderbuffer address to point to the beginning of the
90 intelScreen
->front
.map
= (char *)sPriv
->pFB
;
91 if (intelScreen
->front
.map
== NULL
) {
92 fprintf(stderr
, "Failed to find framebuffer mapping\n");
98 intelScreen
->back
.handle
,
99 intelScreen
->back
.size
,
100 (drmAddress
*)&intelScreen
->back
.map
) != 0) {
101 intelUnmapScreenRegions(intelScreen
);
105 if (drmMap(sPriv
->fd
,
106 intelScreen
->depth
.handle
,
107 intelScreen
->depth
.size
,
108 (drmAddress
*)&intelScreen
->depth
.map
) != 0) {
109 intelUnmapScreenRegions(intelScreen
);
113 if (drmMap(sPriv
->fd
,
114 intelScreen
->tex
.handle
,
115 intelScreen
->tex
.size
,
116 (drmAddress
*)&intelScreen
->tex
.map
) != 0) {
117 intelUnmapScreenRegions(intelScreen
);
122 printf("Mappings: front: %p back: %p depth: %p tex: %p\n",
123 intelScreen
->front
.map
,
124 intelScreen
->back
.map
,
125 intelScreen
->depth
.map
,
126 intelScreen
->tex
.map
);
132 intelUnmapScreenRegions(intelScreenPrivate
*intelScreen
)
134 #define REALLY_UNMAP 1
135 /* If front.handle is present, we're doing the dynamic front buffer mapping,
136 * but if we've fallen back to static allocation then we shouldn't try to
139 if (intelScreen
->front
.handle
) {
141 if (drmUnmap(intelScreen
->front
.map
, intelScreen
->front
.size
) != 0)
142 printf("drmUnmap front failed!\n");
144 intelScreen
->front
.map
= NULL
;
146 if (intelScreen
->back
.map
) {
148 if (drmUnmap(intelScreen
->back
.map
, intelScreen
->back
.size
) != 0)
149 printf("drmUnmap back failed!\n");
151 intelScreen
->back
.map
= NULL
;
153 if (intelScreen
->depth
.map
) {
155 drmUnmap(intelScreen
->depth
.map
, intelScreen
->depth
.size
);
156 intelScreen
->depth
.map
= NULL
;
159 if (intelScreen
->tex
.map
) {
161 drmUnmap(intelScreen
->tex
.map
, intelScreen
->tex
.size
);
162 intelScreen
->tex
.map
= NULL
;
169 intelPrintDRIInfo(intelScreenPrivate
*intelScreen
,
170 __DRIscreenPrivate
*sPriv
,
173 fprintf(stderr
, "*** Front size: 0x%x offset: 0x%x pitch: %d\n",
174 intelScreen
->front
.size
, intelScreen
->front
.offset
,
175 intelScreen
->front
.pitch
);
176 fprintf(stderr
, "*** Back size: 0x%x offset: 0x%x pitch: %d\n",
177 intelScreen
->back
.size
, intelScreen
->back
.offset
,
178 intelScreen
->back
.pitch
);
179 fprintf(stderr
, "*** Depth size: 0x%x offset: 0x%x pitch: %d\n",
180 intelScreen
->depth
.size
, intelScreen
->depth
.offset
,
181 intelScreen
->depth
.pitch
);
182 fprintf(stderr
, "*** Rotated size: 0x%x offset: 0x%x pitch: %d\n",
183 intelScreen
->rotated
.size
, intelScreen
->rotated
.offset
,
184 intelScreen
->rotated
.pitch
);
185 fprintf(stderr
, "*** Texture size: 0x%x offset: 0x%x\n",
186 intelScreen
->tex
.size
, intelScreen
->tex
.offset
);
187 fprintf(stderr
, "*** Memory : 0x%x\n", gDRIPriv
->mem
);
192 intelPrintSAREA(volatile drmI830Sarea
*sarea
)
194 fprintf(stderr
, "SAREA: sarea width %d height %d\n", sarea
->width
, sarea
->height
);
195 fprintf(stderr
, "SAREA: pitch: %d\n", sarea
->pitch
);
197 "SAREA: front offset: 0x%08x size: 0x%x handle: 0x%x\n",
198 sarea
->front_offset
, sarea
->front_size
,
199 (unsigned) sarea
->front_handle
);
201 "SAREA: back offset: 0x%08x size: 0x%x handle: 0x%x\n",
202 sarea
->back_offset
, sarea
->back_size
,
203 (unsigned) sarea
->back_handle
);
204 fprintf(stderr
, "SAREA: depth offset: 0x%08x size: 0x%x handle: 0x%x\n",
205 sarea
->depth_offset
, sarea
->depth_size
,
206 (unsigned) sarea
->depth_handle
);
207 fprintf(stderr
, "SAREA: tex offset: 0x%08x size: 0x%x handle: 0x%x\n",
208 sarea
->tex_offset
, sarea
->tex_size
,
209 (unsigned) sarea
->tex_handle
);
210 fprintf(stderr
, "SAREA: rotation: %d\n", sarea
->rotation
);
212 "SAREA: rotated offset: 0x%08x size: 0x%x\n",
213 sarea
->rotated_offset
, sarea
->rotated_size
);
214 fprintf(stderr
, "SAREA: rotated pitch: %d\n", sarea
->rotated_pitch
);
219 * A number of the screen parameters are obtained/computed from
220 * information in the SAREA. This function updates those parameters.
223 intelUpdateScreenFromSAREA(intelScreenPrivate
*intelScreen
,
224 volatile drmI830Sarea
*sarea
)
226 intelScreen
->width
= sarea
->width
;
227 intelScreen
->height
= sarea
->height
;
229 intelScreen
->front
.offset
= sarea
->front_offset
;
230 intelScreen
->front
.pitch
= sarea
->pitch
* intelScreen
->cpp
;
231 intelScreen
->front
.handle
= sarea
->front_handle
;
232 intelScreen
->front
.size
= sarea
->front_size
;
234 intelScreen
->back
.offset
= sarea
->back_offset
;
235 intelScreen
->back
.pitch
= sarea
->pitch
* intelScreen
->cpp
;
236 intelScreen
->back
.handle
= sarea
->back_handle
;
237 intelScreen
->back
.size
= sarea
->back_size
;
239 intelScreen
->depth
.offset
= sarea
->depth_offset
;
240 intelScreen
->depth
.pitch
= sarea
->pitch
* intelScreen
->cpp
;
241 intelScreen
->depth
.handle
= sarea
->depth_handle
;
242 intelScreen
->depth
.size
= sarea
->depth_size
;
244 intelScreen
->tex
.offset
= sarea
->tex_offset
;
245 intelScreen
->logTextureGranularity
= sarea
->log_tex_granularity
;
246 intelScreen
->tex
.handle
= sarea
->tex_handle
;
247 intelScreen
->tex
.size
= sarea
->tex_size
;
249 intelScreen
->rotated
.offset
= sarea
->rotated_offset
;
250 intelScreen
->rotated
.pitch
= sarea
->rotated_pitch
* intelScreen
->cpp
;
251 intelScreen
->rotated
.size
= sarea
->rotated_size
;
252 intelScreen
->current_rotation
= sarea
->rotation
;
254 matrix23Rotate(&intelScreen
->rotMatrix
,
255 sarea
->width
, sarea
->height
, sarea
->rotation
);
257 intelScreen
->rotatedWidth
= sarea
->virtualX
;
258 intelScreen
->rotatedHeight
= sarea
->virtualY
;
261 intelPrintSAREA(sarea
);
265 static GLboolean
intelInitDriver(__DRIscreenPrivate
*sPriv
)
267 intelScreenPrivate
*intelScreen
;
268 I830DRIPtr gDRIPriv
= (I830DRIPtr
)sPriv
->pDevPriv
;
269 PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension
=
270 (PFNGLXSCRENABLEEXTENSIONPROC
) (*dri_interface
->getProcAddress("glxEnableExtension"));
271 void * const psc
= sPriv
->psc
->screenConfigs
;
272 volatile drmI830Sarea
*sarea
;
274 if (sPriv
->devPrivSize
!= sizeof(I830DRIRec
)) {
275 fprintf(stderr
,"\nERROR! sizeof(I830DRIRec) (%d) does not match passed size from device driver (%d)\n", sizeof(I830DRIRec
), sPriv
->devPrivSize
);
279 /* Allocate the private area */
280 intelScreen
= (intelScreenPrivate
*)CALLOC(sizeof(intelScreenPrivate
));
282 fprintf(stderr
,"\nERROR! Allocating private area failed\n");
285 /* parse information in __driConfigOptions */
286 driParseOptionInfo (&intelScreen
->optionCache
,
287 __driConfigOptions
, __driNConfigOptions
);
289 intelScreen
->driScrnPriv
= sPriv
;
290 sPriv
->private = (void *)intelScreen
;
291 intelScreen
->sarea_priv_offset
= gDRIPriv
->sarea_priv_offset
;
292 sarea
= (volatile drmI830Sarea
*)
293 (((GLubyte
*)sPriv
->pSAREA
)+intelScreen
->sarea_priv_offset
);
295 intelScreen
->deviceID
= gDRIPriv
->deviceID
;
296 intelScreen
->mem
= gDRIPriv
->mem
;
297 intelScreen
->cpp
= gDRIPriv
->cpp
;
299 switch (gDRIPriv
->bitsPerPixel
) {
300 case 15: intelScreen
->fbFormat
= DV_PF_555
; break;
301 case 16: intelScreen
->fbFormat
= DV_PF_565
; break;
302 case 32: intelScreen
->fbFormat
= DV_PF_8888
; break;
305 intelUpdateScreenFromSAREA(intelScreen
, sarea
);
308 intelPrintDRIInfo(intelScreen
, sPriv
, gDRIPriv
);
310 if (!intelMapScreenRegions(sPriv
)) {
311 fprintf(stderr
,"\nERROR! mapping regions\n");
312 _mesa_free(intelScreen
);
313 sPriv
->private = NULL
;
317 intelScreen
->drmMinor
= sPriv
->drmMinor
;
319 /* Determine if IRQs are active? */
324 gp
.param
= I830_PARAM_IRQ_ACTIVE
;
325 gp
.value
= &intelScreen
->irq_active
;
327 ret
= drmCommandWriteRead( sPriv
->fd
, DRM_I830_GETPARAM
,
330 fprintf(stderr
, "drmI830GetParam: %d\n", ret
);
335 /* Determine if batchbuffers are allowed */
340 gp
.param
= I830_PARAM_ALLOW_BATCHBUFFER
;
341 gp
.value
= &intelScreen
->allow_batchbuffer
;
343 ret
= drmCommandWriteRead( sPriv
->fd
, DRM_I830_GETPARAM
,
346 fprintf(stderr
, "drmI830GetParam: (%d) %d\n", gp
.param
, ret
);
351 if (glx_enable_extension
!= NULL
) {
352 (*glx_enable_extension
)( psc
, "GLX_SGI_swap_control" );
353 (*glx_enable_extension
)( psc
, "GLX_SGI_video_sync" );
354 (*glx_enable_extension
)( psc
, "GLX_MESA_swap_control" );
355 (*glx_enable_extension
)( psc
, "GLX_MESA_swap_frame_usage" );
356 (*glx_enable_extension
)( psc
, "GLX_SGI_make_current_read" );
357 (*glx_enable_extension
)( psc
, "GLX_MESA_copy_sub_buffer" );
364 static void intelDestroyScreen(__DRIscreenPrivate
*sPriv
)
366 intelScreenPrivate
*intelScreen
= (intelScreenPrivate
*)sPriv
->private;
368 intelUnmapScreenRegions(intelScreen
);
370 sPriv
->private = NULL
;
373 static GLboolean
intelCreateBuffer( __DRIscreenPrivate
*driScrnPriv
,
374 __DRIdrawablePrivate
*driDrawPriv
,
375 const __GLcontextModes
*mesaVis
,
378 intelScreenPrivate
*screen
= (intelScreenPrivate
*) driScrnPriv
->private;
381 return GL_FALSE
; /* not implemented */
383 GLboolean swStencil
= (mesaVis
->stencilBits
> 0 &&
384 mesaVis
->depthBits
!= 24);
386 struct gl_framebuffer
*fb
= _mesa_create_framebuffer(mesaVis
);
389 driRenderbuffer
*frontRb
390 = driNewRenderbuffer(GL_RGBA
,
393 screen
->front
.offset
, screen
->front
.pitch
,
395 intelSetSpanFunctions(frontRb
, mesaVis
);
396 _mesa_add_renderbuffer(fb
, BUFFER_FRONT_LEFT
, &frontRb
->Base
);
399 if (mesaVis
->doubleBufferMode
) {
400 driRenderbuffer
*backRb
401 = driNewRenderbuffer(GL_RGBA
,
404 screen
->back
.offset
, screen
->back
.pitch
,
406 intelSetSpanFunctions(backRb
, mesaVis
);
407 _mesa_add_renderbuffer(fb
, BUFFER_BACK_LEFT
, &backRb
->Base
);
410 if (mesaVis
->depthBits
== 16) {
411 driRenderbuffer
*depthRb
412 = driNewRenderbuffer(GL_DEPTH_COMPONENT16
,
415 screen
->depth
.offset
, screen
->depth
.pitch
,
417 intelSetSpanFunctions(depthRb
, mesaVis
);
418 _mesa_add_renderbuffer(fb
, BUFFER_DEPTH
, &depthRb
->Base
);
420 else if (mesaVis
->depthBits
== 24) {
421 driRenderbuffer
*depthRb
422 = driNewRenderbuffer(GL_DEPTH_COMPONENT24
,
425 screen
->depth
.offset
, screen
->depth
.pitch
,
427 intelSetSpanFunctions(depthRb
, mesaVis
);
428 _mesa_add_renderbuffer(fb
, BUFFER_DEPTH
, &depthRb
->Base
);
431 if (mesaVis
->stencilBits
> 0 && !swStencil
) {
432 driRenderbuffer
*stencilRb
433 = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT
,
436 screen
->depth
.offset
, screen
->depth
.pitch
,
438 intelSetSpanFunctions(stencilRb
, mesaVis
);
439 _mesa_add_renderbuffer(fb
, BUFFER_STENCIL
, &stencilRb
->Base
);
442 _mesa_add_soft_renderbuffers(fb
,
443 GL_FALSE
, /* color */
444 GL_FALSE
, /* depth */
446 mesaVis
->accumRedBits
> 0,
447 GL_FALSE
, /* alpha */
449 driDrawPriv
->driverPrivate
= (void *) fb
;
451 return (driDrawPriv
->driverPrivate
!= NULL
);
455 static void intelDestroyBuffer(__DRIdrawablePrivate
*driDrawPriv
)
457 _mesa_destroy_framebuffer((GLframebuffer
*) (driDrawPriv
->driverPrivate
));
462 * Get information about previous buffer swaps.
465 intelGetSwapInfo( __DRIdrawablePrivate
*dPriv
, __DRIswapInfo
* sInfo
)
467 struct intel_context
*intel
;
469 if ( (dPriv
== NULL
) || (dPriv
->driContextPriv
== NULL
)
470 || (dPriv
->driContextPriv
->driverPrivate
== NULL
)
471 || (sInfo
== NULL
) ) {
475 intel
= dPriv
->driContextPriv
->driverPrivate
;
476 sInfo
->swap_count
= intel
->swap_count
;
477 sInfo
->swap_ust
= intel
->swap_ust
;
478 sInfo
->swap_missed_count
= intel
->swap_missed_count
;
480 sInfo
->swap_missed_usage
= (sInfo
->swap_missed_count
!= 0)
481 ? driCalculateSwapUsage( dPriv
, 0, intel
->swap_missed_ust
)
488 /* There are probably better ways to do this, such as an
489 * init-designated function to register chipids and createcontext
492 extern GLboolean
i830CreateContext( const __GLcontextModes
*mesaVis
,
493 __DRIcontextPrivate
*driContextPriv
,
494 void *sharedContextPrivate
);
496 extern GLboolean
i915CreateContext( const __GLcontextModes
*mesaVis
,
497 __DRIcontextPrivate
*driContextPriv
,
498 void *sharedContextPrivate
);
500 extern GLboolean
brwCreateContext( const __GLcontextModes
*mesaVis
,
501 __DRIcontextPrivate
*driContextPriv
,
502 void *sharedContextPrivate
);
507 static GLboolean
intelCreateContext( const __GLcontextModes
*mesaVis
,
508 __DRIcontextPrivate
*driContextPriv
,
509 void *sharedContextPrivate
)
512 __DRIscreenPrivate
*sPriv
= driContextPriv
->driScreenPriv
;
513 intelScreenPrivate
*intelScreen
= (intelScreenPrivate
*)sPriv
->private;
514 switch (intelScreen
->deviceID
) {
516 case PCI_CHIP_I830_M
:
517 case PCI_CHIP_I855_GM
:
518 case PCI_CHIP_I865_G
:
519 return i830CreateContext( mesaVis
, driContextPriv
,
520 sharedContextPrivate
);
522 case PCI_CHIP_I915_G
:
523 case PCI_CHIP_I915_GM
:
524 case PCI_CHIP_I945_G
:
525 case PCI_CHIP_I945_GM
:
526 return i915CreateContext( mesaVis
, driContextPriv
,
527 sharedContextPrivate
);
530 fprintf(stderr
, "Unrecognized deviceID %x\n", intelScreen
->deviceID
);
534 return brwCreateContext( mesaVis
, driContextPriv
,
535 sharedContextPrivate
);
540 static const struct __DriverAPIRec intelAPI
= {
541 .InitDriver
= intelInitDriver
,
542 .DestroyScreen
= intelDestroyScreen
,
543 .CreateContext
= intelCreateContext
,
544 .DestroyContext
= intelDestroyContext
,
545 .CreateBuffer
= intelCreateBuffer
,
546 .DestroyBuffer
= intelDestroyBuffer
,
547 .SwapBuffers
= intelSwapBuffers
,
548 .MakeCurrent
= intelMakeCurrent
,
549 .UnbindContext
= intelUnbindContext
,
550 .GetSwapInfo
= intelGetSwapInfo
,
551 .GetMSC
= driGetMSC32
,
552 .WaitForMSC
= driWaitForMSC32
,
554 .SwapBuffersMSC
= NULL
,
555 .CopySubBuffer
= intelCopySubBuffer
559 static __GLcontextModes
*
560 intelFillInModes( unsigned pixel_bits
, unsigned depth_bits
,
561 unsigned stencil_bits
, GLboolean have_back_buffer
)
563 __GLcontextModes
* modes
;
564 __GLcontextModes
* m
;
566 unsigned depth_buffer_factor
;
567 unsigned back_buffer_factor
;
571 /* GLX_SWAP_COPY_OML is only supported because the Intel driver doesn't
572 * support pageflipping at all.
574 static const GLenum back_buffer_modes
[] = {
575 GLX_NONE
, GLX_SWAP_UNDEFINED_OML
, GLX_SWAP_COPY_OML
578 u_int8_t depth_bits_array
[3];
579 u_int8_t stencil_bits_array
[3];
582 depth_bits_array
[0] = 0;
583 depth_bits_array
[1] = depth_bits
;
584 depth_bits_array
[2] = depth_bits
;
586 /* Just like with the accumulation buffer, always provide some modes
587 * with a stencil buffer. It will be a sw fallback, but some apps won't
590 stencil_bits_array
[0] = 0;
591 stencil_bits_array
[1] = 0;
592 stencil_bits_array
[2] = (stencil_bits
== 0) ? 8 : stencil_bits
;
594 depth_buffer_factor
= ((depth_bits
!= 0) || (stencil_bits
!= 0)) ? 3 : 1;
595 back_buffer_factor
= (have_back_buffer
) ? 3 : 1;
597 num_modes
= depth_buffer_factor
* back_buffer_factor
* 4;
599 if ( pixel_bits
== 16 ) {
601 fb_type
= GL_UNSIGNED_SHORT_5_6_5
;
605 fb_type
= GL_UNSIGNED_INT_8_8_8_8_REV
;
608 modes
= (*dri_interface
->createContextModes
)( num_modes
, sizeof( __GLcontextModes
) );
610 if ( ! driFillInModes( & m
, fb_format
, fb_type
,
611 depth_bits_array
, stencil_bits_array
, depth_buffer_factor
,
612 back_buffer_modes
, back_buffer_factor
,
614 fprintf( stderr
, "[%s:%u] Error creating FBConfig!\n",
615 __func__
, __LINE__
);
618 if ( ! driFillInModes( & m
, fb_format
, fb_type
,
619 depth_bits_array
, stencil_bits_array
, depth_buffer_factor
,
620 back_buffer_modes
, back_buffer_factor
,
621 GLX_DIRECT_COLOR
) ) {
622 fprintf( stderr
, "[%s:%u] Error creating FBConfig!\n",
623 __func__
, __LINE__
);
627 /* Mark the visual as slow if there are "fake" stencil bits.
629 for ( m
= modes
; m
!= NULL
; m
= m
->next
) {
630 if ( (m
->stencilBits
!= 0) && (m
->stencilBits
!= stencil_bits
) ) {
631 m
->visualRating
= GLX_SLOW_CONFIG
;
640 * This is the bootstrap function for the driver. libGL supplies all of the
641 * requisite information about the system, and the driver initializes itself.
642 * This routine also fills in the linked list pointed to by \c driver_modes
643 * with the \c __GLcontextModes that the driver can support for windows or
646 * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on
650 void * __driCreateNewScreen_20050727( __DRInativeDisplay
*dpy
, int scrn
, __DRIscreen
*psc
,
651 const __GLcontextModes
* modes
,
652 const __DRIversion
* ddx_version
,
653 const __DRIversion
* dri_version
,
654 const __DRIversion
* drm_version
,
655 const __DRIframebuffer
* frame_buffer
,
656 drmAddress pSAREA
, int fd
,
657 int internal_api_version
,
658 const __DRIinterfaceMethods
* interface
,
659 __GLcontextModes
** driver_modes
)
662 __DRIscreenPrivate
*psp
;
663 static const __DRIversion ddx_expected
= { 1, 6, 0 };
664 static const __DRIversion dri_expected
= { 4, 0, 0 };
665 static const __DRIversion drm_expected
= { 1, 3, 0 };
667 dri_interface
= interface
;
669 if ( ! driCheckDriDdxDrmVersions2( "i915",
670 dri_version
, & dri_expected
,
671 ddx_version
, & ddx_expected
,
672 drm_version
, & drm_expected
) ) {
676 psp
= __driUtilCreateNewScreen(dpy
, scrn
, psc
, NULL
,
677 ddx_version
, dri_version
, drm_version
,
678 frame_buffer
, pSAREA
, fd
,
679 internal_api_version
, &intelAPI
);
681 I830DRIPtr dri_priv
= (I830DRIPtr
) psp
->pDevPriv
;
682 *driver_modes
= intelFillInModes( dri_priv
->cpp
* 8,
683 (dri_priv
->cpp
== 2) ? 16 : 24,
684 (dri_priv
->cpp
== 2) ? 0 : 8,
687 /* Calling driInitExtensions here, with a NULL context pointer, does not actually
688 * enable the extensions. It just makes sure that all the dispatch offsets for all
689 * the extensions that *might* be enables are known. This is needed because the
690 * dispatch offsets need to be known when _mesa_context_create is called, but we can't
691 * enable the extensions until we have a context pointer.
693 * Hello chicken. Hello egg. How are you two today?
695 driInitExtensions( NULL
, card_extensions
, GL_FALSE
);