From 3ea0500be1ab7a058c90be35b5d8d2be26692f6a Mon Sep 17 00:00:00 2001 From: Stephane Marchesin Date: Sat, 4 Nov 2006 16:56:10 +0100 Subject: Move the context object creation flag handling to the drm. --- shared-core/nouveau_drm.h | 7 ++++++- shared-core/nouveau_object.c | 40 +++++++++++++++++++++++++++++++++++++--- 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); -- cgit v1.2.3