radeonsi: remove redundant call to emit_cache_flush in compute clear/copy
[mesa.git] / src / gallium / drivers / radeonsi / si_texture.c
index 2fb79253a72dc746bca4de90d1973517de81d02a..c169d4e443dd478aa108f2ca0896d668999ace1a 100644 (file)
@@ -303,7 +303,7 @@ static int si_init_surface(struct si_screen *sscreen,
                flags |= RADEON_SURF_SHAREABLE;
        if (is_imported)
                flags |= RADEON_SURF_IMPORTED | RADEON_SURF_SHAREABLE;
-       if (!(ptex->flags & SI_RESOURCE_FLAG_FORCE_TILING))
+       if (!(ptex->flags & SI_RESOURCE_FLAG_FORCE_MSAA_TILING))
                flags |= RADEON_SURF_OPTIMIZE_FOR_SPACE;
 
        r = sscreen->ws->surface_init(sscreen->ws, ptex, flags, bpe,
@@ -1293,7 +1293,7 @@ si_choose_tiling(struct si_screen *sscreen,
                 const struct pipe_resource *templ, bool tc_compatible_htile)
 {
        const struct util_format_description *desc = util_format_description(templ->format);
-       bool force_tiling = templ->flags & SI_RESOURCE_FLAG_FORCE_TILING;
+       bool force_tiling = templ->flags & SI_RESOURCE_FLAG_FORCE_MSAA_TILING;
        bool is_depth_stencil = util_format_is_depth_or_stencil(templ->format) &&
                                !(templ->flags & SI_RESOURCE_FLAG_FLUSHED_DEPTH);
 
@@ -1487,7 +1487,9 @@ static struct pipe_resource *si_texture_from_handle(struct pipe_screen *screen,
              templ->depth0 != 1 || templ->last_level != 0)
                return NULL;
 
-       buf = sscreen->ws->buffer_from_handle(sscreen->ws, whandle, &stride, &offset);
+       buf = sscreen->ws->buffer_from_handle(sscreen->ws, whandle,
+                                             sscreen->info.max_alignment,
+                                             &stride, &offset);
        if (!buf)
                return NULL;
 
@@ -1796,6 +1798,12 @@ static void *si_texture_transfer_map(struct pipe_context *ctx,
                buf = &tex->buffer;
        }
 
+       /* Always unmap texture CPU mappings on 32-bit architectures, so that
+        * we don't run out of the CPU address space.
+        */
+       if (sizeof(void*) == 4)
+               usage |= RADEON_TRANSFER_TEMPORARY;
+
        if (!(map = si_buffer_map_sync_with_rings(sctx, buf, usage)))
                goto fail_trans;
 
@@ -1817,6 +1825,16 @@ static void si_texture_transfer_unmap(struct pipe_context *ctx,
        struct pipe_resource *texture = transfer->resource;
        struct si_texture *tex = (struct si_texture*)texture;
 
+       /* Always unmap texture CPU mappings on 32-bit architectures, so that
+        * we don't run out of the CPU address space.
+        */
+       if (sizeof(void*) == 4) {
+               struct r600_resource *buf =
+                       stransfer->staging ? stransfer->staging : &tex->buffer;
+
+               sctx->ws->buffer_unmap(buf->buf);
+       }
+
        if ((transfer->usage & PIPE_TRANSFER_WRITE) && stransfer->staging) {
                if (tex->is_depth && tex->buffer.b.b.nr_samples <= 1) {
                        ctx->resource_copy_region(ctx, texture, transfer->level,
@@ -2281,11 +2299,10 @@ void vi_separate_dcc_process_and_reset_stats(struct pipe_context *ctx,
                union pipe_query_result result;
 
                /* Read the results. */
-               ctx->get_query_result(ctx, sctx->dcc_stats[i].ps_stats[2],
+               struct pipe_query *query = sctx->dcc_stats[i].ps_stats[2];
+               ctx->get_query_result(ctx, query,
                                      true, &result);
-               si_query_hw_reset_buffers(sctx,
-                                         (struct si_query_hw*)
-                                         sctx->dcc_stats[i].ps_stats[2]);
+               si_query_buffer_reset(sctx, &((struct si_query_hw*)query)->buffer);
 
                /* Compute the approximate number of fullscreen draws. */
                tex->ps_draw_ratio =
@@ -2338,6 +2355,7 @@ si_memobj_from_handle(struct pipe_screen *screen,
                return NULL;
 
        buf = sscreen->ws->buffer_from_handle(sscreen->ws, whandle,
+                                             sscreen->info.max_alignment,
                                              &stride, &offset);
        if (!buf) {
                free(memobj);