3 * GLX Hardware Device Driver for Sun Creator/Creator3D
4 * Copyright (C) 2000, 2001 David S. Miller
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * DAVID MILLER, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
22 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 * David S. Miller <davem@redhat.com>
28 #include "ffb_xmesa.h"
29 #include "main/context.h"
30 #include "main/framebuffer.h"
31 #include "main/matrix.h"
32 #include "main/renderbuffer.h"
33 #include "main/simple_list.h"
34 #include "main/imports.h"
37 #include "swrast/swrast.h"
38 #include "swrast_setup/swrast_setup.h"
40 #include "tnl/t_pipeline.h"
42 #include "drivers/common/driverfuncs.h"
44 #include "ffb_context.h"
47 #include "ffb_depth.h"
48 #include "ffb_stencil.h"
49 #include "ffb_clear.h"
52 #include "ffb_lines.h"
53 #include "ffb_points.h"
54 #include "ffb_state.h"
57 #include "ffb_vtxfmt.h"
58 #include "ffb_bitmap.h"
60 #include "drm_sarea.h"
62 #include "drirenderbuffer.h"
65 ffbInitDriver(__DRIscreenPrivate
*sPriv
)
67 ffbScreenPrivate
*ffbScreen
;
68 FFBDRIPtr gDRIPriv
= (FFBDRIPtr
) sPriv
->pDevPriv
;
71 if (getenv("LIBGL_FORCE_XSERVER"))
75 if (sPriv
->devPrivSize
!= sizeof(FFBDRIRec
)) {
76 fprintf(stderr
,"\nERROR! sizeof(FFBDRIRec) does not match passed size from device driver\n");
80 /* Allocate the private area. */
81 ffbScreen
= (ffbScreenPrivate
*) MALLOC(sizeof(ffbScreenPrivate
));
85 /* Map FBC registers. */
93 ffbScreen
->regs
= (ffb_fbcPtr
) map
;
95 /* Map ramdac registers. */
100 drmUnmap((drmAddress
)ffbScreen
->regs
, gDRIPriv
->sFbcRegs
);
104 ffbScreen
->dac
= (ffb_dacPtr
) map
;
106 /* Map "Smart" framebuffer views. */
107 if (drmMap(sPriv
->fd
,
111 drmUnmap((drmAddress
)ffbScreen
->regs
, gDRIPriv
->sFbcRegs
);
112 drmUnmap((drmAddress
)ffbScreen
->dac
, gDRIPriv
->sDacRegs
);
116 ffbScreen
->sfb8r
= (volatile char *) map
;
118 if (drmMap(sPriv
->fd
,
122 drmUnmap((drmAddress
)ffbScreen
->regs
, gDRIPriv
->sFbcRegs
);
123 drmUnmap((drmAddress
)ffbScreen
->dac
, gDRIPriv
->sDacRegs
);
124 drmUnmap((drmAddress
)ffbScreen
->sfb8r
, gDRIPriv
->sSfb8r
);
128 ffbScreen
->sfb32
= (volatile char *) map
;
130 if (drmMap(sPriv
->fd
,
134 drmUnmap((drmAddress
)ffbScreen
->regs
, gDRIPriv
->sFbcRegs
);
135 drmUnmap((drmAddress
)ffbScreen
->dac
, gDRIPriv
->sDacRegs
);
136 drmUnmap((drmAddress
)ffbScreen
->sfb8r
, gDRIPriv
->sSfb8r
);
137 drmUnmap((drmAddress
)ffbScreen
->sfb32
, gDRIPriv
->sSfb32
);
141 ffbScreen
->sfb64
= (volatile char *) map
;
143 ffbScreen
->fifo_cache
= 0;
144 ffbScreen
->rp_active
= 0;
146 ffbScreen
->sPriv
= sPriv
;
147 sPriv
->private = (void *) ffbScreen
;
150 ffbDDPointfuncInit();
157 ffbDestroyScreen(__DRIscreenPrivate
*sPriv
)
159 ffbScreenPrivate
*ffbScreen
= sPriv
->private;
160 FFBDRIPtr gDRIPriv
= (FFBDRIPtr
) sPriv
->pDevPriv
;
162 drmUnmap((drmAddress
)ffbScreen
->regs
, gDRIPriv
->sFbcRegs
);
163 drmUnmap((drmAddress
)ffbScreen
->dac
, gDRIPriv
->sDacRegs
);
164 drmUnmap((drmAddress
)ffbScreen
->sfb8r
, gDRIPriv
->sSfb8r
);
165 drmUnmap((drmAddress
)ffbScreen
->sfb32
, gDRIPriv
->sSfb32
);
166 drmUnmap((drmAddress
)ffbScreen
->sfb64
, gDRIPriv
->sSfb64
);
171 static const struct tnl_pipeline_stage
*ffb_pipeline
[] = {
172 &_tnl_vertex_transform_stage
,
173 &_tnl_normal_transform_stage
,
174 &_tnl_lighting_stage
,
175 /* REMOVE: fog coord stage */
177 &_tnl_texture_transform_stage
,
178 /* REMOVE: point attenuation stage */
183 /* Create and initialize the Mesa and driver specific context data */
185 ffbCreateContext(const __GLcontextModes
*mesaVis
,
186 __DRIcontextPrivate
*driContextPriv
,
187 void *sharedContextPrivate
)
190 GLcontext
*ctx
, *shareCtx
;
191 __DRIscreenPrivate
*sPriv
;
192 ffbScreenPrivate
*ffbScreen
;
194 struct dd_function_table functions
;
196 /* Allocate ffb context */
197 fmesa
= (ffbContextPtr
) CALLOC(sizeof(ffbContextRec
));
201 _mesa_init_driver_functions(&functions
);
203 /* Allocate Mesa context */
204 if (sharedContextPrivate
)
205 shareCtx
= ((ffbContextPtr
) sharedContextPrivate
)->glCtx
;
208 fmesa
->glCtx
= _mesa_create_context(mesaVis
, shareCtx
,
214 driContextPriv
->driverPrivate
= fmesa
;
217 sPriv
= driContextPriv
->driScreenPriv
;
218 ffbScreen
= (ffbScreenPrivate
*) sPriv
->private;
221 fmesa
->hHWContext
= driContextPriv
->hHWContext
;
222 fmesa
->driFd
= sPriv
->fd
;
223 fmesa
->driHwLock
= &sPriv
->pSAREA
->lock
;
225 fmesa
->ffbScreen
= ffbScreen
;
226 fmesa
->driScreen
= sPriv
;
227 fmesa
->ffb_sarea
= FFB_DRISHARE(sPriv
->pSAREA
);
229 /* Register and framebuffer pointers. */
230 fmesa
->regs
= ffbScreen
->regs
;
231 fmesa
->sfb32
= ffbScreen
->sfb32
;
233 ffbDDInitContextHwState(ctx
);
235 /* Default clear and depth colors. */
237 GLubyte r
= (GLint
) (ctx
->Color
.ClearColor
[0] * 255.0F
);
238 GLubyte g
= (GLint
) (ctx
->Color
.ClearColor
[1] * 255.0F
);
239 GLubyte b
= (GLint
) (ctx
->Color
.ClearColor
[2] * 255.0F
);
241 fmesa
->clear_pixel
= ((r
<< 0) |
245 fmesa
->clear_depth
= Z_FROM_MESA(ctx
->Depth
.Clear
* 4294967295.0f
);
246 fmesa
->clear_stencil
= ctx
->Stencil
.Clear
& 0xf;
248 /* No wide points. */
249 ctx
->Const
.MinPointSize
= 1.0;
250 ctx
->Const
.MinPointSizeAA
= 1.0;
251 ctx
->Const
.MaxPointSize
= 1.0;
252 ctx
->Const
.MaxPointSizeAA
= 1.0;
254 /* Disable wide lines as we can't antialias them correctly in
257 ctx
->Const
.MinLineWidth
= 1.0;
258 ctx
->Const
.MinLineWidthAA
= 1.0;
259 ctx
->Const
.MaxLineWidth
= 1.0;
260 ctx
->Const
.MaxLineWidthAA
= 1.0;
261 ctx
->Const
.LineWidthGranularity
= 1.0;
263 ctx
->Const
.MaxDrawBuffers
= 1;
265 /* Instead of having GCC emit these constants a zillion times
266 * everywhere in the driver, put them here.
268 fmesa
->ffb_2_30_fixed_scale
= __FFB_2_30_FIXED_SCALE
;
269 fmesa
->ffb_one_over_2_30_fixed_scale
= (1.0 / __FFB_2_30_FIXED_SCALE
);
270 fmesa
->ffb_16_16_fixed_scale
= __FFB_16_16_FIXED_SCALE
;
271 fmesa
->ffb_one_over_16_16_fixed_scale
= (1.0 / __FFB_16_16_FIXED_SCALE
);
272 fmesa
->ffb_ubyte_color_scale
= 255.0f
;
273 fmesa
->ffb_zero
= 0.0f
;
275 fmesa
->debugFallbacks
= GL_FALSE
;
276 debug
= getenv("LIBGL_DEBUG");
277 if (debug
&& strstr(debug
, "fallbacks"))
278 fmesa
->debugFallbacks
= GL_TRUE
;
280 /* Initialize the software rasterizer and helper modules. */
281 _swrast_CreateContext( ctx
);
282 _vbo_CreateContext( ctx
);
283 _tnl_CreateContext( ctx
);
284 _swsetup_CreateContext( ctx
);
286 /* All of this need only be done once for a new context. */
287 /* XXX these should be moved right after the
288 * _mesa_init_driver_functions() call above.
290 ffbDDExtensionsInit(ctx
);
291 ffbDDInitDriverFuncs(ctx
);
292 ffbDDInitStateFuncs(ctx
);
293 ffbDDInitRenderFuncs(ctx
);
294 /*ffbDDInitTexFuncs(ctx); not needed */
295 ffbDDInitBitmapFuncs(ctx
);
299 ffbInitTnlModule(ctx
);
302 _tnl_destroy_pipeline(ctx
);
303 _tnl_install_pipeline(ctx
, ffb_pipeline
);
309 ffbDestroyContext(__DRIcontextPrivate
*driContextPriv
)
311 ffbContextPtr fmesa
= (ffbContextPtr
) driContextPriv
->driverPrivate
;
314 ffbFreeVB(fmesa
->glCtx
);
316 _swsetup_DestroyContext( fmesa
->glCtx
);
317 _tnl_DestroyContext( fmesa
->glCtx
);
318 _vbo_DestroyContext( fmesa
->glCtx
);
319 _swrast_DestroyContext( fmesa
->glCtx
);
321 /* free the Mesa context */
322 fmesa
->glCtx
->DriverCtx
= NULL
;
323 _mesa_destroy_context(fmesa
->glCtx
);
329 /* Create and initialize the Mesa and driver specific pixmap buffer data */
331 ffbCreateBuffer(__DRIscreenPrivate
*driScrnPriv
,
332 __DRIdrawablePrivate
*driDrawPriv
,
333 const __GLcontextModes
*mesaVis
,
336 /* Mesa checks for pitch > 0, but ffb doesn't use pitches */
338 int bpp
= 4; /* we've always got a 32bpp framebuffer */
339 int offset
= 0; /* always at 0 for offset */
342 return GL_FALSE
; /* not implemented */
344 GLboolean swStencil
= (mesaVis
->stencilBits
> 0 &&
345 mesaVis
->depthBits
!= 24);
346 struct gl_framebuffer
*fb
= _mesa_create_framebuffer(mesaVis
);
349 driRenderbuffer
*frontRb
350 = driNewRenderbuffer(GL_RGBA
, NULL
, bpp
, offset
, bogusPitch
,
352 ffbSetSpanFunctions(frontRb
, mesaVis
);
353 _mesa_add_renderbuffer(fb
, BUFFER_FRONT_LEFT
, &frontRb
->Base
);
356 if (mesaVis
->doubleBufferMode
) {
357 driRenderbuffer
*backRb
358 = driNewRenderbuffer(GL_RGBA
, NULL
, bpp
, offset
, bogusPitch
,
360 ffbSetSpanFunctions(backRb
, mesaVis
);
361 _mesa_add_renderbuffer(fb
, BUFFER_BACK_LEFT
, &backRb
->Base
);
364 if (mesaVis
->depthBits
== 16) {
365 driRenderbuffer
*depthRb
366 = driNewRenderbuffer(GL_DEPTH_COMPONENT16
, NULL
, bpp
, offset
,
367 bogusPitch
, driDrawPriv
);
368 ffbSetDepthFunctions(depthRb
, mesaVis
);
369 _mesa_add_renderbuffer(fb
, BUFFER_DEPTH
, &depthRb
->Base
);
372 if (mesaVis
->stencilBits
> 0 && !swStencil
) {
373 driRenderbuffer
*stencilRb
374 = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT
, NULL
, bpp
, offset
,
375 bogusPitch
, driDrawPriv
);
376 ffbSetStencilFunctions(stencilRb
, mesaVis
);
377 _mesa_add_renderbuffer(fb
, BUFFER_STENCIL
, &stencilRb
->Base
);
380 _mesa_add_soft_renderbuffers(fb
,
381 GL_FALSE
, /* color */
382 GL_FALSE
, /* depth */
384 mesaVis
->accumRedBits
> 0,
385 GL_FALSE
, /* alpha */
387 driDrawPriv
->driverPrivate
= (void *) fb
;
389 return (driDrawPriv
->driverPrivate
!= NULL
);
395 ffbDestroyBuffer(__DRIdrawablePrivate
*driDrawPriv
)
397 _mesa_reference_framebuffer((GLframebuffer
**)(&(driDrawPriv
->driverPrivate
)), NULL
);
401 #define USE_FAST_SWAP
404 ffbSwapBuffers( __DRIdrawablePrivate
*dPriv
)
406 ffbContextPtr fmesa
= (ffbContextPtr
) dPriv
->driContextPriv
->driverPrivate
;
407 unsigned int fbc
, wid
, wid_reg_val
, dac_db_bit
;
408 unsigned int shadow_dac_addr
, active_dac_addr
;
413 fmesa
->glCtx
->Visual
.doubleBufferMode
== 0)
416 /* Flush pending rendering commands */
417 _mesa_notifySwapBuffers(fmesa
->glCtx
);
420 dac
= fmesa
->ffbScreen
->dac
;
425 /* Swap the buffer we render into and read pixels from. */
426 fmesa
->back_buffer
^= 1;
428 /* If we are writing into both buffers, don't mess with
431 if ((fbc
& FFB_FBC_WB_AB
) != FFB_FBC_WB_AB
) {
432 if ((fbc
& FFB_FBC_WB_A
) != 0)
433 fbc
= (fbc
& ~FFB_FBC_WB_A
) | FFB_FBC_WB_B
;
435 fbc
= (fbc
& ~FFB_FBC_WB_B
) | FFB_FBC_WB_A
;
438 /* But either way, we must flip the read buffer setting. */
439 if ((fbc
& FFB_FBC_RB_A
) != 0)
440 fbc
= (fbc
& ~FFB_FBC_RB_A
) | FFB_FBC_RB_B
;
442 fbc
= (fbc
& ~FFB_FBC_RB_B
) | FFB_FBC_RB_A
;
444 LOCK_HARDWARE(fmesa
);
446 if (fmesa
->fbc
!= fbc
) {
448 ffb
->fbc
= fmesa
->fbc
= fbc
;
449 fmesa
->ffbScreen
->rp_active
= 1;
452 /* And swap the buffer displayed in the WID. */
453 if (fmesa
->ffb_sarea
->flags
& FFB_DRI_PAC1
) {
454 shadow_dac_addr
= FFBDAC_PAC1_SPWLUT(wid
);
455 active_dac_addr
= FFBDAC_PAC1_APWLUT(wid
);
456 dac_db_bit
= FFBDAC_PAC1_WLUT_DB
;
458 shadow_dac_addr
= FFBDAC_PAC2_SPWLUT(wid
);
459 active_dac_addr
= FFBDAC_PAC2_APWLUT(wid
);
460 dac_db_bit
= FFBDAC_PAC2_WLUT_DB
;
465 wid_reg_val
= DACCFG_READ(dac
, active_dac_addr
);
466 if (fmesa
->back_buffer
== 0)
467 wid_reg_val
|= dac_db_bit
;
469 wid_reg_val
&= ~dac_db_bit
;
471 DACCFG_WRITE(dac
, active_dac_addr
, wid_reg_val
);
473 DACCFG_WRITE(dac
, shadow_dac_addr
, wid_reg_val
);
475 /* Schedule the window transfer. */
476 DACCFG_WRITE(dac
, FFBDAC_CFG_WTCTRL
,
477 (FFBDAC_CFG_WTCTRL_TCMD
| FFBDAC_CFG_WTCTRL_TE
));
482 unsigned int wtctrl
= DACCFG_READ(dac
, FFBDAC_CFG_WTCTRL
);
484 if ((wtctrl
& FFBDAC_CFG_WTCTRL_DS
) == 0)
490 UNLOCK_HARDWARE(fmesa
);
493 static void ffb_init_wid(ffbContextPtr fmesa
, unsigned int wid
)
495 ffb_dacPtr dac
= fmesa
->ffbScreen
->dac
;
496 unsigned int wid_reg_val
, dac_db_bit
, active_dac_addr
;
497 unsigned int shadow_dac_addr
;
499 if (fmesa
->ffb_sarea
->flags
& FFB_DRI_PAC1
) {
500 shadow_dac_addr
= FFBDAC_PAC1_SPWLUT(wid
);
501 active_dac_addr
= FFBDAC_PAC1_APWLUT(wid
);
502 dac_db_bit
= FFBDAC_PAC1_WLUT_DB
;
504 shadow_dac_addr
= FFBDAC_PAC2_SPWLUT(wid
);
505 active_dac_addr
= FFBDAC_PAC2_APWLUT(wid
);
506 dac_db_bit
= FFBDAC_PAC2_WLUT_DB
;
509 wid_reg_val
= DACCFG_READ(dac
, active_dac_addr
);
510 wid_reg_val
&= ~dac_db_bit
;
512 DACCFG_WRITE(dac
, active_dac_addr
, wid_reg_val
);
514 DACCFG_WRITE(dac
, shadow_dac_addr
, wid_reg_val
);
516 /* Schedule the window transfer. */
517 DACCFG_WRITE(dac
, FFBDAC_CFG_WTCTRL
,
518 (FFBDAC_CFG_WTCTRL_TCMD
| FFBDAC_CFG_WTCTRL_TE
));
523 unsigned int wtctrl
= DACCFG_READ(dac
, FFBDAC_CFG_WTCTRL
);
525 if ((wtctrl
& FFBDAC_CFG_WTCTRL_DS
) == 0)
532 /* Force the context `c' to be the current context and associate with it
535 ffbMakeCurrent(__DRIcontextPrivate
*driContextPriv
,
536 __DRIdrawablePrivate
*driDrawPriv
,
537 __DRIdrawablePrivate
*driReadPriv
)
539 if (driContextPriv
) {
540 ffbContextPtr fmesa
= (ffbContextPtr
) driContextPriv
->driverPrivate
;
543 fmesa
->driDrawable
= driDrawPriv
;
545 _mesa_make_current(fmesa
->glCtx
,
546 (GLframebuffer
*) driDrawPriv
->driverPrivate
,
547 (GLframebuffer
*) driReadPriv
->driverPrivate
);
550 if (fmesa
->wid
== ~0) {
552 if (getenv("LIBGL_SOFTWARE_RENDERING"))
553 FALLBACK( fmesa
->glCtx
, FFB_BADATTR_SWONLY
, GL_TRUE
);
556 LOCK_HARDWARE(fmesa
);
558 fmesa
->wid
= fmesa
->ffb_sarea
->wid_table
[driDrawPriv
->index
];
559 ffb_init_wid(fmesa
, fmesa
->wid
);
562 fmesa
->state_dirty
|= FFB_STATE_ALL
;
563 fmesa
->state_fifo_ents
= fmesa
->state_all_fifo_ents
;
564 ffbSyncHardware(fmesa
);
565 UNLOCK_HARDWARE(fmesa
);
568 /* Also, at the first switch to a new context,
569 * we need to clear all the hw buffers.
571 ffbDDClear(fmesa
->glCtx
,
572 (BUFFER_BIT_FRONT_LEFT
| BUFFER_BIT_BACK_LEFT
|
573 BUFFER_BIT_DEPTH
| BUFFER_BIT_STENCIL
));
576 _mesa_make_current(NULL
, NULL
, NULL
);
582 /* Force the context `c' to be unbound from its buffer */
584 ffbUnbindContext(__DRIcontextPrivate
*driContextPriv
)
589 void ffbXMesaUpdateState(ffbContextPtr fmesa
)
591 __DRIdrawablePrivate
*dPriv
= fmesa
->driDrawable
;
592 __DRIscreenPrivate
*sPriv
= fmesa
->driScreen
;
593 int stamp
= dPriv
->lastStamp
;
595 DRI_VALIDATE_DRAWABLE_INFO(sPriv
, dPriv
);
597 if (dPriv
->lastStamp
!= stamp
) {
598 GLcontext
*ctx
= fmesa
->glCtx
;
600 ffbCalcViewport(ctx
);
601 driUpdateFramebufferSize(ctx
, dPriv
);
602 if (ctx
->Polygon
.StippleFlag
) {
603 ffbXformAreaPattern(fmesa
,
604 (const GLubyte
*)ctx
->PolygonStipple
);
609 static const __DRIconfig
**
610 ffbFillInModes( __DRIscreenPrivate
*psp
,
611 unsigned pixel_bits
, unsigned depth_bits
,
612 unsigned stencil_bits
, GLboolean have_back_buffer
)
614 __DRIconfig
**configs
;
616 unsigned depth_buffer_factor
;
617 unsigned back_buffer_factor
;
622 /* GLX_SWAP_COPY_OML is only supported because the FFB driver doesn't
623 * support pageflipping at all.
625 static const GLenum back_buffer_modes
[] = {
626 GLX_NONE
, GLX_SWAP_UNDEFINED_OML
, GLX_SWAP_COPY_OML
629 uint8_t depth_bits_array
[3];
630 uint8_t stencil_bits_array
[3];
631 uint8_t msaa_samples_array
[1];
633 depth_bits_array
[0] = 0;
634 depth_bits_array
[1] = depth_bits
;
635 depth_bits_array
[2] = depth_bits
;
637 /* Just like with the accumulation buffer, always provide some modes
638 * with a stencil buffer. It will be a sw fallback, but some apps won't
641 stencil_bits_array
[0] = 0;
642 stencil_bits_array
[1] = 0;
643 stencil_bits_array
[2] = (stencil_bits
== 0) ? 8 : stencil_bits
;
645 msaa_samples_array
[0] = 0;
647 depth_buffer_factor
= ((depth_bits
!= 0) || (stencil_bits
!= 0)) ? 3 : 1;
648 back_buffer_factor
= (have_back_buffer
) ? 3 : 1;
650 if ( pixel_bits
== 16 ) {
652 fb_type
= GL_UNSIGNED_SHORT_5_6_5
;
656 fb_type
= GL_UNSIGNED_INT_8_8_8_8_REV
;
659 configs
= driCreateConfigs(fb_format
, fb_type
,
660 depth_bits_array
, stencil_bits_array
,
661 depth_buffer_factor
, back_buffer_modes
,
663 msaa_samples_array
, 1);
664 if (configs
== NULL
) {
665 fprintf(stderr
, "[%s:%u] Error creating FBConfig!\n", __func__
,
670 /* Mark the visual as slow if there are "fake" stencil bits.
672 for (i
= 0; configs
[i
]; i
++) {
673 m
= &configs
[i
]->modes
;
674 if ((m
->stencilBits
!= 0) && (m
->stencilBits
!= stencil_bits
)) {
675 m
->visualRating
= GLX_SLOW_CONFIG
;
679 return (const __DRIconfig
**) configs
;
684 * This is the driver specific part of the createNewScreen entry point.
686 * \todo maybe fold this into intelInitDriver
688 * \return the __GLcontextModes supported by this driver
690 static const __DRIconfig
**
691 ffbInitScreen(__DRIscreen
*psp
)
693 static const __DRIversion ddx_expected
= { 0, 1, 1 };
694 static const __DRIversion dri_expected
= { 4, 0, 0 };
695 static const __DRIversion drm_expected
= { 0, 0, 1 };
697 if ( ! driCheckDriDdxDrmVersions2( "ffb",
698 &psp
->dri_version
, & dri_expected
,
699 &psp
->ddx_version
, & ddx_expected
,
700 &psp
->drm_version
, & drm_expected
) )
703 if (!ffbInitDriver(psp
))
706 return ffbFillInModes( psp
, 32, 16, 0, GL_TRUE
);
709 const struct __DriverAPIRec driDriverAPI
= {
710 .InitScreen
= ffbInitScreen
,
711 .DestroyScreen
= ffbDestroyScreen
,
712 .CreateContext
= ffbCreateContext
,
713 .DestroyContext
= ffbDestroyContext
,
714 .CreateBuffer
= ffbCreateBuffer
,
715 .DestroyBuffer
= ffbDestroyBuffer
,
716 .SwapBuffers
= ffbSwapBuffers
,
717 .MakeCurrent
= ffbMakeCurrent
,
718 .UnbindContext
= ffbUnbindContext
,
720 .GetDrawableMSC
= NULL
,
723 .SwapBuffersMSC
= NULL