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_tris.h"
44 #include "intel_ioctl.h"
48 PUBLIC
const char __driConfigOptions
[] =
50 DRI_CONF_SECTION_PERFORMANCE
51 DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS
)
52 DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0
)
54 DRI_CONF_SECTION_QUALITY
55 DRI_CONF_FORCE_S3TC_ENABLE(false)
56 DRI_CONF_ALLOW_LARGE_TEXTURES(1)
59 const GLuint __driNConfigOptions
= 4;
61 #ifdef USE_NEW_INTERFACE
62 static PFNGLXCREATECONTEXTMODES create_context_modes
= NULL
;
63 #endif /*USE_NEW_INTERFACE*/
65 extern const struct dri_extension card_extensions
[];
68 * Map all the memory regions described by the screen.
69 * \return GL_TRUE if success, GL_FALSE if error.
72 intelMapScreenRegions(__DRIscreenPrivate
*sPriv
)
74 intelScreenPrivate
*intelScreen
= (intelScreenPrivate
*)sPriv
->private;
76 if (intelScreen
->front
.handle
) {
78 intelScreen
->front
.handle
,
79 intelScreen
->front
.size
,
80 (drmAddress
*)&intelScreen
->front
.map
) != 0) {
81 _mesa_problem(NULL
, "drmMap(frontbuffer) failed!");
86 _mesa_warning(NULL
, "no front buffer handle in intelMapScreenRegions!");
90 intelScreen
->back
.handle
,
91 intelScreen
->back
.size
,
92 (drmAddress
*)&intelScreen
->back
.map
) != 0) {
93 intelUnmapScreenRegions(intelScreen
);
98 intelScreen
->depth
.handle
,
99 intelScreen
->depth
.size
,
100 (drmAddress
*)&intelScreen
->depth
.map
) != 0) {
101 intelUnmapScreenRegions(intelScreen
);
105 if (drmMap(sPriv
->fd
,
106 intelScreen
->tex
.handle
,
107 intelScreen
->tex
.size
,
108 (drmAddress
*)&intelScreen
->tex
.map
) != 0) {
109 intelUnmapScreenRegions(intelScreen
);
114 printf("Mappings: front: %p back: %p depth: %p tex: %p\n",
115 intelScreen
->front
.map
,
116 intelScreen
->back
.map
,
117 intelScreen
->depth
.map
,
118 intelScreen
->tex
.map
);
124 intelUnmapScreenRegions(intelScreenPrivate
*intelScreen
)
126 #define REALLY_UNMAP 1
127 if (intelScreen
->front
.map
) {
129 if (drmUnmap(intelScreen
->front
.map
, intelScreen
->front
.size
) != 0)
130 printf("drmUnmap front failed!\n");
132 intelScreen
->front
.map
= NULL
;
134 if (intelScreen
->back
.map
) {
136 if (drmUnmap(intelScreen
->back
.map
, intelScreen
->back
.size
) != 0)
137 printf("drmUnmap back failed!\n");
139 intelScreen
->back
.map
= NULL
;
141 if (intelScreen
->depth
.map
) {
143 drmUnmap(intelScreen
->depth
.map
, intelScreen
->depth
.size
);
144 intelScreen
->depth
.map
= NULL
;
147 if (intelScreen
->tex
.map
) {
149 drmUnmap(intelScreen
->tex
.map
, intelScreen
->tex
.size
);
150 intelScreen
->tex
.map
= NULL
;
157 intelPrintDRIInfo(intelScreenPrivate
*intelScreen
,
158 __DRIscreenPrivate
*sPriv
,
161 fprintf(stderr
, "*** Front size: 0x%x offset: 0x%x pitch: %d\n",
162 intelScreen
->front
.size
, intelScreen
->front
.offset
,
163 intelScreen
->front
.pitch
);
164 fprintf(stderr
, "*** Back size: 0x%x offset: 0x%x pitch: %d\n",
165 intelScreen
->back
.size
, intelScreen
->back
.offset
,
166 intelScreen
->back
.pitch
);
167 fprintf(stderr
, "*** Depth size: 0x%x offset: 0x%x pitch: %d\n",
168 intelScreen
->depth
.size
, intelScreen
->depth
.offset
,
169 intelScreen
->depth
.pitch
);
170 fprintf(stderr
, "*** Rotated size: 0x%x offset: 0x%x pitch: %d\n",
171 intelScreen
->rotated
.size
, intelScreen
->rotated
.offset
,
172 intelScreen
->rotated
.pitch
);
173 fprintf(stderr
, "*** Texture size: 0x%x offset: 0x%x\n",
174 intelScreen
->tex
.size
, intelScreen
->tex
.offset
);
175 fprintf(stderr
, "*** Memory : 0x%x\n", gDRIPriv
->mem
);
180 intelPrintSAREA(const drmI830Sarea
*sarea
)
182 fprintf(stderr
, "SAREA: sarea width %d height %d\n", sarea
->width
, sarea
->height
);
183 fprintf(stderr
, "SAREA: pitch: %d\n", sarea
->pitch
);
185 "SAREA: front offset: 0x%08x size: 0x%x handle: 0x%x\n",
186 sarea
->front_offset
, sarea
->front_size
,
187 (unsigned) sarea
->front_handle
);
189 "SAREA: back offset: 0x%08x size: 0x%x handle: 0x%x\n",
190 sarea
->back_offset
, sarea
->back_size
,
191 (unsigned) sarea
->back_handle
);
192 fprintf(stderr
, "SAREA: depth offset: 0x%08x size: 0x%x handle: 0x%x\n",
193 sarea
->depth_offset
, sarea
->depth_size
,
194 (unsigned) sarea
->depth_handle
);
195 fprintf(stderr
, "SAREA: tex offset: 0x%08x size: 0x%x handle: 0x%x\n",
196 sarea
->tex_offset
, sarea
->tex_size
,
197 (unsigned) sarea
->tex_handle
);
198 fprintf(stderr
, "SAREA: rotation: %d\n", sarea
->rotation
);
200 "SAREA: rotated offset: 0x%08x size: 0x%x\n",
201 sarea
->rotated_offset
, sarea
->rotated_size
);
202 fprintf(stderr
, "SAREA: rotated pitch: %d\n", sarea
->rotated_pitch
);
207 * A number of the screen parameters are obtained/computed from
208 * information in the SAREA. This function updates those parameters.
211 intelUpdateScreenFromSAREA(intelScreenPrivate
*intelScreen
,
214 intelScreen
->width
= sarea
->width
;
215 intelScreen
->height
= sarea
->height
;
217 intelScreen
->front
.offset
= sarea
->front_offset
;
218 intelScreen
->front
.pitch
= sarea
->pitch
* intelScreen
->cpp
;
219 intelScreen
->front
.handle
= sarea
->front_handle
;
220 intelScreen
->front
.size
= sarea
->front_size
;
222 intelScreen
->back
.offset
= sarea
->back_offset
;
223 intelScreen
->back
.pitch
= sarea
->pitch
* intelScreen
->cpp
;
224 intelScreen
->back
.handle
= sarea
->back_handle
;
225 intelScreen
->back
.size
= sarea
->back_size
;
227 intelScreen
->depth
.offset
= sarea
->depth_offset
;
228 intelScreen
->depth
.pitch
= sarea
->pitch
* intelScreen
->cpp
;
229 intelScreen
->depth
.handle
= sarea
->depth_handle
;
230 intelScreen
->depth
.size
= sarea
->depth_size
;
232 intelScreen
->tex
.offset
= sarea
->tex_offset
;
233 intelScreen
->logTextureGranularity
= sarea
->log_tex_granularity
;
234 intelScreen
->tex
.handle
= sarea
->tex_handle
;
235 intelScreen
->tex
.size
= sarea
->tex_size
;
237 intelScreen
->rotated
.offset
= sarea
->rotated_offset
;
238 intelScreen
->rotated
.pitch
= sarea
->rotated_pitch
* intelScreen
->cpp
;
239 intelScreen
->rotated
.size
= sarea
->rotated_size
;
240 intelScreen
->current_rotation
= sarea
->rotation
;
241 matrix23Rotate(&intelScreen
->rotMatrix
,
242 sarea
->width
, sarea
->height
, sarea
->rotation
);
243 intelScreen
->rotatedWidth
= sarea
->virtualX
;
244 intelScreen
->rotatedHeight
= sarea
->virtualY
;
247 intelPrintSAREA(sarea
);
251 static GLboolean
intelInitDriver(__DRIscreenPrivate
*sPriv
)
253 intelScreenPrivate
*intelScreen
;
254 I830DRIPtr gDRIPriv
= (I830DRIPtr
)sPriv
->pDevPriv
;
256 PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension
=
257 (PFNGLXSCRENABLEEXTENSIONPROC
) (*dri_interface
->getProcAddress("glxEnableExtension"));
258 void * const psc
= sPriv
->psc
->screenConfigs
;
260 if (sPriv
->devPrivSize
!= sizeof(I830DRIRec
)) {
261 fprintf(stderr
,"\nERROR! sizeof(I830DRIRec) does not match passed size from device driver\n");
265 /* Allocate the private area */
266 intelScreen
= (intelScreenPrivate
*)CALLOC(sizeof(intelScreenPrivate
));
268 fprintf(stderr
,"\nERROR! Allocating private area failed\n");
271 /* parse information in __driConfigOptions */
272 driParseOptionInfo (&intelScreen
->optionCache
,
273 __driConfigOptions
, __driNConfigOptions
);
275 intelScreen
->driScrnPriv
= sPriv
;
276 sPriv
->private = (void *)intelScreen
;
277 intelScreen
->sarea_priv_offset
= gDRIPriv
->sarea_priv_offset
;
278 sarea
= (drmI830Sarea
*)
279 (((GLubyte
*)sPriv
->pSAREA
)+intelScreen
->sarea_priv_offset
);
281 intelScreen
->deviceID
= gDRIPriv
->deviceID
;
282 intelScreen
->mem
= gDRIPriv
->mem
;
283 intelScreen
->cpp
= gDRIPriv
->cpp
;
285 switch (gDRIPriv
->bitsPerPixel
) {
286 case 15: intelScreen
->fbFormat
= DV_PF_555
; break;
287 case 16: intelScreen
->fbFormat
= DV_PF_565
; break;
288 case 32: intelScreen
->fbFormat
= DV_PF_8888
; break;
291 intelUpdateScreenFromSAREA(intelScreen
, sarea
);
294 intelPrintDRIInfo(intelScreen
, sPriv
, gDRIPriv
);
296 if (!intelMapScreenRegions(sPriv
)) {
297 fprintf(stderr
,"\nERROR! mapping regions\n");
298 _mesa_free(intelScreen
);
299 sPriv
->private = NULL
;
303 intelScreen
->drmMinor
= sPriv
->drmMinor
;
305 /* Determine if IRQs are active? */
310 gp
.param
= I830_PARAM_IRQ_ACTIVE
;
311 gp
.value
= &intelScreen
->irq_active
;
313 ret
= drmCommandWriteRead( sPriv
->fd
, DRM_I830_GETPARAM
,
316 fprintf(stderr
, "drmI830GetParam: %d\n", ret
);
321 /* Determine if batchbuffers are allowed */
326 gp
.param
= I830_PARAM_ALLOW_BATCHBUFFER
;
327 gp
.value
= &intelScreen
->allow_batchbuffer
;
329 ret
= drmCommandWriteRead( sPriv
->fd
, DRM_I830_GETPARAM
,
332 fprintf(stderr
, "drmI830GetParam: (%d) %d\n", gp
.param
, ret
);
337 if (glx_enable_extension
!= NULL
) {
338 (*glx_enable_extension
)( psc
, "GLX_SGI_swap_control" );
339 (*glx_enable_extension
)( psc
, "GLX_SGI_video_sync" );
340 (*glx_enable_extension
)( psc
, "GLX_MESA_swap_control" );
341 (*glx_enable_extension
)( psc
, "GLX_MESA_swap_frame_usage" );
342 (*glx_enable_extension
)( psc
, "GLX_SGI_make_current_read" );
343 (*glx_enable_extension
)( psc
, "GLX_MESA_allocate_memory" );
344 (*glx_enable_extension
)( psc
, "GLX_MESA_copy_sub_buffer" );
347 sPriv
->psc
->allocateMemory
= (void *) intelAllocateMemoryMESA
;
348 sPriv
->psc
->freeMemory
= (void *) intelFreeMemoryMESA
;
349 sPriv
->psc
->memoryOffset
= (void *) intelGetMemoryOffsetMESA
;
355 static void intelDestroyScreen(__DRIscreenPrivate
*sPriv
)
357 intelScreenPrivate
*intelScreen
= (intelScreenPrivate
*)sPriv
->private;
359 intelUnmapScreenRegions(intelScreen
);
361 sPriv
->private = NULL
;
365 static GLboolean
intelCreateBuffer( __DRIscreenPrivate
*driScrnPriv
,
366 __DRIdrawablePrivate
*driDrawPriv
,
367 const __GLcontextModes
*mesaVis
,
370 intelScreenPrivate
*screen
= (intelScreenPrivate
*) driScrnPriv
->private;
373 return GL_FALSE
; /* not implemented */
375 GLboolean swStencil
= (mesaVis
->stencilBits
> 0 &&
376 mesaVis
->depthBits
!= 24);
378 struct gl_framebuffer
*fb
= _mesa_create_framebuffer(mesaVis
);
381 driRenderbuffer
*frontRb
382 = driNewRenderbuffer(GL_RGBA
,
385 screen
->front
.offset
, screen
->front
.pitch
,
387 intelSetSpanFunctions(frontRb
, mesaVis
);
388 _mesa_add_renderbuffer(fb
, BUFFER_FRONT_LEFT
, &frontRb
->Base
);
391 if (mesaVis
->doubleBufferMode
) {
392 driRenderbuffer
*backRb
393 = driNewRenderbuffer(GL_RGBA
,
396 screen
->back
.offset
, screen
->back
.pitch
,
398 intelSetSpanFunctions(backRb
, mesaVis
);
399 _mesa_add_renderbuffer(fb
, BUFFER_BACK_LEFT
, &backRb
->Base
);
402 if (mesaVis
->depthBits
== 16) {
403 driRenderbuffer
*depthRb
404 = driNewRenderbuffer(GL_DEPTH_COMPONENT16
,
407 screen
->depth
.offset
, screen
->depth
.pitch
,
409 intelSetSpanFunctions(depthRb
, mesaVis
);
410 _mesa_add_renderbuffer(fb
, BUFFER_DEPTH
, &depthRb
->Base
);
412 else if (mesaVis
->depthBits
== 24) {
413 driRenderbuffer
*depthRb
414 = driNewRenderbuffer(GL_DEPTH_COMPONENT24
,
417 screen
->depth
.offset
, screen
->depth
.pitch
,
419 intelSetSpanFunctions(depthRb
, mesaVis
);
420 _mesa_add_renderbuffer(fb
, BUFFER_DEPTH
, &depthRb
->Base
);
423 if (mesaVis
->stencilBits
> 0 && !swStencil
) {
424 driRenderbuffer
*stencilRb
425 = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT
,
428 screen
->depth
.offset
, screen
->depth
.pitch
,
430 intelSetSpanFunctions(stencilRb
, mesaVis
);
431 _mesa_add_renderbuffer(fb
, BUFFER_STENCIL
, &stencilRb
->Base
);
434 _mesa_add_soft_renderbuffers(fb
,
435 GL_FALSE
, /* color */
436 GL_FALSE
, /* depth */
438 mesaVis
->accumRedBits
> 0,
439 GL_FALSE
, /* alpha */
441 driDrawPriv
->driverPrivate
= (void *) fb
;
443 return (driDrawPriv
->driverPrivate
!= NULL
);
447 static void intelDestroyBuffer(__DRIdrawablePrivate
*driDrawPriv
)
449 _mesa_destroy_framebuffer((GLframebuffer
*) (driDrawPriv
->driverPrivate
));
454 * Get information about previous buffer swaps.
457 intelGetSwapInfo( __DRIdrawablePrivate
*dPriv
, __DRIswapInfo
* sInfo
)
459 intelContextPtr intel
;
461 if ( (dPriv
== NULL
) || (dPriv
->driContextPriv
== NULL
)
462 || (dPriv
->driContextPriv
->driverPrivate
== NULL
)
463 || (sInfo
== NULL
) ) {
467 intel
= dPriv
->driContextPriv
->driverPrivate
;
468 sInfo
->swap_count
= intel
->swap_count
;
469 sInfo
->swap_ust
= intel
->swap_ust
;
470 sInfo
->swap_missed_count
= intel
->swap_missed_count
;
472 sInfo
->swap_missed_usage
= (sInfo
->swap_missed_count
!= 0)
473 ? driCalculateSwapUsage( dPriv
, 0, intel
->swap_missed_ust
)
480 /* There are probably better ways to do this, such as an
481 * init-designated function to register chipids and createcontext
484 extern GLboolean
i830CreateContext( const __GLcontextModes
*mesaVis
,
485 __DRIcontextPrivate
*driContextPriv
,
486 void *sharedContextPrivate
);
488 extern GLboolean
i915CreateContext( const __GLcontextModes
*mesaVis
,
489 __DRIcontextPrivate
*driContextPriv
,
490 void *sharedContextPrivate
);
495 static GLboolean
intelCreateContext( const __GLcontextModes
*mesaVis
,
496 __DRIcontextPrivate
*driContextPriv
,
497 void *sharedContextPrivate
)
499 __DRIscreenPrivate
*sPriv
= driContextPriv
->driScreenPriv
;
500 intelScreenPrivate
*intelScreen
= (intelScreenPrivate
*)sPriv
->private;
502 switch (intelScreen
->deviceID
) {
504 case PCI_CHIP_I830_M
:
505 case PCI_CHIP_I855_GM
:
506 case PCI_CHIP_I865_G
:
507 return i830CreateContext( mesaVis
, driContextPriv
,
508 sharedContextPrivate
);
510 case PCI_CHIP_I915_G
:
511 case PCI_CHIP_I915_GM
:
512 case PCI_CHIP_I945_G
:
513 case PCI_CHIP_I945_GM
:
514 return i915CreateContext( mesaVis
, driContextPriv
,
515 sharedContextPrivate
);
518 fprintf(stderr
, "Unrecognized deviceID %x\n", intelScreen
->deviceID
);
524 static const struct __DriverAPIRec intelAPI
= {
525 .InitDriver
= intelInitDriver
,
526 .DestroyScreen
= intelDestroyScreen
,
527 .CreateContext
= intelCreateContext
,
528 .DestroyContext
= intelDestroyContext
,
529 .CreateBuffer
= intelCreateBuffer
,
530 .DestroyBuffer
= intelDestroyBuffer
,
531 .SwapBuffers
= intelSwapBuffers
,
532 .MakeCurrent
= intelMakeCurrent
,
533 .UnbindContext
= intelUnbindContext
,
534 .GetSwapInfo
= intelGetSwapInfo
,
535 .GetMSC
= driGetMSC32
,
536 .WaitForMSC
= driWaitForMSC32
,
538 .SwapBuffersMSC
= NULL
,
539 .CopySubBuffer
= intelCopySubBuffer
543 static __GLcontextModes
*
544 intelFillInModes( unsigned pixel_bits
, unsigned depth_bits
,
545 unsigned stencil_bits
, GLboolean have_back_buffer
)
547 __GLcontextModes
* modes
;
548 __GLcontextModes
* m
;
550 unsigned depth_buffer_factor
;
551 unsigned back_buffer_factor
;
555 /* GLX_SWAP_COPY_OML is only supported because the Intel driver doesn't
556 * support pageflipping at all.
558 static const GLenum back_buffer_modes
[] = {
559 GLX_NONE
, GLX_SWAP_UNDEFINED_OML
, GLX_SWAP_COPY_OML
562 u_int8_t depth_bits_array
[3];
563 u_int8_t stencil_bits_array
[3];
566 depth_bits_array
[0] = 0;
567 depth_bits_array
[1] = depth_bits
;
568 depth_bits_array
[2] = depth_bits
;
570 /* Just like with the accumulation buffer, always provide some modes
571 * with a stencil buffer. It will be a sw fallback, but some apps won't
574 stencil_bits_array
[0] = 0;
575 stencil_bits_array
[1] = 0;
576 stencil_bits_array
[2] = (stencil_bits
== 0) ? 8 : stencil_bits
;
578 depth_buffer_factor
= ((depth_bits
!= 0) || (stencil_bits
!= 0)) ? 3 : 1;
579 back_buffer_factor
= (have_back_buffer
) ? 3 : 1;
581 num_modes
= depth_buffer_factor
* back_buffer_factor
* 4;
583 if ( pixel_bits
== 16 ) {
585 fb_type
= GL_UNSIGNED_SHORT_5_6_5
;
589 fb_type
= GL_UNSIGNED_INT_8_8_8_8_REV
;
592 modes
= (*dri_interface
->createContextModes
)( num_modes
, sizeof( __GLcontextModes
) );
594 if ( ! driFillInModes( & m
, fb_format
, fb_type
,
595 depth_bits_array
, stencil_bits_array
, depth_buffer_factor
,
596 back_buffer_modes
, back_buffer_factor
,
598 fprintf( stderr
, "[%s:%u] Error creating FBConfig!\n",
599 __func__
, __LINE__
);
602 if ( ! driFillInModes( & m
, fb_format
, fb_type
,
603 depth_bits_array
, stencil_bits_array
, depth_buffer_factor
,
604 back_buffer_modes
, back_buffer_factor
,
605 GLX_DIRECT_COLOR
) ) {
606 fprintf( stderr
, "[%s:%u] Error creating FBConfig!\n",
607 __func__
, __LINE__
);
611 /* Mark the visual as slow if there are "fake" stencil bits.
613 for ( m
= modes
; m
!= NULL
; m
= m
->next
) {
614 if ( (m
->stencilBits
!= 0) && (m
->stencilBits
!= stencil_bits
) ) {
615 m
->visualRating
= GLX_SLOW_CONFIG
;
624 * This is the bootstrap function for the driver. libGL supplies all of the
625 * requisite information about the system, and the driver initializes itself.
626 * This routine also fills in the linked list pointed to by \c driver_modes
627 * with the \c __GLcontextModes that the driver can support for windows or
630 * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on
634 void * __driCreateNewScreen_20050727( __DRInativeDisplay
*dpy
, int scrn
, __DRIscreen
*psc
,
635 const __GLcontextModes
* modes
,
636 const __DRIversion
* ddx_version
,
637 const __DRIversion
* dri_version
,
638 const __DRIversion
* drm_version
,
639 const __DRIframebuffer
* frame_buffer
,
640 drmAddress pSAREA
, int fd
,
641 int internal_api_version
,
642 const __DRIinterfaceMethods
* interface
,
643 __GLcontextModes
** driver_modes
)
646 __DRIscreenPrivate
*psp
;
647 static const __DRIversion ddx_expected
= { 1, 5, 0 };
648 static const __DRIversion dri_expected
= { 4, 0, 0 };
649 static const __DRIversion drm_expected
= { 1, 4, 0 };
651 dri_interface
= interface
;
653 if ( ! driCheckDriDdxDrmVersions2( "i915",
654 dri_version
, & dri_expected
,
655 ddx_version
, & ddx_expected
,
656 drm_version
, & drm_expected
) ) {
660 psp
= __driUtilCreateNewScreen(dpy
, scrn
, psc
, NULL
,
661 ddx_version
, dri_version
, drm_version
,
662 frame_buffer
, pSAREA
, fd
,
663 internal_api_version
, &intelAPI
);
665 I830DRIPtr dri_priv
= (I830DRIPtr
) psp
->pDevPriv
;
666 *driver_modes
= intelFillInModes( dri_priv
->cpp
* 8,
667 (dri_priv
->cpp
== 2) ? 16 : 24,
668 (dri_priv
->cpp
== 2) ? 0 : 8,
671 /* Calling driInitExtensions here, with a NULL context pointer, does not actually
672 * enable the extensions. It just makes sure that all the dispatch offsets for all
673 * the extensions that *might* be enables are known. This is needed because the
674 * dispatch offsets need to be known when _mesa_context_create is called, but we can't
675 * enable the extensions until we have a context pointer.
677 * Hello chicken. Hello egg. How are you two today?
679 driInitExtensions( NULL
, card_extensions
, GL_FALSE
);