summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_dma.h8
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c31
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c3
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_dma.c3
5 files changed, 25 insertions, 24 deletions
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h
index 8679b14d4..07da54939 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h
@@ -830,8 +830,8 @@ extern void DRM(reclaim_buffers)( struct file *filp );
extern void DRM(clear_next_buffer)(drm_device_t *dev);
extern int DRM(select_queue)(drm_device_t *dev,
void (*wrapper)(unsigned long));
-extern int DRM(dma_enqueue)(drm_device_t *dev, drm_dma_t *dma);
-extern int DRM(dma_get_buffers)(drm_device_t *dev, drm_dma_t *dma);
+extern int DRM(dma_enqueue)(struct file *filp, drm_dma_t *dma);
+extern int DRM(dma_get_buffers)(struct file *filp, drm_dma_t *dma);
#endif
#if __HAVE_DMA_IRQ
extern int DRM(control)( struct inode *inode, struct file *filp,
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_dma.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_dma.h
index 33243840f..545f19065 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_dma.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_dma.h
@@ -468,7 +468,7 @@ static int DRM(dma_get_buffers_of_order)(struct file *filp, drm_dma_t *d,
}
-int DRM(dma_get_buffers)(drm_device_t *dev, drm_dma_t *dma)
+int DRM(dma_get_buffers)(struct file *filp, drm_dma_t *dma)
{
int order;
int retcode = 0;
@@ -477,7 +477,7 @@ int DRM(dma_get_buffers)(drm_device_t *dev, drm_dma_t *dma)
order = DRM(order)(dma->request_size);
dma->granted_count = 0;
- retcode = DRM(dma_get_buffers_of_order)(dev, dma, order);
+ retcode = DRM(dma_get_buffers_of_order)(filp, dma, order);
if (dma->granted_count < dma->request_count
&& (dma->flags & _DRM_DMA_SMALLER_OK)) {
@@ -487,7 +487,7 @@ int DRM(dma_get_buffers)(drm_device_t *dev, drm_dma_t *dma)
&& tmp_order >= DRM_MIN_ORDER;
--tmp_order) {
- retcode = DRM(dma_get_buffers_of_order)(dev, dma,
+ retcode = DRM(dma_get_buffers_of_order)(filp, dma,
tmp_order);
}
}
@@ -500,7 +500,7 @@ int DRM(dma_get_buffers)(drm_device_t *dev, drm_dma_t *dma)
&& tmp_order <= DRM_MAX_ORDER;
++tmp_order) {
- retcode = DRM(dma_get_buffers_of_order)(dev, dma,
+ retcode = DRM(dma_get_buffers_of_order)(filp, dma,
tmp_order);
}
}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c
index 094f51d65..6a9f68ae4 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c
@@ -32,6 +32,8 @@
#define __NO_VERSION__
#include "gamma.h"
#include "drmP.h"
+#include "drm.h"
+#include "gamma_drm.h"
#include "gamma_drv.h"
#include <linux/interrupt.h> /* For task queue support */
@@ -188,7 +190,7 @@ static int gamma_do_dma(drm_device_t *dev, int locked)
if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
DRM_ERROR("Dispatching buffer %d from pid %d"
" \"while locked\", but no lock held\n",
- buf->idx, buf->pid);
+ buf->idx, current->pid);
}
} else {
if (!locked && !gamma_lock_take(&dev->lock.hw_lock->lock,
@@ -340,7 +342,8 @@ again:
return retcode;
}
-static int gamma_dma_priority(drm_device_t *dev, drm_dma_t *d)
+static int gamma_dma_priority(struct file *filp,
+ drm_device_t *dev, drm_dma_t *d)
{
unsigned long address;
unsigned long length;
@@ -378,15 +381,15 @@ static int gamma_dma_priority(drm_device_t *dev, drm_dma_t *d)
continue;
}
buf = dma->buflist[ idx ];
- if (buf->pid != current->pid) {
- DRM_ERROR("Process %d using buffer owned by %d\n",
- current->pid, buf->pid);
+ if (buf->filp != filp) {
+ DRM_ERROR("Process %d using buffer not owned\n",
+ current->pid);
retcode = -EINVAL;
goto cleanup;
}
if (buf->list != DRM_LIST_NONE) {
- DRM_ERROR("Process %d using %d's buffer on list %d\n",
- current->pid, buf->pid, buf->list);
+ DRM_ERROR("Process %d using buffer on list %d\n",
+ current->pid, buf->list);
retcode = -EINVAL;
goto cleanup;
}
@@ -478,7 +481,8 @@ cleanup:
return retcode;
}
-static int gamma_dma_send_buffers(drm_device_t *dev, drm_dma_t *d)
+static int gamma_dma_send_buffers(struct file *filp,
+ drm_device_t *dev, drm_dma_t *d)
{
DECLARE_WAITQUEUE(entry, current);
drm_buf_t *last_buf = NULL;
@@ -490,7 +494,7 @@ static int gamma_dma_send_buffers(drm_device_t *dev, drm_dma_t *d)
add_wait_queue(&last_buf->dma_wait, &entry);
}
- if ((retcode = gamma_dma_enqueue(dev, d))) {
+ if ((retcode = gamma_dma_enqueue(filp, d))) {
if (d->flags & _DRM_DMA_BLOCK)
remove_wait_queue(&last_buf->dma_wait, &entry);
return retcode;
@@ -520,14 +524,13 @@ static int gamma_dma_send_buffers(drm_device_t *dev, drm_dma_t *d)
}
}
if (retcode) {
- DRM_ERROR("ctx%d w%d p%d c%d i%d l%d %d/%d\n",
+ DRM_ERROR("ctx%d w%d p%d c%d i%d l%d pid:%d\n",
d->context,
last_buf->waiting,
last_buf->pending,
DRM_WAITCOUNT(dev, d->context),
last_buf->idx,
last_buf->list,
- last_buf->pid,
current->pid);
}
}
@@ -560,15 +563,15 @@ int gamma_dma(struct inode *inode, struct file *filp, unsigned int cmd,
if (d.send_count) {
if (d.flags & _DRM_DMA_PRIORITY)
- retcode = gamma_dma_priority(dev, &d);
+ retcode = gamma_dma_priority(filp, dev, &d);
else
- retcode = gamma_dma_send_buffers(dev, &d);
+ retcode = gamma_dma_send_buffers(filp, dev, &d);
}
d.granted_count = 0;
if (!retcode && d.request_count) {
- retcode = gamma_dma_get_buffers(dev, &d);
+ retcode = gamma_dma_get_buffers(filp, &d);
}
DRM_DEBUG("%d returning, granted = %d\n",
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c
index 2adc71c20..2f90cbb66 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c
@@ -242,7 +242,6 @@ static int i810_unmap_buffer(drm_buf_t *buf)
static int i810_dma_get_buffer(drm_device_t *dev, drm_i810_dma_t *d,
struct file *filp)
{
- drm_file_t *priv = filp->private_data;
drm_buf_t *buf;
drm_i810_buf_priv_t *buf_priv;
int retcode = 0;
@@ -906,7 +905,7 @@ void i810_reclaim_buffers(struct file *filp)
drm_buf_t *buf = dma->buflist[ i ];
drm_i810_buf_priv_t *buf_priv = buf->dev_private;
- if (buf->pid == pid && buf_priv) {
+ if (buf->filp == filp && buf_priv) {
int used = cmpxchg(buf_priv->in_use, I810_BUF_CLIENT,
I810_BUF_FREE);
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_dma.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_dma.c
index 6c4b34b98..26cad294b 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_dma.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i830_dma.c
@@ -244,7 +244,6 @@ static int i830_unmap_buffer(drm_buf_t *buf)
static int i830_dma_get_buffer(drm_device_t *dev, drm_i830_dma_t *d,
struct file *filp)
{
- drm_file_t *priv = filp->private_data;
drm_buf_t *buf;
drm_i830_buf_priv_t *buf_priv;
int retcode = 0;
@@ -1103,7 +1102,7 @@ void i830_reclaim_buffers( struct file *filp )
drm_buf_t *buf = dma->buflist[ i ];
drm_i830_buf_priv_t *buf_priv = buf->dev_private;
- if (buf->pid == pid && buf_priv) {
+ if (buf->filp == filp && buf_priv) {
int used = cmpxchg(buf_priv->in_use, I830_BUF_CLIENT,
I830_BUF_FREE);