summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephane Marchesin <marchesin@icps.u-strasbg.fr>2006-11-04 16:56:10 +0100
committerStephane Marchesin <marchesin@icps.u-strasbg.fr>2006-11-04 16:56:10 +0100
commit3ea0500be1ab7a058c90be35b5d8d2be26692f6a (patch)
treedf7a504bc2dbd78a3e58e95cb0a1c24c839cd811
parentb5cf0d635c81d2c99510ce5e3f67f4aa593cd6d7 (diff)
Move the context object creation flag handling to the drm.
-rw-r--r--shared-core/nouveau_drm.h7
-rw-r--r--shared-core/nouveau_object.c40
2 files changed, 43 insertions, 4 deletions
diff --git a/shared-core/nouveau_drm.h b/shared-core/nouveau_drm.h
index ed87f5c4..9e996de9 100644
--- a/shared-core/nouveau_drm.h
+++ b/shared-core/nouveau_drm.h
@@ -37,10 +37,15 @@ typedef struct drm_nouveau_fifo_alloc {
}
drm_nouveau_fifo_alloc_t;
+#define NV_DMA_CONTEXT_FLAGS_PATCH_ROP_AND 0x1
+#define NV_DMA_CONTEXT_FLAGS_PATCH_SRCCOPY 0x2
+#define NV_DMA_CONTEXT_FLAGS_CLIP_ENABLE 0x4
+#define NV_DMA_CONTEXT_FLAGS_MONO 0x8
+
typedef struct drm_nouveau_object_init {
uint32_t handle;
int class;
- uint32_t flags0, flags1, flags2;
+ uint32_t flags;
/* these are object handles */
uint32_t dma0;
uint32_t dma1;
diff --git a/shared-core/nouveau_object.c b/shared-core/nouveau_object.c
index 78a4b78f..b539ee65 100644
--- a/shared-core/nouveau_object.c
+++ b/shared-core/nouveau_object.c
@@ -427,7 +427,7 @@ struct nouveau_object *nouveau_dma_object_create(drm_device_t* dev,
set to 0?
*/
static struct nouveau_object *nouveau_context_object_create(drm_device_t* dev,
- int class, uint32_t flags0, uint32_t flags1, uint32_t flags2,
+ int class, uint32_t flags,
struct nouveau_object *dma0,
struct nouveau_object *dma1,
struct nouveau_object *dma_notifier)
@@ -435,6 +435,40 @@ static struct nouveau_object *nouveau_context_object_create(drm_device_t* dev,
drm_nouveau_private_t *dev_priv=dev->dev_private;
struct nouveau_object *obj;
uint32_t d0, d1, dn;
+ uint32_t flags0,flags1,flags2;
+ flags0=0;flags1=0;flags2=0;
+
+ if (dev_priv->card_type >= NV_40) {
+ if (flags & NV_DMA_CONTEXT_FLAGS_PATCH_ROP_AND)
+ flags0 |= 0x02080000;
+ else if (flags & NV_DMA_CONTEXT_FLAGS_PATCH_SRCCOPY)
+ flags0 |= 0x02080000;
+ if (flags & NV_DMA_CONTEXT_FLAGS_CLIP_ENABLE)
+ flags0 |= 0x00020000;
+#ifdef __BIG_ENDIAN
+ if (flags & NV_DMA_CONTEXT_FLAGS_MONO)
+ flags1 |= 0x01000000;
+ flags2 |= 0x01000000;
+#else
+ if (flags & NV_DMA_CONTEXT_FLAGS_MONO)
+ flags1 |= 0x02000000;
+#endif
+ } else {
+ if (flags & NV_DMA_CONTEXT_FLAGS_PATCH_ROP_AND)
+ flags0 |= 0x01008000;
+ else if (flags & NV_DMA_CONTEXT_FLAGS_PATCH_SRCCOPY)
+ flags0 |= 0x01018000;
+ if (flags & NV_DMA_CONTEXT_FLAGS_CLIP_ENABLE)
+ flags0 |= 0x00002000;
+#ifdef __BIG_ENDIAN
+ flags0 |= 0x00080000;
+ if (flags & NV_DMA_CONTEXT_FLAGS_MONO)
+ flags1 |= 0x00000001;
+#else
+ if (flags & NV_DMA_CONTEXT_FLAGS_MONO)
+ flags1 |= 0x00000002;
+#endif
+ }
DRM_DEBUG("class=%x, dma0=%08x, dma1=%08x, dman=%08x\n",
class,
@@ -536,8 +570,8 @@ int nouveau_ioctl_object_init(DRM_IOCTL_ARGS)
return DRM_ERR(EINVAL);
}
- obj = nouveau_context_object_create(dev, init.class, init.flags0,
- init.flags1, init.flags2, dma0, dma1, dman);
+ obj = nouveau_context_object_create(dev, init.class, init.flags,
+ dma0, dma1, dman);
if (!obj)
return DRM_ERR(ENOMEM);