Support ARB_texture_rectangle.
[mesa.git] / src / mesa / drivers / dri / i965 / intel_context.c
1 /**************************************************************************
2 *
3 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
4 * All Rights Reserved.
5 *
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:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
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.
25 *
26 **************************************************************************/
27
28
29 #include "glheader.h"
30 #include "context.h"
31 #include "matrix.h"
32 #include "simple_list.h"
33 #include "extensions.h"
34 #include "framebuffer.h"
35 #include "imports.h"
36
37 #include "swrast/swrast.h"
38 #include "swrast_setup/swrast_setup.h"
39 #include "tnl/tnl.h"
40 #include "array_cache/acache.h"
41
42 #include "tnl/t_pipeline.h"
43 #include "tnl/t_vertex.h"
44
45 #include "drivers/common/driverfuncs.h"
46
47 #include "intel_screen.h"
48
49 #include "i830_dri.h"
50 #include "i830_common.h"
51
52 #include "intel_tex.h"
53 #include "intel_span.h"
54 #include "intel_ioctl.h"
55 #include "intel_batchbuffer.h"
56 #include "intel_blit.h"
57 #include "intel_regions.h"
58 #include "intel_buffer_objects.h"
59
60 #include "bufmgr.h"
61
62 #include "utils.h"
63 #ifndef INTEL_DEBUG
64 int INTEL_DEBUG = (0);
65 #endif
66
67 #define need_GL_ARB_multisample
68 #define need_GL_ARB_point_parameters
69 #define need_GL_ARB_texture_compression
70 #define need_GL_ARB_vertex_buffer_object
71 #define need_GL_ARB_vertex_program
72 #define need_GL_ARB_window_pos
73 #define need_GL_EXT_blend_color
74 #define need_GL_EXT_blend_equation_separate
75 #define need_GL_EXT_blend_func_separate
76 #define need_GL_EXT_blend_minmax
77 #define need_GL_EXT_cull_vertex
78 #define need_GL_EXT_fog_coord
79 #define need_GL_EXT_multi_draw_arrays
80 #define need_GL_EXT_secondary_color
81 #include "extension_helper.h"
82
83 #ifndef VERBOSE
84 int VERBOSE = 0;
85 #endif
86
87 #if DEBUG_LOCKING
88 char *prevLockFile;
89 int prevLockLine;
90 #endif
91
92 /***************************************
93 * Mesa's Driver Functions
94 ***************************************/
95
96 #define DRIVER_VERSION "4.1.3002"
97
98 static const GLubyte *intelGetString( GLcontext *ctx, GLenum name )
99 {
100 const char * chipset;
101 static char buffer[128];
102
103 switch (name) {
104 case GL_VENDOR:
105 return (GLubyte *)"Tungsten Graphics, Inc";
106 break;
107
108 case GL_RENDERER:
109 switch (intel_context(ctx)->intelScreen->deviceID) {
110 case PCI_CHIP_I965_Q:
111 chipset = "Intel(R) 965Q"; break;
112 break;
113 case PCI_CHIP_I965_G:
114 case PCI_CHIP_I965_G_1:
115 chipset = "Intel(R) 965G"; break;
116 break;
117 case PCI_CHIP_I946_GZ:
118 chipset = "Intel(R) 946GZ"; break;
119 break;
120 default:
121 chipset = "Unknown Intel Chipset"; break;
122 }
123
124 (void) driGetRendererString( buffer, chipset, DRIVER_VERSION, 0 );
125 return (GLubyte *) buffer;
126
127 default:
128 return NULL;
129 }
130 }
131
132
133 /**
134 * Extension strings exported by the intel driver.
135 *
136 * \note
137 * It appears that ARB_texture_env_crossbar has "disappeared" compared to the
138 * old i830-specific driver.
139 */
140 const struct dri_extension card_extensions[] =
141 {
142 { "GL_ARB_multisample", GL_ARB_multisample_functions },
143 { "GL_ARB_multitexture", NULL },
144 { "GL_ARB_point_parameters", GL_ARB_point_parameters_functions },
145 { "GL_ARB_texture_border_clamp", NULL },
146 { "GL_ARB_texture_compression", GL_ARB_texture_compression_functions },
147 { "GL_ARB_texture_cube_map", NULL },
148 { "GL_ARB_texture_env_add", NULL },
149 { "GL_ARB_texture_env_combine", NULL },
150 { "GL_ARB_texture_env_dot3", NULL },
151 { "GL_ARB_texture_mirrored_repeat", NULL },
152 { "GL_ARB_texture_non_power_of_two", NULL },
153 { "GL_ARB_texture_rectangle", NULL },
154 { "GL_NV_texture_rectangle", NULL },
155 { "GL_EXT_texture_rectangle", NULL },
156 { "GL_ARB_texture_rectangle", NULL },
157 { "GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions },
158 { "GL_ARB_vertex_program", GL_ARB_vertex_program_functions },
159 { "GL_ARB_window_pos", GL_ARB_window_pos_functions },
160 { "GL_EXT_blend_color", GL_EXT_blend_color_functions },
161 { "GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions },
162 { "GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions },
163 { "GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions },
164 { "GL_EXT_blend_logic_op", NULL },
165 { "GL_EXT_blend_subtract", NULL },
166 { "GL_EXT_cull_vertex", GL_EXT_cull_vertex_functions },
167 { "GL_EXT_fog_coord", GL_EXT_fog_coord_functions },
168 { "GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions },
169 { "GL_EXT_secondary_color", GL_EXT_secondary_color_functions },
170 { "GL_EXT_stencil_wrap", NULL },
171 { "GL_EXT_texture_edge_clamp", NULL },
172 { "GL_EXT_texture_env_combine", NULL },
173 { "GL_EXT_texture_env_dot3", NULL },
174 { "GL_EXT_texture_filter_anisotropic", NULL },
175 { "GL_EXT_texture_lod_bias", NULL },
176 { "GL_3DFX_texture_compression_FXT1", NULL },
177 { "GL_APPLE_client_storage", NULL },
178 { "GL_MESA_pack_invert", NULL },
179 { "GL_MESA_ycbcr_texture", NULL },
180 { "GL_NV_blend_square", NULL },
181 { "GL_SGIS_generate_mipmap", NULL },
182 { NULL, NULL }
183 };
184
185
186
187 static const struct dri_debug_control debug_control[] =
188 {
189 { "fall", DEBUG_FALLBACKS },
190 { "tex", DEBUG_TEXTURE },
191 { "ioctl", DEBUG_IOCTL },
192 { "prim", DEBUG_PRIMS },
193 { "vert", DEBUG_VERTS },
194 { "state", DEBUG_STATE },
195 { "verb", DEBUG_VERBOSE },
196 { "dri", DEBUG_DRI },
197 { "dma", DEBUG_DMA },
198 { "san", DEBUG_SANITY },
199 { "sync", DEBUG_SYNC },
200 { "sleep", DEBUG_SLEEP },
201 { "pix", DEBUG_PIXEL },
202 { "buf", DEBUG_BUFMGR },
203 { "stats", DEBUG_STATS },
204 { "tile", DEBUG_TILE },
205 { "sing", DEBUG_SINGLE_THREAD },
206 { "thre", DEBUG_SINGLE_THREAD },
207 { "wm", DEBUG_WM },
208 { "vs", DEBUG_VS },
209 { NULL, 0 }
210 };
211
212
213 static void intelInvalidateState( GLcontext *ctx, GLuint new_state )
214 {
215 struct intel_context *intel = intel_context(ctx);
216
217 _swrast_InvalidateState( ctx, new_state );
218 _swsetup_InvalidateState( ctx, new_state );
219 _ac_InvalidateState( ctx, new_state );
220 _tnl_InvalidateState( ctx, new_state );
221 _tnl_invalidate_vertex_state( ctx, new_state );
222
223 intel->NewGLState |= new_state;
224
225 if (intel->vtbl.invalidate_state)
226 intel->vtbl.invalidate_state( intel, new_state );
227 }
228
229
230 void intelFlush( GLcontext *ctx )
231 {
232 struct intel_context *intel = intel_context( ctx );
233
234 bmLockAndFence(intel);
235 }
236
237 void intelFinish( GLcontext *ctx )
238 {
239 struct intel_context *intel = intel_context( ctx );
240
241 bmFinishFence(intel, bmLockAndFence(intel));
242 }
243
244
245 void intelInitDriverFunctions( struct dd_function_table *functions )
246 {
247 _mesa_init_driver_functions( functions );
248
249 functions->Flush = intelFlush;
250 functions->Finish = intelFinish;
251 functions->GetString = intelGetString;
252 functions->UpdateState = intelInvalidateState;
253 functions->CopyColorTable = _swrast_CopyColorTable;
254 functions->CopyColorSubTable = _swrast_CopyColorSubTable;
255 functions->CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
256 functions->CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
257
258 /* Pixel path fallbacks.
259 */
260 functions->Accum = _swrast_Accum;
261 functions->Bitmap = _swrast_Bitmap;
262 functions->ReadPixels = _swrast_ReadPixels;
263 functions->DrawPixels = _swrast_DrawPixels;
264
265 /* CopyPixels can be accelerated even with the current memory
266 * manager:
267 */
268 functions->CopyPixels = intelCopyPixels;
269
270 intelInitTextureFuncs( functions );
271 intelInitStateFuncs( functions );
272 intelInitBufferFuncs( functions );
273 }
274
275
276
277 GLboolean intelInitContext( struct intel_context *intel,
278 const __GLcontextModes *mesaVis,
279 __DRIcontextPrivate *driContextPriv,
280 void *sharedContextPrivate,
281 struct dd_function_table *functions )
282 {
283 GLcontext *ctx = &intel->ctx;
284 GLcontext *shareCtx = (GLcontext *) sharedContextPrivate;
285 __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
286 intelScreenPrivate *intelScreen = (intelScreenPrivate *)sPriv->private;
287 volatile drmI830Sarea *saPriv = (volatile drmI830Sarea *)
288 (((GLubyte *)sPriv->pSAREA)+intelScreen->sarea_priv_offset);
289
290 if (!_mesa_initialize_context(&intel->ctx,
291 mesaVis, shareCtx,
292 functions,
293 (void*) intel)) {
294 _mesa_printf("%s: failed to init mesa context\n", __FUNCTION__);
295 return GL_FALSE;
296 }
297
298 driContextPriv->driverPrivate = intel;
299 intel->intelScreen = intelScreen;
300 intel->driScreen = sPriv;
301 intel->sarea = saPriv;
302
303
304 ctx->Const.MaxTextureMaxAnisotropy = 2.0;
305
306 if (getenv("INTEL_STRICT_CONFORMANCE")) {
307 intel->strict_conformance = 1;
308 }
309
310 if (intel->strict_conformance) {
311 ctx->Const.MinLineWidth = 1.0;
312 ctx->Const.MinLineWidthAA = 1.0;
313 ctx->Const.MaxLineWidth = 1.0;
314 ctx->Const.MaxLineWidthAA = 1.0;
315 ctx->Const.LineWidthGranularity = 1.0;
316 }
317 else {
318 ctx->Const.MinLineWidth = 1.0;
319 ctx->Const.MinLineWidthAA = 1.0;
320 ctx->Const.MaxLineWidth = 5.0;
321 ctx->Const.MaxLineWidthAA = 5.0;
322 ctx->Const.LineWidthGranularity = 0.5;
323 }
324
325 ctx->Const.MinPointSize = 1.0;
326 ctx->Const.MinPointSizeAA = 1.0;
327 ctx->Const.MaxPointSize = 255.0;
328 ctx->Const.MaxPointSizeAA = 3.0;
329 ctx->Const.PointSizeGranularity = 1.0;
330
331 /* Initialize the software rasterizer and helper modules. */
332 _swrast_CreateContext( ctx );
333 _ac_CreateContext( ctx );
334 _tnl_CreateContext( ctx );
335 _swsetup_CreateContext( ctx );
336
337 TNL_CONTEXT(ctx)->Driver.RunPipeline = _tnl_run_pipeline;
338
339 /* Configure swrast to match hardware characteristics: */
340 _swrast_allow_pixel_fog( ctx, GL_FALSE );
341 _swrast_allow_vertex_fog( ctx, GL_TRUE );
342
343 /* Dri stuff */
344 intel->hHWContext = driContextPriv->hHWContext;
345 intel->driFd = sPriv->fd;
346 intel->driHwLock = (drmLock *) &sPriv->pSAREA->lock;
347
348 intel->hw_stencil = mesaVis->stencilBits && mesaVis->depthBits == 24;
349 intel->hw_stipple = 1;
350
351 switch(mesaVis->depthBits) {
352 case 0: /* what to do in this case? */
353 case 16:
354 intel->depth_scale = 1.0/0xffff;
355 intel->polygon_offset_scale = 1.0/0xffff;
356 intel->depth_clear_mask = ~0;
357 intel->ClearDepth = 0xffff;
358 break;
359 case 24:
360 intel->depth_scale = 1.0/0xffffff;
361 intel->polygon_offset_scale = 2.0/0xffffff; /* req'd to pass glean */
362 intel->depth_clear_mask = 0x00ffffff;
363 intel->stencil_clear_mask = 0xff000000;
364 intel->ClearDepth = 0x00ffffff;
365 break;
366 default:
367 assert(0);
368 break;
369 }
370
371 /* Initialize swrast, tnl driver tables: */
372 intelInitSpanFuncs( ctx );
373
374 intel->no_hw = getenv("INTEL_NO_HW") != NULL;
375
376 if (!intel->intelScreen->irq_active) {
377 _mesa_printf("IRQs not active. Exiting\n");
378 exit(1);
379 }
380
381 _math_matrix_ctr (&intel->ViewportMatrix);
382
383 driInitExtensions( ctx, card_extensions,
384 GL_TRUE );
385
386 INTEL_DEBUG = driParseDebugString( getenv( "INTEL_DEBUG" ),
387 debug_control );
388
389
390 /* Buffer manager:
391 */
392 intel->bm = bm_fake_intel_Attach( intel );
393
394
395 bmInitPool(intel,
396 intel->intelScreen->tex.offset, /* low offset */
397 intel->intelScreen->tex.map, /* low virtual */
398 intel->intelScreen->tex.size,
399 BM_MEM_AGP);
400
401 /* These are still static, but create regions for them.
402 */
403 intel->front_region =
404 intel_region_create_static(intel,
405 BM_MEM_AGP,
406 intelScreen->front.offset,
407 intelScreen->front.map,
408 intelScreen->cpp,
409 intelScreen->front.pitch / intelScreen->cpp,
410 intelScreen->height,
411 GL_FALSE);
412
413
414 intel->back_region =
415 intel_region_create_static(intel,
416 BM_MEM_AGP,
417 intelScreen->back.offset,
418 intelScreen->back.map,
419 intelScreen->cpp,
420 intelScreen->back.pitch / intelScreen->cpp,
421 intelScreen->height,
422 (INTEL_DEBUG & DEBUG_TILE) ? 0 : 1);
423
424 /* Still assuming front.cpp == depth.cpp
425 *
426 * XXX: Setting tiling to false because Depth tiling only supports
427 * YMAJOR but the blitter only supports XMAJOR tiling. Have to
428 * resolve later.
429 */
430 intel->depth_region =
431 intel_region_create_static(intel,
432 BM_MEM_AGP,
433 intelScreen->depth.offset,
434 intelScreen->depth.map,
435 intelScreen->cpp,
436 intelScreen->depth.pitch / intelScreen->cpp,
437 intelScreen->height,
438 (INTEL_DEBUG & DEBUG_TILE) ? 0 : 1);
439
440 intel_bufferobj_init( intel );
441 intel->batch = intel_batchbuffer_alloc( intel );
442
443 if (intel->ctx.Mesa_DXTn) {
444 _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
445 _mesa_enable_extension( ctx, "GL_S3_s3tc" );
446 }
447 else if (driQueryOptionb (&intelScreen->optionCache, "force_s3tc_enable")) {
448 _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" );
449 }
450
451 /* driInitTextureObjects( ctx, & intel->swapped, */
452 /* DRI_TEXMGR_DO_TEXTURE_1D | */
453 /* DRI_TEXMGR_DO_TEXTURE_2D | */
454 /* DRI_TEXMGR_DO_TEXTURE_RECT ); */
455
456
457 if (getenv("INTEL_NO_RAST")) {
458 fprintf(stderr, "disabling 3D rasterization\n");
459 intel->no_rast = 1;
460 }
461
462
463 return GL_TRUE;
464 }
465
466 void intelDestroyContext(__DRIcontextPrivate *driContextPriv)
467 {
468 struct intel_context *intel = (struct intel_context *) driContextPriv->driverPrivate;
469
470 assert(intel); /* should never be null */
471 if (intel) {
472 GLboolean release_texture_heaps;
473
474
475 intel->vtbl.destroy( intel );
476
477 release_texture_heaps = (intel->ctx.Shared->RefCount == 1);
478 _swsetup_DestroyContext (&intel->ctx);
479 _tnl_DestroyContext (&intel->ctx);
480 _ac_DestroyContext (&intel->ctx);
481
482 _swrast_DestroyContext (&intel->ctx);
483 intel->Fallback = 0; /* don't call _swrast_Flush later */
484 intel_batchbuffer_free(intel->batch);
485 intel->batch = NULL;
486
487
488 if ( release_texture_heaps ) {
489 /* This share group is about to go away, free our private
490 * texture object data.
491 */
492
493 /* XXX: destroy the shared bufmgr struct here?
494 */
495 }
496
497 /* Free the regions created to describe front/back/depth
498 * buffers:
499 */
500 #if 0
501 intel_region_release(intel, &intel->front_region);
502 intel_region_release(intel, &intel->back_region);
503 intel_region_release(intel, &intel->depth_region);
504 intel_region_release(intel, &intel->draw_region);
505 #endif
506
507 /* free the Mesa context */
508 _mesa_destroy_context(&intel->ctx);
509 }
510
511 driContextPriv->driverPrivate = NULL;
512 }
513
514 GLboolean intelUnbindContext(__DRIcontextPrivate *driContextPriv)
515 {
516 return GL_TRUE;
517 }
518
519 GLboolean intelMakeCurrent(__DRIcontextPrivate *driContextPriv,
520 __DRIdrawablePrivate *driDrawPriv,
521 __DRIdrawablePrivate *driReadPriv)
522 {
523
524 if (driContextPriv) {
525 struct intel_context *intel = (struct intel_context *) driContextPriv->driverPrivate;
526
527 if ( intel->driDrawable != driDrawPriv ) {
528 /* Shouldn't the readbuffer be stored also? */
529 intel->driDrawable = driDrawPriv;
530 intelWindowMoved( intel );
531 }
532
533 _mesa_make_current(&intel->ctx,
534 (GLframebuffer *) driDrawPriv->driverPrivate,
535 (GLframebuffer *) driReadPriv->driverPrivate);
536
537 intel->ctx.Driver.DrawBuffer( &intel->ctx, intel->ctx.Color.DrawBuffer[0] );
538 } else {
539 _mesa_make_current(NULL, NULL, NULL);
540 }
541
542 return GL_TRUE;
543 }
544
545
546 static void intelContendedLock( struct intel_context *intel, GLuint flags )
547 {
548 __DRIdrawablePrivate *dPriv = intel->driDrawable;
549 __DRIscreenPrivate *sPriv = intel->driScreen;
550 volatile drmI830Sarea * sarea = intel->sarea;
551 int me = intel->hHWContext;
552 int my_bufmgr = bmCtxId(intel);
553
554 drmGetLock(intel->driFd, intel->hHWContext, flags);
555
556 /* If the window moved, may need to set a new cliprect now.
557 *
558 * NOTE: This releases and regains the hw lock, so all state
559 * checking must be done *after* this call:
560 */
561 if (dPriv)
562 DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
563
564
565 intel->locked = 1;
566 intel->need_flush = 1;
567
568 /* Lost context?
569 */
570 if (sarea->ctxOwner != me) {
571 DBG("Lost Context: sarea->ctxOwner %x me %x\n", sarea->ctxOwner, me);
572 sarea->ctxOwner = me;
573 intel->vtbl.lost_hardware( intel );
574 }
575
576 /* As above, but don't evict the texture data on transitions
577 * between contexts which all share a local buffer manager.
578 */
579 if (sarea->texAge != my_bufmgr) {
580 DBG("Lost Textures: sarea->texAge %x my_bufmgr %x\n", sarea->ctxOwner, my_bufmgr);
581 sarea->texAge = my_bufmgr;
582 bm_fake_NotifyContendedLockTake( intel );
583 }
584
585 /* Drawable changed?
586 */
587 if (dPriv && intel->lastStamp != dPriv->lastStamp) {
588 intelWindowMoved( intel );
589 intel->lastStamp = dPriv->lastStamp;
590
591 /* This works because the lock is always grabbed before emitting
592 * commands and commands are always flushed prior to releasing
593 * the lock.
594 */
595 intel->NewGLState |= _NEW_WINDOW_POS;
596 }
597 }
598
599 _glthread_DECLARE_STATIC_MUTEX(lockMutex);
600
601 /* Lock the hardware and validate our state.
602 */
603 void LOCK_HARDWARE( struct intel_context *intel )
604 {
605 char __ret=0;
606
607 _glthread_LOCK_MUTEX(lockMutex);
608 assert(!intel->locked);
609
610
611 DRM_CAS(intel->driHwLock, intel->hHWContext,
612 (DRM_LOCK_HELD|intel->hHWContext), __ret);
613 if (__ret)
614 intelContendedLock( intel, 0 );
615
616 intel->locked = 1;
617
618 if (intel->aub_wrap) {
619 bm_fake_NotifyContendedLockTake( intel );
620 intel->vtbl.lost_hardware( intel );
621 intel->vtbl.aub_wrap(intel);
622 intel->aub_wrap = 0;
623 }
624
625 if (bmError(intel)) {
626 bmEvictAll(intel);
627 intel->vtbl.lost_hardware( intel );
628 }
629
630 /* Make sure nothing has been emitted prior to getting the lock:
631 */
632 assert(intel->batch->map == 0);
633
634 /* XXX: postpone, may not be needed:
635 */
636 if (!intel_batchbuffer_map(intel->batch)) {
637 bmEvictAll(intel);
638 intel->vtbl.lost_hardware( intel );
639
640 /* This could only fail if the batchbuffer was greater in size
641 * than the available texture memory:
642 */
643 if (!intel_batchbuffer_map(intel->batch)) {
644 _mesa_printf("double failure to map batchbuffer\n");
645 assert(0);
646 }
647 }
648 }
649
650
651 /* Unlock the hardware using the global current context
652 */
653 void UNLOCK_HARDWARE( struct intel_context *intel )
654 {
655 /* Make sure everything has been released:
656 */
657 assert(intel->batch->ptr == intel->batch->map + intel->batch->offset);
658
659 intel_batchbuffer_unmap(intel->batch);
660 intel->vtbl.note_unlock( intel );
661 intel->locked = 0;
662
663
664
665 DRM_UNLOCK(intel->driFd, intel->driHwLock, intel->hHWContext);
666 _glthread_UNLOCK_MUTEX(lockMutex);
667 }
668