unsigned clearValue)
{
struct nv50_context *nv50 = nv50_context(pipe);
+ struct nouveau_channel *chan = nv50->screen->nvws->channel;
+ struct nouveau_grobj *tesla = nv50->screen->tesla;
struct pipe_framebuffer_state fb, s_fb = nv50->framebuffer;
struct pipe_scissor_state sc, s_sc = nv50->scissor;
unsigned dirty = nv50->dirty;
switch (ps->format) {
case PIPE_FORMAT_A8R8G8B8_UNORM:
- BEGIN_RING(tesla, 0x0d80, 4);
- OUT_RINGf (ubyte_to_float((clearValue >> 16) & 0xff));
- OUT_RINGf (ubyte_to_float((clearValue >> 8) & 0xff));
- OUT_RINGf (ubyte_to_float((clearValue >> 0) & 0xff));
- OUT_RINGf (ubyte_to_float((clearValue >> 24) & 0xff));
- BEGIN_RING(tesla, 0x19d0, 1);
- OUT_RING (0x3c);
+ BEGIN_RING(chan, tesla, 0x0d80, 4);
+ OUT_RINGf (chan, ubyte_to_float((clearValue >> 16) & 0xff));
+ OUT_RINGf (chan, ubyte_to_float((clearValue >> 8) & 0xff));
+ OUT_RINGf (chan, ubyte_to_float((clearValue >> 0) & 0xff));
+ OUT_RINGf (chan, ubyte_to_float((clearValue >> 24) & 0xff));
+ BEGIN_RING(chan, tesla, 0x19d0, 1);
+ OUT_RING (chan, 0x3c);
break;
case PIPE_FORMAT_Z24S8_UNORM:
- BEGIN_RING(tesla, 0x0d90, 1);
- OUT_RINGf ((float)(clearValue >> 8) * (1.0 / 16777215.0));
- BEGIN_RING(tesla, 0x0da0, 1);
- OUT_RING (clearValue & 0xff);
- BEGIN_RING(tesla, 0x19d0, 1);
- OUT_RING (0x03);
+ BEGIN_RING(chan, tesla, 0x0d90, 1);
+ OUT_RINGf (chan, (float)(clearValue >> 8) * (1.0 / 16777215.0));
+ BEGIN_RING(chan, tesla, 0x0da0, 1);
+ OUT_RING (chan, clearValue & 0xff);
+ BEGIN_RING(chan, tesla, 0x19d0, 1);
+ OUT_RING (chan, 0x03);
break;
default:
pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height,
{
struct nv50_context *nv50 = (struct nv50_context *)pipe;
- FIRE_RING(fence);
+ FIRE_RING(nv50->screen->nvws->channel);
}
static void
#include "nouveau/nouveau_gldefs.h"
#include "nouveau/nouveau_stateobj.h"
-#define NOUVEAU_PUSH_CONTEXT(ctx) \
- struct nv50_screen *ctx = nv50->screen
-#include "nouveau/nouveau_push.h"
-
#include "nv50_screen.h"
#include "nv50_program.h"
nv50_program_upload_data(struct nv50_context *nv50, float *map,
unsigned start, unsigned count)
{
+ struct nouveau_channel *chan = nv50->screen->nvws->channel;
+ struct nouveau_grobj *tesla = nv50->screen->tesla;
+
while (count) {
unsigned nr = count > 2047 ? 2047 : count;
- BEGIN_RING(tesla, 0x00000f00, 1);
- OUT_RING ((NV50_CB_PMISC << 0) | (start << 8));
- BEGIN_RING(tesla, 0x40000f04, nr);
- OUT_RINGp (map, nr);
+ BEGIN_RING(chan, tesla, 0x00000f00, 1);
+ OUT_RING (chan, (NV50_CB_PMISC << 0) | (start << 8));
+ BEGIN_RING(chan, tesla, 0x40000f04, nr);
+ OUT_RINGp (chan, map, nr);
map += nr;
start += nr;
static void
nv50_program_validate_code(struct nv50_context *nv50, struct nv50_program *p)
{
+ struct nouveau_channel *chan = nv50->screen->nvws->channel;
+ struct nouveau_grobj *tesla = nv50->screen->tesla;
struct pipe_winsys *ws = nv50->pipe.winsys;
struct nv50_program_exec *e;
struct nouveau_stateobj *so;
nr = MIN2(count, 2047);
nr = MIN2(nvws->channel->pushbuf->remaining, nr);
if (nvws->channel->pushbuf->remaining < (nr + 3)) {
- FIRE_RING(NULL);
+ FIRE_RING(chan);
continue;
}
- BEGIN_RING(tesla, 0x0f00, 1);
- OUT_RING ((start << 8) | NV50_CB_PUPLOAD);
- BEGIN_RING(tesla, 0x40000f04, nr);
- OUT_RINGp (up + start, nr);
+ BEGIN_RING(chan, tesla, 0x0f00, 1);
+ OUT_RING (chan, (start << 8) | NV50_CB_PUPLOAD);
+ BEGIN_RING(chan, tesla, 0x40000f04, nr);
+ OUT_RINGp (chan, up + start, nr);
start += nr;
count -= nr;
nv50_query_begin(struct pipe_context *pipe, struct pipe_query *pq)
{
struct nv50_context *nv50 = nv50_context(pipe);
+ struct nouveau_channel *chan = nv50->screen->nvws->channel;
+ struct nouveau_grobj *tesla = nv50->screen->tesla;
struct nv50_query *q = nv50_query(pq);
- BEGIN_RING(tesla, 0x1530, 1);
- OUT_RING (1);
- BEGIN_RING(tesla, 0x1514, 1);
- OUT_RING (1);
+ BEGIN_RING(chan, tesla, 0x1530, 1);
+ OUT_RING (chan, 1);
+ BEGIN_RING(chan, tesla, 0x1514, 1);
+ OUT_RING (chan, 1);
q->ready = FALSE;
}
nv50_query_end(struct pipe_context *pipe, struct pipe_query *pq)
{
struct nv50_context *nv50 = nv50_context(pipe);
+ struct nouveau_channel *chan = nv50->screen->nvws->channel;
+ struct nouveau_grobj *tesla = nv50->screen->tesla;
struct nv50_query *q = nv50_query(pq);
- BEGIN_RING(tesla, 0x1b00, 4);
- OUT_RELOCh(q->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
- OUT_RELOCl(q->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
- OUT_RING (0x00000000);
- OUT_RING (0x0100f002);
- FIRE_RING (NULL);
+ WAIT_RING (chan, 5);
+ BEGIN_RING(chan, tesla, 0x1b00, 4);
+ OUT_RELOCh(chan, q->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+ OUT_RELOCl(chan, q->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+ OUT_RING (chan, 0x00000000);
+ OUT_RING (chan, 0x0100f002);
+ FIRE_RING (chan);
}
static boolean
unsigned count)
{
struct nv50_context *nv50 = nv50_context(pipe);
+ struct nouveau_channel *chan = nv50->screen->nvws->channel;
+ struct nouveau_grobj *tesla = nv50->screen->tesla;
nv50_state_validate(nv50);
- BEGIN_RING(tesla, 0x142c, 1);
- OUT_RING (0);
- BEGIN_RING(tesla, 0x142c, 1);
- OUT_RING (0);
- BEGIN_RING(tesla, 0x1440, 1);
- OUT_RING (0);
- BEGIN_RING(tesla, 0x1334, 1);
- OUT_RING (0);
-
- BEGIN_RING(tesla, NV50TCL_VERTEX_BEGIN, 1);
- OUT_RING (nv50_prim(mode));
- BEGIN_RING(tesla, NV50TCL_VERTEX_BUFFER_FIRST, 2);
- OUT_RING (start);
- OUT_RING (count);
- BEGIN_RING(tesla, NV50TCL_VERTEX_END, 1);
- OUT_RING (0);
+ BEGIN_RING(chan, tesla, 0x142c, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, tesla, 0x142c, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, tesla, 0x1440, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, tesla, 0x1334, 1);
+ OUT_RING (chan, 0);
+
+ BEGIN_RING(chan, tesla, NV50TCL_VERTEX_BEGIN, 1);
+ OUT_RING (chan, nv50_prim(mode));
+ BEGIN_RING(chan, tesla, NV50TCL_VERTEX_BUFFER_FIRST, 2);
+ OUT_RING (chan, start);
+ OUT_RING (chan, count);
+ BEGIN_RING(chan, tesla, NV50TCL_VERTEX_END, 1);
+ OUT_RING (chan, 0);
pipe->flush(pipe, 0, NULL);
return TRUE;
nv50_draw_elements_inline_u08(struct nv50_context *nv50, uint8_t *map,
unsigned start, unsigned count)
{
+ struct nouveau_channel *chan = nv50->screen->nvws->channel;
+ struct nouveau_grobj *tesla = nv50->screen->tesla;
+
map += start;
if (count & 1) {
- BEGIN_RING(tesla, 0x15e8, 1);
- OUT_RING (map[0]);
+ BEGIN_RING(chan, tesla, 0x15e8, 1);
+ OUT_RING (chan, map[0]);
map++;
count--;
}
unsigned nr = count > 2046 ? 2046 : count;
int i;
- BEGIN_RING(tesla, 0x400015f0, nr >> 1);
+ BEGIN_RING(chan, tesla, 0x400015f0, nr >> 1);
for (i = 0; i < nr; i += 2)
- OUT_RING ((map[1] << 16) | map[0]);
+ OUT_RING (chan, (map[1] << 16) | map[0]);
count -= nr;
map += nr;
nv50_draw_elements_inline_u16(struct nv50_context *nv50, uint16_t *map,
unsigned start, unsigned count)
{
+ struct nouveau_channel *chan = nv50->screen->nvws->channel;
+ struct nouveau_grobj *tesla = nv50->screen->tesla;
+
map += start;
if (count & 1) {
- BEGIN_RING(tesla, 0x15e8, 1);
- OUT_RING (map[0]);
+ BEGIN_RING(chan, tesla, 0x15e8, 1);
+ OUT_RING (chan, map[0]);
map++;
count--;
}
unsigned nr = count > 2046 ? 2046 : count;
int i;
- BEGIN_RING(tesla, 0x400015f0, nr >> 1);
+ BEGIN_RING(chan, tesla, 0x400015f0, nr >> 1);
for (i = 0; i < nr; i += 2)
- OUT_RING ((map[1] << 16) | map[0]);
+ OUT_RING (chan, (map[1] << 16) | map[0]);
count -= nr;
map += nr;
nv50_draw_elements_inline_u32(struct nv50_context *nv50, uint8_t *map,
unsigned start, unsigned count)
{
+ struct nouveau_channel *chan = nv50->screen->nvws->channel;
+ struct nouveau_grobj *tesla = nv50->screen->tesla;
+
map += start;
while (count) {
unsigned nr = count > 2047 ? 2047 : count;
- BEGIN_RING(tesla, 0x400015e8, nr);
- OUT_RINGp (map, nr);
+ BEGIN_RING(chan, tesla, 0x400015e8, nr);
+ OUT_RINGp (chan, map, nr);
count -= nr;
map += nr;
unsigned mode, unsigned start, unsigned count)
{
struct nv50_context *nv50 = nv50_context(pipe);
+ struct nouveau_channel *chan = nv50->screen->nvws->channel;
+ struct nouveau_grobj *tesla = nv50->screen->tesla;
struct pipe_winsys *ws = pipe->winsys;
void *map = ws->buffer_map(ws, indexBuffer, PIPE_BUFFER_USAGE_CPU_READ);
nv50_state_validate(nv50);
- BEGIN_RING(tesla, 0x142c, 1);
- OUT_RING (0);
- BEGIN_RING(tesla, 0x142c, 1);
- OUT_RING (0);
+ BEGIN_RING(chan, tesla, 0x142c, 1);
+ OUT_RING (chan, 0);
+ BEGIN_RING(chan, tesla, 0x142c, 1);
+ OUT_RING (chan, 0);
- BEGIN_RING(tesla, NV50TCL_VERTEX_BEGIN, 1);
- OUT_RING (nv50_prim(mode));
+ BEGIN_RING(chan, tesla, NV50TCL_VERTEX_BEGIN, 1);
+ OUT_RING (chan, nv50_prim(mode));
switch (indexSize) {
case 1:
nv50_draw_elements_inline_u08(nv50, map, start, count);
default:
assert(0);
}
- BEGIN_RING(tesla, NV50TCL_VERTEX_END, 1);
- OUT_RING (0);
+ BEGIN_RING(chan, tesla, NV50TCL_VERTEX_END, 1);
+ OUT_RING (chan, 0);
pipe->flush(pipe, 0, NULL);
return TRUE;