1 #include "nvfx_context.h"
2 #include "nvfx_resource.h"
5 nvfx_fragtex_validate(struct nvfx_context
*nvfx
)
7 struct nouveau_channel
* chan
= nvfx
->screen
->base
.channel
;
8 unsigned samplers
, unit
;
10 samplers
= nvfx
->dirty_samplers
;
15 unit
= ffs(samplers
) - 1;
16 samplers
&= ~(1 << unit
);
18 if(nvfx
->fragment_sampler_views
[unit
] && nvfx
->tex_sampler
[unit
]) {
20 nv30_fragtex_set(nvfx
, unit
);
22 nv40_fragtex_set(nvfx
, unit
);
25 /* this is OK for nv40 too */
26 OUT_RING(chan
, RING_3D(NV34TCL_TX_ENABLE(unit
), 1));
28 nvfx
->hw_samplers
&= ~(1 << unit
);
31 nvfx
->dirty_samplers
= 0;
35 nvfx_fragtex_relocate(struct nvfx_context
*nvfx
)
37 struct nouveau_channel
* chan
= nvfx
->screen
->base
.channel
;
38 unsigned samplers
, unit
;
39 unsigned tex_flags
= NOUVEAU_BO_VRAM
| NOUVEAU_BO_GART
| NOUVEAU_BO_RD
;
41 samplers
= nvfx
->hw_samplers
;
43 struct nvfx_miptree
* mt
;
44 struct nouveau_bo
*bo
;
46 unit
= ffs(samplers
) - 1;
47 samplers
&= ~(1 << unit
);
49 mt
= (struct nvfx_miptree
*)nvfx
->fragment_sampler_views
[unit
]->texture
;
52 MARK_RING(chan
, 3, 3);
53 OUT_RELOC(chan
, bo
, RING_3D(NV34TCL_TX_OFFSET(unit
), 2), tex_flags
| NOUVEAU_BO_DUMMY
, 0, 0);
54 OUT_RELOC(chan
, bo
, 0, tex_flags
| NOUVEAU_BO_LOW
| NOUVEAU_BO_DUMMY
, 0, 0);
55 OUT_RELOC(chan
, bo
, nvfx
->hw_txf
[unit
], tex_flags
| NOUVEAU_BO_OR
| NOUVEAU_BO_DUMMY
,
56 NV34TCL_TX_FORMAT_DMA0
, NV34TCL_TX_FORMAT_DMA1
);