summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hellstrom <unichrome@shipmail.org>2005-08-14 09:52:09 +0000
committerThomas Hellstrom <unichrome@shipmail.org>2005-08-14 09:52:09 +0000
commit4f5961eeeee806a2d6e08e159c56262d4f060cba (patch)
treee5e70f2900f9cb441ad16eca442bc616018595e8
parent4050f5066a706bda74ed93ab858bbc9fc0b1477b (diff)
VIA bugvixes by Joris van Rantwijk Initial commit.
-rw-r--r--shared-core/via_drv.c10
-rw-r--r--shared-core/via_drv.h4
-rw-r--r--shared-core/via_verifier.c2
-rw-r--r--shared-core/via_video.c3
-rw-r--r--shared/via.h10
-rw-r--r--shared/via_verifier.c2
-rw-r--r--shared/via_video.c6
7 files changed, 24 insertions, 13 deletions
diff --git a/shared-core/via_drv.c b/shared-core/via_drv.c
index d8d85f5e..fd0dbcc9 100644
--- a/shared-core/via_drv.c
+++ b/shared-core/via_drv.c
@@ -39,12 +39,16 @@ static struct pci_device_id pciidlist[] = {
viadrv_PCI_IDS
};
+/*
+ * {function, auth_needed, master, root_only}
+ */
+
static drm_ioctl_desc_t ioctls[] = {
[DRM_IOCTL_NR(DRM_VIA_ALLOCMEM)] = {via_mem_alloc, 1, 0, 0},
[DRM_IOCTL_NR(DRM_VIA_FREEMEM)] = {via_mem_free, 1, 0, 0},
- [DRM_IOCTL_NR(DRM_VIA_AGP_INIT)] = {via_agp_init, 1, 0, 0},
- [DRM_IOCTL_NR(DRM_VIA_FB_INIT)] = {via_fb_init, 1, 0, 0},
- [DRM_IOCTL_NR(DRM_VIA_MAP_INIT)] = {via_map_init, 1, 0, 0},
+ [DRM_IOCTL_NR(DRM_VIA_AGP_INIT)] = {via_agp_init, 1, 1, 0},
+ [DRM_IOCTL_NR(DRM_VIA_FB_INIT)] = {via_fb_init, 1, 1, 0},
+ [DRM_IOCTL_NR(DRM_VIA_MAP_INIT)] = {via_map_init, 1, 1, 0},
[DRM_IOCTL_NR(DRM_VIA_DEC_FUTEX)] = {via_decoder_futex, 1, 0, 0},
[DRM_IOCTL_NR(DRM_VIA_DMA_INIT)] = {via_dma_init, 1, 0, 0},
[DRM_IOCTL_NR(DRM_VIA_CMDBUFFER)] = {via_cmdbuffer, 1, 0, 0},
diff --git a/shared-core/via_drv.h b/shared-core/via_drv.h
index a059261d..ba1c6d78 100644
--- a/shared-core/via_drv.h
+++ b/shared-core/via_drv.h
@@ -28,11 +28,11 @@
#define DRIVER_NAME "via"
#define DRIVER_DESC "VIA Unichrome / Pro"
-#define DRIVER_DATE "20050812"
+#define DRIVER_DATE "20050814"
#define DRIVER_MAJOR 2
#define DRIVER_MINOR 6
-#define DRIVER_PATCHLEVEL 6
+#define DRIVER_PATCHLEVEL 7
#include "via_verifier.h"
diff --git a/shared-core/via_verifier.c b/shared-core/via_verifier.c
index 07923b0c..65a7b9e7 100644
--- a/shared-core/via_verifier.c
+++ b/shared-core/via_verifier.c
@@ -246,7 +246,7 @@ static hazard_t table3[256];
static __inline__ int
eat_words(const uint32_t **buf, const uint32_t *buf_end, unsigned num_words)
{
- if ((*buf - buf_end) >= num_words) {
+ if ((buf_end - *buf) >= num_words) {
*buf += num_words;
return 0;
}
diff --git a/shared-core/via_video.c b/shared-core/via_video.c
index 1e2d4445..8ba09674 100644
--- a/shared-core/via_video.c
+++ b/shared-core/via_video.c
@@ -53,6 +53,9 @@ via_release_futex(drm_via_private_t *dev_priv, int context)
unsigned int i;
volatile int *lock;
+ if (!dev_priv->sarea_priv)
+ return;
+
for (i=0; i < VIA_NR_XVMC_LOCKS; ++i) {
lock = (int *) XVMCLOCKPTR(dev_priv->sarea_priv, i);
if ( (_DRM_LOCKING_CONTEXT( *lock ) == context)) {
diff --git a/shared/via.h b/shared/via.h
index 5c33d6a7..cc63df9f 100644
--- a/shared/via.h
+++ b/shared/via.h
@@ -30,18 +30,18 @@
#define DRIVER_NAME "via"
#define DRIVER_DESC "VIA Unichrome / Pro"
-#define DRIVER_DATE "20050715"
+#define DRIVER_DATE "20050814"
#define DRIVER_MAJOR 2
#define DRIVER_MINOR 6
-#define DRIVER_PATCHLEVEL 4
+#define DRIVER_PATCHLEVEL 7
#define DRIVER_IOCTLS \
[DRM_IOCTL_NR(DRM_IOCTL_VIA_ALLOCMEM)] = { via_mem_alloc, 1, 0 }, \
[DRM_IOCTL_NR(DRM_IOCTL_VIA_FREEMEM)] = { via_mem_free, 1, 0 }, \
- [DRM_IOCTL_NR(DRM_IOCTL_VIA_AGP_INIT)] = { via_agp_init, 1, 0 }, \
- [DRM_IOCTL_NR(DRM_IOCTL_VIA_FB_INIT)] = { via_fb_init, 1, 0 }, \
- [DRM_IOCTL_NR(DRM_IOCTL_VIA_MAP_INIT)] = { via_map_init, 1, 0 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_VIA_AGP_INIT)] = { via_agp_init, 1, 1 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_VIA_FB_INIT)] = { via_fb_init, 1, 1 }, \
+ [DRM_IOCTL_NR(DRM_IOCTL_VIA_MAP_INIT)] = { via_map_init, 1, 1 }, \
[DRM_IOCTL_NR(DRM_IOCTL_VIA_DEC_FUTEX)] = { via_decoder_futex, 1, 0}, \
[DRM_IOCTL_NR(DRM_IOCTL_VIA_DMA_INIT)] = { via_dma_init, 1, 0}, \
[DRM_IOCTL_NR(DRM_IOCTL_VIA_CMDBUFFER)] = { via_cmdbuffer, 1, 0}, \
diff --git a/shared/via_verifier.c b/shared/via_verifier.c
index ed14b1c6..13b5ccf0 100644
--- a/shared/via_verifier.c
+++ b/shared/via_verifier.c
@@ -248,7 +248,7 @@ static hazard_t table3[256];
static __inline__ int
eat_words(const uint32_t **buf, const uint32_t *buf_end, unsigned num_words)
{
- if ((*buf - buf_end) >= num_words) {
+ if ((buf_end - *buf) >= num_words) {
*buf += num_words;
return 0;
}
diff --git a/shared/via_video.c b/shared/via_video.c
index 289ddac1..d79ee028 100644
--- a/shared/via_video.c
+++ b/shared/via_video.c
@@ -54,6 +54,9 @@ via_release_futex(drm_via_private_t *dev_priv, int context)
unsigned int i;
volatile int *lock;
+ if (!dev_priv->sarea_priv)
+ return;
+
for (i=0; i < VIA_NR_XVMC_LOCKS; ++i) {
lock = (int *) XVMCLOCKPTR(dev_priv->sarea_priv, i);
if ( (_DRM_LOCKING_CONTEXT( *lock ) == context)) {
@@ -77,7 +80,8 @@ via_decoder_futex(DRM_IOCTL_ARGS)
DRM_DEBUG("%s\n", __FUNCTION__);
- DRM_COPY_FROM_USER_IOCTL(fx, (drm_via_futex_t *) data, sizeof(fx));
+ DRM_COPY_FROM_USER_IOCTL(fx, (drm_via_futex_t __user *) data,
+ sizeof(fx));
if (fx.lock > VIA_NR_XVMC_LOCKS)
return -EFAULT;