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_context.h"
42 #include "intel_tex.h"
43 #include "intel_span.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*/
66 * Map all the memory regions described by the screen.
67 * \return GL_TRUE if success, GL_FALSE if error.
70 intelMapScreenRegions(__DRIscreenPrivate
*sPriv
)
72 intelScreenPrivate
*intelScreen
= (intelScreenPrivate
*)sPriv
->private;
74 if (intelScreen
->front
.handle
) {
76 intelScreen
->front
.handle
,
77 intelScreen
->front
.size
,
78 (drmAddress
*)&intelScreen
->front
.map
) != 0) {
79 _mesa_problem(NULL
, "drmMap(frontbuffer) failed!");
83 /* Use the old static allocation method if the server isn't setting up
84 * a movable handle for us. Add in the front buffer offset from
85 * framebuffer start, as our span routines (unlike other drivers) expect
86 * the renderbuffer address to point to the beginning of the
89 intelScreen
->front
.map
= (char *)sPriv
->pFB
;
90 if (intelScreen
->front
.map
== NULL
) {
91 fprintf(stderr
, "Failed to find framebuffer mapping\n");
97 intelScreen
->back
.handle
,
98 intelScreen
->back
.size
,
99 (drmAddress
*)&intelScreen
->back
.map
) != 0) {
100 intelUnmapScreenRegions(intelScreen
);
104 if (drmMap(sPriv
->fd
,
105 intelScreen
->depth
.handle
,
106 intelScreen
->depth
.size
,
107 (drmAddress
*)&intelScreen
->depth
.map
) != 0) {
108 intelUnmapScreenRegions(intelScreen
);
112 if (drmMap(sPriv
->fd
,
113 intelScreen
->tex
.handle
,
114 intelScreen
->tex
.size
,
115 (drmAddress
*)&intelScreen
->tex
.map
) != 0) {
116 intelUnmapScreenRegions(intelScreen
);
121 printf("Mappings: front: %p back: %p depth: %p tex: %p\n",
122 intelScreen
->front
.map
,
123 intelScreen
->back
.map
,
124 intelScreen
->depth
.map
,
125 intelScreen
->tex
.map
);
131 intelUnmapScreenRegions(intelScreenPrivate
*intelScreen
)
133 #define REALLY_UNMAP 1
134 /* If front.handle is present, we're doing the dynamic front buffer mapping,
135 * but if we've fallen back to static allocation then we shouldn't try to
138 if (intelScreen
->front
.handle
) {
140 if (drmUnmap(intelScreen
->front
.map
, intelScreen
->front
.size
) != 0)
141 printf("drmUnmap front failed!\n");
143 intelScreen
->front
.map
= NULL
;
145 if (intelScreen
->back
.map
) {
147 if (drmUnmap(intelScreen
->back
.map
, intelScreen
->back
.size
) != 0)
148 printf("drmUnmap back failed!\n");
150 intelScreen
->back
.map
= NULL
;
152 if (intelScreen
->depth
.map
) {
154 drmUnmap(intelScreen
->depth
.map
, intelScreen
->depth
.size
);
155 intelScreen
->depth
.map
= NULL
;
158 if (intelScreen
->tex
.map
) {
160 drmUnmap(intelScreen
->tex
.map
, intelScreen
->tex
.size
);
161 intelScreen
->tex
.map
= NULL
;
168 intelPrintDRIInfo(intelScreenPrivate
*intelScreen
,
169 __DRIscreenPrivate
*sPriv
,
172 fprintf(stderr
, "*** Front size: 0x%x offset: 0x%x pitch: %d\n",
173 intelScreen
->front
.size
, intelScreen
->front
.offset
,
174 intelScreen
->front
.pitch
);
175 fprintf(stderr
, "*** Back size: 0x%x offset: 0x%x pitch: %d\n",
176 intelScreen
->back
.size
, intelScreen
->back
.offset
,
177 intelScreen
->back
.pitch
);
178 fprintf(stderr
, "*** Depth size: 0x%x offset: 0x%x pitch: %d\n",
179 intelScreen
->depth
.size
, intelScreen
->depth
.offset
,
180 intelScreen
->depth
.pitch
);
181 fprintf(stderr
, "*** Rotated size: 0x%x offset: 0x%x pitch: %d\n",
182 intelScreen
->rotated
.size
, intelScreen
->rotated
.offset
,
183 intelScreen
->rotated
.pitch
);
184 fprintf(stderr
, "*** Texture size: 0x%x offset: 0x%x\n",
185 intelScreen
->tex
.size
, intelScreen
->tex
.offset
);
186 fprintf(stderr
, "*** Memory : 0x%x\n", gDRIPriv
->mem
);
191 intelPrintSAREA(volatile drmI830Sarea
*sarea
)
193 fprintf(stderr
, "SAREA: sarea width %d height %d\n", sarea
->width
, sarea
->height
);
194 fprintf(stderr
, "SAREA: pitch: %d\n", sarea
->pitch
);
196 "SAREA: front offset: 0x%08x size: 0x%x handle: 0x%x\n",
197 sarea
->front_offset
, sarea
->front_size
,
198 (unsigned) sarea
->front_handle
);
200 "SAREA: back offset: 0x%08x size: 0x%x handle: 0x%x\n",
201 sarea
->back_offset
, sarea
->back_size
,
202 (unsigned) sarea
->back_handle
);
203 fprintf(stderr
, "SAREA: depth offset: 0x%08x size: 0x%x handle: 0x%x\n",
204 sarea
->depth_offset
, sarea
->depth_size
,
205 (unsigned) sarea
->depth_handle
);
206 fprintf(stderr
, "SAREA: tex offset: 0x%08x size: 0x%x handle: 0x%x\n",
207 sarea
->tex_offset
, sarea
->tex_size
,
208 (unsigned) sarea
->tex_handle
);
209 fprintf(stderr
, "SAREA: rotation: %d\n", sarea
->rotation
);
211 "SAREA: rotated offset: 0x%08x size: 0x%x\n",
212 sarea
->rotated_offset
, sarea
->rotated_size
);
213 fprintf(stderr
, "SAREA: rotated pitch: %d\n", sarea
->rotated_pitch
);
218 * A number of the screen parameters are obtained/computed from
219 * information in the SAREA. This function updates those parameters.
222 intelUpdateScreenFromSAREA(intelScreenPrivate
*intelScreen
,
223 volatile drmI830Sarea
*sarea
)
225 intelScreen
->width
= sarea
->width
;
226 intelScreen
->height
= sarea
->height
;
228 intelScreen
->front
.offset
= sarea
->front_offset
;
229 intelScreen
->front
.pitch
= sarea
->pitch
* intelScreen
->cpp
;
230 intelScreen
->front
.handle
= sarea
->front_handle
;
231 intelScreen
->front
.size
= sarea
->front_size
;
232 intelScreen
->front
.tiled
= sarea
->front_tiled
;
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
;
238 intelScreen
->back
.tiled
= sarea
->back_tiled
;
240 intelScreen
->depth
.offset
= sarea
->depth_offset
;
241 intelScreen
->depth
.pitch
= sarea
->pitch
* intelScreen
->cpp
;
242 intelScreen
->depth
.handle
= sarea
->depth_handle
;
243 intelScreen
->depth
.size
= sarea
->depth_size
;
244 intelScreen
->depth
.tiled
= sarea
->depth_tiled
;
246 intelScreen
->tex
.offset
= sarea
->tex_offset
;
247 intelScreen
->logTextureGranularity
= sarea
->log_tex_granularity
;
248 intelScreen
->tex
.handle
= sarea
->tex_handle
;
249 intelScreen
->tex
.size
= sarea
->tex_size
;
251 intelScreen
->rotated
.offset
= sarea
->rotated_offset
;
252 intelScreen
->rotated
.pitch
= sarea
->rotated_pitch
* intelScreen
->cpp
;
253 intelScreen
->rotated
.size
= sarea
->rotated_size
;
254 intelScreen
->rotated
.tiled
= sarea
->rotated_tiled
;
255 intelScreen
->current_rotation
= sarea
->rotation
;
257 matrix23Rotate(&intelScreen
->rotMatrix
,
258 sarea
->width
, sarea
->height
, sarea
->rotation
);
260 intelScreen
->rotatedWidth
= sarea
->virtualX
;
261 intelScreen
->rotatedHeight
= sarea
->virtualY
;
264 intelPrintSAREA(sarea
);
268 static GLboolean
intelInitDriver(__DRIscreenPrivate
*sPriv
)
270 intelScreenPrivate
*intelScreen
;
271 I830DRIPtr gDRIPriv
= (I830DRIPtr
)sPriv
->pDevPriv
;
272 PFNGLXSCRENABLEEXTENSIONPROC glx_enable_extension
=
273 (PFNGLXSCRENABLEEXTENSIONPROC
) (*dri_interface
->getProcAddress("glxEnableExtension"));
274 void * const psc
= sPriv
->psc
->screenConfigs
;
275 volatile drmI830Sarea
*sarea
;
277 if (sPriv
->devPrivSize
!= sizeof(I830DRIRec
)) {
278 fprintf(stderr
,"\nERROR! sizeof(I830DRIRec) (%ld) does not match passed size from device driver (%d)\n", (unsigned long)sizeof(I830DRIRec
), sPriv
->devPrivSize
);
282 /* Allocate the private area */
283 intelScreen
= (intelScreenPrivate
*)CALLOC(sizeof(intelScreenPrivate
));
285 fprintf(stderr
,"\nERROR! Allocating private area failed\n");
288 /* parse information in __driConfigOptions */
289 driParseOptionInfo (&intelScreen
->optionCache
,
290 __driConfigOptions
, __driNConfigOptions
);
292 intelScreen
->driScrnPriv
= sPriv
;
293 sPriv
->private = (void *)intelScreen
;
294 intelScreen
->sarea_priv_offset
= gDRIPriv
->sarea_priv_offset
;
295 sarea
= (volatile drmI830Sarea
*)
296 (((GLubyte
*)sPriv
->pSAREA
)+intelScreen
->sarea_priv_offset
);
298 intelScreen
->deviceID
= gDRIPriv
->deviceID
;
299 intelScreen
->mem
= gDRIPriv
->mem
;
300 intelScreen
->cpp
= gDRIPriv
->cpp
;
302 switch (gDRIPriv
->bitsPerPixel
) {
303 case 15: intelScreen
->fbFormat
= DV_PF_555
; break;
304 case 16: intelScreen
->fbFormat
= DV_PF_565
; break;
305 case 32: intelScreen
->fbFormat
= DV_PF_8888
; break;
308 intelUpdateScreenFromSAREA(intelScreen
, sarea
);
311 intelPrintDRIInfo(intelScreen
, sPriv
, gDRIPriv
);
313 if (!intelMapScreenRegions(sPriv
)) {
314 fprintf(stderr
,"\nERROR! mapping regions\n");
315 _mesa_free(intelScreen
);
316 sPriv
->private = NULL
;
320 intelScreen
->drmMinor
= sPriv
->drmMinor
;
322 /* Determine if IRQs are active? */
327 gp
.param
= I830_PARAM_IRQ_ACTIVE
;
328 gp
.value
= &intelScreen
->irq_active
;
330 ret
= drmCommandWriteRead( sPriv
->fd
, DRM_I830_GETPARAM
,
333 fprintf(stderr
, "drmI830GetParam: %d\n", ret
);
338 /* Determine if batchbuffers are allowed */
343 gp
.param
= I830_PARAM_ALLOW_BATCHBUFFER
;
344 gp
.value
= &intelScreen
->allow_batchbuffer
;
346 ret
= drmCommandWriteRead( sPriv
->fd
, DRM_I830_GETPARAM
,
349 fprintf(stderr
, "drmI830GetParam: (%d) %d\n", gp
.param
, ret
);
354 if (glx_enable_extension
!= NULL
) {
355 (*glx_enable_extension
)( psc
, "GLX_SGI_swap_control" );
356 (*glx_enable_extension
)( psc
, "GLX_SGI_video_sync" );
357 (*glx_enable_extension
)( psc
, "GLX_MESA_swap_control" );
358 (*glx_enable_extension
)( psc
, "GLX_MESA_swap_frame_usage" );
359 (*glx_enable_extension
)( psc
, "GLX_SGI_make_current_read" );
360 (*glx_enable_extension
)( psc
, "GLX_MESA_copy_sub_buffer" );
367 static void intelDestroyScreen(__DRIscreenPrivate
*sPriv
)
369 intelScreenPrivate
*intelScreen
= (intelScreenPrivate
*)sPriv
->private;
371 intelUnmapScreenRegions(intelScreen
);
373 sPriv
->private = NULL
;
376 static GLboolean
intelCreateBuffer( __DRIscreenPrivate
*driScrnPriv
,
377 __DRIdrawablePrivate
*driDrawPriv
,
378 const __GLcontextModes
*mesaVis
,
381 intelScreenPrivate
*screen
= (intelScreenPrivate
*) driScrnPriv
->private;
384 return GL_FALSE
; /* not implemented */
386 GLboolean swStencil
= (mesaVis
->stencilBits
> 0 &&
387 mesaVis
->depthBits
!= 24);
389 struct gl_framebuffer
*fb
= _mesa_create_framebuffer(mesaVis
);
392 driRenderbuffer
*frontRb
393 = driNewRenderbuffer(GL_RGBA
,
396 screen
->front
.offset
, screen
->front
.pitch
,
398 intelSetSpanFunctions(frontRb
, mesaVis
);
399 _mesa_add_renderbuffer(fb
, BUFFER_FRONT_LEFT
, &frontRb
->Base
);
402 if (mesaVis
->doubleBufferMode
) {
403 driRenderbuffer
*backRb
404 = driNewRenderbuffer(GL_RGBA
,
407 screen
->back
.offset
, screen
->back
.pitch
,
409 intelSetSpanFunctions(backRb
, mesaVis
);
410 _mesa_add_renderbuffer(fb
, BUFFER_BACK_LEFT
, &backRb
->Base
);
413 if (mesaVis
->depthBits
== 16) {
414 driRenderbuffer
*depthRb
415 = driNewRenderbuffer(GL_DEPTH_COMPONENT16
,
418 screen
->depth
.offset
, screen
->depth
.pitch
,
420 intelSetSpanFunctions(depthRb
, mesaVis
);
421 _mesa_add_renderbuffer(fb
, BUFFER_DEPTH
, &depthRb
->Base
);
423 else if (mesaVis
->depthBits
== 24) {
424 driRenderbuffer
*depthRb
425 = driNewRenderbuffer(GL_DEPTH_COMPONENT24
,
428 screen
->depth
.offset
, screen
->depth
.pitch
,
430 intelSetSpanFunctions(depthRb
, mesaVis
);
431 _mesa_add_renderbuffer(fb
, BUFFER_DEPTH
, &depthRb
->Base
);
434 if (mesaVis
->stencilBits
> 0 && !swStencil
) {
435 driRenderbuffer
*stencilRb
436 = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT
,
439 screen
->depth
.offset
, screen
->depth
.pitch
,
441 intelSetSpanFunctions(stencilRb
, mesaVis
);
442 _mesa_add_renderbuffer(fb
, BUFFER_STENCIL
, &stencilRb
->Base
);
445 _mesa_add_soft_renderbuffers(fb
,
446 GL_FALSE
, /* color */
447 GL_FALSE
, /* depth */
449 mesaVis
->accumRedBits
> 0,
450 GL_FALSE
, /* alpha */
452 driDrawPriv
->driverPrivate
= (void *) fb
;
454 return (driDrawPriv
->driverPrivate
!= NULL
);
458 static void intelDestroyBuffer(__DRIdrawablePrivate
*driDrawPriv
)
460 _mesa_unreference_framebuffer((GLframebuffer
**)(&(driDrawPriv
->driverPrivate
)));
465 * Get information about previous buffer swaps.
468 intelGetSwapInfo( __DRIdrawablePrivate
*dPriv
, __DRIswapInfo
* sInfo
)
470 struct intel_context
*intel
;
472 if ( (dPriv
== NULL
) || (dPriv
->driContextPriv
== NULL
)
473 || (dPriv
->driContextPriv
->driverPrivate
== NULL
)
474 || (sInfo
== NULL
) ) {
478 intel
= dPriv
->driContextPriv
->driverPrivate
;
479 sInfo
->swap_count
= intel
->swap_count
;
480 sInfo
->swap_ust
= intel
->swap_ust
;
481 sInfo
->swap_missed_count
= intel
->swap_missed_count
;
483 sInfo
->swap_missed_usage
= (sInfo
->swap_missed_count
!= 0)
484 ? driCalculateSwapUsage( dPriv
, 0, intel
->swap_missed_ust
)
491 /* There are probably better ways to do this, such as an
492 * init-designated function to register chipids and createcontext
495 extern GLboolean
i830CreateContext( const __GLcontextModes
*mesaVis
,
496 __DRIcontextPrivate
*driContextPriv
,
497 void *sharedContextPrivate
);
499 extern GLboolean
i915CreateContext( const __GLcontextModes
*mesaVis
,
500 __DRIcontextPrivate
*driContextPriv
,
501 void *sharedContextPrivate
);
503 extern GLboolean
brwCreateContext( const __GLcontextModes
*mesaVis
,
504 __DRIcontextPrivate
*driContextPriv
,
505 void *sharedContextPrivate
);
510 static GLboolean
intelCreateContext( const __GLcontextModes
*mesaVis
,
511 __DRIcontextPrivate
*driContextPriv
,
512 void *sharedContextPrivate
)
515 __DRIscreenPrivate
*sPriv
= driContextPriv
->driScreenPriv
;
516 intelScreenPrivate
*intelScreen
= (intelScreenPrivate
*)sPriv
->private;
517 switch (intelScreen
->deviceID
) {
519 case PCI_CHIP_I830_M
:
520 case PCI_CHIP_I855_GM
:
521 case PCI_CHIP_I865_G
:
522 return i830CreateContext( mesaVis
, driContextPriv
,
523 sharedContextPrivate
);
525 case PCI_CHIP_I915_G
:
526 case PCI_CHIP_I915_GM
:
527 case PCI_CHIP_I945_G
:
528 case PCI_CHIP_I945_GM
:
529 return i915CreateContext( mesaVis
, driContextPriv
,
530 sharedContextPrivate
);
533 fprintf(stderr
, "Unrecognized deviceID %x\n", intelScreen
->deviceID
);
537 return brwCreateContext( mesaVis
, driContextPriv
,
538 sharedContextPrivate
);
543 static const struct __DriverAPIRec intelAPI
= {
544 .InitDriver
= intelInitDriver
,
545 .DestroyScreen
= intelDestroyScreen
,
546 .CreateContext
= intelCreateContext
,
547 .DestroyContext
= intelDestroyContext
,
548 .CreateBuffer
= intelCreateBuffer
,
549 .DestroyBuffer
= intelDestroyBuffer
,
550 .SwapBuffers
= intelSwapBuffers
,
551 .MakeCurrent
= intelMakeCurrent
,
552 .UnbindContext
= intelUnbindContext
,
553 .GetSwapInfo
= intelGetSwapInfo
,
554 .GetMSC
= driGetMSC32
,
555 .WaitForMSC
= driWaitForMSC32
,
557 .SwapBuffersMSC
= NULL
,
558 .CopySubBuffer
= intelCopySubBuffer
562 static __GLcontextModes
*
563 intelFillInModes( unsigned pixel_bits
, unsigned depth_bits
,
564 unsigned stencil_bits
, GLboolean have_back_buffer
)
566 __GLcontextModes
* modes
;
567 __GLcontextModes
* m
;
569 unsigned depth_buffer_factor
;
570 unsigned back_buffer_factor
;
574 /* GLX_SWAP_COPY_OML is only supported because the Intel driver doesn't
575 * support pageflipping at all.
577 static const GLenum back_buffer_modes
[] = {
578 GLX_NONE
, GLX_SWAP_UNDEFINED_OML
, GLX_SWAP_COPY_OML
581 uint8_t depth_bits_array
[3];
582 uint8_t stencil_bits_array
[3];
585 depth_bits_array
[0] = 0;
586 depth_bits_array
[1] = depth_bits
;
587 depth_bits_array
[2] = depth_bits
;
589 /* Just like with the accumulation buffer, always provide some modes
590 * with a stencil buffer. It will be a sw fallback, but some apps won't
593 stencil_bits_array
[0] = 0;
594 stencil_bits_array
[1] = 0;
595 stencil_bits_array
[2] = (stencil_bits
== 0) ? 8 : stencil_bits
;
597 depth_buffer_factor
= ((depth_bits
!= 0) || (stencil_bits
!= 0)) ? 3 : 1;
598 back_buffer_factor
= (have_back_buffer
) ? 3 : 1;
600 num_modes
= depth_buffer_factor
* back_buffer_factor
* 4;
602 if ( pixel_bits
== 16 ) {
604 fb_type
= GL_UNSIGNED_SHORT_5_6_5
;
608 fb_type
= GL_UNSIGNED_INT_8_8_8_8_REV
;
611 modes
= (*dri_interface
->createContextModes
)( num_modes
, sizeof( __GLcontextModes
) );
613 if ( ! driFillInModes( & m
, fb_format
, fb_type
,
614 depth_bits_array
, stencil_bits_array
, depth_buffer_factor
,
615 back_buffer_modes
, back_buffer_factor
,
617 fprintf( stderr
, "[%s:%u] Error creating FBConfig!\n",
618 __func__
, __LINE__
);
621 if ( ! driFillInModes( & m
, fb_format
, fb_type
,
622 depth_bits_array
, stencil_bits_array
, depth_buffer_factor
,
623 back_buffer_modes
, back_buffer_factor
,
624 GLX_DIRECT_COLOR
) ) {
625 fprintf( stderr
, "[%s:%u] Error creating FBConfig!\n",
626 __func__
, __LINE__
);
630 /* Mark the visual as slow if there are "fake" stencil bits.
632 for ( m
= modes
; m
!= NULL
; m
= m
->next
) {
633 if ( (m
->stencilBits
!= 0) && (m
->stencilBits
!= stencil_bits
) ) {
634 m
->visualRating
= GLX_SLOW_CONFIG
;
643 * This is the bootstrap function for the driver. libGL supplies all of the
644 * requisite information about the system, and the driver initializes itself.
645 * This routine also fills in the linked list pointed to by \c driver_modes
646 * with the \c __GLcontextModes that the driver can support for windows or
649 * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on
653 void * __driCreateNewScreen_20050727( __DRInativeDisplay
*dpy
, int scrn
, __DRIscreen
*psc
,
654 const __GLcontextModes
* modes
,
655 const __DRIversion
* ddx_version
,
656 const __DRIversion
* dri_version
,
657 const __DRIversion
* drm_version
,
658 const __DRIframebuffer
* frame_buffer
,
659 drmAddress pSAREA
, int fd
,
660 int internal_api_version
,
661 const __DRIinterfaceMethods
* interface
,
662 __GLcontextModes
** driver_modes
)
665 __DRIscreenPrivate
*psp
;
666 static const __DRIversion ddx_expected
= { 1, 6, 0 };
667 static const __DRIversion dri_expected
= { 4, 0, 0 };
668 static const __DRIversion drm_expected
= { 1, 3, 0 };
670 dri_interface
= interface
;
672 if ( ! driCheckDriDdxDrmVersions2( "i915",
673 dri_version
, & dri_expected
,
674 ddx_version
, & ddx_expected
,
675 drm_version
, & drm_expected
) ) {
679 psp
= __driUtilCreateNewScreen(dpy
, scrn
, psc
, NULL
,
680 ddx_version
, dri_version
, drm_version
,
681 frame_buffer
, pSAREA
, fd
,
682 internal_api_version
, &intelAPI
);
684 I830DRIPtr dri_priv
= (I830DRIPtr
) psp
->pDevPriv
;
685 *driver_modes
= intelFillInModes( dri_priv
->cpp
* 8,
686 (dri_priv
->cpp
== 2) ? 16 : 24,
687 (dri_priv
->cpp
== 2) ? 0 : 8,
689 /* Calling driInitExtensions here, with a NULL context pointer, does not actually
690 * enable the extensions. It just makes sure that all the dispatch offsets for all
691 * the extensions that *might* be enables are known. This is needed because the
692 * dispatch offsets need to be known when _mesa_context_create is called, but we can't
693 * enable the extensions until we have a context pointer.
695 * Hello chicken. Hello egg. How are you two today?
697 intelInitExtensions(NULL
, GL_FALSE
);