diff --git a/configure.ac b/configure.ac index 430e6f3..f98d5c2 100644 --- a/configure.ac +++ b/configure.ac @@ -31,7 +31,7 @@ LIBDRM_REQUIRED=2.4.24 LIBDRM_RADEON_REQUIRED=2.4.50 LIBDRM_INTEL_REQUIRED=2.4.52 LIBDRM_NVVIEUX_REQUIRED=2.4.33 -LIBDRM_NOUVEAU_REQUIRED="2.4.33 libdrm >= 2.4.41" +LIBDRM_NOUVEAU_REQUIRED="2.4.54" LIBDRM_FREEDRENO_REQUIRED=2.4.51 DRI2PROTO_REQUIRED=2.6 DRI3PROTO_REQUIRED=1.0 diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c index f742a94..9fd6cf7 100644 --- a/src/gallium/drivers/nouveau/nouveau_screen.c +++ b/src/gallium/drivers/nouveau/nouveau_screen.c @@ -221,5 +221,5 @@ nouveau_screen_fini(struct nouveau_screen *screen) nouveau_client_del(&screen->client); nouveau_object_del(&screen->channel); - nouveau_device_del(&screen->device); + nouveau_drm_screen_device_unref(screen->device); } diff --git a/src/gallium/drivers/nouveau/nouveau_screen.h b/src/gallium/drivers/nouveau/nouveau_screen.h index cf06f7e..9412861 100644 --- a/src/gallium/drivers/nouveau/nouveau_screen.h +++ b/src/gallium/drivers/nouveau/nouveau_screen.h @@ -114,7 +114,7 @@ nouveau_screen(struct pipe_screen *pscreen) return (struct nouveau_screen *)pscreen; } -boolean nouveau_drm_screen_unref(struct nouveau_screen *screen); +void nouveau_drm_screen_device_unref(struct nouveau_device *dev); boolean nouveau_screen_bo_get_handle(struct pipe_screen *pscreen, diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c index 70e50df..8ec6c3b 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c @@ -302,9 +302,6 @@ nv30_screen_destroy(struct pipe_screen *pscreen) { struct nv30_screen *screen = nv30_screen(pscreen); - if (!nouveau_drm_screen_unref(&screen->base)) - return; - if (screen->base.fence.current) { struct nouveau_fence *current = NULL; diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c index d8e4e8f..4b23677 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c @@ -289,9 +289,6 @@ nv50_screen_destroy(struct pipe_screen *pscreen) { struct nv50_screen *screen = nv50_screen(pscreen); - if (!nouveau_drm_screen_unref(&screen->base)) - return; - if (screen->base.fence.current) { struct nouveau_fence *current = NULL; diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c index 23b1874..137cdb1 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c @@ -333,9 +333,6 @@ nvc0_screen_destroy(struct pipe_screen *pscreen) { struct nvc0_screen *screen = nvc0_screen(pscreen); - if (!nouveau_drm_screen_unref(&screen->base)) - return; - if (screen->base.fence.current) { struct nouveau_fence *current = NULL; diff --git a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c index a077c48..b57dea4 100644 --- a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c +++ b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c @@ -16,19 +16,22 @@ static struct util_hash_table *fd_tab = NULL; pipe_static_mutex(nouveau_screen_mutex); -boolean nouveau_drm_screen_unref(struct nouveau_screen *screen) +void nouveau_drm_screen_device_unref(struct nouveau_device *dev) { int ret; - if (screen->refcount == -1) - return true; + if (dev->object.handle == -1) { + nouveau_device_del(&dev); + return; + } pipe_mutex_lock(nouveau_screen_mutex); - ret = --screen->refcount; + ret = --dev->object.handle; assert(ret >= 0); if (ret == 0) - util_hash_table_remove(fd_tab, intptr_to_pointer(screen->device->fd)); + util_hash_table_remove(fd_tab, intptr_to_pointer(dev->fd)); pipe_mutex_unlock(nouveau_screen_mutex); - return ret == 0; + if (ret == 0) + nouveau_device_del(&dev); } static unsigned hash_fd(void *key) @@ -68,14 +71,10 @@ nouveau_drm_screen_create(int fd) goto err; } - screen = util_hash_table_get(fd_tab, intptr_to_pointer(fd)); - if (screen) { - screen->refcount++; - pipe_mutex_unlock(nouveau_screen_mutex); - return &screen->base; - } + dev = util_hash_table_get(fd_tab, intptr_to_pointer(fd)); + if (!dev) + ret = nouveau_device_wrap(fd, 0, &dev); - ret = nouveau_device_wrap(fd, 0, &dev); if (ret) goto err; @@ -108,8 +107,8 @@ nouveau_drm_screen_create(int fd) if (!screen) goto err; - util_hash_table_set(fd_tab, intptr_to_pointer(fd), screen); - screen->refcount = 1; + util_hash_table_set(fd_tab, intptr_to_pointer(fd), dev); + dev->object.handle = 1; pipe_mutex_unlock(nouveau_screen_mutex); return &screen->base; diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c index e45cda6..4fcbc24 100644 --- a/src/glx/dri2_glx.c +++ b/src/glx/dri2_glx.c @@ -850,7 +850,7 @@ dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor, unsigned flags = __DRI2_FLUSH_DRAWABLE; if (flush) flags |= __DRI2_FLUSH_CONTEXT; - dri2Flush(psc, ctx, priv, flags, __DRI2_THROTTLE_SWAPBUFFER); +// dri2Flush(psc, ctx, priv, flags, __DRI2_THROTTLE_SWAPBUFFER); ret = dri2XcbSwapBuffers(pdraw->psc->dpy, pdraw, target_msc, divisor, remainder); diff --git a/src/mesa/state_tracker/st_vdpau.c b/src/mesa/state_tracker/st_vdpau.c index c5b4780..8349693 100644 --- a/src/mesa/state_tracker/st_vdpau.c +++ b/src/mesa/state_tracker/st_vdpau.c @@ -119,12 +119,6 @@ st_vdpau_map_surface(struct gl_context *ctx, GLenum target, GLenum access, return; } - /* do we have different screen objects ? */ - if (res->screen != st->pipe->screen) { - _mesa_error(ctx, GL_INVALID_OPERATION, "VDPAUMapSurfacesNV"); - return; - } - /* switch to surface based */ if (!stObj->surface_based) { _mesa_clear_texture_object(ctx, texObj);