diff options
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r-- | src/gallium/state_trackers/dri/dri_context.c | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/dri_drawable.c | 10 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/dri_screen.c | 6 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/dri_screen.h | 1 | ||||
-rw-r--r-- | src/gallium/state_trackers/egl/egl_context.c | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/egl/egl_surface.c | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/egl/egl_tracker.c | 5 | ||||
-rw-r--r-- | src/gallium/state_trackers/egl/egl_tracker.h | 1 | ||||
-rw-r--r-- | src/gallium/state_trackers/xorg/xorg_crtc.c | 8 | ||||
-rw-r--r-- | src/gallium/state_trackers/xorg/xorg_dri2.c | 4 | ||||
-rw-r--r-- | src/gallium/state_trackers/xorg/xorg_driver.c | 5 | ||||
-rw-r--r-- | src/gallium/state_trackers/xorg/xorg_exa.c | 6 | ||||
-rw-r--r-- | src/gallium/state_trackers/xorg/xorg_tracker.h | 1 |
13 files changed, 34 insertions, 19 deletions
diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/dri_context.c index 45eaec4ed3..6c617197ec 100644 --- a/src/gallium/state_trackers/dri/dri_context.c +++ b/src/gallium/state_trackers/dri/dri_context.c @@ -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; diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c index 815055b15b..1d91fbb89f 100644 --- a/src/gallium/state_trackers/dri/dri_drawable.c +++ b/src/gallium/state_trackers/dri/dri_drawable.c @@ -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, diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c index 98bf68ccba..5f78b7264a 100644 --- a/src/gallium/state_trackers/dri/dri_screen.c +++ b/src/gallium/state_trackers/dri/dri_screen.c @@ -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; diff --git a/src/gallium/state_trackers/dri/dri_screen.h b/src/gallium/state_trackers/dri/dri_screen.h index 090f9fee7c..f3335bb09f 100644 --- a/src/gallium/state_trackers/dri/dri_screen.h +++ b/src/gallium/state_trackers/dri/dri_screen.h @@ -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; diff --git a/src/gallium/state_trackers/egl/egl_context.c b/src/gallium/state_trackers/egl/egl_context.c index 36548fae26..edd49486e5 100644 --- a/src/gallium/state_trackers/egl/egl_context.c +++ b/src/gallium/state_trackers/egl/egl_context.c @@ -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; diff --git a/src/gallium/state_trackers/egl/egl_surface.c b/src/gallium/state_trackers/egl/egl_surface.c index 489aa8d9af..de8194a46a 100644 --- a/src/gallium/state_trackers/egl/egl_surface.c +++ b/src/gallium/state_trackers/egl/egl_surface.c @@ -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; diff --git a/src/gallium/state_trackers/egl/egl_tracker.c b/src/gallium/state_trackers/egl/egl_tracker.c index 8e62008461..521c91d895 100644 --- a/src/gallium/state_trackers/egl/egl_tracker.c +++ b/src/gallium/state_trackers/egl/egl_tracker.c @@ -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); diff --git a/src/gallium/state_trackers/egl/egl_tracker.h b/src/gallium/state_trackers/egl/egl_tracker.h index ce2717de63..3b8836720d 100644 --- a/src/gallium/state_trackers/egl/egl_tracker.h +++ b/src/gallium/state_trackers/egl/egl_tracker.h @@ -38,6 +38,7 @@ struct drm_device * pipe */ + struct drm_api *api; struct pipe_winsys *winsys; struct pipe_screen *screen; diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c index 7304113a65..2235961b03 100644 --- a/src/gallium/state_trackers/xorg/xorg_crtc.c +++ b/src/gallium/state_trackers/xorg/xorg_crtc.c @@ -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); diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c index 401bd39dac..ae3338ffef 100644 --- a/src/gallium/state_trackers/xorg/xorg_dri2.c +++ b/src/gallium/state_trackers/xorg/xorg_dri2.c @@ -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]; diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index 45e831f0c2..e01e5294b1 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -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; diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 7913174354..0fbfed1e2a 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -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; diff --git a/src/gallium/state_trackers/xorg/xorg_tracker.h b/src/gallium/state_trackers/xorg/xorg_tracker.h index 82c3890dfb..95924b7d88 100644 --- a/src/gallium/state_trackers/xorg/xorg_tracker.h +++ b/src/gallium/state_trackers/xorg/xorg_tracker.h @@ -75,6 +75,7 @@ typedef struct _modesettingRec CreateScreenResourcesProcPtr createScreenResources; /* gallium */ + struct drm_api *api; struct pipe_screen *screen; struct pipe_context *ctx; |