2 #include "nouveau_fifo.h"
3 #include "nouveau_object.h"
4 #include "nouveau_reg.h"
7 GLboolean
nouveauCreateContextObject(nouveauContextPtr nmesa
,
8 uint32_t handle
, int class)
10 drm_nouveau_object_init_t cto
;
13 cto
.channel
= nmesa
->fifo
.channel
;
16 ret
= drmCommandWrite(nmesa
->driFd
, DRM_NOUVEAU_OBJECT_INIT
, &cto
, sizeof(cto
));
21 GLboolean
nouveauCreateDmaObject(nouveauContextPtr nmesa
,
29 drm_nouveau_dma_object_init_t dma
;
32 dma
.channel
= nmesa
->fifo
.channel
;
39 ret
= drmCommandWriteRead(nmesa
->driFd
, DRM_NOUVEAU_DMA_OBJECT_INIT
,
44 GLboolean
nouveauCreateDmaObjectFromMem(nouveauContextPtr nmesa
,
45 uint32_t handle
, int class,
49 uint32_t offset
= mem
->offset
;
50 int target
= mem
->type
& (NOUVEAU_MEM_FB
| NOUVEAU_MEM_AGP
);
55 if (target
& NOUVEAU_MEM_FB
)
56 offset
-= nmesa
->vram_phys
;
57 else if (target
& NOUVEAU_MEM_AGP
)
58 offset
-= nmesa
->agp_phys
;
60 return nouveauCreateDmaObject(nmesa
, handle
, class,
65 void nouveauObjectOnSubchannel(nouveauContextPtr nmesa
, int subchannel
, int handle
)
67 BEGIN_RING_SIZE(subchannel
, 0, 1);
71 void nouveauObjectInit(nouveauContextPtr nmesa
)
73 #ifdef NOUVEAU_RING_DEBUG
77 /* We need to know vram size.. and AGP size (and even if the card is AGP..) */
78 nouveauCreateDmaObject( nmesa
, NvDmaFB
, NV_DMA_IN_MEMORY
,
81 NOUVEAU_MEM_ACCESS_RW
);
82 nouveauCreateDmaObject( nmesa
, NvDmaAGP
, NV_DMA_IN_MEMORY
,
85 NOUVEAU_MEM_ACCESS_RW
);
87 nouveauCreateContextObject(nmesa
, Nv3D
, nmesa
->screen
->card
->class_3d
);
88 if (nmesa
->screen
->card
->type
>=NV_10
) {
89 nouveauCreateContextObject(nmesa
, NvCtxSurf2D
, NV10_CONTEXT_SURFACES_2D
);
90 nouveauCreateContextObject(nmesa
, NvImageBlit
, NV10_IMAGE_BLIT
);
92 nouveauCreateContextObject(nmesa
, NvCtxSurf2D
, NV04_CONTEXT_SURFACES_2D
);
93 nouveauCreateContextObject(nmesa
, NvCtxSurf3D
, NV04_CONTEXT_SURFACES_3D
);
94 nouveauCreateContextObject(nmesa
, NvImageBlit
, NV_IMAGE_BLIT
);
96 nouveauCreateContextObject(nmesa
, NvMemFormat
, NV_MEMORY_TO_MEMORY_FORMAT
);
98 #ifdef ALLOW_MULTI_SUBCHANNEL
99 nouveauObjectOnSubchannel(nmesa
, NvSubCtxSurf2D
, NvCtxSurf2D
);
100 BEGIN_RING_SIZE(NvSubCtxSurf2D
, NV10_CONTEXT_SURFACES_2D_SET_DMA_IN_MEMORY0
, 2);
104 nouveauObjectOnSubchannel(nmesa
, NvSubImageBlit
, NvImageBlit
);
105 BEGIN_RING_SIZE(NvSubImageBlit
, NV10_IMAGE_BLIT_SET_CONTEXT_SURFACES_2D
, 1);
106 OUT_RING(NvCtxSurf2D
);
107 BEGIN_RING_SIZE(NvSubImageBlit
, NV10_IMAGE_BLIT_SET_OPERATION
, 1);
108 OUT_RING(3); /* SRCCOPY */
110 nouveauObjectOnSubchannel(nmesa
, NvSubMemFormat
, NvMemFormat
);
113 nouveauObjectOnSubchannel(nmesa
, NvSub3D
, Nv3D
);