diff options
author | Christian König <[email protected]> | 2013-09-21 12:25:13 +0200 |
---|---|---|
committer | Christian König <[email protected]> | 2013-09-22 10:33:20 +0200 |
commit | 01a0dbcb96f133737a7f71b21125a58684d883cc (patch) | |
tree | 78035296305590866f7842f8b3f9d84c331af200 /src/gallium/winsys/radeon | |
parent | 0653c66ef40ac553f91b29bbda7f59f7ce6948fa (diff) |
winsys/radeon: share winsys between different fd's
Share the winsys between different fd's if they point to the same device.
Signed-off-by: Christian König <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/winsys/radeon')
-rw-r--r-- | src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 19 |
1 files 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 27bf3483d7d..61f091323f4 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) |