summaryrefslogtreecommitdiff
path: root/shared-core/savage_drv.h
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2005-11-08 21:40:03 +0000
committerEric Anholt <anholt@freebsd.org>2005-11-08 21:40:03 +0000
commit6481a2e4cda67732ce7c6fe30aa4dc50d3cc7ed0 (patch)
tree829ca6f0cbfbfd16ee81aa72bc10370711d06209 /shared-core/savage_drv.h
parentc7af46cf7d464ff89c64ab864fcd2af51d462812 (diff)
Correct a LOR issue on FreeBSD by allocating temporary space and doing a
single DRM_COPY_FROM_USER rather than DRM_VERIFYAREA_READ followed by tons of DRM_COPY_FROM_USER_UNCHECKED. I don't like the look of the temporary space allocation, but I like the simplification in the rest of the file. Tested with glxgears, tuxracer, and q3 on a savage4.
Diffstat (limited to 'shared-core/savage_drv.h')
-rw-r--r--shared-core/savage_drv.h19
1 files changed, 5 insertions, 14 deletions
diff --git a/shared-core/savage_drv.h b/shared-core/savage_drv.h
index 3b64ad2a..8ec604f0 100644
--- a/shared-core/savage_drv.h
+++ b/shared-core/savage_drv.h
@@ -189,7 +189,7 @@ typedef struct drm_savage_private {
/* Err, there is a macro wait_event in include/linux/wait.h.
* Avoid unwanted macro expansion. */
void (*emit_clip_rect)(struct drm_savage_private *dev_priv,
- drm_clip_rect_t *pbox);
+ const drm_clip_rect_t *pbox);
void (*dma_flush)(struct drm_savage_private *dev_priv);
} drm_savage_private_t;
@@ -214,9 +214,9 @@ extern void savage_reclaim_buffers(drm_device_t *dev, DRMFILE filp);
/* state functions */
extern void savage_emit_clip_rect_s3d(drm_savage_private_t *dev_priv,
- drm_clip_rect_t *pbox);
+ const drm_clip_rect_t *pbox);
extern void savage_emit_clip_rect_s4(drm_savage_private_t *dev_priv,
- drm_clip_rect_t *pbox);
+ const drm_clip_rect_t *pbox);
#define SAVAGE_FB_SIZE_S3 0x01000000 /* 16MB */
#define SAVAGE_FB_SIZE_S4 0x02000000 /* 32MB */
@@ -499,15 +499,6 @@ extern void savage_emit_clip_rect_s4(drm_savage_private_t *dev_priv,
#define BCI_WRITE( val ) *bci_ptr++ = (uint32_t)(val)
-#define BCI_COPY_FROM_USER(src,n) do { \
- unsigned int i; \
- for (i = 0; i < n; ++i) { \
- uint32_t val; \
- DRM_GET_USER_UNCHECKED(val, &((uint32_t*)(src))[i]); \
- BCI_WRITE(val); \
- } \
-} while(0)
-
/*
* command DMA support
*/
@@ -533,8 +524,8 @@ extern void savage_emit_clip_rect_s4(drm_savage_private_t *dev_priv,
#define DMA_WRITE( val ) *dma_ptr++ = (uint32_t)(val)
-#define DMA_COPY_FROM_USER(src,n) do { \
- DRM_COPY_FROM_USER_UNCHECKED(dma_ptr, (src), (n)*4); \
+#define DMA_COPY(src, n) do { \
+ memcpy(dma_ptr, (src), (n)*4); \
dma_ptr += n; \
} while(0)