dri2.c revision 421235d42ad9921fd45332ec7b33bcee5c1ad33d
1/*
2 * Mesa 3-D graphics library
3 * Version:  7.9
4 *
5 * Copyright 2009, VMware, Inc.
6 * All Rights Reserved.
7 * Copyright (C) 2010 LunarG Inc.
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 * Authors:
27 *    Keith Whitwell <keithw@vmware.com>
28 *    Jakob Bornecrantz <wallbraker@gmail.com>
29 *    Chia-I Wu <olv@lunarg.com>
30 */
31
32#include "util/u_memory.h"
33#include "util/u_inlines.h"
34#include "util/u_format.h"
35#include "util/u_debug.h"
36#include "state_tracker/drm_driver.h"
37
38#include "dri_screen.h"
39#include "dri_context.h"
40#include "dri_drawable.h"
41#include "dri2_buffer.h"
42
43/**
44 * DRI2 flush extension.
45 */
46static void
47dri2_flush_drawable(__DRIdrawable *dPriv)
48{
49   struct dri_context *ctx = dri_get_current(dPriv->driScreenPriv);
50   struct dri_drawable *drawable = dri_drawable(dPriv);
51
52   struct pipe_resource *ptex = drawable->textures[ST_ATTACHMENT_BACK_LEFT];
53
54   if (ctx) {
55      if (ptex && ctx->pp && drawable->textures[ST_ATTACHMENT_DEPTH_STENCIL])
56         pp_run(ctx->pp, ptex, ptex, drawable->textures[ST_ATTACHMENT_DEPTH_STENCIL]);
57
58      ctx->st->flush(ctx->st, 0, NULL);
59   }
60}
61
62static void
63dri2_invalidate_drawable(__DRIdrawable *dPriv)
64{
65   struct dri_drawable *drawable = dri_drawable(dPriv);
66
67   dri2InvalidateDrawable(dPriv);
68   drawable->dPriv->lastStamp = *drawable->dPriv->pStamp;
69
70   p_atomic_inc(&drawable->base.stamp);
71}
72
73static const __DRI2flushExtension dri2FlushExtension = {
74    { __DRI2_FLUSH, __DRI2_FLUSH_VERSION },
75    dri2_flush_drawable,
76    dri2_invalidate_drawable,
77};
78
79/**
80 * Retrieve __DRIbuffer from the DRI loader.
81 */
82static __DRIbuffer *
83dri2_drawable_get_buffers(struct dri_drawable *drawable,
84                          const enum st_attachment_type *statts,
85                          unsigned *count)
86{
87   __DRIdrawable *dri_drawable = drawable->dPriv;
88   struct __DRIdri2LoaderExtensionRec *loader = drawable->sPriv->dri2.loader;
89   boolean with_format;
90   __DRIbuffer *buffers;
91   int num_buffers;
92   unsigned attachments[10];
93   unsigned num_attachments, i;
94
95   assert(loader);
96   with_format = dri_with_format(drawable->sPriv);
97
98   num_attachments = 0;
99
100   /* for Xserver 1.6.0 (DRI2 version 1) we always need to ask for the front */
101   if (!with_format)
102      attachments[num_attachments++] = __DRI_BUFFER_FRONT_LEFT;
103
104   for (i = 0; i < *count; i++) {
105      enum pipe_format format;
106      unsigned bind;
107      int att, bpp;
108
109      dri_drawable_get_format(drawable, statts[i], &format, &bind);
110      if (format == PIPE_FORMAT_NONE)
111         continue;
112
113      switch (statts[i]) {
114      case ST_ATTACHMENT_FRONT_LEFT:
115         /* already added */
116         if (!with_format)
117            continue;
118         att = __DRI_BUFFER_FRONT_LEFT;
119         break;
120      case ST_ATTACHMENT_BACK_LEFT:
121         att = __DRI_BUFFER_BACK_LEFT;
122         break;
123      case ST_ATTACHMENT_FRONT_RIGHT:
124         att = __DRI_BUFFER_FRONT_RIGHT;
125         break;
126      case ST_ATTACHMENT_BACK_RIGHT:
127         att = __DRI_BUFFER_BACK_RIGHT;
128         break;
129      case ST_ATTACHMENT_DEPTH_STENCIL:
130         att = __DRI_BUFFER_DEPTH_STENCIL;
131         break;
132      default:
133         att = -1;
134         break;
135      }
136
137      bpp = util_format_get_blocksizebits(format);
138
139      if (att >= 0) {
140         attachments[num_attachments++] = att;
141         if (with_format) {
142            attachments[num_attachments++] = bpp;
143         }
144      }
145   }
146
147   if (with_format) {
148      num_attachments /= 2;
149      buffers = loader->getBuffersWithFormat(dri_drawable,
150            &dri_drawable->w, &dri_drawable->h,
151            attachments, num_attachments,
152            &num_buffers, dri_drawable->loaderPrivate);
153   }
154   else {
155      buffers = loader->getBuffers(dri_drawable,
156            &dri_drawable->w, &dri_drawable->h,
157            attachments, num_attachments,
158            &num_buffers, dri_drawable->loaderPrivate);
159   }
160
161   if (buffers) {
162      /* set one cliprect to cover the whole dri_drawable */
163      dri_drawable->x = 0;
164      dri_drawable->y = 0;
165      dri_drawable->backX = 0;
166      dri_drawable->backY = 0;
167      dri_drawable->numClipRects = 1;
168      dri_drawable->pClipRects[0].x1 = 0;
169      dri_drawable->pClipRects[0].y1 = 0;
170      dri_drawable->pClipRects[0].x2 = dri_drawable->w;
171      dri_drawable->pClipRects[0].y2 = dri_drawable->h;
172      dri_drawable->numBackClipRects = 1;
173      dri_drawable->pBackClipRects[0].x1 = 0;
174      dri_drawable->pBackClipRects[0].y1 = 0;
175      dri_drawable->pBackClipRects[0].x2 = dri_drawable->w;
176      dri_drawable->pBackClipRects[0].y2 = dri_drawable->h;
177
178      *count = num_buffers;
179   }
180
181   return buffers;
182}
183
184/**
185 * Process __DRIbuffer and convert them into pipe_resources.
186 */
187static void
188dri2_drawable_process_buffers(struct dri_drawable *drawable,
189                              __DRIbuffer *buffers, unsigned count)
190{
191   struct dri_screen *screen = dri_screen(drawable->sPriv);
192   __DRIdrawable *dri_drawable = drawable->dPriv;
193   struct pipe_resource templ;
194   struct winsys_handle whandle;
195   boolean have_depth = FALSE;
196   unsigned i, bind;
197
198   if (drawable->old_num == count &&
199       drawable->old_w == dri_drawable->w &&
200       drawable->old_h == dri_drawable->h &&
201       memcmp(drawable->old, buffers, sizeof(__DRIbuffer) * count) == 0)
202      return;
203
204   for (i = 0; i < ST_ATTACHMENT_COUNT; i++)
205      pipe_resource_reference(&drawable->textures[i], NULL);
206
207   memset(&templ, 0, sizeof(templ));
208   templ.target = screen->target;
209   templ.last_level = 0;
210   templ.width0 = dri_drawable->w;
211   templ.height0 = dri_drawable->h;
212   templ.depth0 = 1;
213   templ.array_size = 1;
214
215   memset(&whandle, 0, sizeof(whandle));
216
217   for (i = 0; i < count; i++) {
218      __DRIbuffer *buf = &buffers[i];
219      enum st_attachment_type statt;
220      enum pipe_format format;
221
222      switch (buf->attachment) {
223      case __DRI_BUFFER_FRONT_LEFT:
224         if (!screen->auto_fake_front) {
225            statt = ST_ATTACHMENT_INVALID;
226            break;
227         }
228         /* fallthrough */
229      case __DRI_BUFFER_FAKE_FRONT_LEFT:
230         statt = ST_ATTACHMENT_FRONT_LEFT;
231         break;
232      case __DRI_BUFFER_BACK_LEFT:
233         statt = ST_ATTACHMENT_BACK_LEFT;
234         break;
235      case __DRI_BUFFER_DEPTH:
236      case __DRI_BUFFER_DEPTH_STENCIL:
237      case __DRI_BUFFER_STENCIL:
238         /* use only the first depth/stencil buffer */
239         if (!have_depth) {
240            have_depth = TRUE;
241            statt = ST_ATTACHMENT_DEPTH_STENCIL;
242         }
243         else {
244            statt = ST_ATTACHMENT_INVALID;
245         }
246         break;
247      default:
248         statt = ST_ATTACHMENT_INVALID;
249         break;
250      }
251
252      dri_drawable_get_format(drawable, statt, &format, &bind);
253      if (statt == ST_ATTACHMENT_INVALID || format == PIPE_FORMAT_NONE)
254         continue;
255
256      templ.format = format;
257      templ.bind = bind;
258      whandle.handle = buf->name;
259      whandle.stride = buf->pitch;
260
261      drawable->textures[statt] =
262         screen->base.screen->resource_from_handle(screen->base.screen,
263               &templ, &whandle);
264   }
265
266   drawable->old_num = count;
267   drawable->old_w = dri_drawable->w;
268   drawable->old_h = dri_drawable->h;
269   memcpy(drawable->old, buffers, sizeof(__DRIbuffer) * count);
270}
271
272static __DRIbuffer *
273dri2_allocate_buffer(__DRIscreen *sPriv,
274                     unsigned attachment, unsigned format,
275                     int width, int height)
276{
277   struct dri_screen *screen = dri_screen(sPriv);
278   struct dri2_buffer *buffer;
279   struct pipe_resource templ;
280   enum pipe_format pf;
281   unsigned bind = 0;
282   struct winsys_handle whandle;
283
284   switch (attachment) {
285      case __DRI_BUFFER_FRONT_LEFT:
286      case __DRI_BUFFER_FAKE_FRONT_LEFT:
287         bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW;
288         break;
289      case __DRI_BUFFER_BACK_LEFT:
290         bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW;
291         break;
292      case __DRI_BUFFER_DEPTH:
293      case __DRI_BUFFER_DEPTH_STENCIL:
294      case __DRI_BUFFER_STENCIL:
295            bind = PIPE_BIND_DEPTH_STENCIL; /* XXX sampler? */
296         break;
297   }
298
299   switch (format) {
300      case 32:
301         pf = PIPE_FORMAT_B8G8R8X8_UNORM;
302         break;
303      case 16:
304         pf = PIPE_FORMAT_Z16_UNORM;
305         break;
306      default:
307         return NULL;
308   }
309
310   buffer = CALLOC_STRUCT(dri2_buffer);
311   if (!buffer)
312      return NULL;
313
314   memset(&templ, 0, sizeof(templ));
315   templ.bind = bind;
316   templ.format = pf;
317   templ.target = PIPE_TEXTURE_2D;
318   templ.last_level = 0;
319   templ.width0 = width;
320   templ.height0 = height;
321   templ.depth0 = 1;
322   templ.array_size = 1;
323
324   buffer->resource =
325      screen->base.screen->resource_create(screen->base.screen, &templ);
326   if (!buffer->resource)
327      return NULL;
328
329   memset(&whandle, 0, sizeof(whandle));
330   whandle.type = DRM_API_HANDLE_TYPE_SHARED;
331   screen->base.screen->resource_get_handle(screen->base.screen,
332         buffer->resource, &whandle);
333
334   buffer->base.attachment = attachment;
335   buffer->base.name = whandle.handle;
336   buffer->base.cpp = util_format_get_blocksize(pf);
337   buffer->base.pitch = whandle.stride;
338
339   return &buffer->base;
340}
341
342static void
343dri2_release_buffer(__DRIscreen *sPriv, __DRIbuffer *bPriv)
344{
345   struct dri2_buffer *buffer = dri2_buffer(bPriv);
346
347   pipe_resource_reference(&buffer->resource, NULL);
348   FREE(buffer);
349}
350
351/*
352 * Backend functions for st_framebuffer interface.
353 */
354
355static void
356dri2_allocate_textures(struct dri_drawable *drawable,
357                       const enum st_attachment_type *statts,
358                       unsigned count)
359{
360   __DRIbuffer *buffers;
361   unsigned num_buffers = count;
362
363   buffers = dri2_drawable_get_buffers(drawable, statts, &num_buffers);
364   if (buffers)
365      dri2_drawable_process_buffers(drawable, buffers, num_buffers);
366}
367
368static void
369dri2_flush_frontbuffer(struct dri_drawable *drawable,
370                       enum st_attachment_type statt)
371{
372   __DRIdrawable *dri_drawable = drawable->dPriv;
373   struct __DRIdri2LoaderExtensionRec *loader = drawable->sPriv->dri2.loader;
374
375   if (loader->flushFrontBuffer == NULL)
376      return;
377
378   if (statt == ST_ATTACHMENT_FRONT_LEFT) {
379      loader->flushFrontBuffer(dri_drawable, dri_drawable->loaderPrivate);
380   }
381}
382
383static __DRIimage *
384dri2_lookup_egl_image(struct dri_screen *screen, void *handle)
385{
386   __DRIimageLookupExtension *loader = screen->sPriv->dri2.image;
387   __DRIimage *img;
388
389   if (!loader->lookupEGLImage)
390      return NULL;
391
392   img = loader->lookupEGLImage(screen->sPriv,
393				handle, screen->sPriv->loaderPrivate);
394
395   return img;
396}
397
398static __DRIimage *
399dri2_create_image_from_name(__DRIscreen *_screen,
400                            int width, int height, int format,
401                            int name, int pitch, void *loaderPrivate)
402{
403   struct dri_screen *screen = dri_screen(_screen);
404   __DRIimage *img;
405   struct pipe_resource templ;
406   struct winsys_handle whandle;
407   unsigned tex_usage;
408   enum pipe_format pf;
409
410   tex_usage = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW;
411
412   switch (format) {
413   case __DRI_IMAGE_FORMAT_RGB565:
414      pf = PIPE_FORMAT_B5G6R5_UNORM;
415      break;
416   case __DRI_IMAGE_FORMAT_XRGB8888:
417      pf = PIPE_FORMAT_B8G8R8X8_UNORM;
418      break;
419   case __DRI_IMAGE_FORMAT_ARGB8888:
420      pf = PIPE_FORMAT_B8G8R8A8_UNORM;
421      break;
422   default:
423      pf = PIPE_FORMAT_NONE;
424      break;
425   }
426   if (pf == PIPE_FORMAT_NONE)
427      return NULL;
428
429   img = CALLOC_STRUCT(__DRIimageRec);
430   if (!img)
431      return NULL;
432
433   memset(&templ, 0, sizeof(templ));
434   templ.bind = tex_usage;
435   templ.format = pf;
436   templ.target = screen->target;
437   templ.last_level = 0;
438   templ.width0 = width;
439   templ.height0 = height;
440   templ.depth0 = 1;
441   templ.array_size = 1;
442
443   memset(&whandle, 0, sizeof(whandle));
444   whandle.handle = name;
445   whandle.stride = pitch * util_format_get_blocksize(pf);
446
447   img->texture = screen->base.screen->resource_from_handle(screen->base.screen,
448         &templ, &whandle);
449   if (!img->texture) {
450      FREE(img);
451      return NULL;
452   }
453
454   img->level = 0;
455   img->layer = 0;
456   img->loader_private = loaderPrivate;
457
458   return img;
459}
460
461static __DRIimage *
462dri2_create_image_from_renderbuffer(__DRIcontext *context,
463				    int renderbuffer, void *loaderPrivate)
464{
465   struct dri_context *ctx = dri_context(context);
466
467   if (!ctx->st->get_resource_for_egl_image)
468      return NULL;
469
470   /* TODO */
471   return NULL;
472}
473
474static __DRIimage *
475dri2_create_image(__DRIscreen *_screen,
476                   int width, int height, int format,
477                   unsigned int use, void *loaderPrivate)
478{
479   struct dri_screen *screen = dri_screen(_screen);
480   __DRIimage *img;
481   struct pipe_resource templ;
482   unsigned tex_usage;
483   enum pipe_format pf;
484
485   tex_usage = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW;
486   if (use & __DRI_IMAGE_USE_SCANOUT)
487      tex_usage |= PIPE_BIND_SCANOUT;
488   if (use & __DRI_IMAGE_USE_SHARE)
489      tex_usage |= PIPE_BIND_SHARED;
490   if (use & __DRI_IMAGE_USE_CURSOR) {
491      if (width != 64 || height != 64)
492         return NULL;
493      tex_usage |= PIPE_BIND_CURSOR;
494   }
495
496   switch (format) {
497   case __DRI_IMAGE_FORMAT_RGB565:
498      pf = PIPE_FORMAT_B5G6R5_UNORM;
499      break;
500   case __DRI_IMAGE_FORMAT_XRGB8888:
501      pf = PIPE_FORMAT_B8G8R8X8_UNORM;
502      break;
503   case __DRI_IMAGE_FORMAT_ARGB8888:
504      pf = PIPE_FORMAT_B8G8R8A8_UNORM;
505      break;
506   default:
507      pf = PIPE_FORMAT_NONE;
508      break;
509   }
510   if (pf == PIPE_FORMAT_NONE)
511      return NULL;
512
513   img = CALLOC_STRUCT(__DRIimageRec);
514   if (!img)
515      return NULL;
516
517   memset(&templ, 0, sizeof(templ));
518   templ.bind = tex_usage;
519   templ.format = pf;
520   templ.target = PIPE_TEXTURE_2D;
521   templ.last_level = 0;
522   templ.width0 = width;
523   templ.height0 = height;
524   templ.depth0 = 1;
525   templ.array_size = 1;
526
527   img->texture = screen->base.screen->resource_create(screen->base.screen, &templ);
528   if (!img->texture) {
529      FREE(img);
530      return NULL;
531   }
532
533   img->level = 0;
534   img->layer = 0;
535
536   img->loader_private = loaderPrivate;
537   return img;
538}
539
540static GLboolean
541dri2_query_image(__DRIimage *image, int attrib, int *value)
542{
543   struct winsys_handle whandle;
544   memset(&whandle, 0, sizeof(whandle));
545
546   switch (attrib) {
547   case __DRI_IMAGE_ATTRIB_STRIDE:
548      image->texture->screen->resource_get_handle(image->texture->screen,
549            image->texture, &whandle);
550      *value = whandle.stride;
551      return GL_TRUE;
552   case __DRI_IMAGE_ATTRIB_HANDLE:
553      whandle.type = DRM_API_HANDLE_TYPE_KMS;
554      image->texture->screen->resource_get_handle(image->texture->screen,
555         image->texture, &whandle);
556      *value = whandle.handle;
557      return GL_TRUE;
558   case __DRI_IMAGE_ATTRIB_NAME:
559      whandle.type = DRM_API_HANDLE_TYPE_SHARED;
560      image->texture->screen->resource_get_handle(image->texture->screen,
561         image->texture, &whandle);
562      *value = whandle.handle;
563      return GL_TRUE;
564   default:
565      return GL_FALSE;
566   }
567}
568
569static __DRIimage *
570dri2_dup_image(__DRIimage *image, void *loaderPrivate)
571{
572   __DRIimage *img;
573
574   img = CALLOC_STRUCT(__DRIimageRec);
575   if (!img)
576      return NULL;
577
578   img->texture = NULL;
579   pipe_resource_reference(&img->texture, image->texture);
580   img->level = image->level;
581   img->layer = image->layer;
582   img->loader_private = loaderPrivate;
583
584   return img;
585}
586
587static void
588dri2_destroy_image(__DRIimage *img)
589{
590   pipe_resource_reference(&img->texture, NULL);
591   FREE(img);
592}
593
594static struct __DRIimageExtensionRec dri2ImageExtension = {
595    { __DRI_IMAGE, __DRI_IMAGE_VERSION },
596    dri2_create_image_from_name,
597    dri2_create_image_from_renderbuffer,
598    dri2_destroy_image,
599    dri2_create_image,
600    dri2_query_image,
601    dri2_dup_image,
602};
603
604/*
605 * Backend function init_screen.
606 */
607
608static const __DRIextension *dri_screen_extensions[] = {
609   &driReadDrawableExtension,
610   &driCopySubBufferExtension.base,
611   &driSwapControlExtension.base,
612   &driMediaStreamCounterExtension.base,
613   &driTexBufferExtension.base,
614   &dri2FlushExtension.base,
615   &dri2ImageExtension.base,
616   &dri2ConfigQueryExtension.base,
617   NULL
618};
619
620/**
621 * This is the driver specific part of the createNewScreen entry point.
622 *
623 * Returns the struct gl_config supported by this driver.
624 */
625static const __DRIconfig **
626dri2_init_screen(__DRIscreen * sPriv)
627{
628   const __DRIconfig **configs;
629   struct dri_screen *screen;
630   struct pipe_screen *pscreen;
631
632   screen = CALLOC_STRUCT(dri_screen);
633   if (!screen)
634      return NULL;
635
636   screen->sPriv = sPriv;
637   screen->fd = sPriv->fd;
638
639   sPriv->private = (void *)screen;
640   sPriv->extensions = dri_screen_extensions;
641
642   pscreen = driver_descriptor.create_screen(screen->fd);
643   /* dri_init_screen_helper checks pscreen for us */
644
645   configs = dri_init_screen_helper(screen, pscreen, 32);
646   if (!configs)
647      goto fail;
648
649   sPriv->api_mask = 0;
650   if (screen->st_api->profile_mask & ST_PROFILE_DEFAULT_MASK)
651      sPriv->api_mask |= 1 << __DRI_API_OPENGL;
652   if (screen->st_api->profile_mask & ST_PROFILE_OPENGL_ES1_MASK)
653      sPriv->api_mask |= 1 << __DRI_API_GLES;
654   if (screen->st_api->profile_mask & ST_PROFILE_OPENGL_ES2_MASK)
655      sPriv->api_mask |= 1 << __DRI_API_GLES2;
656
657   screen->auto_fake_front = dri_with_format(sPriv);
658   screen->broken_invalidate = !sPriv->dri2.useInvalidate;
659   screen->lookup_egl_image = dri2_lookup_egl_image;
660
661   return configs;
662fail:
663   dri_destroy_screen_helper(screen);
664   FREE(screen);
665   return NULL;
666}
667
668static boolean
669dri2_create_buffer(__DRIscreen * sPriv,
670                   __DRIdrawable * dPriv,
671                   const struct gl_config * visual, boolean isPixmap)
672{
673   struct dri_drawable *drawable = NULL;
674
675   if (!dri_create_buffer(sPriv, dPriv, visual, isPixmap))
676      return FALSE;
677
678   drawable = dPriv->driverPrivate;
679
680   drawable->allocate_textures = dri2_allocate_textures;
681   drawable->flush_frontbuffer = dri2_flush_frontbuffer;
682
683   return TRUE;
684}
685
686/**
687 * DRI driver virtual function table.
688 *
689 * DRI versions differ in their implementation of init_screen and swap_buffers.
690 */
691const struct __DriverAPIRec driDriverAPI = {
692   .InitScreen = NULL,
693   .InitScreen2 = dri2_init_screen,
694   .DestroyScreen = dri_destroy_screen,
695   .CreateContext = dri_create_context,
696   .DestroyContext = dri_destroy_context,
697   .CreateBuffer = dri2_create_buffer,
698   .DestroyBuffer = dri_destroy_buffer,
699   .MakeCurrent = dri_make_current,
700   .UnbindContext = dri_unbind_context,
701
702   .GetSwapInfo = NULL,
703   .GetDrawableMSC = NULL,
704   .WaitForMSC = NULL,
705
706   .SwapBuffers = NULL,
707   .CopySubBuffer = NULL,
708
709   .AllocateBuffer = dri2_allocate_buffer,
710   .ReleaseBuffer  = dri2_release_buffer,
711};
712
713/* This is the table of extensions that the loader will dlsym() for. */
714PUBLIC const __DRIextension *__driDriverExtensions[] = {
715    &driCoreExtension.base,
716    &driLegacyExtension.base,
717    &driDRI2Extension.base,
718    NULL
719};
720
721/* vim: set sw=3 ts=8 sts=3 expandtab: */
722