aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/radeon_cp.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2007-08-25 06:23:09 -0400
committerDave Airlie <airlied@optimus.(none)>2007-10-14 20:38:20 -0400
commit6c340eac0285f3d62406d2d902d0e96fbf2a5dc0 (patch)
treea92039951cb7eaced306cfff2bad6af0ac5257ad /drivers/char/drm/radeon_cp.c
parent20caafa6ecb2487d9b223aa33e7cc704f912a758 (diff)
drm: Replace filp in ioctl arguments with drm_file *file_priv.
As a fallout, replace filp storage with file_priv storage for "unique identifier of a client" all over the DRM. There is a 1:1 mapping, so this should be a noop. This could be a minor performance improvement, as everyth on Linux dereferenced filp to get file_priv anyway, while only the mmap ioct went the other direction. Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char/drm/radeon_cp.c')
-rw-r--r--drivers/char/drm/radeon_cp.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c
index a023fce3f1b1..af95b5897a0c 100644
--- a/drivers/char/drm/radeon_cp.c
+++ b/drivers/char/drm/radeon_cp.c
@@ -1828,7 +1828,7 @@ int radeon_cp_init(DRM_IOCTL_ARGS)
1828 DRM_DEVICE; 1828 DRM_DEVICE;
1829 drm_radeon_init_t init; 1829 drm_radeon_init_t init;
1830 1830
1831 LOCK_TEST_WITH_RETURN(dev, filp); 1831 LOCK_TEST_WITH_RETURN(dev, file_priv);
1832 1832
1833 DRM_COPY_FROM_USER_IOCTL(init, (drm_radeon_init_t __user *) data, 1833 DRM_COPY_FROM_USER_IOCTL(init, (drm_radeon_init_t __user *) data,
1834 sizeof(init)); 1834 sizeof(init));
@@ -1854,7 +1854,7 @@ int radeon_cp_start(DRM_IOCTL_ARGS)
1854 drm_radeon_private_t *dev_priv = dev->dev_private; 1854 drm_radeon_private_t *dev_priv = dev->dev_private;
1855 DRM_DEBUG("\n"); 1855 DRM_DEBUG("\n");
1856 1856
1857 LOCK_TEST_WITH_RETURN(dev, filp); 1857 LOCK_TEST_WITH_RETURN(dev, file_priv);
1858 1858
1859 if (dev_priv->cp_running) { 1859 if (dev_priv->cp_running) {
1860 DRM_DEBUG("%s while CP running\n", __FUNCTION__); 1860 DRM_DEBUG("%s while CP running\n", __FUNCTION__);
@@ -1882,7 +1882,7 @@ int radeon_cp_stop(DRM_IOCTL_ARGS)
1882 int ret; 1882 int ret;
1883 DRM_DEBUG("\n"); 1883 DRM_DEBUG("\n");
1884 1884
1885 LOCK_TEST_WITH_RETURN(dev, filp); 1885 LOCK_TEST_WITH_RETURN(dev, file_priv);
1886 1886
1887 DRM_COPY_FROM_USER_IOCTL(stop, (drm_radeon_cp_stop_t __user *) data, 1887 DRM_COPY_FROM_USER_IOCTL(stop, (drm_radeon_cp_stop_t __user *) data,
1888 sizeof(stop)); 1888 sizeof(stop));
@@ -1969,7 +1969,7 @@ int radeon_cp_reset(DRM_IOCTL_ARGS)
1969 drm_radeon_private_t *dev_priv = dev->dev_private; 1969 drm_radeon_private_t *dev_priv = dev->dev_private;
1970 DRM_DEBUG("\n"); 1970 DRM_DEBUG("\n");
1971 1971
1972 LOCK_TEST_WITH_RETURN(dev, filp); 1972 LOCK_TEST_WITH_RETURN(dev, file_priv);
1973 1973
1974 if (!dev_priv) { 1974 if (!dev_priv) {
1975 DRM_DEBUG("%s called before init done\n", __FUNCTION__); 1975 DRM_DEBUG("%s called before init done\n", __FUNCTION__);
@@ -1990,7 +1990,7 @@ int radeon_cp_idle(DRM_IOCTL_ARGS)
1990 drm_radeon_private_t *dev_priv = dev->dev_private; 1990 drm_radeon_private_t *dev_priv = dev->dev_private;
1991 DRM_DEBUG("\n"); 1991 DRM_DEBUG("\n");
1992 1992
1993 LOCK_TEST_WITH_RETURN(dev, filp); 1993 LOCK_TEST_WITH_RETURN(dev, file_priv);
1994 1994
1995 return radeon_do_cp_idle(dev_priv); 1995 return radeon_do_cp_idle(dev_priv);
1996} 1996}
@@ -2009,7 +2009,7 @@ int radeon_engine_reset(DRM_IOCTL_ARGS)
2009 DRM_DEVICE; 2009 DRM_DEVICE;
2010 DRM_DEBUG("\n"); 2010 DRM_DEBUG("\n");
2011 2011
2012 LOCK_TEST_WITH_RETURN(dev, filp); 2012 LOCK_TEST_WITH_RETURN(dev, file_priv);
2013 2013
2014 return radeon_do_engine_reset(dev); 2014 return radeon_do_engine_reset(dev);
2015} 2015}
@@ -2066,8 +2066,9 @@ struct drm_buf *radeon_freelist_get(struct drm_device * dev)
2066 for (i = start; i < dma->buf_count; i++) { 2066 for (i = start; i < dma->buf_count; i++) {
2067 buf = dma->buflist[i]; 2067 buf = dma->buflist[i];
2068 buf_priv = buf->dev_private; 2068 buf_priv = buf->dev_private;
2069 if (buf->filp == 0 || (buf->pending && 2069 if (buf->file_priv == NULL || (buf->pending &&
2070 buf_priv->age <= done_age)) { 2070 buf_priv->age <=
2071 done_age)) {
2071 dev_priv->stats.requested_bufs++; 2072 dev_priv->stats.requested_bufs++;
2072 buf->pending = 0; 2073 buf->pending = 0;
2073 return buf; 2074 return buf;
@@ -2106,8 +2107,9 @@ struct drm_buf *radeon_freelist_get(struct drm_device * dev)
2106 for (i = start; i < dma->buf_count; i++) { 2107 for (i = start; i < dma->buf_count; i++) {
2107 buf = dma->buflist[i]; 2108 buf = dma->buflist[i];
2108 buf_priv = buf->dev_private; 2109 buf_priv = buf->dev_private;
2109 if (buf->filp == 0 || (buf->pending && 2110 if (buf->file_priv == 0 || (buf->pending &&
2110 buf_priv->age <= done_age)) { 2111 buf_priv->age <=
2112 done_age)) {
2111 dev_priv->stats.requested_bufs++; 2113 dev_priv->stats.requested_bufs++;
2112 buf->pending = 0; 2114 buf->pending = 0;
2113 return buf; 2115 return buf;
@@ -2170,7 +2172,8 @@ int radeon_wait_ring(drm_radeon_private_t * dev_priv, int n)
2170 return -EBUSY; 2172 return -EBUSY;
2171} 2173}
2172 2174
2173static int radeon_cp_get_buffers(DRMFILE filp, struct drm_device * dev, 2175static int radeon_cp_get_buffers(struct drm_device *dev,
2176 struct drm_file *file_priv,
2174 struct drm_dma * d) 2177 struct drm_dma * d)
2175{ 2178{
2176 int i; 2179 int i;
@@ -2181,7 +2184,7 @@ static int radeon_cp_get_buffers(DRMFILE filp, struct drm_device * dev,
2181 if (!buf) 2184 if (!buf)
2182 return -EBUSY; /* NOTE: broken client */ 2185 return -EBUSY; /* NOTE: broken client */
2183 2186
2184 buf->filp = filp; 2187 buf->file_priv = file_priv;
2185 2188
2186 if (DRM_COPY_TO_USER(&d->request_indices[i], &buf->idx, 2189 if (DRM_COPY_TO_USER(&d->request_indices[i], &buf->idx,
2187 sizeof(buf->idx))) 2190 sizeof(buf->idx)))
@@ -2203,7 +2206,7 @@ int radeon_cp_buffers(DRM_IOCTL_ARGS)
2203 struct drm_dma __user *argp = (void __user *)data; 2206 struct drm_dma __user *argp = (void __user *)data;
2204 struct drm_dma d; 2207 struct drm_dma d;
2205 2208
2206 LOCK_TEST_WITH_RETURN(dev, filp); 2209 LOCK_TEST_WITH_RETURN(dev, file_priv);
2207 2210
2208 DRM_COPY_FROM_USER_IOCTL(d, argp, sizeof(d)); 2211 DRM_COPY_FROM_USER_IOCTL(d, argp, sizeof(d));
2209 2212
@@ -2226,7 +2229,7 @@ int radeon_cp_buffers(DRM_IOCTL_ARGS)
2226 d.granted_count = 0; 2229 d.granted_count = 0;
2227 2230
2228 if (d.request_count) { 2231 if (d.request_count) {
2229 ret = radeon_cp_get_buffers(filp, dev, &d); 2232 ret = radeon_cp_get_buffers(dev, file_priv, &d);
2230 } 2233 }
2231 2234
2232 DRM_COPY_TO_USER_IOCTL(argp, d, sizeof(d)); 2235 DRM_COPY_TO_USER_IOCTL(argp, d, sizeof(d));