diff options
author | Wang Zhenyu <zhenyu.z.wang@intel.com> | 2006-12-04 15:48:04 +0800 |
---|---|---|
committer | Keith Packard <keithp@neko.keithp.com> | 2007-01-06 15:49:23 -0800 |
commit | caf8010652f77e7687c0a3b7c267ba49d0a24d74 (patch) | |
tree | b21776131775e7ec72e5ab57c962226eaa755030 /src/mesa/drivers/dri/nouveau/nouveau_object.c | |
parent | f34cad0f972ca838cb223429acab54d26c2f6a57 (diff) | |
parent | 8c1cc5fd8084e7a927b15c88709a615fa16b06a3 (diff) |
Merge branch 'master' into crestline
Conflicts:
src/mesa/drivers/dri/i965/brw_tex_layout.c
Michel Dänzer replaced the copy of the 945 mipmap layout code with that from
the 945 driver directly.
Diffstat (limited to 'src/mesa/drivers/dri/nouveau/nouveau_object.c')
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_object.c | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_object.c b/src/mesa/drivers/dri/nouveau/nouveau_object.c new file mode 100644 index 0000000000..1558f2963d --- /dev/null +++ b/src/mesa/drivers/dri/nouveau/nouveau_object.c @@ -0,0 +1,92 @@ + +#include "nouveau_fifo.h" +#include "nouveau_object.h" +#include "nouveau_reg.h" + + +GLboolean nouveauCreateContextObject(nouveauContextPtr nmesa, int handle, int class, uint32_t flags, uint32_t dma_in, uint32_t dma_out, uint32_t dma_notifier) +{ + drm_nouveau_object_init_t cto; + int ret; + + cto.handle = handle; + cto.class = class; + cto.flags = flags; + cto.dma0= dma_in; + cto.dma1= dma_out; + cto.dma_notifier = dma_notifier; + ret = drmCommandWrite(nmesa->driFd, DRM_NOUVEAU_OBJECT_INIT, &cto, sizeof(cto)); + + return ret == 0; +} + +GLboolean nouveauCreateDmaObject(nouveauContextPtr nmesa, + uint32_t handle, + uint32_t offset, + uint32_t size, + int target, + int access) +{ + drm_nouveau_dma_object_init_t dma; + int ret; + + dma.handle = handle; + dma.target = target; + dma.access = access; + dma.offset = offset; + dma.size = size; + ret = drmCommandWriteRead(nmesa->driFd, DRM_NOUVEAU_DMA_OBJECT_INIT, + &dma, sizeof(dma)); + return ret == 0; +} + +void nouveauObjectOnSubchannel(nouveauContextPtr nmesa, int subchannel, int handle) +{ + BEGIN_RING_SIZE(subchannel, 0, 1); + OUT_RING(handle); +} + +void nouveauObjectInit(nouveauContextPtr nmesa) +{ +#ifdef NOUVEAU_RING_DEBUG + return; +#endif + +/* We need to know vram size.. and AGP size (and even if the card is AGP..) */ + nouveauCreateDmaObject( nmesa, NvDmaFB, + 0, (256*1024*1024), + 0 /*NV_DMA_TARGET_FB*/, 0 /*NV_DMA_ACCESS_RW*/); + nouveauCreateDmaObject( nmesa, NvDmaAGP, + nmesa->agp_phys, (128*1024*1024), + 3 /* AGP */, 0 /* RW */); + + nouveauCreateContextObject(nmesa, Nv3D, nmesa->screen->card->class_3d, + 0, 0, 0, 0); + nouveauCreateContextObject(nmesa, NvCtxSurf2D, NV10_CONTEXT_SURFACES_2D, + 0, 0, 0, 0); + nouveauCreateContextObject(nmesa, NvImageBlit, NV10_IMAGE_BLIT, + NV_DMA_CONTEXT_FLAGS_PATCH_SRCCOPY, 0, 0, 0); + nouveauCreateContextObject(nmesa, NvMemFormat, + NV_MEMORY_TO_MEMORY_FORMAT, + 0, 0, 0, 0); + +#ifdef ALLOW_MULTI_SUBCHANNEL + nouveauObjectOnSubchannel(nmesa, NvSubCtxSurf2D, NvCtxSurf2D); + BEGIN_RING_SIZE(NvSubCtxSurf2D, NV10_CONTEXT_SURFACES_2D_SET_DMA_IN_MEMORY0, 2); + OUT_RING(NvDmaFB); + OUT_RING(NvDmaFB); + + nouveauObjectOnSubchannel(nmesa, NvSubImageBlit, NvImageBlit); + BEGIN_RING_SIZE(NvSubImageBlit, NV10_IMAGE_BLIT_SET_CONTEXT_SURFACES_2D, 1); + OUT_RING(NvCtxSurf2D); + BEGIN_RING_SIZE(NvSubImageBlit, NV10_IMAGE_BLIT_SET_OPERATION, 1); + OUT_RING(3); /* SRCCOPY */ + + nouveauObjectOnSubchannel(nmesa, NvSubMemFormat, NvMemFormat); +#endif + + nouveauObjectOnSubchannel(nmesa, NvSub3D, Nv3D); +} + + + |