summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorMaarten Lankhorst <[email protected]>2014-02-12 14:56:53 +0100
committerMaarten Lankhorst <[email protected]>2014-02-12 14:57:25 +0100
commitfee0686c21c631d96d6042741267a3c218c23ffc (patch)
tree96cb24b8377f9e0058d1786d24885b078bb9af63 /src/gallium/drivers
parent572a8345bfd1d6289a91b64eef92565ef9b3ee55 (diff)
nouveau: create only 1 shared screen between vdpau and opengl
This fixes bug 73200 "vdpau-GL interop fails due to different screen objects" in the same way radeon does. Signed-off-by: Maarten Lankhorst <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/nouveau/nouveau_screen.c6
-rw-r--r--src/gallium/drivers/nouveau/nouveau_screen.h4
-rw-r--r--src/gallium/drivers/nouveau/nv30/nv30_screen.c3
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_screen.c3
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_screen.c3
5 files changed, 19 insertions, 0 deletions
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c
index 21b31e04f0a..f742a9483b1 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.c
+++ b/src/gallium/drivers/nouveau/nouveau_screen.c
@@ -144,6 +144,12 @@ nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev)
if (nv_dbg)
nouveau_mesa_debug = atoi(nv_dbg);
+ /*
+ * this is initialized to 1 in nouveau_drm_screen_create after screen
+ * is fully constructed and added to the global screen list.
+ */
+ screen->refcount = -1;
+
if (dev->chipset < 0xc0) {
data = &nv04_data;
size = sizeof(nv04_data);
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.h b/src/gallium/drivers/nouveau/nouveau_screen.h
index 51e24fa05a4..cf06f7e88aa 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.h
+++ b/src/gallium/drivers/nouveau/nouveau_screen.h
@@ -22,6 +22,8 @@ struct nouveau_screen {
struct nouveau_client *client;
struct nouveau_pushbuf *pushbuf;
+ int refcount;
+
unsigned vidmem_bindings; /* PIPE_BIND_* where VRAM placement is desired */
unsigned sysmem_bindings; /* PIPE_BIND_* where GART placement is desired */
unsigned lowmem_bindings; /* PIPE_BIND_* that require an address < 4 GiB */
@@ -112,6 +114,8 @@ nouveau_screen(struct pipe_screen *pscreen)
return (struct nouveau_screen *)pscreen;
}
+boolean nouveau_drm_screen_unref(struct nouveau_screen *screen);
+
boolean
nouveau_screen_bo_get_handle(struct pipe_screen *pscreen,
struct nouveau_bo *bo,
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
index c027a5f3130..9854708b371 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
@@ -302,6 +302,9 @@ 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 &&
screen->base.fence.current->state >= NOUVEAU_FENCE_STATE_EMITTED) {
nouveau_fence_wait(screen->base.fence.current);
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
index e636bf8be33..db3265fb29e 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
@@ -287,6 +287,9 @@ 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) {
nouveau_fence_wait(screen->base.fence.current);
nouveau_fence_ref (NULL, &screen->base.fence.current);
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
index 28d9be24bbe..f04771de452 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
@@ -333,6 +333,9 @@ 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) {
nouveau_fence_wait(screen->base.fence.current);
nouveau_fence_ref(NULL, &screen->base.fence.current);