drm/st: Return drm_api struct from a function
authorJakob Bornecrantz <jakob@vmware.com>
Tue, 30 Jun 2009 09:49:43 +0000 (11:49 +0200)
committerJakob Bornecrantz <jakob@vmware.com>
Tue, 30 Jun 2009 10:20:39 +0000 (12:20 +0200)
23 files changed:
src/gallium/drivers/i915simple/i915_texture.c
src/gallium/drivers/i915simple/i915_winsys.h
src/gallium/drivers/softpipe/sp_texture.c
src/gallium/drivers/softpipe/sp_winsys.h
src/gallium/include/state_tracker/drm_api.h
src/gallium/state_trackers/dri/dri_context.c
src/gallium/state_trackers/dri/dri_drawable.c
src/gallium/state_trackers/dri/dri_screen.c
src/gallium/state_trackers/dri/dri_screen.h
src/gallium/state_trackers/egl/egl_context.c
src/gallium/state_trackers/egl/egl_surface.c
src/gallium/state_trackers/egl/egl_tracker.c
src/gallium/state_trackers/egl/egl_tracker.h
src/gallium/state_trackers/xorg/xorg_crtc.c
src/gallium/state_trackers/xorg/xorg_dri2.c
src/gallium/state_trackers/xorg/xorg_driver.c
src/gallium/state_trackers/xorg/xorg_exa.c
src/gallium/state_trackers/xorg/xorg_tracker.h
src/gallium/winsys/drm/intel/gem/intel_be_api.c
src/gallium/winsys/drm/intel/gem/intel_be_api.h
src/gallium/winsys/drm/intel/gem/intel_be_context.c
src/gallium/winsys/drm/intel/gem/intel_be_device.c
src/gallium/winsys/drm/intel/gem/intel_be_device.h

index ca8e87af8d1b3f85dfbaa3130b80b22c1330028f..211ba09fda869d94c5fffff2dc43760f0eeb73ae 100644 (file)
@@ -738,7 +738,8 @@ i915_init_screen_texture_functions(struct pipe_screen *screen)
    screen->tex_surface_destroy = i915_tex_surface_destroy;
 }
 
