Merge remote branch 'origin/master' into gallium_draw_llvm
[mesa.git] / src / gallium / drivers / nv50 / nv50_transfer.c
index 4d9afa6fedc7342d7b53832ab2ecb166df295c2a..9eb223eca65583415652eb8e478cd40fcdc72758 100644 (file)
@@ -1,6 +1,6 @@
 
 #include "pipe/p_context.h"
-#include "pipe/p_inlines.h"
+#include "util/u_inlines.h"
 #include "util/u_format.h"
 #include "util/u_math.h"
 
@@ -47,7 +47,7 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen,
                        NV50_MEMORY_TO_MEMORY_FORMAT_LINEAR_IN, 1);
                OUT_RING  (chan, 1);
                BEGIN_RING(chan, m2mf,
-                       NV50_MEMORY_TO_MEMORY_FORMAT_PITCH_IN, 1);
+                       NV04_MEMORY_TO_MEMORY_FORMAT_PITCH_IN, 1);
                OUT_RING  (chan, src_pitch);
                src_offset += (sy * src_pitch) + (sx * cpp);
        } else {
@@ -66,7 +66,7 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen,
                        NV50_MEMORY_TO_MEMORY_FORMAT_LINEAR_OUT, 1);
                OUT_RING  (chan, 1);
                BEGIN_RING(chan, m2mf,
-                       NV50_MEMORY_TO_MEMORY_FORMAT_PITCH_OUT, 1);
+                       NV04_MEMORY_TO_MEMORY_FORMAT_PITCH_OUT, 1);
                OUT_RING  (chan, dst_pitch);
                dst_offset += (dy * dst_pitch) + (dx * cpp);
        } else {
@@ -89,7 +89,7 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen,
                OUT_RELOCh(chan, src_bo, src_offset, src_reloc);
                OUT_RELOCh(chan, dst_bo, dst_offset, dst_reloc);
                BEGIN_RING(chan, m2mf,
-                       NV50_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN, 2);
+                       NV04_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN, 2);
                OUT_RELOCl(chan, src_bo, src_offset, src_reloc);
                OUT_RELOCl(chan, dst_bo, dst_offset, dst_reloc);
                if (src_bo->tile_flags) {
@@ -107,7 +107,7 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen,
                        dst_offset += (line_count * dst_pitch);
                }
                BEGIN_RING(chan, m2mf,
-                       NV50_MEMORY_TO_MEMORY_FORMAT_LINE_LENGTH_IN, 4);
+                       NV04_MEMORY_TO_MEMORY_FORMAT_LINE_LENGTH_IN, 4);
                OUT_RING  (chan, width * cpp);
                OUT_RING  (chan, line_count);
                OUT_RING  (chan, 0x00000101);
@@ -121,11 +121,12 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen,
 }
 
 static struct pipe_transfer *
-nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
+nv50_transfer_new(struct pipe_context *pcontext, struct pipe_texture *pt,
                  unsigned face, unsigned level, unsigned zslice,
                  enum pipe_transfer_usage usage,
                  unsigned x, unsigned y, unsigned w, unsigned h)
 {
+        struct pipe_screen *pscreen = pcontext->screen;
        struct nouveau_device *dev = nouveau_screen(pscreen)->device;
        struct nv50_miptree *mt = nv50_miptree(pt);
        struct nv50_miptree_level *lvl = &mt->level[level];
@@ -186,7 +187,7 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
 }
 
 static void
-nv50_transfer_del(struct pipe_transfer *ptx)
+nv50_transfer_del(struct pipe_context *pcontext, struct pipe_transfer *ptx)
 {
        struct nv50_transfer *tx = (struct nv50_transfer *)ptx;
        struct nv50_miptree *mt = nv50_miptree(ptx->texture);
@@ -196,7 +197,7 @@ nv50_transfer_del(struct pipe_transfer *ptx)
        unsigned ny = util_format_get_nblocksy(pt->format, tx->base.height);
 
        if (ptx->usage & PIPE_TRANSFER_WRITE) {
-               struct pipe_screen *pscreen = pt->screen;
+               struct pipe_screen *pscreen = pcontext->screen;
 
                nv50_transfer_rect_m2mf(pscreen, tx->bo, 0,
                                        tx->base.stride, tx->bo->tile_mode,
@@ -218,7 +219,7 @@ nv50_transfer_del(struct pipe_transfer *ptx)
 }
 
 static void *
-nv50_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+nv50_transfer_map(struct pipe_context *pcontext, struct pipe_transfer *ptx)
 {
        struct nv50_transfer *tx = (struct nv50_transfer *)ptx;
        unsigned flags = 0;
@@ -236,7 +237,7 @@ nv50_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
 }
 
 static void
-nv50_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
+nv50_transfer_unmap(struct pipe_context *pcontext, struct pipe_transfer *ptx)
 {
        struct nv50_transfer *tx = (struct nv50_transfer *)ptx;
 
@@ -244,12 +245,12 @@ nv50_transfer_unmap(struct pipe_screen *pscreen, struct pipe_transfer *ptx)
 }
 
 void
-nv50_transfer_init_screen_functions(struct pipe_screen *pscreen)
+nv50_init_transfer_functions(struct nv50_context *nv50)
 {
-       pscreen->get_tex_transfer = nv50_transfer_new;
-       pscreen->tex_transfer_destroy = nv50_transfer_del;
-       pscreen->transfer_map = nv50_transfer_map;
-       pscreen->transfer_unmap = nv50_transfer_unmap;
+       nv50->pipe.get_tex_transfer = nv50_transfer_new;
+       nv50->pipe.tex_transfer_destroy = nv50_transfer_del;
+       nv50->pipe.transfer_map = nv50_transfer_map;
+       nv50->pipe.transfer_unmap = nv50_transfer_unmap;
 }
 
 void
@@ -291,7 +292,7 @@ nv50_upload_sifc(struct nv50_context *nv50,
 
        /* NV50_2D_OPERATION_SRCCOPY assumed already set */
 
-       BEGIN_RING(chan, eng2d, NV50_2D_SIFC_UNK0800, 2);
+       BEGIN_RING(chan, eng2d, NV50_2D_SIFC_BITMAP_ENABLE, 2);
        OUT_RING  (chan, 0);
        OUT_RING  (chan, src_format);
        BEGIN_RING(chan, eng2d, NV50_2D_SIFC_WIDTH, 10);
@@ -313,7 +314,7 @@ nv50_upload_sifc(struct nv50_context *nv50,
                while (count) {
                        unsigned nr = MIN2(count, 1792);
 
-                       if (chan->pushbuf->remaining <= nr) {
+                       if (AVAIL_RING(chan) <= nr) {
                                FIRE_RING (chan);
 
                                BEGIN_RING(chan, eng2d,
@@ -321,7 +322,7 @@ nv50_upload_sifc(struct nv50_context *nv50,
                                OUT_RELOCh(chan, bo, dst_offset, reloc);
                                OUT_RELOCl(chan, bo, dst_offset, reloc);
                        }
-                       assert(chan->pushbuf->remaining > nr);
+                       assert(AVAIL_RING(chan) > nr);
 
                        BEGIN_RING(chan, eng2d,
                                   NV50_2D_SIFC_DATA | (2 << 29), nr);
@@ -334,6 +335,6 @@ nv50_upload_sifc(struct nv50_context *nv50,
                src += src_pitch;
        }
 
-       BEGIN_RING(chan, tesla, 0x1440, 1);
+       BEGIN_RING(chan, tesla, NV50TCL_CODE_CB_FLUSH, 1);
        OUT_RING  (chan, 0);
 }