mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-28 21:26:49 +00:00
Mesa: add vdpau_interop patches
Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
parent
e0b0d91b99
commit
10e8b2d935
@ -0,0 +1,44 @@
|
||||
From 42a34d19fd3891cdbe0d41482288ebba5dfddc64 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koenig@amd.com>
|
||||
Date: Sat, 21 Sep 2013 13:21:47 +0200
|
||||
Subject: [PATCH 1/5] winsys/radeon: fix killing the CS thread
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Kill the thread only after we checked that it's not used any more, not before.
|
||||
|
||||
Signed-off-by: Christian König <christian.koenig@amd.com>
|
||||
---
|
||||
src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
|
||||
index 69c42a0..0a3b932 100644
|
||||
--- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
|
||||
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
|
||||
@@ -421,6 +421,10 @@ static void radeon_winsys_destroy(struct radeon_winsys *rws)
|
||||
{
|
||||
struct radeon_drm_winsys *ws = (struct radeon_drm_winsys*)rws;
|
||||
|
||||
+ if (!pipe_reference(&ws->base.reference, NULL)) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
if (ws->thread) {
|
||||
ws->kill_thread = 1;
|
||||
pipe_semaphore_signal(&ws->cs_queued);
|
||||
@@ -429,10 +433,6 @@ static void radeon_winsys_destroy(struct radeon_winsys *rws)
|
||||
pipe_semaphore_destroy(&ws->cs_queued);
|
||||
pipe_condvar_destroy(ws->cs_queue_empty);
|
||||
|
||||
- if (!pipe_reference(&ws->base.reference, NULL)) {
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
pipe_mutex_destroy(ws->hyperz_owner_mutex);
|
||||
pipe_mutex_destroy(ws->cmask_owner_mutex);
|
||||
pipe_mutex_destroy(ws->cs_stack_lock);
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,104 @@
|
||||
From 295eb75d53547fa7dcc6b188e423debbba1888ad Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koenig@amd.com>
|
||||
Date: Sat, 21 Sep 2013 15:24:55 +0200
|
||||
Subject: [PATCH 2/5] winsys/radeon: remove cs_queue_empty
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Waiting for an empty queue is nonsense and can lead to deadlocks if we have
|
||||
multiple waiters or another thread that continuously sends down new commands.
|
||||
|
||||
Just post the cs to the queue and immediately wait for it to finish.
|
||||
|
||||
This is a candidate for the stable branch.
|
||||
|
||||
Signed-off-by: Christian König <christian.koenig@amd.com>
|
||||
---
|
||||
src/gallium/winsys/radeon/drm/radeon_drm_cs.c | 11 +++--------
|
||||
src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 6 ------
|
||||
src/gallium/winsys/radeon/drm/radeon_drm_winsys.h | 5 -----
|
||||
3 files changed, 3 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
|
||||
index 38a9209..d530011 100644
|
||||
--- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
|
||||
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
|
||||
@@ -560,17 +560,12 @@ static void radeon_drm_cs_flush(struct radeon_winsys_cs *rcs, unsigned flags, ui
|
||||
break;
|
||||
}
|
||||
|
||||
- if (cs->ws->thread && (flags & RADEON_FLUSH_ASYNC)) {
|
||||
+ if (cs->ws->thread) {
|
||||
cs->flush_started = 1;
|
||||
radeon_drm_ws_queue_cs(cs->ws, cs);
|
||||
+ if (!(flags & RADEON_FLUSH_ASYNC))
|
||||
+ radeon_drm_cs_sync_flush(rcs);
|
||||
} else {
|
||||
- pipe_mutex_lock(cs->ws->cs_stack_lock);
|
||||
- if (cs->ws->thread) {
|
||||
- while (p_atomic_read(&cs->ws->ncs)) {
|
||||
- pipe_condvar_wait(cs->ws->cs_queue_empty, cs->ws->cs_stack_lock);
|
||||
- }
|
||||
- }
|
||||
- pipe_mutex_unlock(cs->ws->cs_stack_lock);
|
||||
radeon_drm_cs_emit_ioctl_oneshot(cs, cs->cst);
|
||||
}
|
||||
} else {
|
||||
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
|
||||
index 0a3b932..27bf348 100644
|
||||
--- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
|
||||
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
|
||||
@@ -431,7 +431,6 @@ static void radeon_winsys_destroy(struct radeon_winsys *rws)
|
||||
pipe_thread_wait(ws->thread);
|
||||
}
|
||||
pipe_semaphore_destroy(&ws->cs_queued);
|
||||
- pipe_condvar_destroy(ws->cs_queue_empty);
|
||||
|
||||
pipe_mutex_destroy(ws->hyperz_owner_mutex);
|
||||
pipe_mutex_destroy(ws->cmask_owner_mutex);
|
||||
@@ -567,9 +566,6 @@ next:
|
||||
}
|
||||
ws->cs_stack[p_atomic_read(&ws->ncs) - 1] = NULL;
|
||||
empty_stack = p_atomic_dec_zero(&ws->ncs);
|
||||
- if (empty_stack) {
|
||||
- pipe_condvar_signal(ws->cs_queue_empty);
|
||||
- }
|
||||
pipe_mutex_unlock(ws->cs_stack_lock);
|
||||
|
||||
pipe_semaphore_signal(&cs->flush_completed);
|
||||
@@ -585,7 +581,6 @@ next:
|
||||
ws->cs_stack[i] = NULL;
|
||||
}
|
||||
p_atomic_set(&ws->ncs, 0);
|
||||
- pipe_condvar_signal(ws->cs_queue_empty);
|
||||
pipe_mutex_unlock(ws->cs_stack_lock);
|
||||
return NULL;
|
||||
}
|
||||
@@ -651,7 +646,6 @@ struct radeon_winsys *radeon_drm_winsys_create(int fd)
|
||||
|
||||
p_atomic_set(&ws->ncs, 0);
|
||||
pipe_semaphore_init(&ws->cs_queued, 0);
|
||||
- pipe_condvar_init(ws->cs_queue_empty);
|
||||
if (ws->num_cpus > 1 && debug_get_option_thread())
|
||||
ws->thread = pipe_thread_create(radeon_drm_cs_emit_ioctl, ws);
|
||||
|
||||
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h
|
||||
index 682479e..ed90194 100644
|
||||
--- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h
|
||||
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.h
|
||||
@@ -67,11 +67,6 @@ struct radeon_drm_winsys {
|
||||
/* rings submission thread */
|
||||
pipe_mutex cs_stack_lock;
|
||||
pipe_semaphore cs_queued;
|
||||
- /* we cannot use semaphore for empty queue because maintaining an even
|
||||
- * number of call to semaphore_wait and semaphore_signal is, to say the
|
||||
- * least, tricky
|
||||
- */
|
||||
- pipe_condvar cs_queue_empty;
|
||||
pipe_thread thread;
|
||||
int kill_thread;
|
||||
int ncs;
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -0,0 +1,59 @@
|
||||
From ab56fbbdb774eeffb232a6995fe350dd6d44ff55 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koenig@amd.com>
|
||||
Date: Sat, 21 Sep 2013 12:25:13 +0200
|
||||
Subject: [PATCH 3/5] winsys/radeon: share winsys between different fd's
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Share the winsys between different fd's if they point to the same device.
|
||||
|
||||
Signed-off-by: Christian König <christian.koenig@amd.com>
|
||||
---
|
||||
src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 19 +++++++++++++++++--
|
||||
1 file changed, 17 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
|
||||
index 27bf348..61f0913 100644
|
||||
--- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
|
||||
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
|
||||
@@ -41,6 +41,9 @@
|
||||
|
||||
#include <xf86drm.h>
|
||||
#include <stdio.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/stat.h>
|
||||
+#include <unistd.h>
|
||||
|
||||
/*
|
||||
* this are copy from radeon_drm, once an updated libdrm is released
|
||||
@@ -519,12 +522,24 @@ static uint64_t radeon_query_value(struct radeon_winsys *rws,
|
||||
|
||||
static unsigned hash_fd(void *key)
|
||||
{
|
||||
- return pointer_to_intptr(key);
|
||||
+ int fd = pointer_to_intptr(key);
|
||||
+ struct stat stat;
|
||||
+ fstat(fd, &stat);
|
||||
+
|
||||
+ return stat.st_dev ^ stat.st_ino ^ stat.st_rdev;
|
||||
}
|
||||
|
||||
static int compare_fd(void *key1, void *key2)
|
||||
{
|
||||
- return pointer_to_intptr(key1) != pointer_to_intptr(key2);
|
||||
+ int fd1 = pointer_to_intptr(key1);
|
||||
+ int fd2 = pointer_to_intptr(key2);
|
||||
+ struct stat stat1, stat2;
|
||||
+ fstat(fd1, &stat1);
|
||||
+ fstat(fd2, &stat2);
|
||||
+
|
||||
+ return stat1.st_dev != stat2.st_dev ||
|
||||
+ stat1.st_ino != stat2.st_ino ||
|
||||
+ stat1.st_rdev != stat2.st_rdev;
|
||||
}
|
||||
|
||||
void radeon_drm_ws_queue_cs(struct radeon_drm_winsys *ws, struct radeon_drm_cs *cs)
|
||||
--
|
||||
1.8.3.1
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,31 @@
|
||||
From 1ee590c6f238b638d663af889201d584239b7f73 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koenig@amd.com>
|
||||
Date: Sat, 21 Sep 2013 15:34:38 +0200
|
||||
Subject: [PATCH 5/5] radeon/uvd: async flush the UVD cs
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
No need to block for the CS thread here.
|
||||
|
||||
Signed-off-by: Christian König <christian.koenig@amd.com>
|
||||
---
|
||||
src/gallium/drivers/radeon/radeon_uvd.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/gallium/drivers/radeon/radeon_uvd.c b/src/gallium/drivers/radeon/radeon_uvd.c
|
||||
index 518978e..fa81105 100644
|
||||
--- a/src/gallium/drivers/radeon/radeon_uvd.c
|
||||
+++ b/src/gallium/drivers/radeon/radeon_uvd.c
|
||||
@@ -110,7 +110,7 @@ static void flush(struct ruvd_decoder *dec)
|
||||
while(dec->cs->cdw % 16)
|
||||
pm4[dec->cs->cdw++] = RUVD_PKT2();
|
||||
|
||||
- dec->ws->cs_flush(dec->cs, 0, 0);
|
||||
+ dec->ws->cs_flush(dec->cs, RADEON_FLUSH_ASYNC, 0);
|
||||
}
|
||||
|
||||
/* add a new set register command to the IB */
|
||||
--
|
||||
1.8.3.1
|
||||
|
Loading…
x
Reference in New Issue
Block a user