-boolean i915_get_texture_buffer( struct pipe_texture *texture,
+boolean i915_get_texture_buffer( struct drm_api *api,
+                                 struct pipe_texture *texture,
                                  struct pipe_buffer **buf,
                                  unsigned *stride )
 {
index ff5b34f193ab33498cd0b95409cc678e9240cd88..58599daa80539364a7c58e9903fdf8d8ecfb0a9a 100644 (file)
@@ -61,6 +61,7 @@ struct pipe_buffer;
 struct pipe_fence_handle;
 struct pipe_winsys;
 struct pipe_screen;
+struct drm_api;
 
 
 /**
@@ -132,7 +133,8 @@ struct pipe_context *i915_create_context( struct pipe_screen *screen,
  *
  * This is needed for example kms.
  */
-boolean i915_get_texture_buffer( struct pipe_texture *texture,
+boolean i915_get_texture_buffer( struct drm_api *api,
+                                 struct pipe_texture *texture,
                                  struct pipe_buffer **buf,
                                  unsigned *stride );
 
index 7a533dad9f014fc6c0f03b92ab53d15c0065236b..41d8a0f93e287e636af8f6a7fd4436f64fde4451 100644 (file)
@@ -403,7 +403,8 @@ softpipe_init_screen_texture_funcs(struct pipe_screen *screen)
 
 
 boolean
-softpipe_get_texture_buffer( struct pipe_texture *texture,
+softpipe_get_texture_buffer( struct drm_api *api,
+                             struct pipe_texture *texture,
                              struct pipe_buffer **buf,
                              unsigned *stride )
 {
index 9e571862b7516f7a0fbd33119c8fb78532be9ff0..3edcbeb558fd9f4e766f0d5f879d300cc50c1d19 100644 (file)
@@ -39,7 +39,7 @@
 extern "C" {
 #endif
 
-
+struct drm_api;
 struct pipe_screen;
 struct pipe_winsys;
 struct pipe_context;
@@ -53,7 +53,8 @@ softpipe_create_screen(struct pipe_winsys *);
 
 
 boolean
-softpipe_get_texture_buffer( struct pipe_texture *texture,
+softpipe_get_texture_buffer( struct drm_api *api,
+                             struct pipe_texture *texture,
                              struct pipe_buffer **buf,
                              unsigned *stride );
 
index 5790b2f6c7e1c845d9925a4e5ec0328c57d3b1d1..7a38b508fbe3dcb9be5b0e7f06433a86988b07f7 100644 (file)
@@ -32,33 +32,37 @@ struct drm_api
         * Special buffer functions
         */
        /*@{*/
-       struct pipe_screen*  (*create_screen)(int drm_fd,
-                                             struct drm_create_screen_arg *arg);
-       struct pipe_context* (*create_context)(struct pipe_screen *screen);
+       struct pipe_screen*  (*create_screen)(struct drm_api *api, int drm_fd,
+                                             struct drm_create_screen_arg *arg);
+       struct pipe_context* (*create_context)(struct drm_api *api,
+                                              struct pipe_screen *screen);
        /*@}*/
 
        /**
         * Special buffer functions
         */
        /*@{*/
-       boolean (*buffer_from_texture)(struct pipe_texture *texture,
-                                       struct pipe_buffer **buffer,
-                                       unsigned *stride);
-       struct pipe_buffer* (*buffer_from_handle)(struct pipe_screen *screen,
+       boolean (*buffer_from_texture)(struct drm_api *api,
+                                      struct pipe_texture *texture,
+                                      struct pipe_buffer **buffer,
+                                      unsigned *stride);
+       struct pipe_buffer* (*buffer_from_handle)(struct drm_api *api,
+                                                 struct pipe_screen *screen,
                                                   const char *name,
                                                   unsigned handle);
-       boolean (*handle_from_buffer)(struct pipe_screen *screen,
-                                      struct pipe_buffer *buffer,
-                                      unsigned *handle);
-       boolean (*global_handle_from_buffer)(struct pipe_screen *screen,
-                                             struct pipe_buffer *buffer,
-                                             unsigned *handle);
+       boolean (*handle_from_buffer)(struct drm_api *api,
+                                     struct pipe_screen *screen,
+                                     struct pipe_buffer *buffer,
+                                     unsigned *handle);
+       boolean (*global_handle_from_buffer)(struct drm_api *api,
+                                            struct pipe_screen *screen,
+                                            struct pipe_buffer *buffer,
+                                            unsigned *handle);
        /*@}*/
+
+       void (*destroy)(struct drm_api *api);
 };
 
-/**
- * A driver needs to export this symbol
- */
-extern struct drm_api drm_api_hooks;
+extern struct drm_api * drm_api_create(void);
 
 #endif
index 45eaec4ed390204d2058c9e622ec4d64ec3814ee..6c617197eca17534d42758072f520eb89d70b56c 100644 (file)
@@ -69,7 +69,7 @@ dri_create_context(const __GLcontextModes * visual,
    driParseConfigFiles(&ctx->optionCache,
                       &screen->optionCache, sPriv->myNum, "dri");
 
-   ctx->pipe = drm_api_hooks.create_context(screen->pipe_screen);
+   ctx->pipe = screen->api->create_context(screen->api, screen->pipe_screen);
 
    if (ctx->pipe == NULL)
       goto fail;
index 815055b15b9bb8e00fc3ca5b00a55136e36d2d8d..1d91fbb89fbb05daac3baed5db043816cf64ee2e 100644 (file)
@@ -53,7 +53,8 @@ dri_copy_to_front(__DRIdrawablePrivate * dPriv,
 }
 
 static struct pipe_surface *
-dri_surface_from_handle(struct pipe_screen *screen,
+dri_surface_from_handle(struct drm_api *api,
+                       struct pipe_screen *screen,
                        unsigned handle,
                        enum pipe_format format,
                        unsigned width, unsigned height, unsigned pitch)
@@ -63,7 +64,7 @@ dri_surface_from_handle(struct pipe_screen *screen,
    struct pipe_texture templat;
    struct pipe_buffer *buf = NULL;
 
-   buf = drm_api_hooks.buffer_from_handle(screen, "dri2 buffer", handle);
+   buf = api->buffer_from_handle(api, screen, "dri2 buffer", handle);
    if (!buf)
       return NULL;
 
@@ -100,12 +101,14 @@ dri_surface_from_handle(struct pipe_screen *screen,
 void
 dri_get_buffers(__DRIdrawablePrivate * dPriv)
 {
+
    struct dri_drawable *drawable = dri_drawable(dPriv);
    struct pipe_surface *surface = NULL;
    struct pipe_screen *screen = dri_screen(drawable->sPriv)->pipe_screen;
    __DRIbuffer *buffers = NULL;
    __DRIscreen *dri_screen = drawable->sPriv;
    __DRIdrawable *dri_drawable = drawable->dPriv;
+   struct drm_api *api = ((struct dri_screen*)(dri_screen->private))->api;
    boolean have_depth = FALSE;
    int i, count;
 
@@ -187,7 +190,8 @@ dri_get_buffers(__DRIdrawablePrivate * dPriv)
            have_depth = TRUE;
       }
 
-      surface = dri_surface_from_handle(screen,
+      surface = dri_surface_from_handle(api,
+                                       screen,
                                        buffers[i].name,
                                        format,
                                        dri_drawable->w,
index 98bf68ccba7f120fc1c32ac5ccbb77c2f3bfaed3..5f78b7264af49b89c34492ce7c556afe19a8e139 100644 (file)
@@ -199,6 +199,7 @@ dri_init_screen(__DRIscreenPrivate * sPriv)
    if (!screen)
       return NULL;
 
+   screen->api = drm_api_create();
    screen->sPriv = sPriv;
    screen->fd = sPriv->fd;
    screen->drmLock = (drmLock *) & sPriv->pSAREA->lock;
@@ -216,7 +217,7 @@ dri_init_screen(__DRIscreenPrivate * sPriv)
    dri_copy_version(&arg.drm_version, &sPriv->drm_version);
    arg.api = NULL;
 
-   screen->pipe_screen = drm_api_hooks.create_screen(screen->fd, &arg.base);
+   screen->pipe_screen = screen->api->create_screen(screen->api, screen->fd, &arg.base);
 
    if (!screen->pipe_screen || !arg.api) {
       debug_printf("%s: failed to create dri1 screen\n", __FUNCTION__);
@@ -265,13 +266,14 @@ dri_init_screen2(__DRIscreenPrivate * sPriv)
    if (!screen)
       goto fail;
 
+   screen->api = drm_api_create();
    screen->sPriv = sPriv;
    screen->fd = sPriv->fd;
    sPriv->private = (void *)screen;
    sPriv->extensions = dri_screen_extensions;
    arg.mode = DRM_CREATE_NORMAL;
 
-   screen->pipe_screen = drm_api_hooks.create_screen(screen->fd, &arg);
+   screen->pipe_screen = screen->api->create_screen(screen->api, screen->fd, &arg);
    if (!screen->pipe_screen) {
       debug_printf("%s: failed to create pipe_screen\n", __FUNCTION__);
       goto fail;
index 090f9fee7c57b9a9c0809e355d69455313a2a0de..f3335bb09f9c964d364aa9081bb2917c3f39b7be 100644 (file)
@@ -60,6 +60,7 @@ struct dri_screen
    drmLock *drmLock;
 
    /* gallium */
+   struct drm_api *api;
    struct pipe_winsys *pipe_winsys;
    struct pipe_screen *pipe_screen;
    boolean d_depth_bits_last;
index 36548fae26327e002e62a37f85a01e6bb39468c2..edd49486e5bccc83bf440d73f5e508b858d0ea27 100644 (file)
@@ -115,7 +115,7 @@ drm_create_context(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext
 
        _eglInitContext(drv, dpy, &ctx->base, config, attrib_list);
 
-       ctx->pipe = drm_api_hooks.create_context(dev->screen);
+       ctx->pipe = dev->api->create_context(dev->api, dev->screen);
        if (!ctx->pipe)
                goto err_pipe;
 
index 489aa8d9af5eb10774684dcb5df6bda848ebe126..de8194a46aff40cb2615eb0c50128a08d6ca24f0 100644 (file)
@@ -132,7 +132,7 @@ drm_create_texture(_EGLDriver *drv,
        scrn->front.width = w;
        scrn->front.height = h;
        scrn->front.pitch = pitch;
-       drm_api_hooks.handle_from_buffer(screen, scrn->buffer, &scrn->front.handle);
+       dev->api->handle_from_buffer(dev->api, screen, scrn->buffer, &scrn->front.handle);
        if (0)
                goto err_handle;
 
index 8e620084617af56b671d8ad2550bf7e1ba6bff61..521c91d8958484d2bbcefcfbf38d620d421d7bd4 100644 (file)
@@ -35,6 +35,8 @@ _eglMain(_EGLDisplay *dpy, const char *args)
                return NULL;
        }
 
+       drm->api = drm_api_create();
+
        /* First fill in the dispatch table with defaults */
        _eglInitDriverFallbacks(&drm->base);
        /* then plug in our Drm-specific functions */
@@ -146,7 +148,7 @@ drm_initialize(_EGLDriver *drv, EGLDisplay dpy, EGLint *major, EGLint *minor)
        dev->drmFD = fd;
        drm_get_device_id(dev);
 
-       dev->screen = drm_api_hooks.create_screen(dev->drmFD, NULL);
+       dev->screen = dev->api->create_screen(dev->api, dev->drmFD, NULL);
        if (!dev->screen)
                goto err_screen;
        dev->winsys = dev->screen->winsys;
@@ -234,6 +236,7 @@ drm_terminate(_EGLDriver *drv, EGLDisplay dpy)
 
        dev->screen->destroy(dev->screen);
        dev->winsys = NULL;
+       dev->api->destroy(dev->api);
 
        drmClose(dev->drmFD);
 
index ce2717de639b396813df82a125fad16a6537c676..3b8836720d62834bd92d9eee9a5312e9451205c9 100644 (file)
@@ -38,6 +38,7 @@ struct drm_device
         * pipe
         */
 
+       struct drm_api *api;
        struct pipe_winsys *winsys;
        struct pipe_screen *screen;
 
index 7304113a659b7110af41a3b59b6b464ada862d07..2235961b031e2f6a468e2f7c30f6d6dafc62c492 100644 (file)
@@ -171,7 +171,6 @@ crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data)
 static void
 crtc_destroy(xf86CrtcPtr crtc)
 {
-    modesettingPtr ms = modesettingPTR(crtc->scrn);
     struct crtc_private *crtcp = crtc->driver_private;
 
     if (crtcp->cursor_buf)
@@ -194,9 +193,10 @@ crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 * image)
                                               PIPE_BUFFER_USAGE_CPU_WRITE |
                                               PIPE_BUFFER_USAGE_GPU_READ,
                                               64*64*4);
-       drm_api_hooks.handle_from_buffer(ms->screen,
-                                        crtcp->cursor_buf,
-                                        &crtcp->cursor_handle);
+       ms->api->handle_from_buffer(ms->api,
+                                   ms->screen,
+                                   crtcp->cursor_buf,
+                                   &crtcp->cursor_handle);
     }
 
     ptr = pipe_buffer_map(ms->screen, crtcp->cursor_buf, PIPE_BUFFER_USAGE_CPU_WRITE);
index 401bd39dac00e50bacb61519be76f2e6c2466a9d..ae3338ffeff599780ad1809fdda6a4810f995a1f 100644 (file)
@@ -108,8 +108,8 @@ driCreateBuffers(DrawablePtr pDraw, unsigned int *attachments, int count)
            tex = ms->screen->texture_create(ms->screen, &template);
        }
 
-       drm_api_hooks.buffer_from_texture(tex, &buf, &stride);
-       drm_api_hooks.global_handle_from_buffer(ms->screen, buf, &handle);
+       ms->api->buffer_from_texture(ms->api, tex, &buf, &stride);
+       ms->api->global_handle_from_buffer(ms->api, ms->screen, buf, &handle);
 
        buffers[i].name = handle;
        buffers[i].attachment = attachments[i];
index 45e831f0c289ce8fb52780f068b6899433bf49be..e01e5294b11a060deb62964354b4bea217f3f45b 100644 (file)
@@ -300,6 +300,7 @@ PreInit(ScrnInfoPtr pScrn, int flags)
            ms->PciInfo->dev, ms->PciInfo->func
        );
 
+    ms->api = drm_api_create();
     ms->fd = drmOpen(NULL, BusID);
 
     if (ms->fd < 0)
@@ -476,7 +477,7 @@ ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
     }
 
     if (!ms->screen) {
-       ms->screen = drm_api_hooks.create_screen(ms->fd, NULL);
+       ms->screen = ms->api->create_screen(ms->api, ms->fd, NULL);
 
        if (!ms->screen) {
            FatalError("Could not init pipe_screen\n");
@@ -678,6 +679,8 @@ CloseScreen(int scrnIndex, ScreenPtr pScreen)
     if (ms->exa)
        xorg_exa_close(pScrn);
 
+       ms->api->destroy(ms->api);
+       ms->api = NULL;
     drmClose(ms->fd);
     ms->fd = -1;
 
index 791317435427c441b9f936328beb9697fdcf7202..0fbfed1e2a280526c0018bc83e45c44223b26599 100644 (file)
@@ -380,8 +380,8 @@ xorg_exa_get_pixmap_handle(PixmapPtr pPixmap)
        return 0;
     }
 
-    drm_api_hooks.buffer_from_texture(priv->tex, &buffer, &stride);
-    drm_api_hooks.handle_from_buffer(ms->screen, buffer, &handle);
+    ms->api->buffer_from_texture(ms->api, priv->tex, &buffer, &stride);
+    ms->api->handle_from_buffer(ms->api, ms->screen, buffer, &handle);
     pipe_buffer_reference(&buffer, NULL);
     return handle;
 }
@@ -527,7 +527,7 @@ xorg_exa_init(ScrnInfoPtr pScrn)
     }
 
     exa->scrn = ms->screen;
-    exa->ctx = drm_api_hooks.create_context(exa->scrn);
+    exa->ctx = ms->api->create_context(ms->api, exa->scrn);
     /* Share context with DRI */
     ms->ctx = exa->ctx;
 
index 82c3890dfbdc15608c8e3e529ac3e31cb96ddd2f..95924b7d88f76eef25c701a3557e7a81294277f7 100644 (file)
@@ -75,6 +75,7 @@ typedef struct _modesettingRec
     CreateScreenResourcesProcPtr createScreenResources;
 
     /* gallium */
+    struct drm_api *api;
     struct pipe_screen *screen;
     struct pipe_context *ctx;
 
index a74be13bf7abe0c132da9f2e6728e0f8ac9b87e4..4a1768a599a9de5dd246873002564cf7a8c44548 100644 (file)
@@ -2,13 +2,12 @@
 #include "intel_be_api.h"
 #include "i915simple/i915_winsys.h"
 
-#ifdef DEBUG
-#include "trace/trace_drm.h"
+static void destroy(struct drm_api *api)
+{
+
+}
 
-struct drm_api hooks =
-#else
-struct drm_api drm_api_hooks =
-#endif
+struct drm_api intel_be_drm_api =
 {
        /* intel_be_context.c */
        .create_context = intel_be_create_context,
@@ -18,4 +17,11 @@ struct drm_api drm_api_hooks =
        .buffer_from_handle = intel_be_buffer_from_handle,
        .handle_from_buffer = intel_be_handle_from_buffer,
        .global_handle_from_buffer = intel_be_global_handle_from_buffer,
+       .destroy = destroy,
 };
+
+struct drm_api *
+drm_api_create()
+{
+       return &intel_be_drm_api;
+}
index 1c622f3b97867d17d4d31c82e71dbaeb2da4043e..f286b62eb8c46fcd82bb8eea6a4e92fb36248175 100644 (file)
@@ -8,8 +8,11 @@
 
 #include "intel_be_device.h"
 
-struct pipe_screen *intel_be_create_screen(int drmFD,
+extern struct drm_api intel_be_drm_api;
+
+struct pipe_screen *intel_be_create_screen(struct drm_api *api, int drmFD,
                                           struct drm_create_screen_arg *arg);
-struct pipe_context *intel_be_create_context(struct pipe_screen *screen);
+struct pipe_context *intel_be_create_context(struct drm_api *api,
+                                            struct pipe_screen *screen);
 
 #endif
index fe0b138fbea84e38376052643321a77dc4fd2ed0..db84f9af514badec275a7167f4e59ae3012f6ad2 100644 (file)
@@ -97,7 +97,7 @@ intel_be_init_context(struct intel_be_context *intel, struct intel_be_device *de
 }
 
 struct pipe_context *
-intel_be_create_context(struct pipe_screen *screen)
+intel_be_create_context(struct drm_api *api, struct pipe_screen *screen)
 {
        struct intel_be_context *intel;
        struct pipe_context *pipe;
index 907ac86637f2138713dec5ead110608305089e10..2d531279f77f60f98dd5423bd8a0c8861a50d199 100644 (file)
@@ -143,7 +143,8 @@ err:
 }
 
 struct pipe_buffer *
-intel_be_buffer_from_handle(struct pipe_screen *screen,
+intel_be_buffer_from_handle(struct drm_api *api,
+                            struct pipe_screen *screen,
                             const char* name, unsigned handle)
 {
        struct intel_be_device *dev = intel_be_device(screen->winsys);
@@ -174,7 +175,8 @@ err:
 }
 
 boolean
-intel_be_handle_from_buffer(struct pipe_screen *screen,
+intel_be_handle_from_buffer(struct drm_api *api,
+                            struct pipe_screen *screen,
                             struct pipe_buffer *buffer,
                             unsigned *handle)
 {
@@ -186,7 +188,8 @@ intel_be_handle_from_buffer(struct pipe_screen *screen,
 }
 
 boolean
-intel_be_global_handle_from_buffer(struct pipe_screen *screen,
+intel_be_global_handle_from_buffer(struct drm_api *api,
+                                   struct pipe_screen *screen,
                                   struct pipe_buffer *buffer,
                                   unsigned *handle)
 {
@@ -296,6 +299,7 @@ intel_be_get_device_id(unsigned int *device_id)
 {
    char path[512];
    FILE *file;
+   void *shutup_gcc;
 
    /*
     * FIXME: Fix this up to use a drm ioctl or whatever.
@@ -307,13 +311,14 @@ intel_be_get_device_id(unsigned int *device_id)
       return;
    }
 
-   fgets(path, sizeof(path), file);
+   shutup_gcc = fgets(path, sizeof(path), file);
    sscanf(path, "%x", device_id);
    fclose(file);
 }
 
 struct pipe_screen *
-intel_be_create_screen(int drmFD, struct drm_create_screen_arg *arg)
+intel_be_create_screen(struct drm_api *api, int drmFD,
+                      struct drm_create_screen_arg *arg)
 {
        struct intel_be_device *dev;
        struct pipe_screen *screen;
@@ -339,7 +344,7 @@ intel_be_create_screen(int drmFD, struct drm_create_screen_arg *arg)
 
        if (dev->softpipe) {
                screen = softpipe_create_screen(&dev->base);
-               drm_api_hooks.buffer_from_texture = softpipe_get_texture_buffer;
+               intel_be_drm_api.buffer_from_texture = softpipe_get_texture_buffer;
        } else
                screen = i915_create_screen(&dev->base, deviceID);
 
index b32637ece298e7a2462e6f38ba2a047969323ba4..777161daca09591588b2a9390de57bc8fbc8721b 100644 (file)
@@ -8,6 +8,8 @@
 #include "drm.h"
 #include "intel_bufmgr.h"
 
+struct drm_api;
+
 /*
  * Device
  */
@@ -56,7 +58,8 @@ struct intel_be_buffer {
  * Takes a reference.
  */
 struct pipe_buffer *
-intel_be_buffer_from_handle(struct pipe_screen *screen,
+intel_be_buffer_from_handle(struct drm_api *api,
+                            struct pipe_screen *screen,
                             const char* name, unsigned handle);
 
 /**
@@ -65,7 +68,8 @@ intel_be_buffer_from_handle(struct pipe_screen *screen,
  * If buffer is destroyed handle may become invalid.
  */
 boolean
-intel_be_handle_from_buffer(struct pipe_screen *screen,
+intel_be_handle_from_buffer(struct drm_api *api,
+                            struct pipe_screen *screen,
                             struct pipe_buffer *buffer,
                             unsigned *handle);
 
@@ -75,7 +79,8 @@ intel_be_handle_from_buffer(struct pipe_screen *screen,
  * If buffer is destroyed handle may become invalid.
  */
 boolean
-intel_be_global_handle_from_buffer(struct pipe_screen *screen,
+intel_be_global_handle_from_buffer(struct drm_api *api,
+                                   struct pipe_screen *screen,
                                    struct pipe_buffer *buffer,
                                    unsigned *handle);