nouveau: remove an unused table
[mesa.git] / src / mesa / drivers / dri / nouveau / nouveau_object.c
index 9003fb1eaeea852bea5b1b35d03948283bd3d674..302009c8b170dba96ce5faba195d9538fd00f76e 100644 (file)
@@ -1,10 +1,10 @@
 
 #include "nouveau_fifo.h"
 #include "nouveau_object.h"
+#include "nouveau_reg.h"
 
 
-static GLboolean NVDmaCreateContextObject(nouveauContextPtr nmesa, int handle, int class, uint32_t flags,
-                             uint32_t dma_in, uint32_t dma_out, uint32_t dma_notifier)
+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;
@@ -20,7 +20,27 @@ static GLboolean NVDmaCreateContextObject(nouveauContextPtr nmesa, int handle, i
        return ret == 0;
 }
 
-static void nouveauObjectOnSubchannel(nouveauContextPtr nmesa, int handle, int subchannel)
+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);
@@ -28,7 +48,52 @@ static void nouveauObjectOnSubchannel(nouveauContextPtr nmesa, int handle, int s
 
 void nouveauObjectInit(nouveauContextPtr nmesa)
 {
-       NVDmaCreateContextObject(nmesa, Nv3D, nmesa->screen->card->class_3d, 0, 0, 0, 0);
+#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);
+       if (nmesa->screen->card->type>=NV_10) {
+               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);
+       } else {
+               nouveauCreateContextObject(nmesa, NvCtxSurf2D, NV04_CONTEXT_SURFACES_2D,
+                                  0, 0, 0, 0);
+               nouveauCreateContextObject(nmesa, NvCtxSurf3D, NV04_CONTEXT_SURFACES_3D,
+                                  0, 0, 0, 0);
+               nouveauCreateContextObject(nmesa, NvImageBlit, NV_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);
 }