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 **************************************************************************/
32 #include "simple_list.h"
33 #include "extensions.h"
34 #include "framebuffer.h"
37 #include "swrast/swrast.h"
38 #include "swrast_setup/swrast_setup.h"
40 #include "array_cache/acache.h"
42 #include "tnl/t_pipeline.h"
43 #include "tnl/t_vertex.h"
45 #include "drivers/common/driverfuncs.h"
47 #include "intel_screen.h"
51 #include "intel_buffers.h"
52 #include "intel_tex.h"
53 #include "intel_span.h"
54 #include "intel_tris.h"
55 #include "intel_ioctl.h"
56 #include "intel_batchbuffer.h"
57 #include "intel_blit.h"
58 #include "intel_pixel.h"
59 #include "intel_regions.h"
60 #include "intel_buffer_objects.h"
61 #include "intel_fbo.h"
65 #include "xmlpool.h" /* for symbolic values of enum-type options */
67 int INTEL_DEBUG
= (0);
70 #define need_GL_ARB_multisample
71 #define need_GL_ARB_point_parameters
72 #define need_GL_ARB_texture_compression
73 #define need_GL_ARB_vertex_buffer_object
74 #define need_GL_ARB_vertex_program
75 #define need_GL_ARB_window_pos
76 #define need_GL_EXT_blend_color
77 #define need_GL_EXT_blend_equation_separate
78 #define need_GL_EXT_blend_func_separate
79 #define need_GL_EXT_blend_minmax
80 #define need_GL_EXT_cull_vertex
81 #define need_GL_EXT_fog_coord
82 #define need_GL_EXT_framebuffer_object
83 #define need_GL_EXT_multi_draw_arrays
84 #define need_GL_EXT_secondary_color
85 #define need_GL_NV_vertex_program
86 #include "extension_helper.h"
89 #define DRIVER_DATE "20061102"
91 _glthread_Mutex lockMutex
;
92 static GLboolean lockMutexInit
= GL_FALSE
;
95 static const GLubyte
*
96 intelGetString(GLcontext
* ctx
, GLenum name
)
99 static char buffer
[128];
103 return (GLubyte
*) "Tungsten Graphics, Inc";
107 switch (intel_context(ctx
)->intelScreen
->deviceID
) {
109 chipset
= "Intel(R) 845G";
111 case PCI_CHIP_I830_M
:
112 chipset
= "Intel(R) 830M";
114 case PCI_CHIP_I855_GM
:
115 chipset
= "Intel(R) 852GM/855GM";
117 case PCI_CHIP_I865_G
:
118 chipset
= "Intel(R) 865G";
120 case PCI_CHIP_I915_G
:
121 chipset
= "Intel(R) 915G";
123 case PCI_CHIP_I915_GM
:
124 chipset
= "Intel(R) 915GM";
126 case PCI_CHIP_I945_G
:
127 chipset
= "Intel(R) 945G";
129 case PCI_CHIP_I945_GM
:
130 chipset
= "Intel(R) 945GM";
133 chipset
= "Unknown Intel Chipset";
137 (void) driGetRendererString(buffer
, chipset
, DRIVER_DATE
, 0);
138 return (GLubyte
*) buffer
;
147 * Extension strings exported by the intel driver.
150 * It appears that ARB_texture_env_crossbar has "disappeared" compared to the
151 * old i830-specific driver.
153 const struct dri_extension card_extensions
[] = {
154 {"GL_ARB_multisample", GL_ARB_multisample_functions
},
155 {"GL_ARB_multitexture", NULL
},
156 {"GL_ARB_point_parameters", GL_ARB_point_parameters_functions
},
157 {"GL_ARB_texture_border_clamp", NULL
},
158 {"GL_ARB_texture_compression", GL_ARB_texture_compression_functions
},
159 {"GL_ARB_texture_cube_map", NULL
},
160 {"GL_ARB_texture_env_add", NULL
},
161 {"GL_ARB_texture_env_combine", NULL
},
162 {"GL_ARB_texture_env_dot3", NULL
},
163 {"GL_ARB_texture_mirrored_repeat", NULL
},
164 {"GL_ARB_texture_rectangle", NULL
},
165 {"GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions
},
166 {"GL_ARB_pixel_buffer_object", NULL
},
167 {"GL_ARB_vertex_program", GL_ARB_vertex_program_functions
},
168 {"GL_ARB_window_pos", GL_ARB_window_pos_functions
},
169 {"GL_EXT_blend_color", GL_EXT_blend_color_functions
},
170 {"GL_EXT_blend_equation_separate",
171 GL_EXT_blend_equation_separate_functions
},
172 {"GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions
},
173 {"GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions
},
174 {"GL_EXT_blend_subtract", NULL
},
175 {"GL_EXT_cull_vertex", GL_EXT_cull_vertex_functions
},
176 {"GL_EXT_fog_coord", GL_EXT_fog_coord_functions
},
177 {"GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions
},
178 {"GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions
},
179 #if 1 /* XXX FBO temporary? */
180 {"GL_EXT_packed_depth_stencil", NULL
},
182 {"GL_EXT_secondary_color", GL_EXT_secondary_color_functions
},
183 {"GL_EXT_stencil_wrap", NULL
},
184 {"GL_EXT_texture_edge_clamp", NULL
},
185 {"GL_EXT_texture_env_combine", NULL
},
186 {"GL_EXT_texture_env_dot3", NULL
},
187 {"GL_EXT_texture_filter_anisotropic", NULL
},
188 {"GL_EXT_texture_lod_bias", NULL
},
189 {"GL_3DFX_texture_compression_FXT1", NULL
},
190 {"GL_APPLE_client_storage", NULL
},
191 {"GL_MESA_pack_invert", NULL
},
192 {"GL_MESA_ycbcr_texture", NULL
},
193 {"GL_NV_blend_square", NULL
},
194 {"GL_NV_vertex_program", GL_NV_vertex_program_functions
},
195 {"GL_NV_vertex_program1_1", NULL
},
196 /* { "GL_SGIS_generate_mipmap", NULL }, */
200 extern const struct tnl_pipeline_stage _intel_render_stage
;
202 static const struct tnl_pipeline_stage
*intel_pipeline
[] = {
203 &_tnl_vertex_transform_stage
,
204 &_tnl_vertex_cull_stage
,
205 &_tnl_normal_transform_stage
,
206 &_tnl_lighting_stage
,
207 &_tnl_fog_coordinate_stage
,
209 &_tnl_texture_transform_stage
,
210 &_tnl_point_attenuation_stage
,
211 &_tnl_arb_vertex_program_stage
,
212 &_tnl_vertex_program_stage
,
214 &_intel_render_stage
, /* ADD: unclipped rastersetup-to-dma */
221 static const struct dri_debug_control debug_control
[] = {
222 {"tex", DEBUG_TEXTURE
},
223 {"state", DEBUG_STATE
},
224 {"ioctl", DEBUG_IOCTL
},
225 {"blit", DEBUG_BLIT
},
226 {"mip", DEBUG_MIPTREE
},
227 {"fall", DEBUG_FALLBACKS
},
228 {"verb", DEBUG_VERBOSE
},
229 {"bat", DEBUG_BATCH
},
230 {"pix", DEBUG_PIXEL
},
231 {"buf", DEBUG_BUFMGR
},
232 {"reg", DEBUG_REGION
},
234 {"lock", DEBUG_LOCK
},
240 intelInvalidateState(GLcontext
* ctx
, GLuint new_state
)
242 _swrast_InvalidateState(ctx
, new_state
);
243 _swsetup_InvalidateState(ctx
, new_state
);
244 _ac_InvalidateState(ctx
, new_state
);
245 _tnl_InvalidateState(ctx
, new_state
);
246 _tnl_invalidate_vertex_state(ctx
, new_state
);
247 intel_context(ctx
)->NewGLState
|= new_state
;
252 intelFlush(GLcontext
* ctx
)
254 struct intel_context
*intel
= intel_context(ctx
);
259 INTEL_FIREVERTICES(intel
);
261 if (intel
->batch
->map
!= intel
->batch
->ptr
)
262 intel_batchbuffer_flush(intel
->batch
);
264 /* XXX: Need to do an MI_FLUSH here.
270 * Check if we need to rotate/warp the front color buffer to the
271 * rotated screen. We generally need to do this when we get a glFlush
272 * or glFinish after drawing to the front color buffer.
275 intelCheckFrontRotate(GLcontext
* ctx
)
277 struct intel_context
*intel
= intel_context(ctx
);
278 if (intel
->ctx
.DrawBuffer
->_ColorDrawBufferMask
[0] ==
279 BUFFER_BIT_FRONT_LEFT
) {
280 intelScreenPrivate
*screen
= intel
->intelScreen
;
281 if (screen
->current_rotation
!= 0) {
282 __DRIdrawablePrivate
*dPriv
= intel
->driDrawable
;
283 intelRotateWindow(intel
, dPriv
, BUFFER_BIT_FRONT_LEFT
);
290 * Called via glFlush.
293 intelglFlush(GLcontext
* ctx
)
296 intelCheckFrontRotate(ctx
);
300 intelFinish(GLcontext
* ctx
)
302 struct intel_context
*intel
= intel_context(ctx
);
304 if (intel
->batch
->last_fence
) {
305 driFenceFinish(intel
->batch
->last_fence
,
307 driFenceUnReference(intel
->batch
->last_fence
);
308 intel
->batch
->last_fence
= NULL
;
310 intelCheckFrontRotate(ctx
);
315 intelInitDriverFunctions(struct dd_function_table
*functions
)
317 _mesa_init_driver_functions(functions
);
319 functions
->Flush
= intelglFlush
;
320 functions
->Finish
= intelFinish
;
321 functions
->GetString
= intelGetString
;
322 functions
->UpdateState
= intelInvalidateState
;
323 functions
->CopyColorTable
= _swrast_CopyColorTable
;
324 functions
->CopyColorSubTable
= _swrast_CopyColorSubTable
;
325 functions
->CopyConvolutionFilter1D
= _swrast_CopyConvolutionFilter1D
;
326 functions
->CopyConvolutionFilter2D
= _swrast_CopyConvolutionFilter2D
;
328 intelInitTextureFuncs(functions
);
329 intelInitPixelFuncs(functions
);
330 intelInitStateFuncs(functions
);
331 intelInitBufferFuncs(functions
);
336 intelInitContext(struct intel_context
*intel
,
337 const __GLcontextModes
* mesaVis
,
338 __DRIcontextPrivate
* driContextPriv
,
339 void *sharedContextPrivate
,
340 struct dd_function_table
*functions
)
342 GLcontext
*ctx
= &intel
->ctx
;
343 GLcontext
*shareCtx
= (GLcontext
*) sharedContextPrivate
;
344 __DRIscreenPrivate
*sPriv
= driContextPriv
->driScreenPriv
;
345 intelScreenPrivate
*intelScreen
= (intelScreenPrivate
*) sPriv
->private;
346 drmI830Sarea
*saPriv
= (drmI830Sarea
*)
347 (((GLubyte
*) sPriv
->pSAREA
) + intelScreen
->sarea_priv_offset
);
350 if (!_mesa_initialize_context(&intel
->ctx
,
352 functions
, (void *) intel
))
355 driContextPriv
->driverPrivate
= intel
;
356 intel
->intelScreen
= intelScreen
;
357 intel
->driScreen
= sPriv
;
358 intel
->sarea
= saPriv
;
360 if (!lockMutexInit
) {
361 lockMutexInit
= GL_TRUE
;
362 _glthread_INIT_MUTEX(lockMutex
);
365 driParseConfigFiles(&intel
->optionCache
, &intelScreen
->optionCache
,
366 intel
->driScreen
->myNum
, "i915");
368 ctx
->Const
.MaxTextureMaxAnisotropy
= 2.0;
370 /* This doesn't yet catch all non-conformant rendering, but it's a
373 if (getenv("INTEL_STRICT_CONFORMANCE")) {
374 intel
->strict_conformance
= 1;
377 ctx
->Const
.MinLineWidth
= 1.0;
378 ctx
->Const
.MinLineWidthAA
= 1.0;
379 ctx
->Const
.MaxLineWidth
= 3.0;
380 ctx
->Const
.MaxLineWidthAA
= 3.0;
381 ctx
->Const
.LineWidthGranularity
= 1.0;
383 ctx
->Const
.MinPointSize
= 1.0;
384 ctx
->Const
.MinPointSizeAA
= 1.0;
385 ctx
->Const
.MaxPointSize
= 255.0;
386 ctx
->Const
.MaxPointSizeAA
= 3.0;
387 ctx
->Const
.PointSizeGranularity
= 1.0;
389 ctx
->Const
.MaxColorAttachments
= 4; /* XXX FBO: review this */
391 /* Initialize the software rasterizer and helper modules. */
392 _swrast_CreateContext(ctx
);
393 _ac_CreateContext(ctx
);
394 _tnl_CreateContext(ctx
);
395 _swsetup_CreateContext(ctx
);
397 /* Install the customized pipeline: */
398 _tnl_destroy_pipeline(ctx
);
399 _tnl_install_pipeline(ctx
, intel_pipeline
);
401 /* Configure swrast to match hardware characteristics: */
402 _swrast_allow_pixel_fog(ctx
, GL_FALSE
);
403 _swrast_allow_vertex_fog(ctx
, GL_TRUE
);
406 intel
->hHWContext
= driContextPriv
->hHWContext
;
407 intel
->driFd
= sPriv
->fd
;
408 intel
->driHwLock
= (drmLock
*) & sPriv
->pSAREA
->lock
;
410 intel
->hw_stipple
= 1;
412 /* XXX FBO: this doesn't seem to be used anywhere */
413 switch (mesaVis
->depthBits
) {
414 case 0: /* what to do in this case? */
416 intel
->polygon_offset_scale
= 1.0 / 0xffff;
419 intel
->polygon_offset_scale
= 2.0 / 0xffffff; /* req'd to pass glean */
426 /* Initialize swrast, tnl driver tables: */
427 intelInitSpanFuncs(ctx
);
428 intelInitTriFuncs(ctx
);
431 intel
->RenderIndex
= ~0;
433 fthrottle_mode
= driQueryOptioni(&intel
->optionCache
, "fthrottle_mode");
434 intel
->iw
.irq_seq
= -1;
435 intel
->irqsEmitted
= 0;
437 intel
->do_irqs
= (intel
->intelScreen
->irq_active
&&
438 fthrottle_mode
== DRI_CONF_FTHROTTLE_IRQS
);
440 intel
->do_usleeps
= (fthrottle_mode
== DRI_CONF_FTHROTTLE_USLEEPS
);
442 intel
->vblank_flags
= (intel
->intelScreen
->irq_active
!= 0)
443 ? driGetDefaultVBlankFlags(&intel
->optionCache
) : VBLANK_FLAG_NO_IRQ
;
445 (*dri_interface
->getUST
) (&intel
->swap_ust
);
446 _math_matrix_ctr(&intel
->ViewportMatrix
);
448 /* Disable imaging extension until convolution is working in
451 driInitExtensions(ctx
, card_extensions
,
456 intel
->batch
= intel_batchbuffer_alloc(intel
);
457 intel
->last_swap_fence
= NULL
;
458 intel
->first_swap_fence
= NULL
;
460 intel_bufferobj_init(intel
);
461 intel_fbo_init(intel
);
463 if (intel
->ctx
.Mesa_DXTn
) {
464 _mesa_enable_extension(ctx
, "GL_EXT_texture_compression_s3tc");
465 _mesa_enable_extension(ctx
, "GL_S3_s3tc");
467 else if (driQueryOptionb(&intel
->optionCache
, "force_s3tc_enable")) {
468 _mesa_enable_extension(ctx
, "GL_EXT_texture_compression_s3tc");
471 intel
->prim
.primitive
= ~0;
475 INTEL_DEBUG
= driParseDebugString(getenv("INTEL_DEBUG"), debug_control
);
478 if (getenv("INTEL_NO_RAST")) {
479 fprintf(stderr
, "disabling 3D rasterization\n");
480 FALLBACK(intel
, INTEL_FALLBACK_USER
, 1);
487 intelDestroyContext(__DRIcontextPrivate
* driContextPriv
)
489 struct intel_context
*intel
=
490 (struct intel_context
*) driContextPriv
->driverPrivate
;
492 assert(intel
); /* should never be null */
494 GLboolean release_texture_heaps
;
496 INTEL_FIREVERTICES(intel
);
498 intel
->vtbl
.destroy(intel
);
500 release_texture_heaps
= (intel
->ctx
.Shared
->RefCount
== 1);
501 _swsetup_DestroyContext(&intel
->ctx
);
502 _tnl_DestroyContext(&intel
->ctx
);
503 _ac_DestroyContext(&intel
->ctx
);
505 _swrast_DestroyContext(&intel
->ctx
);
506 intel
->Fallback
= 0; /* don't call _swrast_Flush later */
508 intel_batchbuffer_free(intel
->batch
);
510 if (intel
->last_swap_fence
) {
511 driFenceFinish(intel
->last_swap_fence
, DRM_FENCE_TYPE_EXE
, GL_TRUE
);
512 driFenceUnReference(intel
->last_swap_fence
);
513 intel
->last_swap_fence
= NULL
;
515 if (intel
->first_swap_fence
) {
516 driFenceFinish(intel
->first_swap_fence
, DRM_FENCE_TYPE_EXE
, GL_TRUE
);
517 driFenceUnReference(intel
->first_swap_fence
);
518 intel
->first_swap_fence
= NULL
;
522 if (release_texture_heaps
) {
523 /* This share group is about to go away, free our private
524 * texture object data.
526 if (INTEL_DEBUG
& DEBUG_TEXTURE
)
527 fprintf(stderr
, "do something to free texture heaps\n");
530 /* free the Mesa context */
531 _mesa_free_context_data(&intel
->ctx
);
536 intelUnbindContext(__DRIcontextPrivate
* driContextPriv
)
542 intelMakeCurrent(__DRIcontextPrivate
* driContextPriv
,
543 __DRIdrawablePrivate
* driDrawPriv
,
544 __DRIdrawablePrivate
* driReadPriv
)
547 if (driContextPriv
) {
548 struct intel_context
*intel
=
549 (struct intel_context
*) driContextPriv
->driverPrivate
;
550 GLframebuffer
*drawFb
= (GLframebuffer
*) driDrawPriv
->driverPrivate
;
551 GLframebuffer
*readFb
= (GLframebuffer
*) driReadPriv
->driverPrivate
;
554 /* XXX FBO temporary fix-ups! */
555 /* if the renderbuffers don't have regions, init them from the context */
557 struct intel_renderbuffer
*irbFront
558 = intel_get_renderbuffer(drawFb
, BUFFER_FRONT_LEFT
);
559 struct intel_renderbuffer
*irbBack
560 = intel_get_renderbuffer(drawFb
, BUFFER_BACK_LEFT
);
561 struct intel_renderbuffer
*irbDepth
562 = intel_get_renderbuffer(drawFb
, BUFFER_DEPTH
);
563 struct intel_renderbuffer
*irbStencil
564 = intel_get_renderbuffer(drawFb
, BUFFER_STENCIL
);
566 if (irbFront
&& !irbFront
->region
) {
567 intel_region_reference(&irbFront
->region
, intel
->intelScreen
->front_region
);
569 if (irbBack
&& !irbBack
->region
) {
570 intel_region_reference(&irbBack
->region
, intel
->intelScreen
->back_region
);
572 if (irbDepth
&& !irbDepth
->region
) {
573 intel_region_reference(&irbDepth
->region
, intel
->intelScreen
->depth_region
);
575 if (irbStencil
&& !irbStencil
->region
) {
576 intel_region_reference(&irbStencil
->region
, intel
->intelScreen
->depth_region
);
580 /* set initial GLframebuffer size to match window, if needed */
581 if (drawFb
->Width
== 0 && driDrawPriv
->w
) {
582 _mesa_resize_framebuffer(&intel
->ctx
, drawFb
,
583 driDrawPriv
->w
, driDrawPriv
->h
);
585 if (readFb
->Width
== 0 && driReadPriv
->w
) {
586 _mesa_resize_framebuffer(&intel
->ctx
, readFb
,
587 driReadPriv
->w
, driReadPriv
->h
);
590 _mesa_make_current(&intel
->ctx
, drawFb
, readFb
);
592 /* The drawbuffer won't always be updated by _mesa_make_current:
594 if (intel
->ctx
.DrawBuffer
== drawFb
) {
596 if (intel
->driDrawable
!= driDrawPriv
) {
597 driDrawableInitVBlank(driDrawPriv
, intel
->vblank_flags
, &intel
->vbl_seq
);
598 intel
->driDrawable
= driDrawPriv
;
599 intelWindowMoved(intel
);
602 intel_draw_buffer(&intel
->ctx
, drawFb
);
606 _mesa_make_current(NULL
, NULL
, NULL
);
613 intelContendedLock(struct intel_context
*intel
, GLuint flags
)
615 __DRIdrawablePrivate
*dPriv
= intel
->driDrawable
;
616 __DRIscreenPrivate
*sPriv
= intel
->driScreen
;
617 intelScreenPrivate
*intelScreen
= (intelScreenPrivate
*) sPriv
->private;
618 drmI830Sarea
*sarea
= intel
->sarea
;
620 drmGetLock(intel
->driFd
, intel
->hHWContext
, flags
);
622 if (INTEL_DEBUG
& DEBUG_LOCK
)
623 _mesa_printf("%s - got contended lock\n", __progname
);
625 /* If the window moved, may need to set a new cliprect now.
627 * NOTE: This releases and regains the hw lock, so all state
628 * checking must be done *after* this call:
631 DRI_VALIDATE_DRAWABLE_INFO(sPriv
, dPriv
);
633 if (sarea
->width
!= intelScreen
->width
||
634 sarea
->height
!= intelScreen
->height
||
635 sarea
->rotation
!= intelScreen
->current_rotation
) {
637 intelUpdateScreenRotation(sPriv
, sarea
);
640 * This will drop the outstanding batchbuffer on the floor
641 * FIXME: This should be done for all contexts?
644 intel_batchbuffer_reset(intel
->batch
);
646 /* lose all primitives */
647 intel
->prim
.primitive
= ~0;
648 intel
->prim
.start_ptr
= 0;
649 intel
->prim
.flush
= 0;
651 /* re-emit all state */
652 intel
->vtbl
.lost_hardware(intel
);
654 /* force window update */
655 intel
->lastStamp
= 0;
661 if (dPriv
&& intel
->lastStamp
!= dPriv
->lastStamp
) {
662 intelWindowMoved(intel
);
663 intel
->lastStamp
= dPriv
->lastStamp
;
668 /* Lock the hardware and validate our state.
670 void LOCK_HARDWARE( struct intel_context
*intel
)
674 _glthread_LOCK_MUTEX(lockMutex
);
675 assert(!intel
->locked
);
677 if (intel
->swap_scheduled
) {
679 vbl
.request
.type
= DRM_VBLANK_ABSOLUTE
;
680 if ( intel
->vblank_flags
& VBLANK_FLAG_SECONDARY
) {
681 vbl
.request
.type
|= DRM_VBLANK_SECONDARY
;
683 vbl
.request
.sequence
= intel
->vbl_seq
;
684 drmWaitVBlank(intel
->driFd
, &vbl
);
685 intel
->swap_scheduled
= 0;
688 DRM_CAS(intel
->driHwLock
, intel
->hHWContext
,
689 (DRM_LOCK_HELD
|intel
->hHWContext
), __ret
);
692 intelContendedLock( intel
, 0 );
694 if (INTEL_DEBUG
& DEBUG_LOCK
)
695 _mesa_printf("%s - locked\n", __progname
);
701 /* Unlock the hardware using the global current context
703 void UNLOCK_HARDWARE( struct intel_context
*intel
)
707 DRM_UNLOCK(intel
->driFd
, intel
->driHwLock
, intel
->hHWContext
);
709 _glthread_UNLOCK_MUTEX(lockMutex
);
711 if (INTEL_DEBUG
& DEBUG_LOCK
)
712 _mesa_printf("%s - unlocked\n", __progname
);