gallium: Preparations for adding more PIPE_TRANSFER_* usage flags.
[mesa.git] / src / gallium / drivers / nv50 / nv50_transfer.c
index d2b5e4d75d4082f0860dfa2839819775b46dbd35..9c289026bbb14498adccdfa5f1ee602794c71416 100644 (file)
@@ -89,14 +89,14 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen,
                if (src_bo->tile_flags) {
                        BEGIN_RING(chan, m2mf,
                                NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_IN, 1);
-                       OUT_RING  (chan, (sy << 16) | sx);
+                       OUT_RING  (chan, (sy << 16) | (sx * cpp));
                } else {
                        src_offset += (line_count * src_pitch);
                }
                if (dst_bo->tile_flags) {
                        BEGIN_RING(chan, m2mf,
                                NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_OUT, 1);
-                       OUT_RING  (chan, (dy << 16) | dx);
+                       OUT_RING  (chan, (dy << 16) | (dx * cpp));
                } else {
                        dst_offset += (line_count * dst_pitch);
                }
@@ -148,8 +148,8 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
        tx->base.usage = usage;
 
        tx->level_pitch = lvl->pitch;
-       tx->level_width = mt->base.width[level];
-       tx->level_height = mt->base.height[level];
+       tx->level_width = mt->base.base.width[level];
+       tx->level_height = mt->base.base.height[level];
        tx->level_offset = lvl->image_offset[image];
        tx->level_tiling = lvl->tile_mode;
        tx->level_x = x;
@@ -161,8 +161,8 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
                return NULL;
        }
 
-       if (usage != PIPE_TRANSFER_WRITE) {
-               nv50_transfer_rect_m2mf(pscreen, mt->bo, tx->level_offset,
+       if (usage & PIPE_TRANSFER_READ) {
+               nv50_transfer_rect_m2mf(pscreen, mt->base.bo, tx->level_offset,
                                        tx->level_pitch, tx->level_tiling,
                                        x, y,
                                        tx->level_width, tx->level_height,
@@ -183,12 +183,12 @@ nv50_transfer_del(struct pipe_transfer *ptx)
        struct nv50_transfer *tx = (struct nv50_transfer *)ptx;
        struct nv50_miptree *mt = nv50_miptree(ptx->texture);
 
-       if (ptx->usage != PIPE_TRANSFER_READ) {
+       if (ptx->usage & PIPE_TRANSFER_WRITE) {
                struct pipe_screen *pscreen = ptx->texture->screen;
                nv50_transfer_rect_m2mf(pscreen, tx->bo, 0, tx->base.stride,
                                        tx->bo->tile_mode, 0, 0,
                                        tx->base.width, tx->base.height,
-                                       mt->bo, tx->level_offset,
+                                       mt->base.bo, tx->level_offset,
                                        tx->level_pitch, tx->level_tiling,
                                        tx->level_x, tx->level_y,
                                        tx->level_width, tx->level_height,