[Mesa-dev] [AppVeyor] mesa master #7350 completed

2018-04-01 Thread AppVeyor


Build mesa 7350 completed



Commit c88e7fe29e by Timothy Arceri on 3/21/2018 2:22 AM:

radeonsi/nir: fix explicit component packing for geom/tess doubles\n\nReviewed-by: Marek Olšák 


Configure your notification preferences

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 53/55] radeonsi: try to fix meson

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

This is not fully tested. Meson can't link LLVM even though automake can.

PATH=/usr/llvm/x86_64-linux-gnu/bin:$PATH meson build/ -Dgallium-va=false \
-Dplatforms=x11,drm -Dgallium-drivers=radeonsi -Ddri-drivers= \
-Dgallium-omx=disabled -Dgallium-xvmc=false -Dgles1=false \
-Dtexture-float=true -Dvulkan-drivers=

src/gallium/auxiliary/libgallium.a(gallivm_lp_bld_misc.cpp.o):
(.data.rel.ro._ZTI26DelegatingJITMemoryManager[_ZTI26DelegatingJITMemoryManager]+0x10):
undefined reference to `typeinfo for llvm::RTDyldMemoryManager'
---
 src/gallium/drivers/radeon/meson.build   | 59 
 src/gallium/drivers/radeonsi/meson.build | 39 +
 src/gallium/meson.build  |  1 -
 3 files changed, 33 insertions(+), 66 deletions(-)
 delete mode 100644 src/gallium/drivers/radeon/meson.build

diff --git a/src/gallium/drivers/radeon/meson.build 
b/src/gallium/drivers/radeon/meson.build
deleted file mode 100644
index 582a5ff..000
--- a/src/gallium/drivers/radeon/meson.build
+++ /dev/null
@@ -1,59 +0,0 @@
-# Copyright © 2017 Dylan Baker
-
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-files_libradeon = files(
-  'r600_buffer_common.c',
-  'r600_cs.h',
-  'r600_gpu_load.c',
-  'r600_perfcounter.c',
-  'r600_pipe_common.c',
-  'r600_pipe_common.h',
-  'r600_query.c',
-  'r600_query.h',
-  'r600_texture.c',
-  'radeon_uvd.c',
-  'radeon_uvd.h',
-  'radeon_vcn_enc_1_2.c',
-  'radeon_vcn_enc.c',
-  'radeon_vcn_enc.h',
-  'radeon_vcn_dec.c',
-  'radeon_vcn_dec.h',
-  'radeon_uvd_enc_1_1.c',
-  'radeon_uvd_enc.c',
-  'radeon_uvd_enc.h',
-  'radeon_vce_40_2_2.c',
-  'radeon_vce_50.c',
-  'radeon_vce_52.c',
-  'radeon_vce.c',
-  'radeon_vce.h',
-  'radeon_video.c',
-  'radeon_video.h',
-  'radeon_winsys.h',
-)
-
-libradeon = static_library(
-  'radeon',
-  files_libradeon,
-  c_args : ['-Wstrict-overflow=0', c_vis_args],
-  dependencies : [dep_llvm, dep_clock],
-  include_directories : [
-inc_include, inc_src, inc_gallium, inc_gallium_aux, inc_gallium_drivers, 
inc_amd_common,
-  ],
-)
diff --git a/src/gallium/drivers/radeonsi/meson.build 
b/src/gallium/drivers/radeonsi/meson.build
index 9a62d14..f817d591 100644
--- a/src/gallium/drivers/radeonsi/meson.build
+++ b/src/gallium/drivers/radeonsi/meson.build
@@ -22,6 +22,8 @@ files_libradeonsi = files(
   'cik_sdma.c',
   'driinfo_radeonsi.h',
   'si_blit.c',
+  'si_buffer.c',
+  'si_build_pm4.h',
   'si_clear.c',
   'si_compute.c',
   'si_compute.h',
@@ -29,15 +31,19 @@ files_libradeonsi = files(
   'si_debug.c',
   'si_descriptors.c',
   'si_dma.c',
+  'si_dma_cs.c',
   'si_fence.c',
   'si_get.c',
-  'si_hw_context.c',
+  'si_gfx_cs.c',
+  'si_gpu_load.c',
+  'si_perfcounter.c',
   'si_pipe.c',
   'si_pipe.h',
   'si_pm4.c',
   'si_pm4.h',
-  'si_perfcounter.c',
   'si_public.h',
+  'si_query.c',
+  'si_query.h',
   'si_shader.c',
   'si_shader.h',
   'si_shader_internal.h',
@@ -46,15 +52,36 @@ files_libradeonsi = files(
   'si_shader_tgsi_mem.c',
   'si_shader_tgsi_setup.c',
   'si_state.c',
+  'si_state.h',
   'si_state_binning.c',
   'si_state_draw.c',
   'si_state_msaa.c',
   'si_state_shaders.c',
   'si_state_streamout.c',
   'si_state_viewport.c',
-  'si_state.h',
   'si_test_dma.c',
+  'si_texture.c',
   'si_uvd.c',
+  '../radeon/r600_perfcounter.c',
+  '../radeon/r600_pipe_common.h',
+  '../radeon/radeon_uvd.c',
+  '../radeon/radeon_uvd.h',
+  '../radeon/radeon_vcn_enc_1_2.c',
+  '../radeon/radeon_vcn_enc.c',
+  '../radeon/radeon_vcn_enc.h',
+  '../radeon/radeon_vcn_dec.c',
+  '../radeon/radeon_vcn_dec.h',
+  '../radeon/radeon_uvd_enc_1_1.c',
+  '../radeon/radeon_uvd_enc.c',
+  '../radeon/radeon_uvd_enc.h',
+  '../radeon/radeon_vce_40_2_2.c',
+  '../radeon/radeon_vce_50.c',
+  '../radeon/radeon_vce_52.c',
+  '../radeon/radeon_vce.c',
+  '../radeon/radeon_vce.h',
+  '../radeon/radeon_video.c',
+  '../radeon/radeon_video.h',
+  '../radeon/radeon_winsys.h',
 

[Mesa-dev] [PATCH 52/55] radeonsi: don't build libradeon.la separately

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

for better parallelism
---
 configure.ac  |  2 --
 src/gallium/Makefile.am   |  5 -
 src/gallium/drivers/radeon/Makefile.am| 29 ---
 src/gallium/drivers/radeon/Makefile.sources   | 21 ---
 src/gallium/drivers/radeonsi/Automake.inc |  1 -
 src/gallium/drivers/radeonsi/Makefile.am  |  7 +++
 src/gallium/drivers/radeonsi/Makefile.sources | 22 +++-
 src/gallium/targets/pipe-loader/Makefile.am   |  1 -
 8 files changed, 28 insertions(+), 60 deletions(-)
 delete mode 100644 src/gallium/drivers/radeon/Makefile.am
 delete mode 100644 src/gallium/drivers/radeon/Makefile.sources

diff --git a/configure.ac b/configure.ac
index e874f8e..c0318c1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2868,7 +2868,6 @@ AM_CONDITIONAL(HAVE_GALLIUM_PL111, test 
"x$HAVE_GALLIUM_PL111" = xyes)
 AM_CONDITIONAL(HAVE_GALLIUM_R300, test "x$HAVE_GALLIUM_R300" = xyes)
 AM_CONDITIONAL(HAVE_GALLIUM_R600, test "x$HAVE_GALLIUM_R600" = xyes)
 AM_CONDITIONAL(HAVE_GALLIUM_RADEONSI, test "x$HAVE_GALLIUM_RADEONSI" = xyes)
-AM_CONDITIONAL(HAVE_GALLIUM_RADEON_COMMON, test "x$HAVE_GALLIUM_RADEONSI" = 
xyes)
 AM_CONDITIONAL(HAVE_GALLIUM_NOUVEAU, test "x$HAVE_GALLIUM_NOUVEAU" = xyes)
 AM_CONDITIONAL(HAVE_GALLIUM_FREEDRENO, test "x$HAVE_GALLIUM_FREEDRENO" = xyes)
 AM_CONDITIONAL(HAVE_GALLIUM_ETNAVIV, test "x$HAVE_GALLIUM_ETNAVIV" = xyes)
@@ -3020,7 +3019,6 @@ AC_CONFIG_FILES([Makefile
  src/gallium/drivers/pl111/Makefile
  src/gallium/drivers/r300/Makefile
  src/gallium/drivers/r600/Makefile
- src/gallium/drivers/radeon/Makefile
  src/gallium/drivers/radeonsi/Makefile
  src/gallium/drivers/rbug/Makefile
  src/gallium/drivers/softpipe/Makefile
diff --git a/src/gallium/Makefile.am b/src/gallium/Makefile.am
index 8170c90..f1fd22c 100644
--- a/src/gallium/Makefile.am
+++ b/src/gallium/Makefile.am
@@ -42,11 +42,6 @@ if HAVE_GALLIUM_R300
 SUBDIRS += drivers/r300
 endif
 
-## radeon - linked into radeonsi
-if HAVE_GALLIUM_RADEON_COMMON
-SUBDIRS += drivers/radeon
-endif
-
 ## r600
 if HAVE_GALLIUM_R600
 SUBDIRS += drivers/r600
diff --git a/src/gallium/drivers/radeon/Makefile.am 
b/src/gallium/drivers/radeon/Makefile.am
deleted file mode 100644
index 1e1d49e..000
--- a/src/gallium/drivers/radeon/Makefile.am
+++ /dev/null
@@ -1,29 +0,0 @@
-include Makefile.sources
-include $(top_srcdir)/src/gallium/Automake.inc
-
-
-AM_CFLAGS = \
-   $(GALLIUM_DRIVER_CFLAGS) \
-   $(RADEON_CFLAGS) \
-   -I$(top_srcdir)/src/amd/common
-
-noinst_LTLIBRARIES = libradeon.la
-
-libradeon_la_SOURCES = \
-   $(C_SOURCES)
-
-if HAVE_GALLIUM_LLVM
-
-AM_CFLAGS += \
-   $(LLVM_CFLAGS)
-
-libradeon_la_LIBADD = \
-   $(CLOCK_LIB) \
-   $(LLVM_LIBS)
-
-libradeon_la_LDFLAGS = \
-   $(LLVM_LDFLAGS)
-
-endif
-
-EXTRA_DIST = meson.build
diff --git a/src/gallium/drivers/radeon/Makefile.sources 
b/src/gallium/drivers/radeon/Makefile.sources
deleted file mode 100644
index fbd1ab6..000
--- a/src/gallium/drivers/radeon/Makefile.sources
+++ /dev/null
@@ -1,21 +0,0 @@
-C_SOURCES := \
-   r600_perfcounter.c \
-   r600_pipe_common.h \
-   radeon_uvd.c \
-   radeon_uvd.h \
-   radeon_vcn_dec.c \
-   radeon_vcn_dec.h \
-   radeon_vcn_enc_1_2.c \
-   radeon_vcn_enc.c \
-   radeon_vcn_enc.h \
-   radeon_uvd_enc_1_1.c \
-   radeon_uvd_enc.c \
-   radeon_uvd_enc.h \
-   radeon_vce_40_2_2.c \
-   radeon_vce_50.c \
-   radeon_vce_52.c \
-   radeon_vce.c \
-   radeon_vce.h \
-   radeon_video.c \
-   radeon_video.h \
-   radeon_winsys.h
diff --git a/src/gallium/drivers/radeonsi/Automake.inc 
b/src/gallium/drivers/radeonsi/Automake.inc
index 6f1843a..740648d 100644
--- a/src/gallium/drivers/radeonsi/Automake.inc
+++ b/src/gallium/drivers/radeonsi/Automake.inc
@@ -16,7 +16,6 @@ TARGET_RADEON_WINSYS = \
$(top_builddir)/src/gallium/winsys/amdgpu/drm/libamdgpuwinsys.la
 
 TARGET_RADEON_COMMON = \
-   $(top_builddir)/src/gallium/drivers/radeon/libradeon.la \
$(top_builddir)/src/amd/common/libamd_common.la
 
 endif
diff --git a/src/gallium/drivers/radeonsi/Makefile.am 
b/src/gallium/drivers/radeonsi/Makefile.am
index b39c559..62b877d 100644
--- a/src/gallium/drivers/radeonsi/Makefile.am
+++ b/src/gallium/drivers/radeonsi/Makefile.am
@@ -37,6 +37,13 @@ noinst_LTLIBRARIES = libradeonsi.la
 
 libradeonsi_la_SOURCES = $(C_SOURCES)
 
+libradeonsi_la_LIBADD = \
+   $(CLOCK_LIB) \
+   $(LLVM_LIBS)
+
+libradeonsi_la_LDFLAGS = \
+   $(LLVM_LDFLAGS)
+
 GEN_DRIINFO_INPUTS = \
$(top_srcdir)/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h \
$(srcdir)/driinfo_radeonsi.h
diff --git a/src/gallium/drivers/radeonsi/Makefile.sources 
b/src/gallium/drivers/radeonsi/Makefile.sources
index 

[Mesa-dev] [PATCH 49/55] radeonsi: remove r600_pipe_common::screen

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_pipe_common.h | 1 -
 src/gallium/drivers/radeonsi/si_debug.c   | 6 +++---
 src/gallium/drivers/radeonsi/si_fence.c   | 2 +-
 src/gallium/drivers/radeonsi/si_gfx_cs.c  | 4 ++--
 src/gallium/drivers/radeonsi/si_pipe.c| 1 -
 src/gallium/drivers/radeonsi/si_state_draw.c  | 4 ++--
 6 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index 81bf386..792f282 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -300,7 +300,6 @@ struct radeon_saved_cs {
 struct r600_common_context {
struct pipe_context b; /* base class */
 
-   struct si_screen*screen;
struct radeon_winsys*ws;
struct radeon_winsys_ctx*ctx;
enum radeon_family  family;
diff --git a/src/gallium/drivers/radeonsi/si_debug.c 
b/src/gallium/drivers/radeonsi/si_debug.c
index 414cb23..f2c32e1 100644
--- a/src/gallium/drivers/radeonsi/si_debug.c
+++ b/src/gallium/drivers/radeonsi/si_debug.c
@@ -553,7 +553,7 @@ static void si_dump_bo_list(struct si_context *sctx,
 
for (i = 0; i < saved->bo_count; i++) {
/* Note: Buffer sizes are expected to be aligned to 4k by the 
winsys. */
-   const unsigned page_size = sctx->b.screen->info.gart_page_size;
+   const unsigned page_size = sctx->screen->info.gart_page_size;
uint64_t va = saved->bo_list[i].vm_address;
uint64_t size = saved->bo_list[i].bo_size;
bool hit = false;
@@ -599,14 +599,14 @@ static void si_dump_framebuffer(struct si_context *sctx, 
struct u_log_context *l
 
rtex = (struct r600_texture*)state->cbufs[i]->texture;
u_log_printf(log, COLOR_YELLOW "Color buffer %i:" COLOR_RESET 
"\n", i);
-   si_print_texture_info(sctx->b.screen, rtex, log);
+   si_print_texture_info(sctx->screen, rtex, log);
u_log_printf(log, "\n");
}
 
if (state->zsbuf) {
rtex = (struct r600_texture*)state->zsbuf->texture;
u_log_printf(log, COLOR_YELLOW "Depth-stencil buffer:" 
COLOR_RESET "\n");
-   si_print_texture_info(sctx->b.screen, rtex, log);
+   si_print_texture_info(sctx->screen, rtex, log);
u_log_printf(log, "\n");
}
 }
diff --git a/src/gallium/drivers/radeonsi/si_fence.c 
b/src/gallium/drivers/radeonsi/si_fence.c
index e43560a..7aa7b1c 100644
--- a/src/gallium/drivers/radeonsi/si_fence.c
+++ b/src/gallium/drivers/radeonsi/si_fence.c
@@ -95,7 +95,7 @@ void si_gfx_write_event_eop(struct si_context *ctx,
query_type != PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE) {
struct r600_resource *scratch = ctx->b.eop_bug_scratch;
 
-   assert(16 * ctx->b.screen->info.num_render_backends <=
+   assert(16 * ctx->screen->info.num_render_backends <=
   scratch->b.b.width0);
radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 2, 0));
radeon_emit(cs, EVENT_TYPE(EVENT_TYPE_ZPASS_DONE) | 
EVENT_INDEX(1));
diff --git a/src/gallium/drivers/radeonsi/si_gfx_cs.c 
b/src/gallium/drivers/radeonsi/si_gfx_cs.c
index cbbf292..d2a580c 100644
--- a/src/gallium/drivers/radeonsi/si_gfx_cs.c
+++ b/src/gallium/drivers/radeonsi/si_gfx_cs.c
@@ -43,7 +43,7 @@ void si_need_gfx_cs_space(struct si_context *ctx)
 * that have been added (cs_add_buffer) and two counters in the pipe
 * driver for those that haven't been added yet.
 */
-   if (unlikely(!radeon_cs_memory_below_limit(ctx->b.screen, ctx->b.gfx_cs,
+   if (unlikely(!radeon_cs_memory_below_limit(ctx->screen, ctx->b.gfx_cs,
   ctx->b.vram, ctx->b.gtt))) {
ctx->b.gtt = 0;
ctx->b.vram = 0;
@@ -104,7 +104,7 @@ void si_flush_gfx_cs(struct si_context *ctx, unsigned flags,
SI_CONTEXT_PS_PARTIAL_FLUSH;
 
/* DRM 3.1.0 doesn't flush TC for VI correctly. */
-   if (ctx->b.chip_class == VI && ctx->b.screen->info.drm_minor <= 1)
+   if (ctx->b.chip_class == VI && ctx->screen->info.drm_minor <= 1)
ctx->b.flags |= SI_CONTEXT_INV_GLOBAL_L2 |
SI_CONTEXT_INV_VMEM_L1;
 
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c 
b/src/gallium/drivers/radeonsi/si_pipe.c
index 7a5b49c..d349e7a 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -347,7 +347,6 @@ static struct pipe_context *si_create_context(struct 
pipe_screen *screen,
slab_create_child(>b.pool_transfers, >pool_transfers);
slab_create_child(>b.pool_transfers_unsync, 

[Mesa-dev] [PATCH 46/55] radeonsi: move r600_query.c/h files to si_query.c/h

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/Makefile.sources  | 2 --
 src/gallium/drivers/radeon/r600_gpu_load.c   | 2 +-
 src/gallium/drivers/radeon/r600_perfcounter.c| 2 +-
 src/gallium/drivers/radeon/r600_pipe_common.h| 6 --
 src/gallium/drivers/radeon/r600_texture.c| 2 +-
 src/gallium/drivers/radeonsi/Makefile.sources| 2 ++
 src/gallium/drivers/radeonsi/si_perfcounter.c| 2 +-
 src/gallium/drivers/radeonsi/si_pipe.h   | 6 ++
 src/gallium/drivers/{radeon/r600_query.c => radeonsi/si_query.c} | 4 ++--
 src/gallium/drivers/{radeon/r600_query.h => radeonsi/si_query.h} | 0
 src/gallium/drivers/radeonsi/si_state.c  | 2 +-
 11 files changed, 15 insertions(+), 15 deletions(-)
 rename src/gallium/drivers/{radeon/r600_query.c => radeonsi/si_query.c} (99%)
 rename src/gallium/drivers/{radeon/r600_query.h => radeonsi/si_query.h} (100%)

diff --git a/src/gallium/drivers/radeon/Makefile.sources 
b/src/gallium/drivers/radeon/Makefile.sources
index 8c355ef..789a347 100644
--- a/src/gallium/drivers/radeon/Makefile.sources
+++ b/src/gallium/drivers/radeon/Makefile.sources
@@ -3,8 +3,6 @@ C_SOURCES := \
r600_gpu_load.c \
r600_perfcounter.c \
r600_pipe_common.h \
-   r600_query.c \
-   r600_query.h \
r600_texture.c \
radeon_uvd.c \
radeon_uvd.h \
diff --git a/src/gallium/drivers/radeon/r600_gpu_load.c 
b/src/gallium/drivers/radeon/r600_gpu_load.c
index 660ac1d..8c457b3 100644
--- a/src/gallium/drivers/radeon/r600_gpu_load.c
+++ b/src/gallium/drivers/radeon/r600_gpu_load.c
@@ -33,7 +33,7 @@
  */
 
 #include "radeonsi/si_pipe.h"
-#include "r600_query.h"
+#include "radeonsi/si_query.h"
 #include "util/os_time.h"
 
 /* For good accuracy at 1000 fps or lower. This will be inaccurate for higher
diff --git a/src/gallium/drivers/radeon/r600_perfcounter.c 
b/src/gallium/drivers/radeon/r600_perfcounter.c
index c5b55cd..57c3246 100644
--- a/src/gallium/drivers/radeon/r600_perfcounter.c
+++ b/src/gallium/drivers/radeon/r600_perfcounter.c
@@ -23,7 +23,7 @@
  */
 
 #include "util/u_memory.h"
-#include "r600_query.h"
+#include "radeonsi/si_query.h"
 #include "radeonsi/si_pipe.h"
 #include "amd/common/sid.h"
 
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index fd94211..1e0bf76 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -434,12 +434,6 @@ unsigned si_end_counter(struct si_screen *sscreen, 
unsigned type,
 /* r600_perfcounters.c */
 void si_perfcounters_destroy(struct si_screen *sscreen);
 
-/* r600_query.c */
-void si_init_screen_query_functions(struct si_screen *sscreen);
-void si_init_query_functions(struct si_context *sctx);
-void si_suspend_queries(struct si_context *sctx);
-void si_resume_queries(struct si_context *sctx);
-
 /* r600_texture.c */
 bool si_prepare_for_dma_blit(struct si_context *sctx,
 struct r600_texture *rdst,
diff --git a/src/gallium/drivers/radeon/r600_texture.c 
b/src/gallium/drivers/radeon/r600_texture.c
index a476164..c1c4315 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -24,7 +24,7 @@
  */
 
 #include "radeonsi/si_pipe.h"
-#include "r600_query.h"
+#include "radeonsi/si_query.h"
 #include "util/u_format.h"
 #include "util/u_log.h"
 #include "util/u_memory.h"
diff --git a/src/gallium/drivers/radeonsi/Makefile.sources 
b/src/gallium/drivers/radeonsi/Makefile.sources
index be9c171..4182b8a 100644
--- a/src/gallium/drivers/radeonsi/Makefile.sources
+++ b/src/gallium/drivers/radeonsi/Makefile.sources
@@ -23,6 +23,8 @@ C_SOURCES := \
si_pm4.h \
si_perfcounter.c \
si_public.h \
+   si_query.c \
+   si_query.h \
si_shader.c \
si_shader.h \
si_shader_internal.h \
diff --git a/src/gallium/drivers/radeonsi/si_perfcounter.c 
b/src/gallium/drivers/radeonsi/si_perfcounter.c
index 0593d55..7ab995c 100644
--- a/src/gallium/drivers/radeonsi/si_perfcounter.c
+++ b/src/gallium/drivers/radeonsi/si_perfcounter.c
@@ -23,7 +23,7 @@
  */
 
 #include "si_build_pm4.h"
-#include "radeon/r600_query.h"
+#include "si_query.h"
 #include "util/u_memory.h"
 
 
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h 
b/src/gallium/drivers/radeonsi/si_pipe.h
index 35a7cf3..00a5f84 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -837,6 +837,12 @@ void si_init_perfcounters(struct si_screen *screen);
 /* si_pipe.c */
 bool si_check_device_reset(struct si_context *sctx);
 
+/* si_query.c */
+void si_init_screen_query_functions(struct si_screen *sscreen);
+void si_init_query_functions(struct si_context *sctx);
+void si_suspend_queries(struct si_context 

[Mesa-dev] [PATCH 51/55] radeonsi: clean up GET_MAX_VIEWPORT_RANGE definition

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeonsi/si_state_viewport.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state_viewport.c 
b/src/gallium/drivers/radeonsi/si_state_viewport.c
index f392c90..09ea584 100644
--- a/src/gallium/drivers/radeonsi/si_state_viewport.c
+++ b/src/gallium/drivers/radeonsi/si_state_viewport.c
@@ -134,7 +134,7 @@ static void si_emit_one_scissor(struct si_context *ctx,
 }
 
 /* the range is [-MAX, MAX] */
-#define GET_MAX_VIEWPORT_RANGE(rctx) (32768)
+#define SI_MAX_VIEWPORT_RANGE 32768
 
 static void si_emit_guardband(struct si_context *ctx,
  struct si_signed_scissor *vp_as_scissor)
@@ -165,7 +165,7 @@ static void si_emit_guardband(struct si_context *ctx,
 *
 * Use a limit one pixel smaller to allow for some precision error.
 */
-   max_range = GET_MAX_VIEWPORT_RANGE(ctx) - 1;
+   max_range = SI_MAX_VIEWPORT_RANGE - 1;
left   = (-max_range - vp.translate[0]) / vp.scale[0];
right  = ( max_range - vp.translate[0]) / vp.scale[0];
top= (-max_range - vp.translate[1]) / vp.scale[1];
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 55/55] radeonsi: remove more R600 references

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeonsi/si_state.c   | 1 -
 src/gallium/drivers/radeonsi/si_texture.c | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state.c 
b/src/gallium/drivers/radeonsi/si_state.c
index d485a29..73e2c9b 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -1846,7 +1846,6 @@ static uint32_t si_translate_texformat(struct pipe_screen 
*screen,
}
 
 out_unknown:
-   /* R600_ERR("Unable to handle texformat %d %s\n", format, 
util_format_name(format)); */
return ~0;
 }
 
diff --git a/src/gallium/drivers/radeonsi/si_texture.c 
b/src/gallium/drivers/radeonsi/si_texture.c
index 25bff21..cce6b90 100644
--- a/src/gallium/drivers/radeonsi/si_texture.c
+++ b/src/gallium/drivers/radeonsi/si_texture.c
@@ -1400,7 +1400,7 @@ si_choose_tiling(struct si_screen *sscreen,
if (sscreen->debug_flags & DBG(NO_TILING))
return RADEON_SURF_MODE_LINEAR_ALIGNED;
 
-   /* Tiling doesn't work with the 422 (SUBSAMPLED) formats on 
R600+. */
+   /* Tiling doesn't work with the 422 (SUBSAMPLED) formats. */
if (desc->layout == UTIL_FORMAT_LAYOUT_SUBSAMPLED)
return RADEON_SURF_MODE_LINEAR_ALIGNED;
 
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 45/55] radeonsi: move r600_cs.h contents into si_pipe.h, si_build_pm4.h

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/Makefile.sources|  1 -
 src/gallium/drivers/radeon/r600_buffer_common.c|  1 -
 src/gallium/drivers/radeon/r600_query.c|  1 -
 src/gallium/drivers/radeon/r600_texture.c  |  1 -
 .../{radeon/r600_cs.h => radeonsi/si_build_pm4.h}  | 87 +-
 src/gallium/drivers/radeonsi/si_compute.c  |  4 +-
 src/gallium/drivers/radeonsi/si_cp_dma.c   |  1 -
 src/gallium/drivers/radeonsi/si_descriptors.c  |  1 -
 src/gallium/drivers/radeonsi/si_dma_cs.c   |  1 -
 src/gallium/drivers/radeonsi/si_fence.c|  3 +-
 src/gallium/drivers/radeonsi/si_gfx_cs.c   |  1 -
 src/gallium/drivers/radeonsi/si_perfcounter.c  |  4 +-
 src/gallium/drivers/radeonsi/si_pipe.h | 79 
 src/gallium/drivers/radeonsi/si_pm4.c  |  1 -
 src/gallium/drivers/radeonsi/si_state.c|  4 +-
 src/gallium/drivers/radeonsi/si_state_binning.c|  4 +-
 src/gallium/drivers/radeonsi/si_state_draw.c   |  4 +-
 src/gallium/drivers/radeonsi/si_state_msaa.c   |  4 +-
 src/gallium/drivers/radeonsi/si_state_shaders.c|  4 +-
 src/gallium/drivers/radeonsi/si_state_streamout.c  |  5 +-
 src/gallium/drivers/radeonsi/si_state_viewport.c   |  4 +-
 21 files changed, 93 insertions(+), 122 deletions(-)
 rename src/gallium/drivers/{radeon/r600_cs.h => radeonsi/si_build_pm4.h} (60%)

diff --git a/src/gallium/drivers/radeon/Makefile.sources 
b/src/gallium/drivers/radeon/Makefile.sources
index 2ecfeb0..8c355ef 100644
--- a/src/gallium/drivers/radeon/Makefile.sources
+++ b/src/gallium/drivers/radeon/Makefile.sources
@@ -1,6 +1,5 @@
 C_SOURCES := \
r600_buffer_common.c \
-   r600_cs.h \
r600_gpu_load.c \
r600_perfcounter.c \
r600_pipe_common.h \
diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c 
b/src/gallium/drivers/radeon/r600_buffer_common.c
index c4f33e3..0af97f4 100644
--- a/src/gallium/drivers/radeon/r600_buffer_common.c
+++ b/src/gallium/drivers/radeon/r600_buffer_common.c
@@ -23,7 +23,6 @@
  */
 
 #include "radeonsi/si_pipe.h"
-#include "r600_cs.h"
 #include "util/u_memory.h"
 #include "util/u_upload_mgr.h"
 #include 
diff --git a/src/gallium/drivers/radeon/r600_query.c 
b/src/gallium/drivers/radeon/r600_query.c
index a2553d1..171f483 100644
--- a/src/gallium/drivers/radeon/r600_query.c
+++ b/src/gallium/drivers/radeon/r600_query.c
@@ -26,7 +26,6 @@
 
 #include "radeonsi/si_pipe.h"
 #include "r600_query.h"
-#include "r600_cs.h"
 #include "util/u_memory.h"
 #include "util/u_upload_mgr.h"
 #include "util/os_time.h"
diff --git a/src/gallium/drivers/radeon/r600_texture.c 
b/src/gallium/drivers/radeon/r600_texture.c
index 00bc89a..a476164 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -24,7 +24,6 @@
  */
 
 #include "radeonsi/si_pipe.h"
-#include "r600_cs.h"
 #include "r600_query.h"
 #include "util/u_format.h"
 #include "util/u_log.h"
diff --git a/src/gallium/drivers/radeon/r600_cs.h 
b/src/gallium/drivers/radeonsi/si_build_pm4.h
similarity index 60%
rename from src/gallium/drivers/radeon/r600_cs.h
rename to src/gallium/drivers/radeonsi/si_build_pm4.h
index f5ef94b..22f5558 100644
--- a/src/gallium/drivers/radeon/r600_cs.h
+++ b/src/gallium/drivers/radeonsi/si_build_pm4.h
@@ -26,90 +26,11 @@
  * This file contains helpers for writing commands to commands streams.
  */
 
-#ifndef R600_CS_H
-#define R600_CS_H
+#ifndef SI_BUILD_PM4_H
+#define SI_BUILD_PM4_H
 
-#include "radeonsi/si_pipe.h"
-#include "amd/common/sid.h"
-
-/**
- * Return true if there is enough memory in VRAM and GTT for the buffers
- * added so far.
- *
- * \param vram  VRAM memory size not added to the buffer list yet
- * \param gtt   GTT memory size not added to the buffer list yet
- */
-static inline bool
-radeon_cs_memory_below_limit(struct si_screen *screen,
-struct radeon_winsys_cs *cs,
-uint64_t vram, uint64_t gtt)
-{
-   vram += cs->used_vram;
-   gtt += cs->used_gart;
-
-   /* Anything that goes above the VRAM size should go to GTT. */
-   if (vram > screen->info.vram_size)
-   gtt += vram - screen->info.vram_size;
-
-   /* Now we just need to check if we have enough GTT. */
-   return gtt < screen->info.gart_size * 0.7;
-}
-
-/**
- * Add a buffer to the buffer list for the given command stream (CS).
- *
- * All buffers used by a CS must be added to the list. This tells the kernel
- * driver which buffers are used by GPU commands. Other buffers can
- * be swapped out (not accessible) during execution.
- *
- * The buffer list becomes empty after every context flush and must be
- * rebuilt.
- */
-static inline void radeon_add_to_buffer_list(struct si_context *sctx,
-struct radeon_winsys_cs *cs,
-

[Mesa-dev] [PATCH 54/55] radeonsi: try to fix android

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/Android.mk|  2 +-
 src/gallium/drivers/radeon/Android.mk | 48 ---
 2 files changed, 1 insertion(+), 49 deletions(-)
 delete mode 100644 src/gallium/drivers/radeon/Android.mk

diff --git a/src/gallium/Android.mk b/src/gallium/Android.mk
index 6f93665..c5f31ef 100644
--- a/src/gallium/Android.mk
+++ b/src/gallium/Android.mk
@@ -41,7 +41,7 @@ SUBDIRS += winsys/nouveau/drm drivers/nouveau
 SUBDIRS += winsys/pl111/drm drivers/pl111
 SUBDIRS += winsys/radeon/drm drivers/r300
 SUBDIRS += winsys/radeon/drm drivers/r600
-SUBDIRS += winsys/radeon/drm winsys/amdgpu/drm drivers/radeonsi drivers/radeon
+SUBDIRS += winsys/radeon/drm winsys/amdgpu/drm drivers/radeonsi
 SUBDIRS += winsys/vc4/drm drivers/vc4
 SUBDIRS += winsys/virgl/drm winsys/virgl/vtest drivers/virgl
 SUBDIRS += winsys/svga/drm drivers/svga
diff --git a/src/gallium/drivers/radeon/Android.mk 
b/src/gallium/drivers/radeon/Android.mk
deleted file mode 100644
index 5efc203..000
--- a/src/gallium/drivers/radeon/Android.mk
+++ /dev/null
@@ -1,48 +0,0 @@
-# Mesa 3-D graphics library
-#
-# Copyright (C) 2011 Chia-I Wu 
-# Copyright (C) 2011 LunarG Inc.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-# DEALINGS IN THE SOFTWARE.
-
-LOCAL_PATH := $(call my-dir)
-
-# get C_SOURCES
-include $(LOCAL_PATH)/Makefile.sources
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(C_SOURCES)
-
-LOCAL_STATIC_LIBRARIES := libmesa_amd_common
-LOCAL_SHARED_LIBRARIES := libdrm_radeon
-LOCAL_MODULE := libmesa_pipe_radeon
-
-ifeq ($(MESA_ENABLE_LLVM),true)
-LOCAL_CFLAGS += -DFORCE_BUILD_AMDGPU   # instructs LLVM to declare 
LLVMInitializeAMDGPU* functions
-$(call mesa-build-with-llvm)
-endif
-
-include $(GALLIUM_COMMON_MK)
-include $(BUILD_STATIC_LIBRARY)
-
-ifneq ($(HAVE_GALLIUM_RADEONSI),)
-$(eval GALLIUM_LIBS += $(LOCAL_MODULE))
-$(eval GALLIUM_SHARED_LIBS += $(LOCAL_SHARED_LIBRARIES))
-endif
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 41/55] radeonsi: move definitions out of r600_pipe_common.h

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_buffer_common.c | 20 +++---
 src/gallium/drivers/radeon/r600_pipe_common.h   | 78 
 src/gallium/drivers/radeon/r600_texture.c   | 28 
 src/gallium/drivers/radeonsi/si_blit.c  |  4 +-
 src/gallium/drivers/radeonsi/si_clear.c |  2 +-
 src/gallium/drivers/radeonsi/si_compute.c   |  2 +-
 src/gallium/drivers/radeonsi/si_cp_dma.c|  2 +-
 src/gallium/drivers/radeonsi/si_get.c   |  4 +-
 src/gallium/drivers/radeonsi/si_pipe.c  |  8 +--
 src/gallium/drivers/radeonsi/si_pipe.h  | 95 ++---
 src/gallium/drivers/radeonsi/si_shader.c|  2 +-
 src/gallium/drivers/radeonsi/si_state_shaders.c |  8 +--
 12 files changed, 125 insertions(+), 128 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c 
b/src/gallium/drivers/radeon/r600_buffer_common.c
index b98065b..c4f33e3 100644
--- a/src/gallium/drivers/radeon/r600_buffer_common.c
+++ b/src/gallium/drivers/radeon/r600_buffer_common.c
@@ -160,7 +160,7 @@ void si_init_resource_fields(struct si_screen *sscreen,
 
/* Tiled textures are unmappable. Always put them in VRAM. */
if ((res->b.b.target != PIPE_BUFFER && !rtex->surface.is_linear) ||
-   res->b.b.flags & R600_RESOURCE_FLAG_UNMAPPABLE) {
+   res->b.b.flags & SI_RESOURCE_FLAG_UNMAPPABLE) {
res->domains = RADEON_DOMAIN_VRAM;
res->flags |= RADEON_FLAG_NO_CPU_ACCESS |
 RADEON_FLAG_GTT_WC;
@@ -175,10 +175,10 @@ void si_init_resource_fields(struct si_screen *sscreen,
if (sscreen->debug_flags & DBG(NO_WC))
res->flags &= ~RADEON_FLAG_GTT_WC;
 
-   if (res->b.b.flags & R600_RESOURCE_FLAG_READ_ONLY)
+   if (res->b.b.flags & SI_RESOURCE_FLAG_READ_ONLY)
res->flags |= RADEON_FLAG_READ_ONLY;
 
-   if (res->b.b.flags & R600_RESOURCE_FLAG_32BIT)
+   if (res->b.b.flags & SI_RESOURCE_FLAG_32BIT)
res->flags |= RADEON_FLAG_32BIT;
 
/* Set expected VRAM and GART usage for the buffer. */
@@ -452,13 +452,13 @@ static void *si_buffer_transfer_map(struct pipe_context 
*ctx,
struct r600_resource *staging = NULL;
 
u_upload_alloc(ctx->stream_uploader, 0,
-   box->width + (box->x % 
R600_MAP_BUFFER_ALIGNMENT),
+   box->width + (box->x % 
SI_MAP_BUFFER_ALIGNMENT),
   sctx->screen->info.tcc_cache_line_size,
   , (struct 
pipe_resource**),
(void**));
 
if (staging) {
-   data += box->x % R600_MAP_BUFFER_ALIGNMENT;
+   data += box->x % SI_MAP_BUFFER_ALIGNMENT;
return si_buffer_get_transfer(ctx, resource, 
usage, box,
ptransfer, 
data, staging, offset);
} else if (rbuffer->flags & RADEON_FLAG_SPARSE) {
@@ -480,11 +480,11 @@ static void *si_buffer_transfer_map(struct pipe_context 
*ctx,
assert(!(usage & TC_TRANSFER_MAP_THREADED_UNSYNC));
staging = (struct r600_resource*) pipe_buffer_create(
ctx->screen, 0, PIPE_USAGE_STAGING,
-   box->width + (box->x % 
R600_MAP_BUFFER_ALIGNMENT));
+   box->width + (box->x % 
SI_MAP_BUFFER_ALIGNMENT));
if (staging) {
/* Copy the VRAM buffer to the staging buffer. */
sctx->b.dma_copy(ctx, >b.b, 0,
-  box->x % R600_MAP_BUFFER_ALIGNMENT,
+  box->x % SI_MAP_BUFFER_ALIGNMENT,
   0, 0, resource, 0, box);
 
data = si_buffer_map_sync_with_rings(sctx, staging,
@@ -493,7 +493,7 @@ static void *si_buffer_transfer_map(struct pipe_context 
*ctx,
r600_resource_reference(, NULL);
return NULL;
}
-   data += box->x % R600_MAP_BUFFER_ALIGNMENT;
+   data += box->x % SI_MAP_BUFFER_ALIGNMENT;
 
return si_buffer_get_transfer(ctx, resource, usage, box,
ptransfer, data, 
staging, 0);
@@ -526,7 +526,7 @@ static void si_buffer_do_flush_region(struct pipe_context 
*ctx,
 
dst = transfer->resource;
src = >staging->b.b;
-   soffset = rtransfer->offset + box->x % 
R600_MAP_BUFFER_ALIGNMENT;
+   soffset = rtransfer->offset + box->x % SI_MAP_BUFFER_ALIGNMENT;
 

[Mesa-dev] [PATCH 39/55] radeonsi: rename r600 -> si in some places

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_buffer_common.c |  80 ++---
 src/gallium/drivers/radeon/r600_cs.h|   4 +-
 src/gallium/drivers/radeon/r600_gpu_load.c  |  28 +-
 src/gallium/drivers/radeon/r600_perfcounter.c   | 168 +-
 src/gallium/drivers/radeon/r600_pipe_common.c   |  18 +-
 src/gallium/drivers/radeon/r600_pipe_common.h   |  52 +--
 src/gallium/drivers/radeon/r600_query.c | 416 
 src/gallium/drivers/radeon/r600_query.h |  74 ++---
 src/gallium/drivers/radeon/r600_texture.c   | 294 -
 src/gallium/drivers/radeonsi/si_perfcounter.c   |   8 +-
 src/gallium/drivers/radeonsi/si_pipe.h  |   4 +-
 src/gallium/drivers/radeonsi/si_state.c |   2 +-
 src/gallium/drivers/radeonsi/si_state.h |   2 +-
 13 files changed, 575 insertions(+), 575 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c 
b/src/gallium/drivers/radeon/r600_buffer_common.c
index e54670a..a8a7bda 100644
--- a/src/gallium/drivers/radeon/r600_buffer_common.c
+++ b/src/gallium/drivers/radeon/r600_buffer_common.c
@@ -244,8 +244,8 @@ bool si_alloc_resource(struct si_screen *sscreen,
return true;
 }
 
-static void r600_buffer_destroy(struct pipe_screen *screen,
-   struct pipe_resource *buf)
+static void si_buffer_destroy(struct pipe_screen *screen,
+ struct pipe_resource *buf)
 {
struct r600_resource *rbuffer = r600_resource(buf);
 
@@ -331,13 +331,13 @@ static void si_invalidate_resource(struct pipe_context 
*ctx,
(void)si_invalidate_buffer(sctx, rbuffer);
 }
 
-static void *r600_buffer_get_transfer(struct pipe_context *ctx,
- struct pipe_resource *resource,
-  unsigned usage,
-  const struct pipe_box *box,
- struct pipe_transfer **ptransfer,
- void *data, struct r600_resource *staging,
- unsigned offset)
+static void *si_buffer_get_transfer(struct pipe_context *ctx,
+   struct pipe_resource *resource,
+   unsigned usage,
+   const struct pipe_box *box,
+   struct pipe_transfer **ptransfer,
+   void *data, struct r600_resource *staging,
+   unsigned offset)
 {
struct si_context *sctx = (struct si_context*)ctx;
struct r600_transfer *transfer;
@@ -361,12 +361,12 @@ static void *r600_buffer_get_transfer(struct pipe_context 
*ctx,
return data;
 }
 
-static void *r600_buffer_transfer_map(struct pipe_context *ctx,
-  struct pipe_resource *resource,
-  unsigned level,
-  unsigned usage,
-  const struct pipe_box *box,
-  struct pipe_transfer **ptransfer)
+static void *si_buffer_transfer_map(struct pipe_context *ctx,
+   struct pipe_resource *resource,
+   unsigned level,
+   unsigned usage,
+   const struct pipe_box *box,
+   struct pipe_transfer **ptransfer)
 {
struct si_context *sctx = (struct si_context*)ctx;
struct r600_resource *rbuffer = r600_resource(resource);
@@ -459,7 +459,7 @@ static void *r600_buffer_transfer_map(struct pipe_context 
*ctx,
 
if (staging) {
data += box->x % R600_MAP_BUFFER_ALIGNMENT;
-   return r600_buffer_get_transfer(ctx, resource, 
usage, box,
+   return si_buffer_get_transfer(ctx, resource, 
usage, box,
ptransfer, 
data, staging, offset);
} else if (rbuffer->flags & RADEON_FLAG_SPARSE) {
return NULL;
@@ -495,7 +495,7 @@ static void *r600_buffer_transfer_map(struct pipe_context 
*ctx,
}
data += box->x % R600_MAP_BUFFER_ALIGNMENT;
 
-   return r600_buffer_get_transfer(ctx, resource, usage, 
box,
+   return si_buffer_get_transfer(ctx, resource, usage, box,
ptransfer, data, 
staging, 0);
} else if (rbuffer->flags & RADEON_FLAG_SPARSE) {
return NULL;
@@ -508,13 +508,13 @@ static void *r600_buffer_transfer_map(struct pipe_context 
*ctx,
}
data += box->x;
 
-   return 

[Mesa-dev] [PATCH 47/55] radeonsi: move r600_gpu_load.c to si_gpu_load.c

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/Makefile.am  | 4 +---
 src/gallium/drivers/radeon/Makefile.sources | 1 -
 src/gallium/drivers/radeon/r600_pipe_common.h   | 6 --
 src/gallium/drivers/radeonsi/Makefile.am| 4 +++-
 src/gallium/drivers/radeonsi/Makefile.sources   | 1 +
 .../drivers/{radeon/r600_gpu_load.c => radeonsi/si_gpu_load.c}  | 0
 src/gallium/drivers/radeonsi/si_pipe.h  | 6 ++
 7 files changed, 11 insertions(+), 11 deletions(-)
 rename src/gallium/drivers/{radeon/r600_gpu_load.c => radeonsi/si_gpu_load.c} 
(100%)

diff --git a/src/gallium/drivers/radeon/Makefile.am 
b/src/gallium/drivers/radeon/Makefile.am
index 43dc35c..1e1d49e 100644
--- a/src/gallium/drivers/radeon/Makefile.am
+++ b/src/gallium/drivers/radeon/Makefile.am
@@ -5,9 +5,7 @@ include $(top_srcdir)/src/gallium/Automake.inc
 AM_CFLAGS = \
$(GALLIUM_DRIVER_CFLAGS) \
$(RADEON_CFLAGS) \
-   -I$(top_srcdir)/src/amd/common \
-   -Wstrict-overflow=0
-# ^^ disable warnings about overflows (os_time_timeout)
+   -I$(top_srcdir)/src/amd/common
 
 noinst_LTLIBRARIES = libradeon.la
 
diff --git a/src/gallium/drivers/radeon/Makefile.sources 
b/src/gallium/drivers/radeon/Makefile.sources
index 789a347..dd08b22 100644
--- a/src/gallium/drivers/radeon/Makefile.sources
+++ b/src/gallium/drivers/radeon/Makefile.sources
@@ -1,6 +1,5 @@
 C_SOURCES := \
r600_buffer_common.c \
-   r600_gpu_load.c \
r600_perfcounter.c \
r600_pipe_common.h \
r600_texture.c \
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index 1e0bf76..4e377d4 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -425,12 +425,6 @@ void si_replace_buffer_storage(struct pipe_context *ctx,
 void si_init_screen_buffer_functions(struct si_screen *sscreen);
 void si_init_buffer_functions(struct si_context *sctx);
 
-/* r600_gpu_load.c */
-void si_gpu_load_kill_thread(struct si_screen *sscreen);
-uint64_t si_begin_counter(struct si_screen *sscreen, unsigned type);
-unsigned si_end_counter(struct si_screen *sscreen, unsigned type,
-   uint64_t begin);
-
 /* r600_perfcounters.c */
 void si_perfcounters_destroy(struct si_screen *sscreen);
 
diff --git a/src/gallium/drivers/radeonsi/Makefile.am 
b/src/gallium/drivers/radeonsi/Makefile.am
index 8c701fa..b39c559 100644
--- a/src/gallium/drivers/radeonsi/Makefile.am
+++ b/src/gallium/drivers/radeonsi/Makefile.am
@@ -29,7 +29,9 @@ AM_CFLAGS = \
-I$(top_builddir)/src/compiler/nir \
-I$(top_srcdir)/src/amd/common \
$(RADEON_CFLAGS) \
-   $(LLVM_CFLAGS)
+   $(LLVM_CFLAGS) \
+   -Wstrict-overflow=0
+# ^^ disable warnings about overflows (os_time_timeout)
 
 noinst_LTLIBRARIES = libradeonsi.la
 
diff --git a/src/gallium/drivers/radeonsi/Makefile.sources 
b/src/gallium/drivers/radeonsi/Makefile.sources
index 4182b8a..c008fc6 100644
--- a/src/gallium/drivers/radeonsi/Makefile.sources
+++ b/src/gallium/drivers/radeonsi/Makefile.sources
@@ -17,6 +17,7 @@ C_SOURCES := \
si_fence.c \
si_get.c \
si_gfx_cs.c \
+   si_gpu_load.c \
si_pipe.c \
si_pipe.h \
si_pm4.c \
diff --git a/src/gallium/drivers/radeon/r600_gpu_load.c 
b/src/gallium/drivers/radeonsi/si_gpu_load.c
similarity index 100%
rename from src/gallium/drivers/radeon/r600_gpu_load.c
rename to src/gallium/drivers/radeonsi/si_gpu_load.c
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h 
b/src/gallium/drivers/radeonsi/si_pipe.h
index 00a5f84..d5a868b 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -828,6 +828,12 @@ void si_flush_gfx_cs(struct si_context *ctx, unsigned 
flags,
 void si_begin_new_gfx_cs(struct si_context *ctx);
 void si_need_gfx_cs_space(struct si_context *ctx);
 
+/* r600_gpu_load.c */
+void si_gpu_load_kill_thread(struct si_screen *sscreen);
+uint64_t si_begin_counter(struct si_screen *sscreen, unsigned type);
+unsigned si_end_counter(struct si_screen *sscreen, unsigned type,
+   uint64_t begin);
+
 /* si_compute.c */
 void si_init_compute_functions(struct si_context *sctx);
 
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 48/55] radeonsi: move r600_buffer_common.c and r600_texture.c into radeonsi

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/Makefile.sources|  2 -
 src/gallium/drivers/radeon/r600_pipe_common.h  | 80 +-
 src/gallium/drivers/radeonsi/Makefile.sources  |  2 +
 .../r600_buffer_common.c => radeonsi/si_buffer.c}  |  0
 src/gallium/drivers/radeonsi/si_pipe.h | 77 +
 .../r600_texture.c => radeonsi/si_texture.c}   |  0
 6 files changed, 80 insertions(+), 81 deletions(-)
 rename src/gallium/drivers/{radeon/r600_buffer_common.c => 
radeonsi/si_buffer.c} (100%)
 rename src/gallium/drivers/{radeon/r600_texture.c => radeonsi/si_texture.c} 
(100%)

diff --git a/src/gallium/drivers/radeon/Makefile.sources 
b/src/gallium/drivers/radeon/Makefile.sources
index dd08b22..fbd1ab6 100644
--- a/src/gallium/drivers/radeon/Makefile.sources
+++ b/src/gallium/drivers/radeon/Makefile.sources
@@ -1,8 +1,6 @@
 C_SOURCES := \
-   r600_buffer_common.c \
r600_perfcounter.c \
r600_pipe_common.h \
-   r600_texture.c \
radeon_uvd.c \
radeon_uvd.h \
radeon_vcn_dec.c \
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index 4e377d4..81bf386 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -23,8 +23,7 @@
  */
 
 /**
- * This file contains common screen and context structures and functions
- * for r600g and radeonsi.
+ * This file is going to be removed.
  */
 
 #ifndef R600_PIPE_COMMON_H
@@ -402,86 +401,9 @@ struct r600_common_context {
 uint64_t offset, uint64_t size, unsigned 
value);
 };
 
-/* r600_buffer_common.c */
-bool si_rings_is_buffer_referenced(struct si_context *sctx,
-  struct pb_buffer *buf,
-  enum radeon_bo_usage usage);
-void *si_buffer_map_sync_with_rings(struct si_context *sctx,
-   struct r600_resource *resource,
-   unsigned usage);
-void si_init_resource_fields(struct si_screen *sscreen,
-struct r600_resource *res,
-uint64_t size, unsigned alignment);
-bool si_alloc_resource(struct si_screen *sscreen,
-  struct r600_resource *res);
-struct pipe_resource *si_aligned_buffer_create(struct pipe_screen *screen,
-  unsigned flags,
-  unsigned usage,
-  unsigned size,
-  unsigned alignment);
-void si_replace_buffer_storage(struct pipe_context *ctx,
-  struct pipe_resource *dst,
-  struct pipe_resource *src);
-void si_init_screen_buffer_functions(struct si_screen *sscreen);
-void si_init_buffer_functions(struct si_context *sctx);
-
 /* r600_perfcounters.c */
 void si_perfcounters_destroy(struct si_screen *sscreen);
 
-/* r600_texture.c */
-bool si_prepare_for_dma_blit(struct si_context *sctx,
-struct r600_texture *rdst,
-unsigned dst_level, unsigned dstx,
-unsigned dsty, unsigned dstz,
-struct r600_texture *rsrc,
-unsigned src_level,
-const struct pipe_box *src_box);
-void si_texture_get_fmask_info(struct si_screen *sscreen,
-  struct r600_texture *rtex,
-  unsigned nr_samples,
-  struct r600_fmask_info *out);
-void si_texture_get_cmask_info(struct si_screen *sscreen,
-  struct r600_texture *rtex,
-  struct r600_cmask_info *out);
-void si_eliminate_fast_color_clear(struct si_context *sctx,
-  struct r600_texture *rtex);
-void si_texture_discard_cmask(struct si_screen *sscreen,
- struct r600_texture *rtex);
-bool si_init_flushed_depth_texture(struct pipe_context *ctx,
-  struct pipe_resource *texture,
-  struct r600_texture **staging);
-void si_print_texture_info(struct si_screen *sscreen,
-  struct r600_texture *rtex, struct u_log_context 
*log);
-struct pipe_resource *si_texture_create(struct pipe_screen *screen,
-   const struct pipe_resource *templ);
-bool vi_dcc_formats_compatible(enum pipe_format format1,
-  enum pipe_format format2);
-bool vi_dcc_formats_are_incompatible(struct pipe_resource *tex,
-unsigned level,
-enum pipe_format view_format);
-void vi_disable_dcc_if_incompatible_format(struct 

[Mesa-dev] [PATCH 40/55] radeonsi: move functions out of and remove r600_pipe_common.c

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/Makefile.sources |   1 -
 src/gallium/drivers/radeon/r600_buffer_common.c |  35 
 src/gallium/drivers/radeon/r600_pipe_common.c   | 229 
 src/gallium/drivers/radeon/r600_pipe_common.h   |   7 -
 src/gallium/drivers/radeonsi/si_pipe.c  | 147 ++-
 src/gallium/drivers/radeonsi/si_pipe.h  |   3 +
 6 files changed, 183 insertions(+), 239 deletions(-)
 delete mode 100644 src/gallium/drivers/radeon/r600_pipe_common.c

diff --git a/src/gallium/drivers/radeon/Makefile.sources 
b/src/gallium/drivers/radeon/Makefile.sources
index f8ee860..2ecfeb0 100644
--- a/src/gallium/drivers/radeon/Makefile.sources
+++ b/src/gallium/drivers/radeon/Makefile.sources
@@ -3,7 +3,6 @@ C_SOURCES := \
r600_cs.h \
r600_gpu_load.c \
r600_perfcounter.c \
-   r600_pipe_common.c \
r600_pipe_common.h \
r600_query.c \
r600_query.h \
diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c 
b/src/gallium/drivers/radeon/r600_buffer_common.c
index a8a7bda..b98065b 100644
--- a/src/gallium/drivers/radeon/r600_buffer_common.c
+++ b/src/gallium/drivers/radeon/r600_buffer_common.c
@@ -708,6 +708,40 @@ static struct pipe_resource *si_resource_create(struct 
pipe_screen *screen,
}
 }
 
+static bool si_resource_commit(struct pipe_context *pctx,
+  struct pipe_resource *resource,
+  unsigned level, struct pipe_box *box,
+  bool commit)
+{
+   struct si_context *ctx = (struct si_context *)pctx;
+   struct r600_resource *res = r600_resource(resource);
+
+   /*
+* Since buffer commitment changes cannot be pipelined, we need to
+* (a) flush any pending commands that refer to the buffer we're about
+* to change, and
+* (b) wait for threaded submit to finish, including those that were
+* triggered by some other, earlier operation.
+*/
+   if (radeon_emitted(ctx->b.gfx_cs, ctx->b.initial_gfx_cs_size) &&
+   ctx->b.ws->cs_is_buffer_referenced(ctx->b.gfx_cs,
+  res->buf, 
RADEON_USAGE_READWRITE)) {
+   si_flush_gfx_cs(ctx, PIPE_FLUSH_ASYNC, NULL);
+   }
+   if (radeon_emitted(ctx->b.dma_cs, 0) &&
+   ctx->b.ws->cs_is_buffer_referenced(ctx->b.dma_cs,
+  res->buf, 
RADEON_USAGE_READWRITE)) {
+   si_flush_dma_cs(ctx, PIPE_FLUSH_ASYNC, NULL);
+   }
+
+   ctx->b.ws->cs_sync_flush(ctx->b.dma_cs);
+   ctx->b.ws->cs_sync_flush(ctx->b.gfx_cs);
+
+   assert(resource->target == PIPE_BUFFER);
+
+   return ctx->b.ws->buffer_commit(res->buf, box->x, box->width, commit);
+}
+
 void si_init_screen_buffer_functions(struct si_screen *sscreen)
 {
sscreen->b.resource_create = si_resource_create;
@@ -723,4 +757,5 @@ void si_init_buffer_functions(struct si_context *sctx)
sctx->b.b.transfer_unmap = u_transfer_unmap_vtbl;
sctx->b.b.texture_subdata = u_default_texture_subdata;
sctx->b.b.buffer_subdata = si_buffer_subdata;
+   sctx->b.b.resource_commit = si_resource_commit;
 }
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c 
b/src/gallium/drivers/radeon/r600_pipe_common.c
deleted file mode 100644
index 10a0da4..000
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * Copyright 2013 Advanced Micro Devices, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
- * SOFTWARE.
- */
-
-#include "r600_pipe_common.h"
-#include "r600_cs.h"
-#include "util/u_memory.h"
-#include "util/u_upload_mgr.h"
-#include "radeon/radeon_video.h"
-
-/*
- * pipe_context
- */
-
-static enum pipe_reset_status si_get_reset_status(struct pipe_context *ctx)

[Mesa-dev] [PATCH 37/55] radeonsi: use si_context instead of pipe_context in parameters pt2

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_pipe_common.h |  6 +++---
 src/gallium/drivers/radeon/r600_texture.c | 24 +++-
 src/gallium/drivers/radeon/radeon_video.c |  4 ++--
 src/gallium/drivers/radeonsi/cik_sdma.c   |  5 ++---
 src/gallium/drivers/radeonsi/si_clear.c   |  6 +++---
 src/gallium/drivers/radeonsi/si_cp_dma.c  |  9 -
 src/gallium/drivers/radeonsi/si_dma.c |  5 ++---
 src/gallium/drivers/radeonsi/si_dma_cs.c  |  2 +-
 src/gallium/drivers/radeonsi/si_pipe.c|  4 ++--
 src/gallium/drivers/radeonsi/si_pipe.h|  2 +-
 src/gallium/drivers/radeonsi/si_state.c   |  4 ++--
 src/gallium/drivers/radeonsi/si_test_dma.c|  2 +-
 12 files changed, 34 insertions(+), 39 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index 6196102..55560d0 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -476,7 +476,7 @@ struct r600_common_context {
 unsigned src_level,
 const struct pipe_box *src_box);
 
-   void (*dma_clear_buffer)(struct pipe_context *ctx, struct pipe_resource 
*dst,
+   void (*dma_clear_buffer)(struct si_context *sctx, struct pipe_resource 
*dst,
 uint64_t offset, uint64_t size, unsigned 
value);
 };
 
@@ -568,9 +568,9 @@ struct pipe_surface *si_create_surface_custom(struct 
pipe_context *pipe,
 unsigned si_translate_colorswap(enum pipe_format format, bool do_endian_swap);
 void vi_separate_dcc_try_enable(struct si_context *sctx,
struct r600_texture *tex);
-void vi_separate_dcc_start_query(struct pipe_context *ctx,
+void vi_separate_dcc_start_query(struct si_context *sctx,
 struct r600_texture *tex);
-void vi_separate_dcc_stop_query(struct pipe_context *ctx,
+void vi_separate_dcc_stop_query(struct si_context *sctx,
struct r600_texture *tex);
 void vi_separate_dcc_process_and_reset_stats(struct pipe_context *ctx,
 struct r600_texture *tex);
diff --git a/src/gallium/drivers/radeon/r600_texture.c 
b/src/gallium/drivers/radeon/r600_texture.c
index 4b76ebd..9ec8ba4 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -2123,7 +2123,7 @@ static void vi_dcc_clean_up_context_slot(struct 
si_context *sctx,
int i;
 
if (sctx->b.dcc_stats[slot].query_active)
-   vi_separate_dcc_stop_query(>b.b,
+   vi_separate_dcc_stop_query(sctx,
   sctx->b.dcc_stats[slot].tex);
 
for (i = 0; i < ARRAY_SIZE(sctx->b.dcc_stats[slot].ps_stats); i++)
@@ -2185,10 +2185,10 @@ static unsigned vi_get_context_dcc_stats_index(struct 
si_context *sctx,
 }
 
 static struct pipe_query *
-vi_create_resuming_pipestats_query(struct pipe_context *ctx)
+vi_create_resuming_pipestats_query(struct si_context *sctx)
 {
struct r600_query_hw *query = (struct r600_query_hw*)
-   ctx->create_query(ctx, PIPE_QUERY_PIPELINE_STATISTICS, 0);
+   sctx->b.b.create_query(>b.b, 
PIPE_QUERY_PIPELINE_STATISTICS, 0);
 
query->flags |= R600_QUERY_HW_FLAG_BEGIN_RESUMES;
return (struct pipe_query*)query;
@@ -2197,36 +2197,34 @@ vi_create_resuming_pipestats_query(struct pipe_context 
*ctx)
 /**
  * Called when binding a color buffer.
  */
-void vi_separate_dcc_start_query(struct pipe_context *ctx,
+void vi_separate_dcc_start_query(struct si_context *sctx,
 struct r600_texture *tex)
 {
-   struct si_context *sctx = (struct si_context*)ctx;
unsigned i = vi_get_context_dcc_stats_index(sctx, tex);
 
assert(!sctx->b.dcc_stats[i].query_active);
 
if (!sctx->b.dcc_stats[i].ps_stats[0])
-   sctx->b.dcc_stats[i].ps_stats[0] = 
vi_create_resuming_pipestats_query(ctx);
+   sctx->b.dcc_stats[i].ps_stats[0] = 
vi_create_resuming_pipestats_query(sctx);
 
/* begin or resume the query */
-   ctx->begin_query(ctx, sctx->b.dcc_stats[i].ps_stats[0]);
+   sctx->b.b.begin_query(>b.b, sctx->b.dcc_stats[i].ps_stats[0]);
sctx->b.dcc_stats[i].query_active = true;
 }
 
 /**
  * Called when unbinding a color buffer.
  */
-void vi_separate_dcc_stop_query(struct pipe_context *ctx,
+void vi_separate_dcc_stop_query(struct si_context *sctx,
struct r600_texture *tex)
 {
-   struct si_context *sctx = (struct si_context*)ctx;
unsigned i = vi_get_context_dcc_stats_index(sctx, tex);
 
assert(sctx->b.dcc_stats[i].query_active);
assert(sctx->b.dcc_stats[i].ps_stats[0]);
 
/* pause or end the query */
-   ctx->end_query(ctx, sctx->b.dcc_stats[i].ps_stats[0]);
+   

[Mesa-dev] [PATCH 38/55] radeonsi: use si_context instead of pipe_context in parameters pt3

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_texture.c |  4 +-
 src/gallium/drivers/radeonsi/si_blit.c| 56 +--
 src/gallium/drivers/radeonsi/si_clear.c   | 12 +++---
 src/gallium/drivers/radeonsi/si_cp_dma.c  |  4 +-
 src/gallium/drivers/radeonsi/si_descriptors.c |  4 +-
 src/gallium/drivers/radeonsi/si_pipe.h|  6 +--
 src/gallium/drivers/radeonsi/si_state.c   |  2 +-
 7 files changed, 42 insertions(+), 46 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_texture.c 
b/src/gallium/drivers/radeon/r600_texture.c
index 9ec8ba4..4d0586e 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -482,7 +482,7 @@ bool si_texture_disable_dcc(struct si_context *sctx,
mtx_lock(>aux_context_lock);
 
/* Decompress DCC. */
-   si_decompress_dcc(>b.b, rtex);
+   si_decompress_dcc(sctx, rtex);
sctx->b.b.flush(>b.b, NULL, 0);
 
if (>b.b == sscreen->aux_context)
@@ -1975,7 +1975,7 @@ void vi_disable_dcc_if_incompatible_format(struct 
si_context *sctx,
 
if (vi_dcc_formats_are_incompatible(tex, level, view_format))
if (!si_texture_disable_dcc(sctx, (struct r600_texture*)tex))
-   si_decompress_dcc(>b.b, rtex);
+   si_decompress_dcc(sctx, rtex);
 }
 
 struct pipe_surface *si_create_surface_custom(struct pipe_context *pipe,
diff --git a/src/gallium/drivers/radeonsi/si_blit.c 
b/src/gallium/drivers/radeonsi/si_blit.c
index 8b68495..3698062 100644
--- a/src/gallium/drivers/radeonsi/si_blit.c
+++ b/src/gallium/drivers/radeonsi/si_blit.c
@@ -42,10 +42,8 @@ enum {
SI_COLOR_RESOLVE = SI_SAVE_FRAMEBUFFER | SI_SAVE_FRAGMENT_STATE
 };
 
-void si_blitter_begin(struct pipe_context *ctx, enum si_blitter_op op)
+void si_blitter_begin(struct si_context *sctx, enum si_blitter_op op)
 {
-   struct si_context *sctx = (struct si_context *)ctx;
-
util_blitter_save_vertex_shader(sctx->blitter, sctx->vs_shader.cso);
util_blitter_save_tessctrl_shader(sctx->blitter, sctx->tcs_shader.cso);
util_blitter_save_tesseval_shader(sctx->blitter, sctx->tes_shader.cso);
@@ -79,10 +77,8 @@ void si_blitter_begin(struct pipe_context *ctx, enum 
si_blitter_op op)
sctx->b.render_cond_force_off = true;
 }
 
-void si_blitter_end(struct pipe_context *ctx)
+void si_blitter_end(struct si_context *sctx)
 {
-   struct si_context *sctx = (struct si_context *)ctx;
-
sctx->b.render_cond_force_off = false;
 
/* Restore shader pointers because the VS blit shader changed all
@@ -147,10 +143,10 @@ si_blit_dbcb_copy(struct si_context *sctx,
si_mark_atom_dirty(sctx, 
>db_render_state);
}
 
-   si_blitter_begin(>b.b, SI_DECOMPRESS);
+   si_blitter_begin(sctx, SI_DECOMPRESS);

util_blitter_custom_depth_stencil(sctx->blitter, zsurf, cbsurf, 1 << sample,
  
sctx->custom_dsa_flush, 1.0f);
-   si_blitter_end(>b.b);
+   si_blitter_end(sctx);
}
 
pipe_surface_reference(, NULL);
@@ -236,11 +232,11 @@ si_blit_decompress_zs_planes_in_place(struct si_context 
*sctx,
 
zsurf = sctx->b.b.create_surface(>b.b, 
>resource.b.b, _tmpl);
 
-   si_blitter_begin(>b.b, SI_DECOMPRESS);
+   si_blitter_begin(sctx, SI_DECOMPRESS);
util_blitter_custom_depth_stencil(sctx->blitter, zsurf, 
NULL, ~0,
  
sctx->custom_dsa_flush,
  1.0f);
-   si_blitter_end(>b.b);
+   si_blitter_end(sctx);
 
pipe_surface_reference(, NULL);
}
@@ -442,13 +438,12 @@ si_decompress_sampler_depth_textures(struct si_context 
*sctx,
}
 }
 
-static void si_blit_decompress_color(struct pipe_context *ctx,
+static void si_blit_decompress_color(struct si_context *sctx,
struct r600_texture *rtex,
unsigned first_level, unsigned last_level,
unsigned first_layer, unsigned last_layer,
bool need_dcc_decompress)
 {
-   struct si_context *sctx = (struct si_context *)ctx;
void* custom_blend;
unsigned layer, checked_last_layer, max_layer;
unsigned level_mask =
@@ -498,16 +493,16 @@ static void si_blit_decompress_color(struct pipe_context 
*ctx,
surf_tmpl.u.tex.level = level;
surf_tmpl.u.tex.first_layer = layer;
surf_tmpl.u.tex.last_layer = layer;
- 

[Mesa-dev] [PATCH 44/55] radeonsi: rename query definitions R600_ -> SI_

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_gpu_load.c|  42 +--
 src/gallium/drivers/radeon/r600_perfcounter.c |  64 ++---
 src/gallium/drivers/radeon/r600_query.c   | 386 +-
 src/gallium/drivers/radeon/r600_query.h   | 170 ++--
 src/gallium/drivers/radeon/r600_texture.c |   2 +-
 src/gallium/drivers/radeonsi/si_perfcounter.c |  26 +-
 6 files changed, 345 insertions(+), 345 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_gpu_load.c 
b/src/gallium/drivers/radeon/r600_gpu_load.c
index 8828626..660ac1d 100644
--- a/src/gallium/drivers/radeon/r600_gpu_load.c
+++ b/src/gallium/drivers/radeon/r600_gpu_load.c
@@ -220,47 +220,47 @@ static unsigned busy_index_from_type(struct si_screen 
*sscreen,
 unsigned type)
 {
switch (type) {
-   case R600_QUERY_GPU_LOAD:
+   case SI_QUERY_GPU_LOAD:
return BUSY_INDEX(sscreen, gpu);
-   case R600_QUERY_GPU_SHADERS_BUSY:
+   case SI_QUERY_GPU_SHADERS_BUSY:
return BUSY_INDEX(sscreen, spi);
-   case R600_QUERY_GPU_TA_BUSY:
+   case SI_QUERY_GPU_TA_BUSY:
return BUSY_INDEX(sscreen, ta);
-   case R600_QUERY_GPU_GDS_BUSY:
+   case SI_QUERY_GPU_GDS_BUSY:
return BUSY_INDEX(sscreen, gds);
-   case R600_QUERY_GPU_VGT_BUSY:
+   case SI_QUERY_GPU_VGT_BUSY:
return BUSY_INDEX(sscreen, vgt);
-   case R600_QUERY_GPU_IA_BUSY:
+   case SI_QUERY_GPU_IA_BUSY:
return BUSY_INDEX(sscreen, ia);
-   case R600_QUERY_GPU_SX_BUSY:
+   case SI_QUERY_GPU_SX_BUSY:
return BUSY_INDEX(sscreen, sx);
-   case R600_QUERY_GPU_WD_BUSY:
+   case SI_QUERY_GPU_WD_BUSY:
return BUSY_INDEX(sscreen, wd);
-   case R600_QUERY_GPU_BCI_BUSY:
+   case SI_QUERY_GPU_BCI_BUSY:
return BUSY_INDEX(sscreen, bci);
-   case R600_QUERY_GPU_SC_BUSY:
+   case SI_QUERY_GPU_SC_BUSY:
return BUSY_INDEX(sscreen, sc);
-   case R600_QUERY_GPU_PA_BUSY:
+   case SI_QUERY_GPU_PA_BUSY:
return BUSY_INDEX(sscreen, pa);
-   case R600_QUERY_GPU_DB_BUSY:
+   case SI_QUERY_GPU_DB_BUSY:
return BUSY_INDEX(sscreen, db);
-   case R600_QUERY_GPU_CP_BUSY:
+   case SI_QUERY_GPU_CP_BUSY:
return BUSY_INDEX(sscreen, cp);
-   case R600_QUERY_GPU_CB_BUSY:
+   case SI_QUERY_GPU_CB_BUSY:
return BUSY_INDEX(sscreen, cb);
-   case R600_QUERY_GPU_SDMA_BUSY:
+   case SI_QUERY_GPU_SDMA_BUSY:
return BUSY_INDEX(sscreen, sdma);
-   case R600_QUERY_GPU_PFP_BUSY:
+   case SI_QUERY_GPU_PFP_BUSY:
return BUSY_INDEX(sscreen, pfp);
-   case R600_QUERY_GPU_MEQ_BUSY:
+   case SI_QUERY_GPU_MEQ_BUSY:
return BUSY_INDEX(sscreen, meq);
-   case R600_QUERY_GPU_ME_BUSY:
+   case SI_QUERY_GPU_ME_BUSY:
return BUSY_INDEX(sscreen, me);
-   case R600_QUERY_GPU_SURF_SYNC_BUSY:
+   case SI_QUERY_GPU_SURF_SYNC_BUSY:
return BUSY_INDEX(sscreen, surf_sync);
-   case R600_QUERY_GPU_CP_DMA_BUSY:
+   case SI_QUERY_GPU_CP_DMA_BUSY:
return BUSY_INDEX(sscreen, cp_dma);
-   case R600_QUERY_GPU_SCRATCH_RAM_BUSY:
+   case SI_QUERY_GPU_SCRATCH_RAM_BUSY:
return BUSY_INDEX(sscreen, scratch_ram);
default:
unreachable("invalid query type");
diff --git a/src/gallium/drivers/radeon/r600_perfcounter.c 
b/src/gallium/drivers/radeon/r600_perfcounter.c
index 29b3c97..c5b55cd 100644
--- a/src/gallium/drivers/radeon/r600_perfcounter.c
+++ b/src/gallium/drivers/radeon/r600_perfcounter.c
@@ -28,7 +28,7 @@
 #include "amd/common/sid.h"
 
 /* Max counters per HW block */
-#define R600_QUERY_MAX_COUNTERS 16
+#define SI_QUERY_MAX_COUNTERS 16
 
 static struct si_perfcounter_block *
 lookup_counter(struct si_perfcounters *pc, unsigned index,
@@ -76,7 +76,7 @@ struct si_pc_group {
int se;
int instance;
unsigned num_counters;
-   unsigned selectors[R600_QUERY_MAX_COUNTERS];
+   unsigned selectors[SI_QUERY_MAX_COUNTERS];
 };
 
 struct si_pc_counter {
@@ -166,7 +166,7 @@ static void si_pc_query_emit_stop(struct si_context *sctx,
unsigned se = group->se >= 0 ? group->se : 0;
unsigned se_end = se + 1;
 
-   if ((block->flags & R600_PC_BLOCK_SE) && (group->se < 0))
+   if ((block->flags & SI_PC_BLOCK_SE) && (group->se < 0))
se_end = sctx->screen->info.max_se;
 
do {
@@ -247,13 +247,13 @@ static struct si_pc_group *get_group_state(struct 
si_screen *screen,
group->block = block;
group->sub_gid = sub_gid;
 
-   if (block->flags & R600_PC_BLOCK_SHADER) {
+   if (block->flags & SI_PC_BLOCK_SHADER) {
unsigned sub_gids = 

[Mesa-dev] [PATCH 42/55] radeonsi: rename a few R600/r600_ -> SI_/si_

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeonsi/si_clear.c  |  6 ++---
 src/gallium/drivers/radeonsi/si_cp_dma.c | 34 ++--
 src/gallium/drivers/radeonsi/si_gfx_cs.c |  2 +-
 src/gallium/drivers/radeonsi/si_pipe.c   |  2 +-
 src/gallium/drivers/radeonsi/si_pipe.h   | 10 
 src/gallium/drivers/radeonsi/si_state_draw.c |  2 +-
 6 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_clear.c 
b/src/gallium/drivers/radeonsi/si_clear.c
index 9ae2a07..d252997 100644
--- a/src/gallium/drivers/radeonsi/si_clear.c
+++ b/src/gallium/drivers/radeonsi/si_clear.c
@@ -231,7 +231,7 @@ void vi_dcc_clear_level(struct si_context *sctx,
}
 
si_clear_buffer(sctx, dcc_buffer, dcc_offset, clear_size,
-   clear_value, R600_COHERENCY_CB_META);
+   clear_value, SI_COHERENCY_CB_META);
 }
 
 /* Set the same micro tile mode as the destination of the last MSAA resolve.
@@ -461,7 +461,7 @@ static void si_do_fast_color_clear(struct si_context *sctx,
 
si_clear_buffer(sctx, >cmask_buffer->b.b,
tex->cmask.offset, 
tex->cmask.size,
-   0x, 
R600_COHERENCY_CB_META);
+   0x, 
SI_COHERENCY_CB_META);
need_decompress_pass = true;
}
 
@@ -493,7 +493,7 @@ static void si_do_fast_color_clear(struct si_context *sctx,
/* Do the fast clear. */
si_clear_buffer(sctx, >cmask_buffer->b.b,
tex->cmask.offset, tex->cmask.size, 0,
-   R600_COHERENCY_CB_META);
+   SI_COHERENCY_CB_META);
need_decompress_pass = true;
}
 
diff --git a/src/gallium/drivers/radeonsi/si_cp_dma.c 
b/src/gallium/drivers/radeonsi/si_cp_dma.c
index 7ce931a..ffdb78c 100644
--- a/src/gallium/drivers/radeonsi/si_cp_dma.c
+++ b/src/gallium/drivers/radeonsi/si_cp_dma.c
@@ -61,7 +61,7 @@ static inline unsigned cp_dma_max_byte_count(struct 
si_context *sctx)
  */
 static void si_emit_cp_dma(struct si_context *sctx, uint64_t dst_va,
   uint64_t src_va, unsigned size, unsigned flags,
-  enum r600_coherency coher)
+  enum si_coherency coher)
 {
struct radeon_winsys_cs *cs = sctx->b.gfx_cs;
uint32_t header = 0, command = 0;
@@ -123,31 +123,31 @@ static void si_emit_cp_dma(struct si_context *sctx, 
uint64_t dst_va,
 * indices. If we wanted to execute CP DMA in PFP, this packet
 * should precede it.
 */
-   if (coher == R600_COHERENCY_SHADER && flags & CP_DMA_SYNC) {
+   if (coher == SI_COHERENCY_SHADER && flags & CP_DMA_SYNC) {
radeon_emit(cs, PKT3(PKT3_PFP_SYNC_ME, 0, 0));
radeon_emit(cs, 0);
}
 }
 
-static unsigned get_flush_flags(struct si_context *sctx, enum r600_coherency 
coher)
+static unsigned get_flush_flags(struct si_context *sctx, enum si_coherency 
coher)
 {
switch (coher) {
default:
-   case R600_COHERENCY_NONE:
+   case SI_COHERENCY_NONE:
return 0;
-   case R600_COHERENCY_SHADER:
+   case SI_COHERENCY_SHADER:
return SI_CONTEXT_INV_SMEM_L1 |
   SI_CONTEXT_INV_VMEM_L1 |
   (sctx->b.chip_class == SI ? SI_CONTEXT_INV_GLOBAL_L2 : 
0);
-   case R600_COHERENCY_CB_META:
+   case SI_COHERENCY_CB_META:
return SI_CONTEXT_FLUSH_AND_INV_CB;
}
 }
 
-static unsigned get_tc_l2_flag(struct si_context *sctx, enum r600_coherency 
coher)
+static unsigned get_tc_l2_flag(struct si_context *sctx, enum si_coherency 
coher)
 {
-   if ((sctx->b.chip_class >= GFX9 && coher == R600_COHERENCY_CB_META) ||
-   (sctx->b.chip_class >= CIK && coher == R600_COHERENCY_SHADER))
+   if ((sctx->b.chip_class >= GFX9 && coher == SI_COHERENCY_CB_META) ||
+   (sctx->b.chip_class >= CIK && coher == SI_COHERENCY_SHADER))
return CP_DMA_USE_L2;
 
return 0;
@@ -206,7 +206,7 @@ static void si_cp_dma_prepare(struct si_context *sctx, 
struct pipe_resource *dst
 
 void si_clear_buffer(struct si_context *sctx, struct pipe_resource *dst,
 uint64_t offset, uint64_t size, unsigned value,
-enum r600_coherency coher)
+enum si_coherency coher)
 {
struct radeon_winsys *ws = sctx->b.ws;
struct r600_resource *rdst = r600_resource(dst);
@@ -274,7 +274,7 @@ void si_clear_buffer(struct si_context *sctx, struct 
pipe_resource *dst,
rdst->TC_L2_dirty = true;
 
/* If it's not a framebuffer fast 

[Mesa-dev] [PATCH 43/55] radeonsi: move and rename R600_ERR out of r600_pipe_common.h

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_pipe_common.h   |  3 ---
 src/gallium/drivers/radeon/r600_texture.c   | 14 +++---
 src/gallium/drivers/radeonsi/si_pipe.h  |  3 +++
 src/gallium/drivers/radeonsi/si_pm4.c   |  2 +-
 src/gallium/drivers/radeonsi/si_state.c | 14 +++---
 src/gallium/drivers/radeonsi/si_state_shaders.c |  2 +-
 6 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index b643e81..fd94211 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -521,7 +521,4 @@ vi_dcc_enabled(struct r600_texture *tex, unsigned level)
return tex->dcc_offset && level < tex->surface.num_dcc_levels;
 }
 
-#define R600_ERR(fmt, args...) \
-   fprintf(stderr, "EE %s:%d %s - " fmt, __FILE__, __LINE__, __func__, 
##args)
-
 #endif
diff --git a/src/gallium/drivers/radeon/r600_texture.c 
b/src/gallium/drivers/radeon/r600_texture.c
index d769b9f..9142d56 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -868,13 +868,13 @@ void si_texture_get_fmask_info(struct si_screen *sscreen,
bpe = 4;
break;
default:
-   R600_ERR("Invalid sample count for FMASK allocation.\n");
+   PRINT_ERR("Invalid sample count for FMASK allocation.\n");
return;
}
 
if (sscreen->ws->surface_init(sscreen->ws, , flags, bpe,
  RADEON_SURF_MODE_2D, )) {
-   R600_ERR("Got error in surface_init while allocating FMASK.\n");
+   PRINT_ERR("Got error in surface_init while allocating 
FMASK.\n");
return;
}
 
@@ -1572,7 +1572,7 @@ bool si_init_flushed_depth_texture(struct pipe_context 
*ctx,
 
*flushed_depth_texture = (struct r600_texture 
*)ctx->screen->resource_create(ctx->screen, );
if (*flushed_depth_texture == NULL) {
-   R600_ERR("failed to create temporary texture to hold flushed 
depth\n");
+   PRINT_ERR("failed to create temporary texture to hold flushed 
depth\n");
return false;
}
return true;
@@ -1734,7 +1734,7 @@ static void *si_texture_transfer_map(struct pipe_context 
*ctx,
si_init_temp_resource_from_box(, texture, box, 
level, 0);
 
if (!si_init_flushed_depth_texture(ctx, , 
_depth)) {
-   R600_ERR("failed to create temporary texture to 
hold untiled copy\n");
+   PRINT_ERR("failed to create temporary texture 
to hold untiled copy\n");
FREE(trans);
return NULL;
}
@@ -1742,7 +1742,7 @@ static void *si_texture_transfer_map(struct pipe_context 
*ctx,
if (usage & PIPE_TRANSFER_READ) {
struct pipe_resource *temp = 
ctx->screen->resource_create(ctx->screen, );
if (!temp) {
-   R600_ERR("failed to create a temporary 
depth texture\n");
+   PRINT_ERR("failed to create a temporary 
depth texture\n");
FREE(trans);
return NULL;
}
@@ -1761,7 +1761,7 @@ static void *si_texture_transfer_map(struct pipe_context 
*ctx,
/* XXX: only readback the rectangle which is being 
mapped? */
/* XXX: when discard is true, no need to read back from 
depth texture */
if (!si_init_flushed_depth_texture(ctx, texture, 
_depth)) {
-   R600_ERR("failed to create temporary texture to 
hold untiled copy\n");
+   PRINT_ERR("failed to create temporary texture 
to hold untiled copy\n");
FREE(trans);
return NULL;
}
@@ -1791,7 +1791,7 @@ static void *si_texture_transfer_map(struct pipe_context 
*ctx,
/* Create the temporary texture. */
staging = (struct 
r600_texture*)ctx->screen->resource_create(ctx->screen, );
if (!staging) {
-   R600_ERR("failed to create temporary texture to hold 
untiled copy\n");
+   PRINT_ERR("failed to create temporary texture to hold 
untiled copy\n");
FREE(trans);
return NULL;
}
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h 
b/src/gallium/drivers/radeonsi/si_pipe.h
index 9d239cd..5087390 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ 

[Mesa-dev] [PATCH 34/55] radeonsi: use r600_common_context less pt7

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_pipe_common.h |  1 -
 src/gallium/drivers/radeon/radeon_uvd.c   | 18 +-
 src/gallium/drivers/radeon/radeon_vce.c   |  4 ++--
 src/gallium/drivers/radeon/radeon_vcn_dec.c   |  6 +++---
 src/gallium/drivers/radeon/radeon_video.c | 14 ++
 src/gallium/drivers/radeon/radeon_video.h |  2 +-
 src/gallium/drivers/radeonsi/si_uvd.c |  2 +-
 7 files changed, 22 insertions(+), 25 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index 5e5843b..6196102 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -126,7 +126,6 @@ enum {
 
 #define SI_MAX_VARIABLE_THREADS_PER_BLOCK 1024
 
-struct r600_common_context;
 struct r600_perfcounters;
 struct tgsi_shader_info;
 struct r600_qbo_state;
diff --git a/src/gallium/drivers/radeon/radeon_uvd.c 
b/src/gallium/drivers/radeon/radeon_uvd.c
index 78ced17..3a680a3 100644
--- a/src/gallium/drivers/radeon/radeon_uvd.c
+++ b/src/gallium/drivers/radeon/radeon_uvd.c
@@ -1363,8 +1363,8 @@ struct pipe_video_codec 
*si_common_uvd_create_decoder(struct pipe_context *conte
  const struct 
pipe_video_codec *templ,
  ruvd_set_dtb set_dtb)
 {
-   struct radeon_winsys* ws = ((struct r600_common_context *)context)->ws;
-   struct r600_common_context *rctx = (struct r600_common_context*)context;
+   struct si_context *sctx = (struct si_context*)context;
+   struct radeon_winsys *ws = sctx->b.ws;
unsigned dpb_size;
unsigned width = templ->width, height = templ->height;
unsigned bs_buf_size;
@@ -1396,7 +1396,7 @@ struct pipe_video_codec 
*si_common_uvd_create_decoder(struct pipe_context *conte
if (!dec)
return NULL;
 
-   if (rctx->screen->info.drm_major < 3)
+   if (sctx->screen->info.drm_major < 3)
dec->use_legacy = true;
 
dec->base = *templ;
@@ -1411,12 +1411,12 @@ struct pipe_video_codec 
*si_common_uvd_create_decoder(struct pipe_context *conte
dec->base.end_frame = ruvd_end_frame;
dec->base.flush = ruvd_flush;
 
-   dec->stream_type = profile2stream_type(dec, rctx->family);
+   dec->stream_type = profile2stream_type(dec, sctx->b.family);
dec->set_dtb = set_dtb;
dec->stream_handle = si_vid_alloc_stream_handle();
dec->screen = context->screen;
dec->ws = ws;
-   dec->cs = ws->cs_create(rctx->ctx, RING_UVD, NULL, NULL);
+   dec->cs = ws->cs_create(sctx->b.ctx, RING_UVD, NULL, NULL);
if (!dec->cs) {
RVID_ERR("Can't get command submission context.\n");
goto error;
@@ -1424,7 +1424,7 @@ struct pipe_video_codec 
*si_common_uvd_create_decoder(struct pipe_context *conte
 
for (i = 0; i < 16; i++)
 dec->render_pic_list[i] = NULL;
-   dec->fb_size = (rctx->family == CHIP_TONGA) ? FB_BUFFER_SIZE_TONGA :
+   dec->fb_size = (sctx->b.family == CHIP_TONGA) ? FB_BUFFER_SIZE_TONGA :
FB_BUFFER_SIZE;
bs_buf_size = width * height * (512 / (16 * 16));
for (i = 0; i < NUM_BUFFERS; ++i) {
@@ -1457,7 +1457,7 @@ struct pipe_video_codec 
*si_common_uvd_create_decoder(struct pipe_context *conte
si_vid_clear_buffer(context, >dpb);
}
 
-   if (dec->stream_type == RUVD_CODEC_H264_PERF && rctx->family >= 
CHIP_POLARIS10) {
+   if (dec->stream_type == RUVD_CODEC_H264_PERF && sctx->b.family >= 
CHIP_POLARIS10) {
unsigned ctx_size = calc_ctx_size_h264_perf(dec);
if (!si_vid_create_buffer(dec->screen, >ctx, ctx_size, 
PIPE_USAGE_DEFAULT)) {
RVID_ERR("Can't allocated context buffer.\n");
@@ -1466,7 +1466,7 @@ struct pipe_video_codec 
*si_common_uvd_create_decoder(struct pipe_context *conte
si_vid_clear_buffer(context, >ctx);
}
 
-   if (rctx->family >= CHIP_POLARIS10 && rctx->screen->info.drm_minor >= 
3) {
+   if (sctx->b.family >= CHIP_POLARIS10 && sctx->screen->info.drm_minor >= 
3) {
if (!si_vid_create_buffer(dec->screen, >sessionctx,
UVD_SESSION_CONTEXT_SIZE,
PIPE_USAGE_DEFAULT)) {
@@ -1476,7 +1476,7 @@ struct pipe_video_codec 
*si_common_uvd_create_decoder(struct pipe_context *conte
si_vid_clear_buffer(context, >sessionctx);
}
 
-   if (rctx->family >= CHIP_VEGA10) {
+   if (sctx->b.family >= CHIP_VEGA10) {
dec->reg.data0 = RUVD_GPCOM_VCPU_DATA0_SOC15;
dec->reg.data1 = RUVD_GPCOM_VCPU_DATA1_SOC15;
dec->reg.cmd = RUVD_GPCOM_VCPU_CMD_SOC15;
diff --git a/src/gallium/drivers/radeon/radeon_vce.c 

[Mesa-dev] [PATCH 31/55] radeonsi: switch radeon_add_to_buffer_list parameter to si_context

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_cs.h  |  6 +++---
 src/gallium/drivers/radeon/r600_query.c   |  6 +++---
 src/gallium/drivers/radeonsi/si_compute.c | 14 +++---
 src/gallium/drivers/radeonsi/si_cp_dma.c  |  4 ++--
 src/gallium/drivers/radeonsi/si_descriptors.c | 16 
 src/gallium/drivers/radeonsi/si_dma_cs.c  |  4 ++--
 src/gallium/drivers/radeonsi/si_fence.c   |  8 
 src/gallium/drivers/radeonsi/si_gfx_cs.c  |  2 +-
 src/gallium/drivers/radeonsi/si_perfcounter.c |  2 +-
 src/gallium/drivers/radeonsi/si_pm4.c |  4 ++--
 src/gallium/drivers/radeonsi/si_state.c   |  8 
 src/gallium/drivers/radeonsi/si_state_draw.c  |  8 
 src/gallium/drivers/radeonsi/si_state_shaders.c   |  2 +-
 src/gallium/drivers/radeonsi/si_state_streamout.c |  4 ++--
 14 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_cs.h 
b/src/gallium/drivers/radeon/r600_cs.h
index c90f06b..b0610f2 100644
--- a/src/gallium/drivers/radeon/r600_cs.h
+++ b/src/gallium/drivers/radeon/r600_cs.h
@@ -64,14 +64,14 @@ radeon_cs_memory_below_limit(struct si_screen *screen,
  * The buffer list becomes empty after every context flush and must be
  * rebuilt.
  */
-static inline void radeon_add_to_buffer_list(struct r600_common_context *rctx,
+static inline void radeon_add_to_buffer_list(struct si_context *sctx,
 struct radeon_winsys_cs *cs,
 struct r600_resource *rbo,
 enum radeon_bo_usage usage,
 enum radeon_bo_priority priority)
 {
assert(usage);
-   rctx->ws->cs_add_buffer(
+   sctx->b.ws->cs_add_buffer(
cs, rbo->buf,
(enum radeon_bo_usage)(usage | RADEON_USAGE_SYNCHRONIZED),
rbo->domains, priority);
@@ -107,7 +107,7 @@ radeon_add_to_gfx_buffer_list_check_mem(struct si_context 
*sctx,
  sctx->b.gtt + rbo->gart_usage))
si_flush_gfx_cs(sctx, PIPE_FLUSH_ASYNC, NULL);
 
-   radeon_add_to_buffer_list(>b, sctx->b.gfx_cs, rbo, usage, 
priority);
+   radeon_add_to_buffer_list(sctx, sctx->b.gfx_cs, rbo, usage, priority);
 }
 
 static inline void radeon_set_config_reg_seq(struct radeon_winsys_cs *cs, 
unsigned reg, unsigned num)
diff --git a/src/gallium/drivers/radeon/r600_query.c 
b/src/gallium/drivers/radeon/r600_query.c
index 3348e75..cf34a42 100644
--- a/src/gallium/drivers/radeon/r600_query.c
+++ b/src/gallium/drivers/radeon/r600_query.c
@@ -786,7 +786,7 @@ static void r600_query_hw_do_emit_start(struct si_context 
*sctx,
default:
assert(0);
}
-   radeon_add_to_buffer_list(>b, sctx->b.gfx_cs, query->buffer.buf, 
RADEON_USAGE_WRITE,
+   radeon_add_to_buffer_list(sctx, sctx->b.gfx_cs, query->buffer.buf, 
RADEON_USAGE_WRITE,
  RADEON_PRIO_QUERY);
 }
 
@@ -878,7 +878,7 @@ static void r600_query_hw_do_emit_stop(struct si_context 
*sctx,
default:
assert(0);
}
-   radeon_add_to_buffer_list(>b, sctx->b.gfx_cs, query->buffer.buf, 
RADEON_USAGE_WRITE,
+   radeon_add_to_buffer_list(sctx, sctx->b.gfx_cs, query->buffer.buf, 
RADEON_USAGE_WRITE,
  RADEON_PRIO_QUERY);
 
if (fence_va)
@@ -930,7 +930,7 @@ static void emit_set_predicate(struct si_context *ctx,
radeon_emit(cs, va);
radeon_emit(cs, op | ((va >> 32) & 0xFF));
}
-   radeon_add_to_buffer_list(>b, ctx->b.gfx_cs, buf, 
RADEON_USAGE_READ,
+   radeon_add_to_buffer_list(ctx, ctx->b.gfx_cs, buf, RADEON_USAGE_READ,
  RADEON_PRIO_QUERY);
 }
 
diff --git a/src/gallium/drivers/radeonsi/si_compute.c 
b/src/gallium/drivers/radeonsi/si_compute.c
index 5b60742..9b75006 100644
--- a/src/gallium/drivers/radeonsi/si_compute.c
+++ b/src/gallium/drivers/radeonsi/si_compute.c
@@ -438,7 +438,7 @@ static bool si_switch_compute_shader(struct si_context 
*sctx,
config->scratch_bytes_per_wave *
sctx->scratch_waves);
 
-   radeon_add_to_buffer_list(>b, sctx->b.gfx_cs,
+   radeon_add_to_buffer_list(sctx, sctx->b.gfx_cs,
  shader->scratch_bo, RADEON_USAGE_READWRITE,
  RADEON_PRIO_SCRATCH_BUFFER);
}
@@ -462,7 +462,7 @@ static bool si_switch_compute_shader(struct si_context 
*sctx,
shader_va += sizeof(amd_kernel_code_t);
}
 
-   radeon_add_to_buffer_list(>b, sctx->b.gfx_cs, shader->bo,
+   radeon_add_to_buffer_list(sctx, sctx->b.gfx_cs, shader->bo,
  RADEON_USAGE_READ, 

[Mesa-dev] [PATCH 30/55] radeonsi: use r600_common_context less pt5

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_perfcounter.c |  28 +-
 src/gallium/drivers/radeon/r600_pipe_common.c |   2 +-
 src/gallium/drivers/radeon/r600_pipe_common.h |   6 +-
 src/gallium/drivers/radeon/r600_query.c   | 374 +-
 src/gallium/drivers/radeon/r600_query.h   |  34 +--
 src/gallium/drivers/radeon/r600_texture.c |   6 +-
 src/gallium/drivers/radeonsi/si_gfx_cs.c  |   4 +-
 src/gallium/drivers/radeonsi/si_perfcounter.c |  25 +-
 8 files changed, 237 insertions(+), 242 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_perfcounter.c 
b/src/gallium/drivers/radeon/r600_perfcounter.c
index 0e7b3d9..99f7ca5 100644
--- a/src/gallium/drivers/radeon/r600_perfcounter.c
+++ b/src/gallium/drivers/radeon/r600_perfcounter.c
@@ -119,18 +119,18 @@ static bool r600_pc_query_prepare_buffer(struct si_screen 
*screen,
return true;
 }
 
-static void r600_pc_query_emit_start(struct r600_common_context *ctx,
+static void r600_pc_query_emit_start(struct si_context *sctx,
 struct r600_query_hw *hwquery,
 struct r600_resource *buffer, uint64_t va)
 {
-   struct r600_perfcounters *pc = ctx->screen->perfcounters;
+   struct r600_perfcounters *pc = sctx->screen->perfcounters;
struct r600_query_pc *query = (struct r600_query_pc *)hwquery;
struct r600_pc_group *group;
int current_se = -1;
int current_instance = -1;
 
if (query->shaders)
-   pc->emit_shaders(ctx, query->shaders);
+   pc->emit_shaders(sctx, query->shaders);
 
for (group = query->groups; group; group = group->next) {
struct r600_perfcounter_block *block = group->block;
@@ -138,27 +138,27 @@ static void r600_pc_query_emit_start(struct 
r600_common_context *ctx,
if (group->se != current_se || group->instance != 
current_instance) {
current_se = group->se;
current_instance = group->instance;
-   pc->emit_instance(ctx, group->se, group->instance);
+   pc->emit_instance(sctx, group->se, group->instance);
}
 
-   pc->emit_select(ctx, block, group->num_counters, 
group->selectors);
+   pc->emit_select(sctx, block, group->num_counters, 
group->selectors);
}
 
if (current_se != -1 || current_instance != -1)
-   pc->emit_instance(ctx, -1, -1);
+   pc->emit_instance(sctx, -1, -1);
 
-   pc->emit_start(ctx, buffer, va);
+   pc->emit_start(sctx, buffer, va);
 }
 
-static void r600_pc_query_emit_stop(struct r600_common_context *ctx,
+static void r600_pc_query_emit_stop(struct si_context *sctx,
struct r600_query_hw *hwquery,
struct r600_resource *buffer, uint64_t va)
 {
-   struct r600_perfcounters *pc = ctx->screen->perfcounters;
+   struct r600_perfcounters *pc = sctx->screen->perfcounters;
struct r600_query_pc *query = (struct r600_query_pc *)hwquery;
struct r600_pc_group *group;
 
-   pc->emit_stop(ctx, buffer, va);
+   pc->emit_stop(sctx, buffer, va);
 
for (group = query->groups; group; group = group->next) {
struct r600_perfcounter_block *block = group->block;
@@ -166,14 +166,14 @@ static void r600_pc_query_emit_stop(struct 
r600_common_context *ctx,
unsigned se_end = se + 1;
 
if ((block->flags & R600_PC_BLOCK_SE) && (group->se < 0))
-   se_end = ctx->screen->info.max_se;
+   se_end = sctx->screen->info.max_se;
 
do {
unsigned instance = group->instance >= 0 ? 
group->instance : 0;
 
do {
-   pc->emit_instance(ctx, se, instance);
-   pc->emit_read(ctx, block,
+   pc->emit_instance(sctx, se, instance);
+   pc->emit_read(sctx, block,
  group->num_counters, 
group->selectors,
  buffer, va);
va += sizeof(uint64_t) * group->num_counters;
@@ -181,7 +181,7 @@ static void r600_pc_query_emit_stop(struct 
r600_common_context *ctx,
} while (++se < se_end);
}
 
-   pc->emit_instance(ctx, -1, -1);
+   pc->emit_instance(sctx, -1, -1);
 }
 
 static void r600_pc_query_clear_result(struct r600_query_hw *hwquery,
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c 
b/src/gallium/drivers/radeon/r600_pipe_common.c
index 12f6785..e4151b1 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -134,7 +134,7 @@ bool si_common_context_init(struct r600_common_context 

[Mesa-dev] [PATCH 36/55] radeonsi: use si_context instead of pipe_context in parameters pt1

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_query.c   |  4 ++--
 src/gallium/drivers/radeonsi/si_compute.c |  4 ++--
 src/gallium/drivers/radeonsi/si_cp_dma.c  |  4 ++--
 src/gallium/drivers/radeonsi/si_descriptors.c |  3 +--
 src/gallium/drivers/radeonsi/si_gfx_cs.c  |  3 +--
 src/gallium/drivers/radeonsi/si_pipe.h|  3 +--
 src/gallium/drivers/radeonsi/si_state.c   | 14 +-
 src/gallium/drivers/radeonsi/si_state.h   |  6 +++---
 src/gallium/drivers/radeonsi/si_state_draw.c  |  2 +-
 src/gallium/drivers/radeonsi/si_state_shaders.c   | 11 +--
 src/gallium/drivers/radeonsi/si_state_streamout.c |  2 +-
 11 files changed, 24 insertions(+), 32 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_query.c 
b/src/gallium/drivers/radeon/r600_query.c
index 7f92461..a29b201 100644
--- a/src/gallium/drivers/radeon/r600_query.c
+++ b/src/gallium/drivers/radeon/r600_query.c
@@ -715,7 +715,7 @@ static void r600_update_occlusion_query_state(struct 
si_context *sctx,
perfect_enable = sctx->b.num_perfect_occlusion_queries != 0;
 
if (enable != old_enable || perfect_enable != 
old_perfect_enable) {
-   si_set_occlusion_query_state(>b.b, 
old_perfect_enable);
+   si_set_occlusion_query_state(sctx, old_perfect_enable);
}
}
 }
@@ -1661,7 +1661,7 @@ static void r600_query_hw_get_result_resource(struct 
si_context *sctx,
return;
}
 
-   si_save_qbo_state(>b.b, _state);
+   si_save_qbo_state(sctx, _state);
 
r600_get_hw_query_params(sctx, query, index >= 0 ? index : 0, );
consts.end_offset = params.end_offset - params.start_offset;
diff --git a/src/gallium/drivers/radeonsi/si_compute.c 
b/src/gallium/drivers/radeonsi/si_compute.c
index 42d9f0d..39579b2 100644
--- a/src/gallium/drivers/radeonsi/si_compute.c
+++ b/src/gallium/drivers/radeonsi/si_compute.c
@@ -836,11 +836,11 @@ static void si_launch_grid(
si_decompress_textures(sctx, 1 << PIPE_SHADER_COMPUTE);
 
/* Add buffer sizes for memory checking in need_cs_space. */
-   si_context_add_resource_size(ctx, >shader.bo->b.b);
+   si_context_add_resource_size(sctx, >shader.bo->b.b);
/* TODO: add the scratch buffer */
 
if (info->indirect) {
-   si_context_add_resource_size(ctx, info->indirect);
+   si_context_add_resource_size(sctx, info->indirect);
 
/* Indirect buffers use TC L2 on GFX9, but not older hw. */
if (sctx->b.chip_class <= VI &&
diff --git a/src/gallium/drivers/radeonsi/si_cp_dma.c 
b/src/gallium/drivers/radeonsi/si_cp_dma.c
index 7e08ca5..7e3d825 100644
--- a/src/gallium/drivers/radeonsi/si_cp_dma.c
+++ b/src/gallium/drivers/radeonsi/si_cp_dma.c
@@ -166,9 +166,9 @@ static void si_cp_dma_prepare(struct si_context *sctx, 
struct pipe_resource *dst
 
if (!(user_flags & SI_CPDMA_SKIP_BO_LIST_UPDATE)) {
/* Count memory usage in so that need_cs_space can take it into 
account. */
-   si_context_add_resource_size(>b.b, dst);
+   si_context_add_resource_size(sctx, dst);
if (src)
-   si_context_add_resource_size(>b.b, src);
+   si_context_add_resource_size(sctx, src);
}
 
if (!(user_flags & SI_CPDMA_SKIP_CHECK_CS_SPACE))
diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c 
b/src/gallium/drivers/radeonsi/si_descriptors.c
index 3460c13..c528ec3 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -1321,13 +1321,12 @@ void si_get_shader_buffers(struct si_context *sctx,
 
 /* RING BUFFERS */
 
-void si_set_ring_buffer(struct pipe_context *ctx, uint slot,
+void si_set_ring_buffer(struct si_context *sctx, uint slot,
struct pipe_resource *buffer,
unsigned stride, unsigned num_records,
bool add_tid, bool swizzle,
unsigned element_size, unsigned index_stride, uint64_t 
offset)
 {
-   struct si_context *sctx = (struct si_context *)ctx;
struct si_buffer_resources *buffers = >rw_buffers;
struct si_descriptors *descs = >descriptors[SI_DESCS_RW_BUFFERS];
 
diff --git a/src/gallium/drivers/radeonsi/si_gfx_cs.c 
b/src/gallium/drivers/radeonsi/si_gfx_cs.c
index 236a1d0..3de38a0 100644
--- a/src/gallium/drivers/radeonsi/si_gfx_cs.c
+++ b/src/gallium/drivers/radeonsi/si_gfx_cs.c
@@ -261,8 +261,7 @@ void si_begin_new_gfx_cs(struct si_context *ctx)
 
si_mark_atom_dirty(ctx, >scratch_state);
if (ctx->scratch_buffer) {
-   si_context_add_resource_size(>b.b,
->scratch_buffer->b.b);
+   si_context_add_resource_size(ctx, >scratch_buffer->b.b);
}
 

[Mesa-dev] [PATCH 35/55] radeonsi: pass sctx to si_rebind_buffer and clean up

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_buffer_common.c |  5 +++--
 src/gallium/drivers/radeonsi/si_descriptors.c   | 16 ++--
 src/gallium/drivers/radeonsi/si_state.h |  2 +-
 3 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c 
b/src/gallium/drivers/radeon/r600_buffer_common.c
index 5a0e157..e54670a 100644
--- a/src/gallium/drivers/radeon/r600_buffer_common.c
+++ b/src/gallium/drivers/radeon/r600_buffer_common.c
@@ -286,7 +286,7 @@ si_invalidate_buffer(struct si_context *sctx,
 
/* Reallocate the buffer in the same pipe_resource. */
si_alloc_resource(sctx->screen, rbuffer);
-   si_rebind_buffer(>b.b, >b.b, old_va);
+   si_rebind_buffer(sctx, >b.b, old_va);
} else {
util_range_set_empty(>valid_buffer_range);
}
@@ -299,6 +299,7 @@ void si_replace_buffer_storage(struct pipe_context *ctx,
 struct pipe_resource *dst,
 struct pipe_resource *src)
 {
+   struct si_context *sctx = (struct si_context*)ctx;
struct r600_resource *rdst = r600_resource(dst);
struct r600_resource *rsrc = r600_resource(src);
uint64_t old_gpu_address = rdst->gpu_address;
@@ -316,7 +317,7 @@ void si_replace_buffer_storage(struct pipe_context *ctx,
assert(rdst->bo_alignment == rsrc->bo_alignment);
assert(rdst->domains == rsrc->domains);
 
-   si_rebind_buffer(ctx, dst, old_gpu_address);
+   si_rebind_buffer(sctx, dst, old_gpu_address);
 }
 
 static void si_invalidate_resource(struct pipe_context *ctx,
diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c 
b/src/gallium/drivers/radeonsi/si_descriptors.c
index 75c11a2..3460c13 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -1416,8 +1416,7 @@ void si_set_ring_buffer(struct pipe_context *ctx, uint 
slot,
sctx->descriptors_dirty |= 1u << SI_DESCS_RW_BUFFERS;
 }
 
-static void si_desc_reset_buffer_offset(struct pipe_context *ctx,
-   uint32_t *desc, uint64_t old_buf_va,
+static void si_desc_reset_buffer_offset(uint32_t *desc, uint64_t old_buf_va,
struct pipe_resource *new_buf)
 {
/* Retrieve the buffer offset from the descriptor. */
@@ -1525,8 +1524,7 @@ static void si_reset_buffer_resources(struct si_context 
*sctx,
while (mask) {
unsigned i = u_bit_scan();
if (buffers->buffers[i] == buf) {
-   si_desc_reset_buffer_offset(>b.b,
-   descs->list + i*4,
+   si_desc_reset_buffer_offset(descs->list + i*4,
old_va, buf);
sctx->descriptors_dirty |= 1u << descriptors_idx;
 
@@ -1540,10 +1538,9 @@ static void si_reset_buffer_resources(struct si_context 
*sctx,
 /* Update all resource bindings where the buffer is bound, including
  * all resource descriptors. This is invalidate_buffer without
  * the invalidation. */
-void si_rebind_buffer(struct pipe_context *ctx, struct pipe_resource *buf,
+void si_rebind_buffer(struct si_context *sctx, struct pipe_resource *buf,
  uint64_t old_va)
 {
-   struct si_context *sctx = (struct si_context*)ctx;
struct r600_resource *rbuffer = r600_resource(buf);
unsigned i, shader;
unsigned num_elems = sctx->vertex_elements ?
@@ -1582,7 +1579,7 @@ void si_rebind_buffer(struct pipe_context *ctx, struct 
pipe_resource *buf,
if (buffers->buffers[i] != buf)
continue;
 
-   si_desc_reset_buffer_offset(ctx, descs->list + i*4,
+   si_desc_reset_buffer_offset(descs->list + i*4,
old_va, buf);
sctx->descriptors_dirty |= 1u << SI_DESCS_RW_BUFFERS;
 
@@ -1634,8 +1631,7 @@ void si_rebind_buffer(struct pipe_context *ctx, struct 
pipe_resource *buf,
if (samplers->views[i]->texture == buf) {
unsigned desc_slot = 
si_get_sampler_slot(i);
 
-   si_desc_reset_buffer_offset(ctx,
-   descs->list 
+
+   si_desc_reset_buffer_offset(descs->list 
+
desc_slot * 
16 + 4,
old_va, 
buf);
sctx->descriptors_dirty |=
@@ -1668,7 +1664,7 @@ void si_rebind_buffer(struct pipe_context *ctx, struct 
pipe_resource *buf,
 

[Mesa-dev] [PATCH 32/55] radeonsi: update copyrights

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_buffer_common.c| 1 +
 src/gallium/drivers/radeon/r600_cs.h   | 1 +
 src/gallium/drivers/radeon/r600_gpu_load.c | 1 +
 src/gallium/drivers/radeon/r600_perfcounter.c  | 1 +
 src/gallium/drivers/radeon/r600_pipe_common.c  | 1 +
 src/gallium/drivers/radeon/r600_pipe_common.h  | 1 +
 src/gallium/drivers/radeon/r600_query.c| 2 ++
 src/gallium/drivers/radeon/r600_query.h| 1 +
 src/gallium/drivers/radeon/r600_texture.c  | 2 ++
 src/gallium/drivers/radeon/radeon_winsys.h | 2 ++
 src/gallium/drivers/radeonsi/cik_sdma.c| 3 ++-
 src/gallium/drivers/radeonsi/glsl_tests/amdgcn_glslc.c | 1 +
 src/gallium/drivers/radeonsi/si_blit.c | 2 ++
 src/gallium/drivers/radeonsi/si_clear.c| 1 +
 src/gallium/drivers/radeonsi/si_compute.c  | 1 +
 src/gallium/drivers/radeonsi/si_compute.h  | 1 +
 src/gallium/drivers/radeonsi/si_cp_dma.c   | 1 +
 src/gallium/drivers/radeonsi/si_debug.c| 1 +
 src/gallium/drivers/radeonsi/si_descriptors.c  | 1 +
 src/gallium/drivers/radeonsi/si_dma.c  | 2 ++
 src/gallium/drivers/radeonsi/si_dma_cs.c   | 1 +
 src/gallium/drivers/radeonsi/si_fence.c| 1 +
 src/gallium/drivers/radeonsi/si_get.c  | 1 +
 src/gallium/drivers/radeonsi/si_gfx_cs.c   | 2 ++
 src/gallium/drivers/radeonsi/si_perfcounter.c  | 1 +
 src/gallium/drivers/radeonsi/si_pipe.c | 2 ++
 src/gallium/drivers/radeonsi/si_pipe.h | 2 ++
 src/gallium/drivers/radeonsi/si_pm4.c  | 1 +
 src/gallium/drivers/radeonsi/si_pm4.h  | 1 +
 src/gallium/drivers/radeonsi/si_public.h   | 2 ++
 src/gallium/drivers/radeonsi/si_shader.c   | 1 +
 src/gallium/drivers/radeonsi/si_shader.h   | 1 +
 src/gallium/drivers/radeonsi/si_shader_internal.h  | 1 +
 src/gallium/drivers/radeonsi/si_shader_nir.c   | 1 +
 src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c  | 1 +
 src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c  | 1 +
 src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c| 1 +
 src/gallium/drivers/radeonsi/si_state.c| 1 +
 src/gallium/drivers/radeonsi/si_state.h| 1 +
 src/gallium/drivers/radeonsi/si_state_binning.c| 1 +
 src/gallium/drivers/radeonsi/si_state_draw.c   | 1 +
 src/gallium/drivers/radeonsi/si_state_msaa.c   | 1 +
 src/gallium/drivers/radeonsi/si_state_shaders.c| 1 +
 src/gallium/drivers/radeonsi/si_state_streamout.c  | 1 +
 src/gallium/drivers/radeonsi/si_state_viewport.c   | 1 +
 src/gallium/drivers/radeonsi/si_test_dma.c | 1 +
 46 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c 
b/src/gallium/drivers/radeon/r600_buffer_common.c
index e24ee51..5a0e157 100644
--- a/src/gallium/drivers/radeon/r600_buffer_common.c
+++ b/src/gallium/drivers/radeon/r600_buffer_common.c
@@ -1,5 +1,6 @@
 /*
  * Copyright 2013 Advanced Micro Devices, Inc.
+ * All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
diff --git a/src/gallium/drivers/radeon/r600_cs.h 
b/src/gallium/drivers/radeon/r600_cs.h
index b0610f2..030ae72 100644
--- a/src/gallium/drivers/radeon/r600_cs.h
+++ b/src/gallium/drivers/radeon/r600_cs.h
@@ -1,5 +1,6 @@
 /*
  * Copyright 2013 Advanced Micro Devices, Inc.
+ * All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
diff --git a/src/gallium/drivers/radeon/r600_gpu_load.c 
b/src/gallium/drivers/radeon/r600_gpu_load.c
index c1fdf20..f0f16c6 100644
--- a/src/gallium/drivers/radeon/r600_gpu_load.c
+++ b/src/gallium/drivers/radeon/r600_gpu_load.c
@@ -1,5 +1,6 @@
 /*
  * Copyright 2015 Advanced Micro Devices, Inc.
+ * All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
diff --git a/src/gallium/drivers/radeon/r600_perfcounter.c 
b/src/gallium/drivers/radeon/r600_perfcounter.c
index 99f7ca5..676d9c1 100644
--- a/src/gallium/drivers/radeon/r600_perfcounter.c
+++ b/src/gallium/drivers/radeon/r600_perfcounter.c
@@ -1,5 +1,6 @@
 /*
  * Copyright 2015 Advanced Micro Devices, Inc.
+ * All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c 

[Mesa-dev] [PATCH 33/55] radeonsi: use r600_common_context less pt6

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_pipe_common.c | 171 +-
 src/gallium/drivers/radeon/r600_pipe_common.h |   6 +-
 src/gallium/drivers/radeonsi/si_gfx_cs.c  |   2 +-
 src/gallium/drivers/radeonsi/si_pipe.c|   4 +-
 4 files changed, 91 insertions(+), 92 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c 
b/src/gallium/drivers/radeon/r600_pipe_common.c
index 493b6f5..c267e84 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -34,44 +34,44 @@
 
 static enum pipe_reset_status r600_get_reset_status(struct pipe_context *ctx)
 {
-   struct r600_common_context *rctx = (struct r600_common_context *)ctx;
-   unsigned latest = rctx->ws->query_value(rctx->ws,
-   RADEON_GPU_RESET_COUNTER);
+   struct si_context *sctx = (struct si_context *)ctx;
+   unsigned latest = sctx->b.ws->query_value(sctx->b.ws,
+ RADEON_GPU_RESET_COUNTER);
 
-   if (rctx->gpu_reset_counter == latest)
+   if (sctx->b.gpu_reset_counter == latest)
return PIPE_NO_RESET;
 
-   rctx->gpu_reset_counter = latest;
+   sctx->b.gpu_reset_counter = latest;
return PIPE_UNKNOWN_CONTEXT_RESET;
 }
 
 static void r600_set_device_reset_callback(struct pipe_context *ctx,
   const struct 
pipe_device_reset_callback *cb)
 {
-   struct r600_common_context *rctx = (struct r600_common_context *)ctx;
+   struct si_context *sctx = (struct si_context *)ctx;
 
if (cb)
-   rctx->device_reset_callback = *cb;
+   sctx->b.device_reset_callback = *cb;
else
-   memset(>device_reset_callback, 0,
-  sizeof(rctx->device_reset_callback));
+   memset(>b.device_reset_callback, 0,
+  sizeof(sctx->b.device_reset_callback));
 }
 
-bool si_check_device_reset(struct r600_common_context *rctx)
+bool si_check_device_reset(struct si_context *sctx)
 {
enum pipe_reset_status status;
 
-   if (!rctx->device_reset_callback.reset)
+   if (!sctx->b.device_reset_callback.reset)
return false;
 
-   if (!rctx->b.get_device_reset_status)
+   if (!sctx->b.b.get_device_reset_status)
return false;
 
-   status = rctx->b.get_device_reset_status(>b);
+   status = sctx->b.b.get_device_reset_status(>b.b);
if (status == PIPE_NO_RESET)
return false;
 
-   rctx->device_reset_callback.reset(rctx->device_reset_callback.data, 
status);
+   sctx->b.device_reset_callback.reset(sctx->b.device_reset_callback.data, 
status);
return true;
 }
 
@@ -109,122 +109,121 @@ static bool r600_resource_commit(struct pipe_context 
*pctx,
return ctx->b.ws->buffer_commit(res->buf, box->x, box->width, commit);
 }
 
-bool si_common_context_init(struct r600_common_context *rctx,
+bool si_common_context_init(struct si_context *sctx,
struct si_screen *sscreen,
unsigned context_flags)
 {
-   struct si_context *sctx = (struct si_context*)rctx;
 
-   slab_create_child(>pool_transfers, >pool_transfers);
-   slab_create_child(>pool_transfers_unsync, 
>pool_transfers);
+   slab_create_child(>b.pool_transfers, >pool_transfers);
+   slab_create_child(>b.pool_transfers_unsync, 
>pool_transfers);
 
-   rctx->screen = sscreen;
-   rctx->ws = sscreen->ws;
-   rctx->family = sscreen->info.family;
-   rctx->chip_class = sscreen->info.chip_class;
+   sctx->b.screen = sscreen;
+   sctx->b.ws = sscreen->ws;
+   sctx->b.family = sscreen->info.family;
+   sctx->b.chip_class = sscreen->info.chip_class;
 
-   rctx->b.resource_commit = r600_resource_commit;
+   sctx->b.b.resource_commit = r600_resource_commit;
 
if (sscreen->info.drm_major == 2 && sscreen->info.drm_minor >= 43) {
-   rctx->b.get_device_reset_status = r600_get_reset_status;
-   rctx->gpu_reset_counter =
-   rctx->ws->query_value(rctx->ws,
- RADEON_GPU_RESET_COUNTER);
+   sctx->b.b.get_device_reset_status = r600_get_reset_status;
+   sctx->b.gpu_reset_counter =
+   sctx->b.ws->query_value(sctx->b.ws,
+   
RADEON_GPU_RESET_COUNTER);
}
 
-   rctx->b.set_device_reset_callback = r600_set_device_reset_callback;
+   sctx->b.b.set_device_reset_callback = r600_set_device_reset_callback;
 
si_init_context_texture_functions(sctx);
si_init_query_functions(sctx);
 
-   if (rctx->chip_class == CIK ||
-   rctx->chip_class == VI ||
-   rctx->chip_class == GFX9) {
-   

[Mesa-dev] [PATCH 23/55] radeonsi: flatten / remove struct r600_ring

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_buffer_common.c   | 20 ++---
 src/gallium/drivers/radeon/r600_cs.h  |  8 ++---
 src/gallium/drivers/radeon/r600_pipe_common.c | 22 +++---
 src/gallium/drivers/radeon/r600_pipe_common.h |  8 ++---
 src/gallium/drivers/radeon/r600_query.c   | 12 
 src/gallium/drivers/radeon/r600_texture.c |  2 +-
 src/gallium/drivers/radeonsi/cik_sdma.c   | 12 
 src/gallium/drivers/radeonsi/si_compute.c | 28 +-
 src/gallium/drivers/radeonsi/si_cp_dma.c  | 10 +++
 src/gallium/drivers/radeonsi/si_debug.c   |  4 +--
 src/gallium/drivers/radeonsi/si_descriptors.c | 26 
 src/gallium/drivers/radeonsi/si_dma.c |  8 ++---
 src/gallium/drivers/radeonsi/si_dma_cs.c  | 30 +--
 src/gallium/drivers/radeonsi/si_fence.c   | 36 +++
 src/gallium/drivers/radeonsi/si_gfx_cs.c  | 14 -
 src/gallium/drivers/radeonsi/si_perfcounter.c | 14 -
 src/gallium/drivers/radeonsi/si_pipe.c|  4 +--
 src/gallium/drivers/radeonsi/si_pm4.c |  6 ++--
 src/gallium/drivers/radeonsi/si_state.c   | 28 +-
 src/gallium/drivers/radeonsi/si_state_binning.c   |  4 +--
 src/gallium/drivers/radeonsi/si_state_draw.c  | 24 +++
 src/gallium/drivers/radeonsi/si_state_shaders.c   |  6 ++--
 src/gallium/drivers/radeonsi/si_state_streamout.c | 16 +-
 src/gallium/drivers/radeonsi/si_state_viewport.c  | 10 +++
 24 files changed, 174 insertions(+), 178 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c 
b/src/gallium/drivers/radeon/r600_buffer_common.c
index bc7e14b..3789bcc 100644
--- a/src/gallium/drivers/radeon/r600_buffer_common.c
+++ b/src/gallium/drivers/radeon/r600_buffer_common.c
@@ -32,11 +32,11 @@ bool si_rings_is_buffer_referenced(struct 
r600_common_context *ctx,
   struct pb_buffer *buf,
   enum radeon_bo_usage usage)
 {
-   if (ctx->ws->cs_is_buffer_referenced(ctx->gfx.cs, buf, usage)) {
+   if (ctx->ws->cs_is_buffer_referenced(ctx->gfx_cs, buf, usage)) {
return true;
}
-   if (radeon_emitted(ctx->dma.cs, 0) &&
-   ctx->ws->cs_is_buffer_referenced(ctx->dma.cs, buf, usage)) {
+   if (radeon_emitted(ctx->dma_cs, 0) &&
+   ctx->ws->cs_is_buffer_referenced(ctx->dma_cs, buf, usage)) {
return true;
}
return false;
@@ -60,8 +60,8 @@ void *si_buffer_map_sync_with_rings(struct 
r600_common_context *ctx,
rusage = RADEON_USAGE_WRITE;
}
 
-   if (radeon_emitted(ctx->gfx.cs, ctx->initial_gfx_cs_size) &&
-   ctx->ws->cs_is_buffer_referenced(ctx->gfx.cs,
+   if (radeon_emitted(ctx->gfx_cs, ctx->initial_gfx_cs_size) &&
+   ctx->ws->cs_is_buffer_referenced(ctx->gfx_cs,
 resource->buf, rusage)) {
if (usage & PIPE_TRANSFER_DONTBLOCK) {
si_flush_gfx_cs(ctx, PIPE_FLUSH_ASYNC, NULL);
@@ -71,8 +71,8 @@ void *si_buffer_map_sync_with_rings(struct 
r600_common_context *ctx,
busy = true;
}
}
-   if (radeon_emitted(ctx->dma.cs, 0) &&
-   ctx->ws->cs_is_buffer_referenced(ctx->dma.cs,
+   if (radeon_emitted(ctx->dma_cs, 0) &&
+   ctx->ws->cs_is_buffer_referenced(ctx->dma_cs,
 resource->buf, rusage)) {
if (usage & PIPE_TRANSFER_DONTBLOCK) {
si_flush_dma_cs(ctx, PIPE_FLUSH_ASYNC, NULL);
@@ -89,9 +89,9 @@ void *si_buffer_map_sync_with_rings(struct 
r600_common_context *ctx,
} else {
/* We will be wait for the GPU. Wait for any offloaded
 * CS flush to complete to avoid busy-waiting in the 
winsys. */
-   ctx->ws->cs_sync_flush(ctx->gfx.cs);
-   if (ctx->dma.cs)
-   ctx->ws->cs_sync_flush(ctx->dma.cs);
+   ctx->ws->cs_sync_flush(ctx->gfx_cs);
+   if (ctx->dma_cs)
+   ctx->ws->cs_sync_flush(ctx->dma_cs);
}
}
 
diff --git a/src/gallium/drivers/radeon/r600_cs.h 
b/src/gallium/drivers/radeon/r600_cs.h
index 5cfe6ab..0283ad7 100644
--- a/src/gallium/drivers/radeon/r600_cs.h
+++ b/src/gallium/drivers/radeon/r600_cs.h
@@ -65,14 +65,14 @@ radeon_cs_memory_below_limit(struct si_screen *screen,
  * rebuilt.
  */
 static inline void radeon_add_to_buffer_list(struct r600_common_context *rctx,
-struct r600_ring *ring,
+struct radeon_winsys_cs *cs,

[Mesa-dev] [PATCH 29/55] radeonsi: use r600_common_context less pt4

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_pipe_common.c |   4 +-
 src/gallium/drivers/radeon/r600_pipe_common.h |  12 +-
 src/gallium/drivers/radeon/r600_texture.c | 224 +-
 src/gallium/drivers/radeonsi/cik_sdma.c   |   4 +-
 src/gallium/drivers/radeonsi/si_blit.c|  12 +-
 src/gallium/drivers/radeonsi/si_clear.c   |   2 +-
 src/gallium/drivers/radeonsi/si_descriptors.c |   4 +-
 src/gallium/drivers/radeonsi/si_dma.c |   4 +-
 src/gallium/drivers/radeonsi/si_state.c   |   2 +-
 9 files changed, 134 insertions(+), 134 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c 
b/src/gallium/drivers/radeon/r600_pipe_common.c
index 0db8872..12f6785 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -112,6 +112,8 @@ bool si_common_context_init(struct r600_common_context 
*rctx,
struct si_screen *sscreen,
unsigned context_flags)
 {
+   struct si_context *sctx = (struct si_context*)rctx;
+
slab_create_child(>pool_transfers, >pool_transfers);
slab_create_child(>pool_transfers_unsync, 
>pool_transfers);
 
@@ -131,7 +133,7 @@ bool si_common_context_init(struct r600_common_context 
*rctx,
 
rctx->b.set_device_reset_callback = r600_set_device_reset_callback;
 
-   si_init_context_texture_functions(rctx);
+   si_init_context_texture_functions(sctx);
si_init_query_functions(rctx);
 
if (rctx->chip_class == CIK ||
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index e2329a9..fb2bf24 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -526,7 +526,7 @@ void si_suspend_queries(struct r600_common_context *ctx);
 void si_resume_queries(struct r600_common_context *ctx);
 
 /* r600_texture.c */
-bool si_prepare_for_dma_blit(struct r600_common_context *rctx,
+bool si_prepare_for_dma_blit(struct si_context *sctx,
 struct r600_texture *rdst,
 unsigned dst_level, unsigned dstx,
 unsigned dsty, unsigned dstz,
@@ -540,7 +540,7 @@ void si_texture_get_fmask_info(struct si_screen *sscreen,
 void si_texture_get_cmask_info(struct si_screen *sscreen,
   struct r600_texture *rtex,
   struct r600_cmask_info *out);
-void si_eliminate_fast_color_clear(struct r600_common_context *rctx,
+void si_eliminate_fast_color_clear(struct si_context *sctx,
   struct r600_texture *rtex);
 void si_texture_discard_cmask(struct si_screen *sscreen,
  struct r600_texture *rtex);
@@ -556,7 +556,7 @@ bool vi_dcc_formats_compatible(enum pipe_format format1,
 bool vi_dcc_formats_are_incompatible(struct pipe_resource *tex,
 unsigned level,
 enum pipe_format view_format);
-void vi_disable_dcc_if_incompatible_format(struct r600_common_context *rctx,
+void vi_disable_dcc_if_incompatible_format(struct si_context *sctx,
   struct pipe_resource *tex,
   unsigned level,
   enum pipe_format view_format);
@@ -566,7 +566,7 @@ struct pipe_surface *si_create_surface_custom(struct 
pipe_context *pipe,
  unsigned width0, unsigned height0,
  unsigned width, unsigned height);
 unsigned si_translate_colorswap(enum pipe_format format, bool do_endian_swap);
-void vi_separate_dcc_try_enable(struct r600_common_context *rctx,
+void vi_separate_dcc_try_enable(struct si_context *sctx,
struct r600_texture *tex);
 void vi_separate_dcc_start_query(struct pipe_context *ctx,
 struct r600_texture *tex);
@@ -574,10 +574,10 @@ void vi_separate_dcc_stop_query(struct pipe_context *ctx,
struct r600_texture *tex);
 void vi_separate_dcc_process_and_reset_stats(struct pipe_context *ctx,
 struct r600_texture *tex);
-bool si_texture_disable_dcc(struct r600_common_context *rctx,
+bool si_texture_disable_dcc(struct si_context *sctx,
struct r600_texture *rtex);
 void si_init_screen_texture_functions(struct si_screen *sscreen);
-void si_init_context_texture_functions(struct r600_common_context *rctx);
+void si_init_context_texture_functions(struct si_context *sctx);
 
 
 /* Inline helpers. */
diff --git a/src/gallium/drivers/radeon/r600_texture.c 
b/src/gallium/drivers/radeon/r600_texture.c
index 1040292..e0a68ea 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ 

[Mesa-dev] [PATCH 24/55] radeonsi: switch r600_atom::emit parameter to si_context

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_pipe_common.h |  2 +-
 src/gallium/drivers/radeon/r600_query.c   | 18 +-
 src/gallium/drivers/radeonsi/si_compute.c |  2 +-
 src/gallium/drivers/radeonsi/si_state.c   |  2 +-
 src/gallium/drivers/radeonsi/si_state_draw.c  |  6 +++---
 src/gallium/drivers/radeonsi/si_state_streamout.c |  7 ++-
 src/gallium/drivers/radeonsi/si_state_viewport.c  |  6 ++
 7 files changed, 19 insertions(+), 24 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index 96b14e0..5c109fa 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -363,7 +363,7 @@ struct r600_memory_object {
 /* This encapsulates a state or an operation which can emitted into the GPU
  * command stream. */
 struct r600_atom {
-   void (*emit)(struct r600_common_context *ctx, struct r600_atom *state);
+   void (*emit)(struct si_context *ctx, struct r600_atom *state);
unsigned short  id;
 };
 
diff --git a/src/gallium/drivers/radeon/r600_query.c 
b/src/gallium/drivers/radeon/r600_query.c
index 585915e..ad859c4 100644
--- a/src/gallium/drivers/radeon/r600_query.c
+++ b/src/gallium/drivers/radeon/r600_query.c
@@ -914,13 +914,13 @@ static void r600_query_hw_emit_stop(struct 
r600_common_context *ctx,
si_update_prims_generated_query_state((void*)ctx, query->b.type, -1);
 }
 
-static void emit_set_predicate(struct r600_common_context *ctx,
+static void emit_set_predicate(struct si_context *ctx,
   struct r600_resource *buf, uint64_t va,
   uint32_t op)
 {
-   struct radeon_winsys_cs *cs = ctx->gfx_cs;
+   struct radeon_winsys_cs *cs = ctx->b.gfx_cs;
 
-   if (ctx->chip_class >= GFX9) {
+   if (ctx->b.chip_class >= GFX9) {
radeon_emit(cs, PKT3(PKT3_SET_PREDICATION, 2, 0));
radeon_emit(cs, op);
radeon_emit(cs, va);
@@ -930,14 +930,14 @@ static void emit_set_predicate(struct r600_common_context 
*ctx,
radeon_emit(cs, va);
radeon_emit(cs, op | ((va >> 32) & 0xFF));
}
-   radeon_add_to_buffer_list(ctx, ctx->gfx_cs, buf, RADEON_USAGE_READ,
+   radeon_add_to_buffer_list(>b, ctx->b.gfx_cs, buf, 
RADEON_USAGE_READ,
  RADEON_PRIO_QUERY);
 }
 
-static void r600_emit_query_predication(struct r600_common_context *ctx,
+static void r600_emit_query_predication(struct si_context *ctx,
struct r600_atom *atom)
 {
-   struct r600_query_hw *query = (struct r600_query_hw *)ctx->render_cond;
+   struct r600_query_hw *query = (struct r600_query_hw 
*)ctx->b.render_cond;
struct r600_query_buffer *qbuf;
uint32_t op;
bool flag_wait, invert;
@@ -945,9 +945,9 @@ static void r600_emit_query_predication(struct 
r600_common_context *ctx,
if (!query)
return;
 
-   invert = ctx->render_cond_invert;
-   flag_wait = ctx->render_cond_mode == PIPE_RENDER_COND_WAIT ||
-   ctx->render_cond_mode == PIPE_RENDER_COND_BY_REGION_WAIT;
+   invert = ctx->b.render_cond_invert;
+   flag_wait = ctx->b.render_cond_mode == PIPE_RENDER_COND_WAIT ||
+   ctx->b.render_cond_mode == PIPE_RENDER_COND_BY_REGION_WAIT;
 
if (query->workaround_buf) {
op = PRED_OP(PREDICATION_OP_BOOL64);
diff --git a/src/gallium/drivers/radeonsi/si_compute.c 
b/src/gallium/drivers/radeonsi/si_compute.c
index 7e458e3..5b60742 100644
--- a/src/gallium/drivers/radeonsi/si_compute.c
+++ b/src/gallium/drivers/radeonsi/si_compute.c
@@ -865,7 +865,7 @@ static void si_launch_grid(
si_emit_compute_shader_pointers(sctx);
 
if (si_is_atom_dirty(sctx, sctx->atoms.s.render_cond)) {
-   sctx->atoms.s.render_cond->emit(>b,
+   sctx->atoms.s.render_cond->emit(sctx,
sctx->atoms.s.render_cond);
si_set_atom_dirty(sctx, sctx->atoms.s.render_cond, false);
}
diff --git a/src/gallium/drivers/radeonsi/si_state.c 
b/src/gallium/drivers/radeonsi/si_state.c
index d3e6a33..fea90a4 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -48,7 +48,7 @@ void si_init_atom(struct si_context *sctx, struct r600_atom 
*atom,
  struct r600_atom **list_elem,
  void (*emit_func)(struct si_context *ctx, struct r600_atom 
*state))
 {
-   atom->emit = (void*)emit_func;
+   atom->emit = emit_func;
atom->id = list_elem - sctx->atoms.array;
*list_elem = atom;
 }
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c 
b/src/gallium/drivers/radeonsi/si_state_draw.c
index d7aecfd..f571d7f 100644
--- 

[Mesa-dev] [PATCH 27/55] radeonsi: use r600_common_context less pt2

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_buffer_common.c |  4 ++--
 src/gallium/drivers/radeon/r600_cs.h|  2 +-
 src/gallium/drivers/radeon/r600_query.c | 20 +---
 src/gallium/drivers/radeon/r600_texture.c   |  3 ++-
 src/gallium/drivers/radeonsi/si_fence.c | 32 -
 src/gallium/drivers/radeonsi/si_gfx_cs.c|  3 +--
 src/gallium/drivers/radeonsi/si_perfcounter.c   | 11 +
 src/gallium/drivers/radeonsi/si_pipe.c  |  2 +-
 src/gallium/drivers/radeonsi/si_pipe.h  | 12 +-
 src/gallium/drivers/radeonsi/si_state_draw.c|  6 ++---
 10 files changed, 49 insertions(+), 46 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c 
b/src/gallium/drivers/radeon/r600_buffer_common.c
index 8a4ad2d..aff2360 100644
--- a/src/gallium/drivers/radeon/r600_buffer_common.c
+++ b/src/gallium/drivers/radeon/r600_buffer_common.c
@@ -65,10 +65,10 @@ void *si_buffer_map_sync_with_rings(struct 
r600_common_context *ctx,
ctx->ws->cs_is_buffer_referenced(ctx->gfx_cs,
 resource->buf, rusage)) {
if (usage & PIPE_TRANSFER_DONTBLOCK) {
-   si_flush_gfx_cs(ctx, PIPE_FLUSH_ASYNC, NULL);
+   si_flush_gfx_cs(sctx, PIPE_FLUSH_ASYNC, NULL);
return NULL;
} else {
-   si_flush_gfx_cs(ctx, 0, NULL);
+   si_flush_gfx_cs(sctx, 0, NULL);
busy = true;
}
}
diff --git a/src/gallium/drivers/radeon/r600_cs.h 
b/src/gallium/drivers/radeon/r600_cs.h
index 0283ad7..c90f06b 100644
--- a/src/gallium/drivers/radeon/r600_cs.h
+++ b/src/gallium/drivers/radeon/r600_cs.h
@@ -105,7 +105,7 @@ radeon_add_to_gfx_buffer_list_check_mem(struct si_context 
*sctx,
!radeon_cs_memory_below_limit(sctx->screen, sctx->b.gfx_cs,
  sctx->b.vram + rbo->vram_usage,
  sctx->b.gtt + rbo->gart_usage))
-   si_flush_gfx_cs(>b, PIPE_FLUSH_ASYNC, NULL);
+   si_flush_gfx_cs(sctx, PIPE_FLUSH_ASYNC, NULL);
 
radeon_add_to_buffer_list(>b, sctx->b.gfx_cs, rbo, usage, 
priority);
 }
diff --git a/src/gallium/drivers/radeon/r600_query.c 
b/src/gallium/drivers/radeon/r600_query.c
index ad859c4..9741223 100644
--- a/src/gallium/drivers/radeon/r600_query.c
+++ b/src/gallium/drivers/radeon/r600_query.c
@@ -827,7 +827,8 @@ static void r600_query_hw_do_emit_stop(struct 
r600_common_context *ctx,
   struct r600_resource *buffer,
   uint64_t va)
 {
-   struct radeon_winsys_cs *cs = ctx->gfx_cs;
+   struct si_context *sctx = (struct si_context*)ctx;
+   struct radeon_winsys_cs *cs = sctx->b.gfx_cs;
uint64_t fence_va = 0;
 
switch (query->b.type) {
@@ -858,9 +859,9 @@ static void r600_query_hw_do_emit_stop(struct 
r600_common_context *ctx,
va += 8;
/* fall through */
case PIPE_QUERY_TIMESTAMP:
-   si_gfx_write_event_eop(ctx, V_028A90_BOTTOM_OF_PIPE_TS,
-0, EOP_DATA_SEL_TIMESTAMP, NULL, va,
-0, query->b.type);
+   si_gfx_write_event_eop(sctx, V_028A90_BOTTOM_OF_PIPE_TS,
+  0, EOP_DATA_SEL_TIMESTAMP, NULL, va,
+  0, query->b.type);
fence_va = va + 8;
break;
case PIPE_QUERY_PIPELINE_STATISTICS: {
@@ -882,10 +883,10 @@ static void r600_query_hw_do_emit_stop(struct 
r600_common_context *ctx,
  RADEON_PRIO_QUERY);
 
if (fence_va)
-   si_gfx_write_event_eop(ctx, V_028A90_BOTTOM_OF_PIPE_TS, 0,
-EOP_DATA_SEL_VALUE_32BIT,
-query->buffer.buf, fence_va, 
0x8000,
-query->b.type);
+   si_gfx_write_event_eop(sctx, V_028A90_BOTTOM_OF_PIPE_TS, 0,
+  EOP_DATA_SEL_VALUE_32BIT,
+  query->buffer.buf, fence_va, 0x8000,
+  query->b.type);
 }
 
 static void r600_query_hw_emit_stop(struct r600_common_context *ctx,
@@ -1626,6 +1627,7 @@ static void r600_query_hw_get_result_resource(struct 
r600_common_context *rctx,
   struct pipe_resource *resource,
   unsigned offset)
 {
+   struct si_context *sctx = (struct si_context*)rctx;
struct r600_query_hw *query = (struct r600_query_hw *)rquery;
struct r600_query_buffer *qbuf;
struct r600_query_buffer *qbuf_prev;
@@ 

[Mesa-dev] [PATCH 28/55] radeonsi: use r600_common_context less pt3

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_buffer_common.c | 79 -
 src/gallium/drivers/radeon/r600_pipe_common.h   |  4 +-
 src/gallium/drivers/radeon/r600_query.c |  6 +-
 src/gallium/drivers/radeon/r600_texture.c   |  7 ++-
 src/gallium/drivers/radeonsi/si_fence.c | 12 ++--
 5 files changed, 54 insertions(+), 54 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c 
b/src/gallium/drivers/radeon/r600_buffer_common.c
index aff2360..e24ee51 100644
--- a/src/gallium/drivers/radeon/r600_buffer_common.c
+++ b/src/gallium/drivers/radeon/r600_buffer_common.c
@@ -28,32 +28,31 @@
 #include 
 #include 
 
-bool si_rings_is_buffer_referenced(struct r600_common_context *ctx,
+bool si_rings_is_buffer_referenced(struct si_context *sctx,
   struct pb_buffer *buf,
   enum radeon_bo_usage usage)
 {
-   if (ctx->ws->cs_is_buffer_referenced(ctx->gfx_cs, buf, usage)) {
+   if (sctx->b.ws->cs_is_buffer_referenced(sctx->b.gfx_cs, buf, usage)) {
return true;
}
-   if (radeon_emitted(ctx->dma_cs, 0) &&
-   ctx->ws->cs_is_buffer_referenced(ctx->dma_cs, buf, usage)) {
+   if (radeon_emitted(sctx->b.dma_cs, 0) &&
+   sctx->b.ws->cs_is_buffer_referenced(sctx->b.dma_cs, buf, usage)) {
return true;
}
return false;
 }
 
-void *si_buffer_map_sync_with_rings(struct r600_common_context *ctx,
+void *si_buffer_map_sync_with_rings(struct si_context *sctx,
struct r600_resource *resource,
unsigned usage)
 {
-   struct si_context *sctx = (struct si_context*)ctx;
enum radeon_bo_usage rusage = RADEON_USAGE_READWRITE;
bool busy = false;
 
assert(!(resource->flags & RADEON_FLAG_SPARSE));
 
if (usage & PIPE_TRANSFER_UNSYNCHRONIZED) {
-   return ctx->ws->buffer_map(resource->buf, NULL, usage);
+   return sctx->b.ws->buffer_map(resource->buf, NULL, usage);
}
 
if (!(usage & PIPE_TRANSFER_WRITE)) {
@@ -61,9 +60,9 @@ void *si_buffer_map_sync_with_rings(struct 
r600_common_context *ctx,
rusage = RADEON_USAGE_WRITE;
}
 
-   if (radeon_emitted(ctx->gfx_cs, ctx->initial_gfx_cs_size) &&
-   ctx->ws->cs_is_buffer_referenced(ctx->gfx_cs,
-resource->buf, rusage)) {
+   if (radeon_emitted(sctx->b.gfx_cs, sctx->b.initial_gfx_cs_size) &&
+   sctx->b.ws->cs_is_buffer_referenced(sctx->b.gfx_cs,
+   resource->buf, rusage)) {
if (usage & PIPE_TRANSFER_DONTBLOCK) {
si_flush_gfx_cs(sctx, PIPE_FLUSH_ASYNC, NULL);
return NULL;
@@ -72,9 +71,9 @@ void *si_buffer_map_sync_with_rings(struct 
r600_common_context *ctx,
busy = true;
}
}
-   if (radeon_emitted(ctx->dma_cs, 0) &&
-   ctx->ws->cs_is_buffer_referenced(ctx->dma_cs,
-resource->buf, rusage)) {
+   if (radeon_emitted(sctx->b.dma_cs, 0) &&
+   sctx->b.ws->cs_is_buffer_referenced(sctx->b.dma_cs,
+   resource->buf, rusage)) {
if (usage & PIPE_TRANSFER_DONTBLOCK) {
si_flush_dma_cs(sctx, PIPE_FLUSH_ASYNC, NULL);
return NULL;
@@ -84,20 +83,20 @@ void *si_buffer_map_sync_with_rings(struct 
r600_common_context *ctx,
}
}
 
-   if (busy || !ctx->ws->buffer_wait(resource->buf, 0, rusage)) {
+   if (busy || !sctx->b.ws->buffer_wait(resource->buf, 0, rusage)) {
if (usage & PIPE_TRANSFER_DONTBLOCK) {
return NULL;
} else {
/* We will be wait for the GPU. Wait for any offloaded
 * CS flush to complete to avoid busy-waiting in the 
winsys. */
-   ctx->ws->cs_sync_flush(ctx->gfx_cs);
-   if (ctx->dma_cs)
-   ctx->ws->cs_sync_flush(ctx->dma_cs);
+   sctx->b.ws->cs_sync_flush(sctx->b.gfx_cs);
+   if (sctx->b.dma_cs)
+   sctx->b.ws->cs_sync_flush(sctx->b.dma_cs);
}
}
 
/* Setting the CS to NULL will prevent doing checks we have done 
already. */
-   return ctx->ws->buffer_map(resource->buf, NULL, usage);
+   return sctx->b.ws->buffer_map(resource->buf, NULL, usage);
 }
 
 void si_init_resource_fields(struct si_screen *sscreen,
@@ -262,8 +261,8 @@ static void r600_buffer_destroy(struct pipe_screen *screen,
  * idle by discarding its contents.
  */
 static bool
-r600_invalidate_buffer(struct r600_common_context *rctx,
-  

[Mesa-dev] [PATCH 19/55] radeonsi: move saved_cs functions from r600_pipe_common.c to si_debug.c

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_pipe_common.c | 51 ---
 src/gallium/drivers/radeon/r600_pipe_common.h |  3 --
 src/gallium/drivers/radeonsi/si_debug.c   | 51 +++
 src/gallium/drivers/radeonsi/si_pipe.h|  3 ++
 4 files changed, 54 insertions(+), 54 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c 
b/src/gallium/drivers/radeon/r600_pipe_common.c
index 987c955..bd35aa8 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -31,57 +31,6 @@
  * pipe_context
  */
 
-/**
- * Store a linearized copy of all chunks of \p cs together with the buffer
- * list in \p saved.
- */
-void si_save_cs(struct radeon_winsys *ws, struct radeon_winsys_cs *cs,
-   struct radeon_saved_cs *saved, bool get_buffer_list)
-{
-   uint32_t *buf;
-   unsigned i;
-
-   /* Save the IB chunks. */
-   saved->num_dw = cs->prev_dw + cs->current.cdw;
-   saved->ib = MALLOC(4 * saved->num_dw);
-   if (!saved->ib)
-   goto oom;
-
-   buf = saved->ib;
-   for (i = 0; i < cs->num_prev; ++i) {
-   memcpy(buf, cs->prev[i].buf, cs->prev[i].cdw * 4);
-   buf += cs->prev[i].cdw;
-   }
-   memcpy(buf, cs->current.buf, cs->current.cdw * 4);
-
-   if (!get_buffer_list)
-   return;
-
-   /* Save the buffer list. */
-   saved->bo_count = ws->cs_get_buffer_list(cs, NULL);
-   saved->bo_list = CALLOC(saved->bo_count,
-   sizeof(saved->bo_list[0]));
-   if (!saved->bo_list) {
-   FREE(saved->ib);
-   goto oom;
-   }
-   ws->cs_get_buffer_list(cs, saved->bo_list);
-
-   return;
-
-oom:
-   fprintf(stderr, "%s: out of memory\n", __func__);
-   memset(saved, 0, sizeof(*saved));
-}
-
-void si_clear_saved_cs(struct radeon_saved_cs *saved)
-{
-   FREE(saved->ib);
-   FREE(saved->bo_list);
-
-   memset(saved, 0, sizeof(*saved));
-}
-
 static enum pipe_reset_status r600_get_reset_status(struct pipe_context *ctx)
 {
struct r600_common_context *rctx = (struct r600_common_context *)ctx;
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index b58c345..50f1745 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -514,9 +514,6 @@ bool si_common_context_init(struct r600_common_context 
*rctx,
struct si_screen *sscreen,
unsigned context_flags);
 void si_common_context_cleanup(struct r600_common_context *rctx);
-void si_save_cs(struct radeon_winsys *ws, struct radeon_winsys_cs *cs,
-   struct radeon_saved_cs *saved, bool get_buffer_list);
-void si_clear_saved_cs(struct radeon_saved_cs *saved);
 bool si_check_device_reset(struct r600_common_context *rctx);
 
 /* r600_gpu_load.c */
diff --git a/src/gallium/drivers/radeonsi/si_debug.c 
b/src/gallium/drivers/radeonsi/si_debug.c
index 886f79d..f036f5e 100644
--- a/src/gallium/drivers/radeonsi/si_debug.c
+++ b/src/gallium/drivers/radeonsi/si_debug.c
@@ -37,6 +37,57 @@ static void si_dump_bo_list(struct si_context *sctx,
 
 DEBUG_GET_ONCE_OPTION(replace_shaders, "RADEON_REPLACE_SHADERS", NULL)
 
+/**
+ * Store a linearized copy of all chunks of \p cs together with the buffer
+ * list in \p saved.
+ */
+void si_save_cs(struct radeon_winsys *ws, struct radeon_winsys_cs *cs,
+   struct radeon_saved_cs *saved, bool get_buffer_list)
+{
+   uint32_t *buf;
+   unsigned i;
+
+   /* Save the IB chunks. */
+   saved->num_dw = cs->prev_dw + cs->current.cdw;
+   saved->ib = MALLOC(4 * saved->num_dw);
+   if (!saved->ib)
+   goto oom;
+
+   buf = saved->ib;
+   for (i = 0; i < cs->num_prev; ++i) {
+   memcpy(buf, cs->prev[i].buf, cs->prev[i].cdw * 4);
+   buf += cs->prev[i].cdw;
+   }
+   memcpy(buf, cs->current.buf, cs->current.cdw * 4);
+
+   if (!get_buffer_list)
+   return;
+
+   /* Save the buffer list. */
+   saved->bo_count = ws->cs_get_buffer_list(cs, NULL);
+   saved->bo_list = CALLOC(saved->bo_count,
+   sizeof(saved->bo_list[0]));
+   if (!saved->bo_list) {
+   FREE(saved->ib);
+   goto oom;
+   }
+   ws->cs_get_buffer_list(cs, saved->bo_list);
+
+   return;
+
+oom:
+   fprintf(stderr, "%s: out of memory\n", __func__);
+   memset(saved, 0, sizeof(*saved));
+}
+
+void si_clear_saved_cs(struct radeon_saved_cs *saved)
+{
+   FREE(saved->ib);
+   FREE(saved->bo_list);
+
+   memset(saved, 0, sizeof(*saved));
+}
+
 void si_destroy_saved_cs(struct si_saved_cs *scs)
 {
si_clear_saved_cs(>gfx);
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h 

[Mesa-dev] [PATCH 22/55] radeonsi: remove r600_ring::flush callback

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_pipe_common.c | 1 -
 src/gallium/drivers/radeon/r600_pipe_common.h | 2 --
 src/gallium/drivers/radeonsi/si_fence.c   | 6 +++---
 src/gallium/drivers/radeonsi/si_pipe.c| 1 -
 4 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c 
b/src/gallium/drivers/radeon/r600_pipe_common.c
index bd35aa8..f09770d 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -177,7 +177,6 @@ bool si_common_context_init(struct r600_common_context 
*rctx,
rctx->dma.cs = rctx->ws->cs_create(rctx->ctx, RING_DMA,
   si_flush_dma_cs,
   rctx);
-   rctx->dma.flush = si_flush_dma_cs;
}
 
return true;
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index 50f1745..0faf66d 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -369,8 +369,6 @@ struct r600_atom {
 
 struct r600_ring {
struct radeon_winsys_cs *cs;
-   void (*flush)(void *ctx, unsigned flags,
- struct pipe_fence_handle **fence);
 };
 
 /* Saved CS data for debugging features. */
diff --git a/src/gallium/drivers/radeonsi/si_fence.c 
b/src/gallium/drivers/radeonsi/si_fence.c
index 3b43709..cd8a88b 100644
--- a/src/gallium/drivers/radeonsi/si_fence.c
+++ b/src/gallium/drivers/radeonsi/si_fence.c
@@ -376,7 +376,7 @@ static boolean si_fence_finish(struct pipe_screen *screen,
 * not going to wait.
 */
threaded_context_unwrap_sync(ctx);
-   sctx->b.gfx.flush(>b, timeout ? 0 : 
PIPE_FLUSH_ASYNC, NULL);
+   si_flush_gfx_cs(>b, timeout ? 0 : 
PIPE_FLUSH_ASYNC, NULL);
rfence->gfx_unflushed.ctx = NULL;
 
if (!timeout)
@@ -516,7 +516,7 @@ static void si_flush_from_st(struct pipe_context *ctx,
 
/* DMA IBs are preambles to gfx IBs, therefore must be flushed first. */
if (rctx->dma.cs)
-   rctx->dma.flush(rctx, rflags, fence ? _fence : NULL);
+   si_flush_dma_cs(rctx, rflags, fence ? _fence : NULL);
 
if (!radeon_emitted(rctx->gfx.cs, rctx->initial_gfx_cs_size)) {
if (fence)
@@ -536,7 +536,7 @@ static void si_flush_from_st(struct pipe_context *ctx,
gfx_fence = rctx->ws->cs_get_next_fence(rctx->gfx.cs);
deferred_fence = true;
} else {
-   rctx->gfx.flush(rctx, rflags, fence ? _fence : 
NULL);
+   si_flush_gfx_cs(rctx, rflags, fence ? _fence : 
NULL);
}
}
 
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c 
b/src/gallium/drivers/radeonsi/si_pipe.c
index c8ed549..ef2942d 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -286,7 +286,6 @@ static struct pipe_context *si_create_context(struct 
pipe_screen *screen,
 
sctx->b.gfx.cs = ws->cs_create(sctx->b.ctx, RING_GFX,
   si_flush_gfx_cs, sctx);
-   sctx->b.gfx.flush = si_flush_gfx_cs;
 
/* Border colors. */
sctx->border_color_table = malloc(SI_MAX_BORDER_COLORS *
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 17/55] radeonsi: move EOP event code from r600_pipe_common.c to si_fence.c

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_pipe_common.c | 121 --
 src/gallium/drivers/radeon/r600_pipe_common.h |   8 --
 src/gallium/drivers/radeonsi/si_fence.c   | 121 ++
 src/gallium/drivers/radeonsi/si_pipe.h|   8 ++
 4 files changed, 129 insertions(+), 129 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c 
b/src/gallium/drivers/radeon/r600_pipe_common.c
index 8344a55..64d50e0 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -31,127 +31,6 @@
  * pipe_context
  */
 
-/**
- * Write an EOP event.
- *
- * \param eventEVENT_TYPE_*
- * \param event_flags  Optional cache flush flags (TC)
- * \param data_sel 1 = fence, 3 = timestamp
- * \param buf  Buffer
- * \param va   GPU address
- * \param old_valuePrevious fence value (for a bug workaround)
- * \param new_valueFence value to write for this event.
- */
-void si_gfx_write_event_eop(struct r600_common_context *ctx,
-   unsigned event, unsigned event_flags,
-   unsigned data_sel,
-   struct r600_resource *buf, uint64_t va,
-   uint32_t new_fence, unsigned query_type)
-{
-   struct radeon_winsys_cs *cs = ctx->gfx.cs;
-   unsigned op = EVENT_TYPE(event) |
- EVENT_INDEX(5) |
- event_flags;
-   unsigned sel = EOP_DATA_SEL(data_sel);
-
-   /* Wait for write confirmation before writing data, but don't send
-* an interrupt. */
-   if (data_sel != EOP_DATA_SEL_DISCARD)
-   sel |= EOP_INT_SEL(EOP_INT_SEL_SEND_DATA_AFTER_WR_CONFIRM);
-
-   if (ctx->chip_class >= GFX9) {
-   /* A ZPASS_DONE or PIXEL_STAT_DUMP_EVENT (of the DB occlusion
-* counters) must immediately precede every timestamp event to
-* prevent a GPU hang on GFX9.
-*
-* Occlusion queries don't need to do it here, because they
-* always do ZPASS_DONE before the timestamp.
-*/
-   if (ctx->chip_class == GFX9 &&
-   query_type != PIPE_QUERY_OCCLUSION_COUNTER &&
-   query_type != PIPE_QUERY_OCCLUSION_PREDICATE &&
-   query_type != PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE) {
-   struct r600_resource *scratch = ctx->eop_bug_scratch;
-
-   assert(16 * ctx->screen->info.num_render_backends <=
-  scratch->b.b.width0);
-   radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 2, 0));
-   radeon_emit(cs, EVENT_TYPE(EVENT_TYPE_ZPASS_DONE) | 
EVENT_INDEX(1));
-   radeon_emit(cs, scratch->gpu_address);
-   radeon_emit(cs, scratch->gpu_address >> 32);
-
-   radeon_add_to_buffer_list(ctx, >gfx, scratch,
- RADEON_USAGE_WRITE, 
RADEON_PRIO_QUERY);
-   }
-
-   radeon_emit(cs, PKT3(PKT3_RELEASE_MEM, 6, 0));
-   radeon_emit(cs, op);
-   radeon_emit(cs, sel);
-   radeon_emit(cs, va);/* address lo */
-   radeon_emit(cs, va >> 32);  /* address hi */
-   radeon_emit(cs, new_fence); /* immediate data lo */
-   radeon_emit(cs, 0); /* immediate data hi */
-   radeon_emit(cs, 0); /* unused */
-   } else {
-   if (ctx->chip_class == CIK ||
-   ctx->chip_class == VI) {
-   struct r600_resource *scratch = ctx->eop_bug_scratch;
-   uint64_t va = scratch->gpu_address;
-
-   /* Two EOP events are required to make all engines go 
idle
-* (and optional cache flushes executed) before the 
timestamp
-* is written.
-*/
-   radeon_emit(cs, PKT3(PKT3_EVENT_WRITE_EOP, 4, 0));
-   radeon_emit(cs, op);
-   radeon_emit(cs, va);
-   radeon_emit(cs, ((va >> 32) & 0x) | sel);
-   radeon_emit(cs, 0); /* immediate data */
-   radeon_emit(cs, 0); /* unused */
-
-   radeon_add_to_buffer_list(ctx, >gfx, scratch,
- RADEON_USAGE_WRITE, 
RADEON_PRIO_QUERY);
-   }
-
-   radeon_emit(cs, PKT3(PKT3_EVENT_WRITE_EOP, 4, 0));
-   radeon_emit(cs, op);
-   radeon_emit(cs, va);
-   radeon_emit(cs, ((va >> 32) & 0x) | sel);
-   radeon_emit(cs, new_fence); /* immediate data */
-   radeon_emit(cs, 0); /* unused */
-   }
-
-   if (buf) {
-   

[Mesa-dev] [PATCH 21/55] radeonsi: make radeon_add_to_buffer_list_check_mem be gfx-only

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_cs.h  | 21 +
 src/gallium/drivers/radeonsi/si_descriptors.c | 52 +++
 src/gallium/drivers/radeonsi/si_state_streamout.c |  2 +-
 3 files changed, 36 insertions(+), 39 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_cs.h 
b/src/gallium/drivers/radeon/r600_cs.h
index c46fad6..5cfe6ab 100644
--- a/src/gallium/drivers/radeon/r600_cs.h
+++ b/src/gallium/drivers/radeon/r600_cs.h
@@ -95,20 +95,19 @@ static inline void radeon_add_to_buffer_list(struct 
r600_common_context *rctx,
  *   a different constraint disallowing a context flush
  */
 static inline void
-radeon_add_to_buffer_list_check_mem(struct r600_common_context *rctx,
-   struct r600_ring *ring,
-   struct r600_resource *rbo,
-   enum radeon_bo_usage usage,
-   enum radeon_bo_priority priority,
-   bool check_mem)
+radeon_add_to_gfx_buffer_list_check_mem(struct si_context *sctx,
+   struct r600_resource *rbo,
+   enum radeon_bo_usage usage,
+   enum radeon_bo_priority priority,
+   bool check_mem)
 {
if (check_mem &&
-   !radeon_cs_memory_below_limit(rctx->screen, ring->cs,
- rctx->vram + rbo->vram_usage,
- rctx->gtt + rbo->gart_usage))
-   ring->flush(rctx, PIPE_FLUSH_ASYNC, NULL);
+   !radeon_cs_memory_below_limit(sctx->screen, sctx->b.gfx.cs,
+ sctx->b.vram + rbo->vram_usage,
+ sctx->b.gtt + rbo->gart_usage))
+   si_flush_gfx_cs(>b, PIPE_FLUSH_ASYNC, NULL);
 
-   radeon_add_to_buffer_list(rctx, ring, rbo, usage, priority);
+   radeon_add_to_buffer_list(>b, >b.gfx, rbo, usage, priority);
 }
 
 static inline void radeon_set_config_reg_seq(struct radeon_winsys_cs *cs, 
unsigned reg, unsigned num)
diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c 
b/src/gallium/drivers/radeonsi/si_descriptors.c
index d0295db..e7afca2 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -265,9 +265,8 @@ static void si_sampler_view_add_buffer(struct si_context 
*sctx,
rres = (struct r600_resource*)resource;
priority = si_get_sampler_view_priority(rres);
 
-   radeon_add_to_buffer_list_check_mem(>b, >b.gfx,
-   rres, usage, priority,
-   check_mem);
+   radeon_add_to_gfx_buffer_list_check_mem(sctx, rres, usage, priority,
+   check_mem);
 
if (resource->target == PIPE_BUFFER)
return;
@@ -275,9 +274,8 @@ static void si_sampler_view_add_buffer(struct si_context 
*sctx,
/* Now add separate DCC or HTILE. */
rtex = (struct r600_texture*)resource;
if (rtex->dcc_separate_buffer) {
-   radeon_add_to_buffer_list_check_mem(>b, >b.gfx,
-   rtex->dcc_separate_buffer, 
usage,
-   RADEON_PRIO_DCC, check_mem);
+   radeon_add_to_gfx_buffer_list_check_mem(sctx, 
rtex->dcc_separate_buffer,
+   usage, RADEON_PRIO_DCC, 
check_mem);
}
 }
 
@@ -1191,10 +1189,10 @@ static void si_set_constant_buffer(struct si_context 
*sctx,
  S_008F0C_DATA_FORMAT(V_008F0C_BUF_DATA_FORMAT_32);
 
buffers->buffers[slot] = buffer;
-   radeon_add_to_buffer_list_check_mem(>b, >b.gfx,
-   (struct 
r600_resource*)buffer,
-   
buffers->shader_usage_constbuf,
-   buffers->priority_constbuf, 
true);
+   radeon_add_to_gfx_buffer_list_check_mem(sctx,
+   (struct 
r600_resource*)buffer,
+   
buffers->shader_usage_constbuf,
+   
buffers->priority_constbuf, true);
buffers->enabled_mask |= 1u << slot;
} else {
/* Clear the descriptor. */
@@ -1289,9 +1287,9 @@ static void si_set_shader_buffers(struct pipe_context 
*ctx,
  S_008F0C_DATA_FORMAT(V_008F0C_BUF_DATA_FORMAT_32);
 
pipe_resource_reference(>buffers[slot], >b.b);
-   radeon_add_to_buffer_list_check_mem(>b, >b.gfx, buf,
- 

[Mesa-dev] [PATCH 25/55] radeonsi: don't use r600_common_context in si_emit_cache_flush

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeonsi/si_state_draw.c | 108 +--
 1 file changed, 54 insertions(+), 54 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c 
b/src/gallium/drivers/radeonsi/si_state_draw.c
index f571d7f..7e86c0f 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -849,12 +849,12 @@ static void si_emit_draw_packets(struct si_context *sctx,
}
 }
 
-static void si_emit_surface_sync(struct r600_common_context *rctx,
+static void si_emit_surface_sync(struct si_context *sctx,
 unsigned cp_coher_cntl)
 {
-   struct radeon_winsys_cs *cs = rctx->gfx_cs;
+   struct radeon_winsys_cs *cs = sctx->b.gfx_cs;
 
-   if (rctx->chip_class >= GFX9) {
+   if (sctx->b.chip_class >= GFX9) {
/* Flush caches and wait for the caches to assert idle. */
radeon_emit(cs, PKT3(PKT3_ACQUIRE_MEM, 5, 0));
radeon_emit(cs, cp_coher_cntl); /* CP_COHER_CNTL */
@@ -875,15 +875,15 @@ static void si_emit_surface_sync(struct 
r600_common_context *rctx,
 
 void si_emit_cache_flush(struct si_context *sctx)
 {
-   struct r600_common_context *rctx = >b;
-   struct radeon_winsys_cs *cs = rctx->gfx_cs;
+   struct radeon_winsys_cs *cs = sctx->b.gfx_cs;
+   uint32_t flags = sctx->b.flags;
uint32_t cp_coher_cntl = 0;
-   uint32_t flush_cb_db = rctx->flags & (SI_CONTEXT_FLUSH_AND_INV_CB |
- SI_CONTEXT_FLUSH_AND_INV_DB);
+   uint32_t flush_cb_db = flags & (SI_CONTEXT_FLUSH_AND_INV_CB |
+   SI_CONTEXT_FLUSH_AND_INV_DB);
 
-   if (rctx->flags & SI_CONTEXT_FLUSH_AND_INV_CB)
+   if (flags & SI_CONTEXT_FLUSH_AND_INV_CB)
sctx->b.num_cb_cache_flushes++;
-   if (rctx->flags & SI_CONTEXT_FLUSH_AND_INV_DB)
+   if (flags & SI_CONTEXT_FLUSH_AND_INV_DB)
sctx->b.num_db_cache_flushes++;
 
/* SI has a bug that it always flushes ICACHE and KCACHE if either
@@ -894,13 +894,13 @@ void si_emit_cache_flush(struct si_context *sctx)
 * to add a workaround for it.
 */
 
-   if (rctx->flags & SI_CONTEXT_INV_ICACHE)
+   if (flags & SI_CONTEXT_INV_ICACHE)
cp_coher_cntl |= S_0085F0_SH_ICACHE_ACTION_ENA(1);
-   if (rctx->flags & SI_CONTEXT_INV_SMEM_L1)
+   if (flags & SI_CONTEXT_INV_SMEM_L1)
cp_coher_cntl |= S_0085F0_SH_KCACHE_ACTION_ENA(1);
 
-   if (rctx->chip_class <= VI) {
-   if (rctx->flags & SI_CONTEXT_FLUSH_AND_INV_CB) {
+   if (sctx->b.chip_class <= VI) {
+   if (flags & SI_CONTEXT_FLUSH_AND_INV_CB) {
cp_coher_cntl |= S_0085F0_CB_ACTION_ENA(1) |
 S_0085F0_CB0_DEST_BASE_ENA(1) |
 S_0085F0_CB1_DEST_BASE_ENA(1) |
@@ -912,23 +912,23 @@ void si_emit_cache_flush(struct si_context *sctx)
 S_0085F0_CB7_DEST_BASE_ENA(1);
 
/* Necessary for DCC */
-   if (rctx->chip_class == VI)
-   si_gfx_write_event_eop(rctx, 
V_028A90_FLUSH_AND_INV_CB_DATA_TS,
-0, 
EOP_DATA_SEL_DISCARD, NULL,
-0, 0, SI_NOT_QUERY);
+   if (sctx->b.chip_class == VI)
+   si_gfx_write_event_eop(>b, 
V_028A90_FLUSH_AND_INV_CB_DATA_TS,
+  0, EOP_DATA_SEL_DISCARD, 
NULL,
+  0, 0, SI_NOT_QUERY);
}
-   if (rctx->flags & SI_CONTEXT_FLUSH_AND_INV_DB)
+   if (flags & SI_CONTEXT_FLUSH_AND_INV_DB)
cp_coher_cntl |= S_0085F0_DB_ACTION_ENA(1) |
 S_0085F0_DB_DEST_BASE_ENA(1);
}
 
-   if (rctx->flags & SI_CONTEXT_FLUSH_AND_INV_CB) {
+   if (flags & SI_CONTEXT_FLUSH_AND_INV_CB) {
/* Flush CMASK/FMASK/DCC. SURFACE_SYNC will wait for idle. */
radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0));
radeon_emit(cs, EVENT_TYPE(V_028A90_FLUSH_AND_INV_CB_META) | 
EVENT_INDEX(0));
}
-   if (rctx->flags & (SI_CONTEXT_FLUSH_AND_INV_DB |
-  SI_CONTEXT_FLUSH_AND_INV_DB_META)) {
+   if (flags & (SI_CONTEXT_FLUSH_AND_INV_DB |
+SI_CONTEXT_FLUSH_AND_INV_DB_META)) {
/* Flush HTILE. SURFACE_SYNC will wait for idle. */
radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0));
radeon_emit(cs, EVENT_TYPE(V_028A90_FLUSH_AND_INV_DB_META) | 
EVENT_INDEX(0));
@@ -939,35 +939,35 @@ void si_emit_cache_flush(struct si_context 

[Mesa-dev] [PATCH 26/55] radeonsi: use r600_common_context less pt1

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_buffer_common.c |  5 +-
 src/gallium/drivers/radeon/r600_pipe_common.c   | 22 
 src/gallium/drivers/radeonsi/cik_sdma.c | 10 ++--
 src/gallium/drivers/radeonsi/si_debug.c |  3 +-
 src/gallium/drivers/radeonsi/si_dma.c   |  6 +--
 src/gallium/drivers/radeonsi/si_dma_cs.c| 68 -
 src/gallium/drivers/radeonsi/si_fence.c | 52 +--
 src/gallium/drivers/radeonsi/si_gfx_cs.c|  2 +-
 src/gallium/drivers/radeonsi/si_pipe.h  |  7 +--
 9 files changed, 88 insertions(+), 87 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c 
b/src/gallium/drivers/radeon/r600_buffer_common.c
index 3789bcc..8a4ad2d 100644
--- a/src/gallium/drivers/radeon/r600_buffer_common.c
+++ b/src/gallium/drivers/radeon/r600_buffer_common.c
@@ -46,6 +46,7 @@ void *si_buffer_map_sync_with_rings(struct 
r600_common_context *ctx,
struct r600_resource *resource,
unsigned usage)
 {
+   struct si_context *sctx = (struct si_context*)ctx;
enum radeon_bo_usage rusage = RADEON_USAGE_READWRITE;
bool busy = false;
 
@@ -75,10 +76,10 @@ void *si_buffer_map_sync_with_rings(struct 
r600_common_context *ctx,
ctx->ws->cs_is_buffer_referenced(ctx->dma_cs,
 resource->buf, rusage)) {
if (usage & PIPE_TRANSFER_DONTBLOCK) {
-   si_flush_dma_cs(ctx, PIPE_FLUSH_ASYNC, NULL);
+   si_flush_dma_cs(sctx, PIPE_FLUSH_ASYNC, NULL);
return NULL;
} else {
-   si_flush_dma_cs(ctx, 0, NULL);
+   si_flush_dma_cs(sctx, 0, NULL);
busy = true;
}
}
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c 
b/src/gallium/drivers/radeon/r600_pipe_common.c
index afea948..0db8872 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -79,7 +79,7 @@ static bool r600_resource_commit(struct pipe_context *pctx,
 unsigned level, struct pipe_box *box,
 bool commit)
 {
-   struct r600_common_context *ctx = (struct r600_common_context *)pctx;
+   struct si_context *ctx = (struct si_context *)pctx;
struct r600_resource *res = r600_resource(resource);
 
/*
@@ -89,23 +89,23 @@ static bool r600_resource_commit(struct pipe_context *pctx,
 * (b) wait for threaded submit to finish, including those that were
 * triggered by some other, earlier operation.
 */
-   if (radeon_emitted(ctx->gfx_cs, ctx->initial_gfx_cs_size) &&
-   ctx->ws->cs_is_buffer_referenced(ctx->gfx_cs,
-res->buf, RADEON_USAGE_READWRITE)) 
{
+   if (radeon_emitted(ctx->b.gfx_cs, ctx->b.initial_gfx_cs_size) &&
+   ctx->b.ws->cs_is_buffer_referenced(ctx->b.gfx_cs,
+  res->buf, 
RADEON_USAGE_READWRITE)) {
si_flush_gfx_cs(ctx, PIPE_FLUSH_ASYNC, NULL);
}
-   if (radeon_emitted(ctx->dma_cs, 0) &&
-   ctx->ws->cs_is_buffer_referenced(ctx->dma_cs,
-res->buf, RADEON_USAGE_READWRITE)) 
{
+   if (radeon_emitted(ctx->b.dma_cs, 0) &&
+   ctx->b.ws->cs_is_buffer_referenced(ctx->b.dma_cs,
+  res->buf, 
RADEON_USAGE_READWRITE)) {
si_flush_dma_cs(ctx, PIPE_FLUSH_ASYNC, NULL);
}
 
-   ctx->ws->cs_sync_flush(ctx->dma_cs);
-   ctx->ws->cs_sync_flush(ctx->gfx_cs);
+   ctx->b.ws->cs_sync_flush(ctx->b.dma_cs);
+   ctx->b.ws->cs_sync_flush(ctx->b.gfx_cs);
 
assert(resource->target == PIPE_BUFFER);
 
-   return ctx->ws->buffer_commit(res->buf, box->x, box->width, commit);
+   return ctx->b.ws->buffer_commit(res->buf, box->x, box->width, commit);
 }
 
 bool si_common_context_init(struct r600_common_context *rctx,
@@ -175,7 +175,7 @@ bool si_common_context_init(struct r600_common_context 
*rctx,
 
if (sscreen->info.num_sdma_rings && !(sscreen->debug_flags & 
DBG(NO_ASYNC_DMA))) {
rctx->dma_cs = rctx->ws->cs_create(rctx->ctx, RING_DMA,
-  si_flush_dma_cs,
+  (void*)si_flush_dma_cs,
   rctx);
}
 
diff --git a/src/gallium/drivers/radeonsi/cik_sdma.c 
b/src/gallium/drivers/radeonsi/cik_sdma.c
index 75d1927..a5b8089 100644
--- a/src/gallium/drivers/radeonsi/cik_sdma.c
+++ b/src/gallium/drivers/radeonsi/cik_sdma.c
@@ -47,7 +47,7 @@ static void cik_sdma_copy_buffer(struct si_context *ctx,

[Mesa-dev] [PATCH 16/55] radeonsi: rename si_hw_context.c -> si_gfx_cs.c

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeonsi/Makefile.sources | 2 +-
 src/gallium/drivers/radeonsi/{si_hw_context.c => si_gfx_cs.c} | 0
 src/gallium/drivers/radeonsi/si_pipe.h| 2 +-
 3 files changed, 2 insertions(+), 2 deletions(-)
 rename src/gallium/drivers/radeonsi/{si_hw_context.c => si_gfx_cs.c} (100%)

diff --git a/src/gallium/drivers/radeonsi/Makefile.sources 
b/src/gallium/drivers/radeonsi/Makefile.sources
index b193a60..964be01 100644
--- a/src/gallium/drivers/radeonsi/Makefile.sources
+++ b/src/gallium/drivers/radeonsi/Makefile.sources
@@ -15,7 +15,7 @@ C_SOURCES := \
si_dma.c \
si_fence.c \
si_get.c \
-   si_hw_context.c \
+   si_gfx_cs.c \
si_pipe.c \
si_pipe.h \
si_pm4.c \
diff --git a/src/gallium/drivers/radeonsi/si_hw_context.c 
b/src/gallium/drivers/radeonsi/si_gfx_cs.c
similarity index 100%
rename from src/gallium/drivers/radeonsi/si_hw_context.c
rename to src/gallium/drivers/radeonsi/si_gfx_cs.c
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h 
b/src/gallium/drivers/radeonsi/si_pipe.h
index b1aa7ed..3a7da43 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -726,7 +726,7 @@ struct pipe_fence_handle *si_create_fence(struct 
pipe_context *ctx,
 const char *si_get_family_name(const struct si_screen *sscreen);
 void si_init_screen_get_functions(struct si_screen *sscreen);
 
-/* si_hw_context.c */
+/* si_gfx_cs.c */
 void si_flush_gfx_cs(void *context, unsigned flags,
 struct pipe_fence_handle **fence);
 void si_begin_new_gfx_cs(struct si_context *ctx);
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 12/55] radeonsi: remove r600_pipe_common::blit_decompress_depth

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_pipe_common.h |  7 ---
 src/gallium/drivers/radeon/r600_texture.c | 12 ++--
 src/gallium/drivers/radeonsi/si_blit.c| 13 ++---
 src/gallium/drivers/radeonsi/si_pipe.h|  6 ++
 4 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index 7793843..26d9511 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -484,13 +484,6 @@ struct r600_common_context {
 
void (*dma_clear_buffer)(struct pipe_context *ctx, struct pipe_resource 
*dst,
 uint64_t offset, uint64_t size, unsigned 
value);
-
-   void (*blit_decompress_depth)(struct pipe_context *ctx,
- struct r600_texture *texture,
- struct r600_texture *staging,
- unsigned first_level, unsigned last_level,
- unsigned first_layer, unsigned last_layer,
- unsigned first_sample, unsigned 
last_sample);
 };
 
 /* r600_buffer_common.c */
diff --git a/src/gallium/drivers/radeon/r600_texture.c 
b/src/gallium/drivers/radeon/r600_texture.c
index 4d09de4..0a89e8a 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -1746,8 +1746,8 @@ static void *r600_texture_transfer_map(struct 
pipe_context *ctx,
}
 
r600_copy_region_with_blit(ctx, temp, 0, 0, 0, 
0, texture, level, box);
-   rctx->blit_decompress_depth(ctx, (struct 
r600_texture*)temp, staging_depth,
-   0, 0, 0, 
box->depth, 0, 0);
+   si_blit_decompress_depth(ctx, (struct 
r600_texture*)temp, staging_depth,
+0, 0, 0, box->depth, 
0, 0);
pipe_resource_reference(, NULL);
}
 
@@ -1764,10 +1764,10 @@ static void *r600_texture_transfer_map(struct 
pipe_context *ctx,
return NULL;
}
 
-   rctx->blit_decompress_depth(ctx, rtex, staging_depth,
-   level, level,
-   box->z, box->z + box->depth 
- 1,
-   0, 0);
+   si_blit_decompress_depth(ctx, rtex, staging_depth,
+level, level,
+box->z, box->z + box->depth - 
1,
+0, 0);
 
offset = r600_texture_get_offset(rctx->screen, 
staging_depth,
 level, box,
diff --git a/src/gallium/drivers/radeonsi/si_blit.c 
b/src/gallium/drivers/radeonsi/si_blit.c
index 229cbba..c75fea4 100644
--- a/src/gallium/drivers/radeonsi/si_blit.c
+++ b/src/gallium/drivers/radeonsi/si_blit.c
@@ -168,12 +168,12 @@ si_blit_dbcb_copy(struct si_context *sctx,
return fully_copied_levels;
 }
 
-static void si_blit_decompress_depth(struct pipe_context *ctx,
-struct r600_texture *texture,
-struct r600_texture *staging,
-unsigned first_level, unsigned last_level,
-unsigned first_layer, unsigned last_layer,
-unsigned first_sample, unsigned 
last_sample)
+void si_blit_decompress_depth(struct pipe_context *ctx,
+ struct r600_texture *texture,
+ struct r600_texture *staging,
+ unsigned first_level, unsigned last_level,
+ unsigned first_layer, unsigned last_layer,
+ unsigned first_sample, unsigned last_sample)
 {
const struct util_format_description *desc;
unsigned planes = 0;
@@ -1333,5 +1333,4 @@ void si_init_blit_functions(struct si_context *sctx)
sctx->b.b.blit = si_blit;
sctx->b.b.flush_resource = si_flush_resource;
sctx->b.b.generate_mipmap = si_generate_mipmap;
-   sctx->b.blit_decompress_depth = si_blit_decompress_depth;
 }
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h 
b/src/gallium/drivers/radeonsi/si_pipe.h
index d621c11..62ddcce 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -659,6 +659,12 @@ void si_resource_copy_region(struct pipe_context *ctx,
 unsigned src_level,
 

[Mesa-dev] [PATCH 09/55] radeonsi: remove r600_pipe_common::rebind_buffer

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_buffer_common.c | 3 +--
 src/gallium/drivers/radeon/r600_pipe_common.h   | 6 --
 src/gallium/drivers/radeonsi/si_descriptors.c   | 8 +---
 src/gallium/drivers/radeonsi/si_state.h | 3 ++-
 4 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c 
b/src/gallium/drivers/radeon/r600_buffer_common.c
index a9ae007..d215c9d 100644
--- a/src/gallium/drivers/radeon/r600_buffer_common.c
+++ b/src/gallium/drivers/radeon/r600_buffer_common.c
@@ -288,7 +288,6 @@ void si_replace_buffer_storage(struct pipe_context *ctx,
 struct pipe_resource *dst,
 struct pipe_resource *src)
 {
-   struct r600_common_context *rctx = (struct r600_common_context *)ctx;
struct r600_resource *rdst = r600_resource(dst);
struct r600_resource *rsrc = r600_resource(src);
uint64_t old_gpu_address = rdst->gpu_address;
@@ -306,7 +305,7 @@ void si_replace_buffer_storage(struct pipe_context *ctx,
assert(rdst->bo_alignment == rsrc->bo_alignment);
assert(rdst->domains == rsrc->domains);
 
-   rctx->rebind_buffer(ctx, dst, old_gpu_address);
+   si_rebind_buffer(ctx, dst, old_gpu_address);
 }
 
 static void si_invalidate_resource(struct pipe_context *ctx,
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index 1381a67..241a0b9 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -498,12 +498,6 @@ struct r600_common_context {
/* Reallocate the buffer and update all resource bindings where
 * the buffer is bound, including all resource descriptors. */
void (*invalidate_buffer)(struct pipe_context *ctx, struct 
pipe_resource *buf);
-
-   /* Update all resource bindings where the buffer is bound, including
-* all resource descriptors. This is invalidate_buffer without
-* the invalidation. */
-   void (*rebind_buffer)(struct pipe_context *ctx, struct pipe_resource 
*buf,
- uint64_t old_gpu_address);
 };
 
 /* r600_buffer_common.c */
diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c 
b/src/gallium/drivers/radeonsi/si_descriptors.c
index 07d1420..6feeb0e 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -1538,8 +1538,11 @@ static void si_reset_buffer_resources(struct si_context 
*sctx,
}
 }
 
-static void si_rebind_buffer(struct pipe_context *ctx, struct pipe_resource 
*buf,
-uint64_t old_va)
+/* Update all resource bindings where the buffer is bound, including
+ * all resource descriptors. This is invalidate_buffer without
+ * the invalidation. */
+void si_rebind_buffer(struct pipe_context *ctx, struct pipe_resource *buf,
+ uint64_t old_va)
 {
struct si_context *sctx = (struct si_context*)ctx;
struct r600_resource *rbuffer = r600_resource(buf);
@@ -2711,7 +2714,6 @@ void si_init_all_descriptors(struct si_context *sctx)
sctx->b.b.delete_image_handle = si_delete_image_handle;
sctx->b.b.make_image_handle_resident = si_make_image_handle_resident;
sctx->b.invalidate_buffer = si_invalidate_buffer;
-   sctx->b.rebind_buffer = si_rebind_buffer;
 
/* Shader user data. */
si_init_atom(sctx, >shader_pointers.atom, 
>atoms.s.shader_pointers,
diff --git a/src/gallium/drivers/radeonsi/si_state.h 
b/src/gallium/drivers/radeonsi/si_state.h
index 95dc2d3..443ce1a 100644
--- a/src/gallium/drivers/radeonsi/si_state.h
+++ b/src/gallium/drivers/radeonsi/si_state.h
@@ -362,7 +362,8 @@ struct pb_slab *si_bindless_descriptor_slab_alloc(void 
*priv, unsigned heap,
  unsigned entry_size,
  unsigned group_index);
 void si_bindless_descriptor_slab_free(void *priv, struct pb_slab *pslab);
-
+void si_rebind_buffer(struct pipe_context *ctx, struct pipe_resource *buf,
+ uint64_t old_va);
 /* si_state.c */
 struct si_shader_selector;
 
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 18/55] radeonsi: move DMA CS functions from r600_pipe_common.c to si_dma_cs.c

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_pipe_common.c | 125 -
 src/gallium/drivers/radeon/r600_pipe_common.h |   5 -
 src/gallium/drivers/radeonsi/Makefile.sources |   1 +
 src/gallium/drivers/radeonsi/si_dma_cs.c  | 149 ++
 src/gallium/drivers/radeonsi/si_pipe.h|   7 ++
 5 files changed, 157 insertions(+), 130 deletions(-)
 create mode 100644 src/gallium/drivers/radeonsi/si_dma_cs.c

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c 
b/src/gallium/drivers/radeon/r600_pipe_common.c
index 64d50e0..987c955 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -31,119 +31,6 @@
  * pipe_context
  */
 
-static void r600_dma_emit_wait_idle(struct r600_common_context *rctx)
-{
-   struct radeon_winsys_cs *cs = rctx->dma.cs;
-
-   /* NOP waits for idle on Evergreen and later. */
-   if (rctx->chip_class >= CIK)
-   radeon_emit(cs, 0x); /* NOP */
-   else
-   radeon_emit(cs, 0xf000); /* NOP */
-}
-
-void si_need_dma_space(struct r600_common_context *ctx, unsigned num_dw,
-  struct r600_resource *dst, struct r600_resource *src)
-{
-   uint64_t vram = ctx->dma.cs->used_vram;
-   uint64_t gtt = ctx->dma.cs->used_gart;
-
-   if (dst) {
-   vram += dst->vram_usage;
-   gtt += dst->gart_usage;
-   }
-   if (src) {
-   vram += src->vram_usage;
-   gtt += src->gart_usage;
-   }
-
-   /* Flush the GFX IB if DMA depends on it. */
-   if (radeon_emitted(ctx->gfx.cs, ctx->initial_gfx_cs_size) &&
-   ((dst &&
- ctx->ws->cs_is_buffer_referenced(ctx->gfx.cs, dst->buf,
-  RADEON_USAGE_READWRITE)) ||
-(src &&
- ctx->ws->cs_is_buffer_referenced(ctx->gfx.cs, src->buf,
-  RADEON_USAGE_WRITE
-   si_flush_gfx_cs(ctx, PIPE_FLUSH_ASYNC, NULL);
-
-   /* Flush if there's not enough space, or if the memory usage per IB
-* is too large.
-*
-* IBs using too little memory are limited by the IB submission 
overhead.
-* IBs using too much memory are limited by the kernel/TTM overhead.
-* Too long IBs create CPU-GPU pipeline bubbles and add latency.
-*
-* This heuristic makes sure that DMA requests are executed
-* very soon after the call is made and lowers memory usage.
-* It improves texture upload performance by keeping the DMA
-* engine busy while uploads are being submitted.
-*/
-   num_dw++; /* for emit_wait_idle below */
-   if (!ctx->ws->cs_check_space(ctx->dma.cs, num_dw) ||
-   ctx->dma.cs->used_vram + ctx->dma.cs->used_gart > 64 * 1024 * 1024 
||
-   !radeon_cs_memory_below_limit(ctx->screen, ctx->dma.cs, vram, gtt)) 
{
-   si_flush_dma_cs(ctx, PIPE_FLUSH_ASYNC, NULL);
-   assert((num_dw + ctx->dma.cs->current.cdw) <= 
ctx->dma.cs->current.max_dw);
-   }
-
-   /* Wait for idle if either buffer has been used in the IB before to
-* prevent read-after-write hazards.
-*/
-   if ((dst &&
-ctx->ws->cs_is_buffer_referenced(ctx->dma.cs, dst->buf,
- RADEON_USAGE_READWRITE)) ||
-   (src &&
-ctx->ws->cs_is_buffer_referenced(ctx->dma.cs, src->buf,
- RADEON_USAGE_WRITE)))
-   r600_dma_emit_wait_idle(ctx);
-
-   if (dst) {
-   radeon_add_to_buffer_list(ctx, >dma, dst,
- RADEON_USAGE_WRITE,
- RADEON_PRIO_SDMA_BUFFER);
-   }
-   if (src) {
-   radeon_add_to_buffer_list(ctx, >dma, src,
- RADEON_USAGE_READ,
- RADEON_PRIO_SDMA_BUFFER);
-   }
-
-   /* this function is called before all DMA calls, so increment this. */
-   ctx->num_dma_calls++;
-}
-
-void si_flush_dma_cs(void *ctx, unsigned flags, struct pipe_fence_handle 
**fence)
-{
-   struct r600_common_context *rctx = (struct r600_common_context *)ctx;
-   struct radeon_winsys_cs *cs = rctx->dma.cs;
-   struct radeon_saved_cs saved;
-   bool check_vm = (rctx->screen->debug_flags & DBG(CHECK_VM));
-
-   if (!radeon_emitted(cs, 0)) {
-   if (fence)
-   rctx->ws->fence_reference(fence, rctx->last_sdma_fence);
-   return;
-   }
-
-   if (check_vm)
-   si_save_cs(rctx->ws, cs, , true);
-
-   rctx->ws->cs_flush(cs, flags, >last_sdma_fence);
-   if (fence)
-   rctx->ws->fence_reference(fence, rctx->last_sdma_fence);
-
-   if (check_vm) {
-

[Mesa-dev] [PATCH 11/55] radeonsi: remove r600_pipe_common::decompress_dcc

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_pipe_common.h | 3 ---
 src/gallium/drivers/radeon/r600_texture.c | 4 ++--
 src/gallium/drivers/radeonsi/si_blit.c| 4 +---
 src/gallium/drivers/radeonsi/si_descriptors.c | 4 ++--
 src/gallium/drivers/radeonsi/si_pipe.h| 1 +
 src/gallium/drivers/radeonsi/si_state.c   | 2 +-
 6 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index 2e2b80b..7793843 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -491,9 +491,6 @@ struct r600_common_context {
  unsigned first_level, unsigned last_level,
  unsigned first_layer, unsigned last_layer,
  unsigned first_sample, unsigned 
last_sample);
-
-   void (*decompress_dcc)(struct pipe_context *ctx,
-  struct r600_texture *rtex);
 };
 
 /* r600_buffer_common.c */
diff --git a/src/gallium/drivers/radeon/r600_texture.c 
b/src/gallium/drivers/radeon/r600_texture.c
index fa12497..4d09de4 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -480,7 +480,7 @@ bool si_texture_disable_dcc(struct r600_common_context 
*rctx,
mtx_lock(>aux_context_lock);
 
/* Decompress DCC. */
-   rctx->decompress_dcc(>b, rtex);
+   si_decompress_dcc(>b, rtex);
rctx->b.flush(>b, NULL, 0);
 
if (>b == sscreen->aux_context)
@@ -1973,7 +1973,7 @@ void vi_disable_dcc_if_incompatible_format(struct 
r600_common_context *rctx,
 
if (vi_dcc_formats_are_incompatible(tex, level, view_format))
if (!si_texture_disable_dcc(rctx, (struct r600_texture*)tex))
-   rctx->decompress_dcc(>b, rtex);
+   si_decompress_dcc(>b, rtex);
 }
 
 struct pipe_surface *si_create_surface_custom(struct pipe_context *pipe,
diff --git a/src/gallium/drivers/radeonsi/si_blit.c 
b/src/gallium/drivers/radeonsi/si_blit.c
index c34d677..229cbba 100644
--- a/src/gallium/drivers/radeonsi/si_blit.c
+++ b/src/gallium/drivers/radeonsi/si_blit.c
@@ -1317,8 +1317,7 @@ static void si_flush_resource(struct pipe_context *ctx,
}
 }
 
-static void si_decompress_dcc(struct pipe_context *ctx,
- struct r600_texture *rtex)
+void si_decompress_dcc(struct pipe_context *ctx, struct r600_texture *rtex)
 {
if (!rtex->dcc_offset)
return;
@@ -1335,5 +1334,4 @@ void si_init_blit_functions(struct si_context *sctx)
sctx->b.b.flush_resource = si_flush_resource;
sctx->b.b.generate_mipmap = si_generate_mipmap;
sctx->b.blit_decompress_depth = si_blit_decompress_depth;
-   sctx->b.decompress_dcc = si_decompress_dcc;
 }
diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c 
b/src/gallium/drivers/radeonsi/si_descriptors.c
index a9c1b7f..d0295db 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -444,7 +444,7 @@ static void si_set_sampler_view_desc(struct si_context 
*sctx,
if (unlikely(!is_buffer && sview->dcc_incompatible)) {
if (vi_dcc_enabled(rtex, view->u.tex.first_level))
if (!si_texture_disable_dcc(>b, rtex))
-   sctx->b.decompress_dcc(>b.b, rtex);
+   si_decompress_dcc(>b.b, rtex);
 
sview->dcc_incompatible = false;
}
@@ -731,7 +731,7 @@ static void si_set_shader_image_desc(struct si_context *ctx,
 * has been decompressed already.
 */
if (!si_texture_disable_dcc(>b, tex))
-   ctx->b.decompress_dcc(>b.b, tex);
+   si_decompress_dcc(>b.b, tex);
}
 
if (ctx->b.chip_class >= GFX9) {
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h 
b/src/gallium/drivers/radeonsi/si_pipe.h
index 793bb5d..d621c11 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -658,6 +658,7 @@ void si_resource_copy_region(struct pipe_context *ctx,
 struct pipe_resource *src,
 unsigned src_level,
 const struct pipe_box *src_box);
+void si_decompress_dcc(struct pipe_context *ctx, struct r600_texture *rtex);
 
 /* si_clear.c */
 void vi_dcc_clear_level(struct si_context *sctx,
diff --git a/src/gallium/drivers/radeonsi/si_state.c 
b/src/gallium/drivers/radeonsi/si_state.c
index ee4f96d..0d89fe5 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -2761,7 +2761,7 @@ static void si_set_framebuffer_state(struct pipe_context 

[Mesa-dev] [PATCH 15/55] radeonsi: move si_destroy_saved_cs to si_debug.c

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeonsi/si_debug.c  | 7 +++
 src/gallium/drivers/radeonsi/si_hw_context.c | 7 ---
 src/gallium/drivers/radeonsi/si_pipe.h   | 2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_debug.c 
b/src/gallium/drivers/radeonsi/si_debug.c
index 30b45ee..886f79d 100644
--- a/src/gallium/drivers/radeonsi/si_debug.c
+++ b/src/gallium/drivers/radeonsi/si_debug.c
@@ -37,6 +37,13 @@ static void si_dump_bo_list(struct si_context *sctx,
 
 DEBUG_GET_ONCE_OPTION(replace_shaders, "RADEON_REPLACE_SHADERS", NULL)
 
+void si_destroy_saved_cs(struct si_saved_cs *scs)
+{
+   si_clear_saved_cs(>gfx);
+   r600_resource_reference(>trace_buf, NULL);
+   free(scs);
+}
+
 static void si_dump_shader(struct si_screen *sscreen,
   enum pipe_shader_type processor,
   const struct si_shader *shader, FILE *f)
diff --git a/src/gallium/drivers/radeonsi/si_hw_context.c 
b/src/gallium/drivers/radeonsi/si_hw_context.c
index 394df23..7c19456 100644
--- a/src/gallium/drivers/radeonsi/si_hw_context.c
+++ b/src/gallium/drivers/radeonsi/si_hw_context.c
@@ -26,13 +26,6 @@
 
 #include "util/os_time.h"
 
-void si_destroy_saved_cs(struct si_saved_cs *scs)
-{
-   si_clear_saved_cs(>gfx);
-   r600_resource_reference(>trace_buf, NULL);
-   free(scs);
-}
-
 /* initialize */
 void si_need_gfx_cs_space(struct si_context *ctx)
 {
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h 
b/src/gallium/drivers/radeonsi/si_pipe.h
index bc5a714..b1aa7ed 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -703,6 +703,7 @@ void cik_emit_prefetch_L2(struct si_context *sctx);
 void si_init_cp_dma_functions(struct si_context *sctx);
 
 /* si_debug.c */
+void si_destroy_saved_cs(struct si_saved_cs *scs);
 void si_auto_log_cs(void *data, struct u_log_context *log);
 void si_log_hw_flush(struct si_context *sctx);
 void si_log_draw_state(struct si_context *sctx, struct u_log_context *log);
@@ -726,7 +727,6 @@ const char *si_get_family_name(const struct si_screen 
*sscreen);
 void si_init_screen_get_functions(struct si_screen *sscreen);
 
 /* si_hw_context.c */
-void si_destroy_saved_cs(struct si_saved_cs *scs);
 void si_flush_gfx_cs(void *context, unsigned flags,
 struct pipe_fence_handle **fence);
 void si_begin_new_gfx_cs(struct si_context *ctx);
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 14/55] radeonsi: rename si_begin_new_cs -> si_begin_new_gfx_cs

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeonsi/si_hw_context.c | 8 
 src/gallium/drivers/radeonsi/si_pipe.c   | 2 +-
 src/gallium/drivers/radeonsi/si_pipe.h   | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_hw_context.c 
b/src/gallium/drivers/radeonsi/si_hw_context.c
index 615e881..394df23 100644
--- a/src/gallium/drivers/radeonsi/si_hw_context.c
+++ b/src/gallium/drivers/radeonsi/si_hw_context.c
@@ -149,11 +149,11 @@ void si_flush_gfx_cs(void *context, unsigned flags,
if (ctx->current_saved_cs)
si_saved_cs_reference(>current_saved_cs, NULL);
 
-   si_begin_new_cs(ctx);
+   si_begin_new_gfx_cs(ctx);
ctx->gfx_flush_in_progress = false;
 }
 
-static void si_begin_cs_debug(struct si_context *ctx)
+static void si_begin_gfx_cs_debug(struct si_context *ctx)
 {
static const uint32_t zeros[1];
assert(!ctx->current_saved_cs);
@@ -183,10 +183,10 @@ static void si_begin_cs_debug(struct si_context *ctx)
  RADEON_USAGE_READWRITE, RADEON_PRIO_TRACE);
 }
 
-void si_begin_new_cs(struct si_context *ctx)
+void si_begin_new_gfx_cs(struct si_context *ctx)
 {
if (ctx->is_debug)
-   si_begin_cs_debug(ctx);
+   si_begin_gfx_cs_debug(ctx);
 
/* Flush read caches at the beginning of CS not flushed by the kernel. 
*/
if (ctx->b.chip_class >= CIK)
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c 
b/src/gallium/drivers/radeonsi/si_pipe.c
index 7e7a8b7..c8ed549 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -331,7 +331,7 @@ static struct pipe_context *si_create_context(struct 
pipe_screen *screen,
sctx->sample_mask.sample_mask = 0x;
 
/* these must be last */
-   si_begin_new_cs(sctx);
+   si_begin_new_gfx_cs(sctx);
 
if (sctx->b.chip_class >= GFX9) {
sctx->wait_mem_scratch = (struct r600_resource*)
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h 
b/src/gallium/drivers/radeonsi/si_pipe.h
index 9b9aa15..bc5a714 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -729,7 +729,7 @@ void si_init_screen_get_functions(struct si_screen 
*sscreen);
 void si_destroy_saved_cs(struct si_saved_cs *scs);
 void si_flush_gfx_cs(void *context, unsigned flags,
 struct pipe_fence_handle **fence);
-void si_begin_new_cs(struct si_context *ctx);
+void si_begin_new_gfx_cs(struct si_context *ctx);
 void si_need_gfx_cs_space(struct si_context *ctx);
 
 /* si_compute.c */
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 20/55] radeonsi: add_to_buffer_list functions can return void

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_cs.h | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_cs.h 
b/src/gallium/drivers/radeon/r600_cs.h
index 89d6c7c..c46fad6 100644
--- a/src/gallium/drivers/radeon/r600_cs.h
+++ b/src/gallium/drivers/radeon/r600_cs.h
@@ -64,17 +64,17 @@ radeon_cs_memory_below_limit(struct si_screen *screen,
  * The buffer list becomes empty after every context flush and must be
  * rebuilt.
  */
-static inline unsigned radeon_add_to_buffer_list(struct r600_common_context 
*rctx,
-struct r600_ring *ring,
-struct r600_resource *rbo,
-enum radeon_bo_usage usage,
-enum radeon_bo_priority 
priority)
+static inline void radeon_add_to_buffer_list(struct r600_common_context *rctx,
+struct r600_ring *ring,
+struct r600_resource *rbo,
+enum radeon_bo_usage usage,
+enum radeon_bo_priority priority)
 {
assert(usage);
-   return rctx->ws->cs_add_buffer(
+   rctx->ws->cs_add_buffer(
ring->cs, rbo->buf,
(enum radeon_bo_usage)(usage | RADEON_USAGE_SYNCHRONIZED),
-   rbo->domains, priority) * 4;
+   rbo->domains, priority);
 }
 
 /**
@@ -94,7 +94,7 @@ static inline unsigned radeon_add_to_buffer_list(struct 
r600_common_context *rct
  * - if shader resource "enabled_mask" is not up-to-date or there is
  *   a different constraint disallowing a context flush
  */
-static inline unsigned
+static inline void
 radeon_add_to_buffer_list_check_mem(struct r600_common_context *rctx,
struct r600_ring *ring,
struct r600_resource *rbo,
@@ -108,7 +108,7 @@ radeon_add_to_buffer_list_check_mem(struct 
r600_common_context *rctx,
  rctx->gtt + rbo->gart_usage))
ring->flush(rctx, PIPE_FLUSH_ASYNC, NULL);
 
-   return radeon_add_to_buffer_list(rctx, ring, rbo, usage, priority);
+   radeon_add_to_buffer_list(rctx, ring, rbo, usage, priority);
 }
 
 static inline void radeon_set_config_reg_seq(struct radeon_winsys_cs *cs, 
unsigned reg, unsigned num)
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 10/55] radeonsi: remove r600_pipe_common::invalidate_buffer

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_buffer_common.c | 12 +++-
 src/gallium/drivers/radeon/r600_pipe_common.h   |  4 
 src/gallium/drivers/radeonsi/si_descriptors.c   | 20 
 3 files changed, 11 insertions(+), 25 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c 
b/src/gallium/drivers/radeon/r600_buffer_common.c
index d215c9d..bc7e14b 100644
--- a/src/gallium/drivers/radeon/r600_buffer_common.c
+++ b/src/gallium/drivers/radeon/r600_buffer_common.c
@@ -254,6 +254,12 @@ static void r600_buffer_destroy(struct pipe_screen *screen,
FREE(rbuffer);
 }
 
+/* Reallocate the buffer a update all resource bindings where the buffer is
+ * bound.
+ *
+ * This is used to avoid CPU-GPU synchronizations, because it makes the buffer
+ * idle by discarding its contents.
+ */
 static bool
 r600_invalidate_buffer(struct r600_common_context *rctx,
   struct r600_resource *rbuffer)
@@ -275,7 +281,11 @@ r600_invalidate_buffer(struct r600_common_context *rctx,
/* Check if mapping this buffer would cause waiting for the GPU. */
if (si_rings_is_buffer_referenced(rctx, rbuffer->buf, 
RADEON_USAGE_READWRITE) ||
!rctx->ws->buffer_wait(rbuffer->buf, 0, RADEON_USAGE_READWRITE)) {
-   rctx->invalidate_buffer(>b, >b.b);
+   uint64_t old_va = rbuffer->gpu_address;
+
+   /* Reallocate the buffer in the same pipe_resource. */
+   si_alloc_resource(rctx->screen, rbuffer);
+   si_rebind_buffer(>b, >b.b, old_va);
} else {
util_range_set_empty(>valid_buffer_range);
}
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index 241a0b9..2e2b80b 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -494,10 +494,6 @@ struct r600_common_context {
 
void (*decompress_dcc)(struct pipe_context *ctx,
   struct r600_texture *rtex);
-
-   /* Reallocate the buffer and update all resource bindings where
-* the buffer is bound, including all resource descriptors. */
-   void (*invalidate_buffer)(struct pipe_context *ctx, struct 
pipe_resource *buf);
 };
 
 /* r600_buffer_common.c */
diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c 
b/src/gallium/drivers/radeonsi/si_descriptors.c
index 6feeb0e..a9c1b7f 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -1739,25 +1739,6 @@ void si_rebind_buffer(struct pipe_context *ctx, struct 
pipe_resource *buf,
}
 }
 
-/* Reallocate a buffer a update all resource bindings where the buffer is
- * bound.
- *
- * This is used to avoid CPU-GPU synchronizations, because it makes the buffer
- * idle by discarding its contents. Apps usually tell us when to do this using
- * map_buffer flags, for example.
- */
-static void si_invalidate_buffer(struct pipe_context *ctx, struct 
pipe_resource *buf)
-{
-   struct si_context *sctx = (struct si_context*)ctx;
-   struct r600_resource *rbuffer = r600_resource(buf);
-   uint64_t old_va = rbuffer->gpu_address;
-
-   /* Reallocate the buffer in the same pipe_resource. */
-   si_alloc_resource(sctx->screen, rbuffer);
-
-   si_rebind_buffer(ctx, buf, old_va);
-}
-
 static void si_upload_bindless_descriptor(struct si_context *sctx,
  unsigned desc_slot,
  unsigned num_dwords)
@@ -2713,7 +2694,6 @@ void si_init_all_descriptors(struct si_context *sctx)
sctx->b.b.create_image_handle = si_create_image_handle;
sctx->b.b.delete_image_handle = si_delete_image_handle;
sctx->b.b.make_image_handle_resident = si_make_image_handle_resident;
-   sctx->b.invalidate_buffer = si_invalidate_buffer;
 
/* Shader user data. */
si_init_atom(sctx, >shader_pointers.atom, 
>atoms.s.shader_pointers,
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 06/55] radeonsi: remove unused query code

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

The get_size perf counter callback is also inlined and removed.
---
 src/gallium/drivers/radeon/r600_perfcounter.c |  9 +---
 src/gallium/drivers/radeon/r600_query.c   | 29 
 src/gallium/drivers/radeon/r600_query.h   |  9 +---
 src/gallium/drivers/radeonsi/si_perfcounter.c | 32 ---
 4 files changed, 2 insertions(+), 77 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_perfcounter.c 
b/src/gallium/drivers/radeon/r600_perfcounter.c
index 711baef..689f4a3 100644
--- a/src/gallium/drivers/radeon/r600_perfcounter.c
+++ b/src/gallium/drivers/radeon/r600_perfcounter.c
@@ -348,10 +348,7 @@ struct pipe_query *si_create_batch_query(struct 
pipe_context *ctx,
}
 
/* Compute result bases and CS size per group */
-   query->b.num_cs_dw_begin = pc->num_start_cs_dwords;
query->b.num_cs_dw_end = pc->num_stop_cs_dwords;
-
-   query->b.num_cs_dw_begin += pc->num_instance_cs_dwords; /* conservative 
*/
query->b.num_cs_dw_end += pc->num_instance_cs_dwords;
 
i = 0;
@@ -369,18 +366,14 @@ struct pipe_query *si_create_batch_query(struct 
pipe_context *ctx,
query->b.result_size += sizeof(uint64_t) * instances * 
group->num_counters;
i += instances * group->num_counters;
 
-   pc->get_size(block, group->num_counters, group->selectors,
-_dw, _dw);
-   query->b.num_cs_dw_begin += select_dw;
+   read_dw = 6 * group->num_counters;
query->b.num_cs_dw_end += instances * read_dw;
-   query->b.num_cs_dw_begin += pc->num_instance_cs_dwords; /* 
conservative */
query->b.num_cs_dw_end += instances * 
pc->num_instance_cs_dwords;
}
 
if (query->shaders) {
if (query->shaders == R600_PC_SHADERS_WINDOWING)
query->shaders = 0x;
-   query->b.num_cs_dw_begin += pc->num_shaders_cs_dwords;
}
 
/* Map user-supplied query array to result indices */
diff --git a/src/gallium/drivers/radeon/r600_query.c 
b/src/gallium/drivers/radeon/r600_query.c
index bf76ae8..89fb3df 100644
--- a/src/gallium/drivers/radeon/r600_query.c
+++ b/src/gallium/drivers/radeon/r600_query.c
@@ -645,12 +645,10 @@ static struct pipe_query *r600_query_hw_create(struct 
si_screen *sscreen,
case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE:
query->result_size = 16 * sscreen->info.num_render_backends;
query->result_size += 16; /* for the fence + alignment */
-   query->num_cs_dw_begin = 6;
query->num_cs_dw_end = 6 + si_gfx_write_fence_dwords(sscreen);
break;
case PIPE_QUERY_TIME_ELAPSED:
query->result_size = 24;
-   query->num_cs_dw_begin = 8;
query->num_cs_dw_end = 8 + si_gfx_write_fence_dwords(sscreen);
break;
case PIPE_QUERY_TIMESTAMP:
@@ -664,21 +662,18 @@ static struct pipe_query *r600_query_hw_create(struct 
si_screen *sscreen,
case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
/* NumPrimitivesWritten, PrimitiveStorageNeeded. */
query->result_size = 32;
-   query->num_cs_dw_begin = 6;
query->num_cs_dw_end = 6;
query->stream = index;
break;
case PIPE_QUERY_SO_OVERFLOW_ANY_PREDICATE:
/* NumPrimitivesWritten, PrimitiveStorageNeeded. */
query->result_size = 32 * R600_MAX_STREAMS;
-   query->num_cs_dw_begin = 6 * R600_MAX_STREAMS;
query->num_cs_dw_end = 6 * R600_MAX_STREAMS;
break;
case PIPE_QUERY_PIPELINE_STATISTICS:
/* 11 values on GCN. */
query->result_size = 11 * 16;
query->result_size += 8; /* for the fence + alignment */
-   query->num_cs_dw_begin = 6;
query->num_cs_dw_end = 6 + si_gfx_write_fence_dwords(sscreen);
break;
default:
@@ -1843,33 +1838,9 @@ void si_suspend_queries(struct r600_common_context *ctx)
assert(ctx->num_cs_dw_queries_suspend == 0);
 }
 
-static unsigned r600_queries_num_cs_dw_for_resuming(struct r600_common_context 
*ctx,
-   struct list_head 
*query_list)
-{
-   struct r600_query_hw *query;
-   unsigned num_dw = 0;
-
-   LIST_FOR_EACH_ENTRY(query, query_list, list) {
-   /* begin + end */
-   num_dw += query->num_cs_dw_begin + query->num_cs_dw_end;
-
-   /* Workaround for the fact that
-* num_cs_dw_nontimer_queries_suspend is incremented for every
-* resumed query, which raises the bar in need_cs_space for
-* queries about to be resumed.
-*/
-   num_dw += 

[Mesa-dev] [PATCH 04/55] radeonsi: remove r600_pipe_common::need_gfx_cs_space

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_pipe_common.h |  4 
 src/gallium/drivers/radeon/r600_query.c   | 10 --
 src/gallium/drivers/radeonsi/si_state.c   |  7 ---
 3 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index ca456e4..f244356 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -511,10 +511,6 @@ struct r600_common_context {
  bool old_perfect_enable);
 
void (*save_qbo_state)(struct pipe_context *ctx, struct r600_qbo_state 
*st);
-
-   /* This ensures there is enough space in the command stream. */
-   void (*need_gfx_cs_space)(struct pipe_context *ctx, unsigned num_dw,
- bool include_draw_vbo);
 };
 
 /* r600_buffer_common.c */
diff --git a/src/gallium/drivers/radeon/r600_query.c 
b/src/gallium/drivers/radeon/r600_query.c
index 0ec53dd..bf76ae8 100644
--- a/src/gallium/drivers/radeon/r600_query.c
+++ b/src/gallium/drivers/radeon/r600_query.c
@@ -807,8 +807,7 @@ static void r600_query_hw_emit_start(struct 
r600_common_context *ctx,
r600_update_occlusion_query_state(ctx, query->b.type, 1);
si_update_prims_generated_query_state((void*)ctx, query->b.type, 1);
 
-   ctx->need_gfx_cs_space(>b, query->num_cs_dw_begin + 
query->num_cs_dw_end,
-  true);
+   si_need_cs_space((struct si_context*)ctx);
 
/* Get a new query buffer if needed. */
if (query->buffer.results_end + query->result_size > 
query->buffer.buf->b.b.width0) {
@@ -904,9 +903,8 @@ static void r600_query_hw_emit_stop(struct 
r600_common_context *ctx,
return; // previous buffer allocation failure
 
/* The queries which need begin already called this in begin_query. */
-   if (query->flags & R600_QUERY_HW_FLAG_NO_START) {
-   ctx->need_gfx_cs_space(>b, query->num_cs_dw_end, false);
-   }
+   if (query->flags & R600_QUERY_HW_FLAG_NO_START)
+   si_need_cs_space((struct si_context*)ctx);
 
/* emit end query */
va = query->buffer.buf->gpu_address + query->buffer.results_end;
@@ -1876,7 +1874,7 @@ void si_resume_queries(struct r600_common_context *ctx)
assert(ctx->num_cs_dw_queries_suspend == 0);
 
/* Check CS space here. Resuming must not be interrupted by flushes. */
-   ctx->need_gfx_cs_space(>b, num_cs_dw, true);
+   si_need_cs_space((struct si_context*)ctx);
 
LIST_FOR_EACH_ENTRY(query, >active_queries, list) {
r600_query_hw_emit_start(ctx, query);
diff --git a/src/gallium/drivers/radeonsi/si_state.c 
b/src/gallium/drivers/radeonsi/si_state.c
index b4165a4..1e1ead0 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -4517,12 +4517,6 @@ static void *si_create_blend_custom(struct si_context 
*sctx, unsigned mode)
return si_create_blend_state_mode(>b.b, , mode);
 }
 
-static void si_need_gfx_cs_space(struct pipe_context *ctx, unsigned num_dw,
-bool include_draw_vbo)
-{
-   si_need_cs_space((struct si_context*)ctx);
-}
-
 static void si_init_config(struct si_context *sctx);
 
 void si_init_state_functions(struct si_context *sctx)
@@ -4590,7 +4584,6 @@ void si_init_state_functions(struct si_context *sctx)
sctx->b.b.set_active_query_state = si_set_active_query_state;
sctx->b.set_occlusion_query_state = si_set_occlusion_query_state;
sctx->b.save_qbo_state = si_save_qbo_state;
-   sctx->b.need_gfx_cs_space = si_need_gfx_cs_space;
 
sctx->b.b.draw_vbo = si_draw_vbo;
 
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 07/55] radeonsi: remove r600_pipe_common::save_qbo_state

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_perfcounter.c | 2 +-
 src/gallium/drivers/radeon/r600_pipe_common.h | 2 --
 src/gallium/drivers/radeon/r600_query.c   | 2 +-
 src/gallium/drivers/radeonsi/si_state.c   | 3 +--
 src/gallium/drivers/radeonsi/si_state.h   | 1 +
 5 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_perfcounter.c 
b/src/gallium/drivers/radeon/r600_perfcounter.c
index 689f4a3..0e7b3d9 100644
--- a/src/gallium/drivers/radeon/r600_perfcounter.c
+++ b/src/gallium/drivers/radeon/r600_perfcounter.c
@@ -354,7 +354,7 @@ struct pipe_query *si_create_batch_query(struct 
pipe_context *ctx,
i = 0;
for (group = query->groups; group; group = group->next) {
struct r600_perfcounter_block *block = group->block;
-   unsigned select_dw, read_dw;
+   unsigned read_dw;
unsigned instances = 1;
 
if ((block->flags & R600_PC_BLOCK_SE) && group->se < 0)
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index f244356..99bba0a 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -509,8 +509,6 @@ struct r600_common_context {
void (*set_occlusion_query_state)(struct pipe_context *ctx,
  bool old_enable,
  bool old_perfect_enable);
-
-   void (*save_qbo_state)(struct pipe_context *ctx, struct r600_qbo_state 
*st);
 };
 
 /* r600_buffer_common.c */
diff --git a/src/gallium/drivers/radeon/r600_query.c 
b/src/gallium/drivers/radeon/r600_query.c
index 89fb3df..d9c402c 100644
--- a/src/gallium/drivers/radeon/r600_query.c
+++ b/src/gallium/drivers/radeon/r600_query.c
@@ -1660,7 +1660,7 @@ static void r600_query_hw_get_result_resource(struct 
r600_common_context *rctx,
return;
}
 
-   rctx->save_qbo_state(>b, _state);
+   si_save_qbo_state(>b, _state);
 
r600_get_hw_query_params(rctx, query, index >= 0 ? index : 0, );
consts.end_offset = params.end_offset - params.start_offset;
diff --git a/src/gallium/drivers/radeonsi/si_state.c 
b/src/gallium/drivers/radeonsi/si_state.c
index 1e1ead0..06dcecc 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -1361,7 +1361,7 @@ static void si_set_occlusion_query_state(struct 
pipe_context *ctx,
si_mark_atom_dirty(sctx, >msaa_config);
 }
 
-static void si_save_qbo_state(struct pipe_context *ctx, struct r600_qbo_state 
*st)
+void si_save_qbo_state(struct pipe_context *ctx, struct r600_qbo_state *st)
 {
struct si_context *sctx = (struct si_context*)ctx;
 
@@ -4583,7 +4583,6 @@ void si_init_state_functions(struct si_context *sctx)
 
sctx->b.b.set_active_query_state = si_set_active_query_state;
sctx->b.set_occlusion_query_state = si_set_occlusion_query_state;
-   sctx->b.save_qbo_state = si_save_qbo_state;
 
sctx->b.b.draw_vbo = si_draw_vbo;
 
diff --git a/src/gallium/drivers/radeonsi/si_state.h 
b/src/gallium/drivers/radeonsi/si_state.h
index 02659a7..60a724a 100644
--- a/src/gallium/drivers/radeonsi/si_state.h
+++ b/src/gallium/drivers/radeonsi/si_state.h
@@ -395,6 +395,7 @@ si_create_sampler_view_custom(struct pipe_context *ctx,
  unsigned width0, unsigned height0,
  unsigned force_level);
 void si_update_fb_dirtiness_after_rendering(struct si_context *sctx);
+void si_save_qbo_state(struct pipe_context *ctx, struct r600_qbo_state *st);
 
 /* si_state_binning.c */
 void si_emit_dpbb_state(struct si_context *sctx, struct r600_atom *state);
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 13/55] radeonsi: rename si_need_cs_space -> si_need_gfx_cs_space

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_query.c  | 6 +++---
 src/gallium/drivers/radeonsi/si_compute.c| 2 +-
 src/gallium/drivers/radeonsi/si_cp_dma.c | 2 +-
 src/gallium/drivers/radeonsi/si_hw_context.c | 2 +-
 src/gallium/drivers/radeonsi/si_pipe.h   | 2 +-
 src/gallium/drivers/radeonsi/si_state_draw.c | 2 +-
 6 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_query.c 
b/src/gallium/drivers/radeon/r600_query.c
index aa23aac..c7b2d94 100644
--- a/src/gallium/drivers/radeon/r600_query.c
+++ b/src/gallium/drivers/radeon/r600_query.c
@@ -801,7 +801,7 @@ static void r600_query_hw_emit_start(struct 
r600_common_context *ctx,
r600_update_occlusion_query_state(ctx, query->b.type, 1);
si_update_prims_generated_query_state((void*)ctx, query->b.type, 1);
 
-   si_need_cs_space((struct si_context*)ctx);
+   si_need_gfx_cs_space((struct si_context*)ctx);
 
/* Get a new query buffer if needed. */
if (query->buffer.results_end + query->result_size > 
query->buffer.buf->b.b.width0) {
@@ -898,7 +898,7 @@ static void r600_query_hw_emit_stop(struct 
r600_common_context *ctx,
 
/* The queries which need begin already called this in begin_query. */
if (query->flags & R600_QUERY_HW_FLAG_NO_START)
-   si_need_cs_space((struct si_context*)ctx);
+   si_need_gfx_cs_space((struct si_context*)ctx);
 
/* emit end query */
va = query->buffer.buf->gpu_address + query->buffer.results_end;
@@ -1844,7 +1844,7 @@ void si_resume_queries(struct r600_common_context *ctx)
assert(ctx->num_cs_dw_queries_suspend == 0);
 
/* Check CS space here. Resuming must not be interrupted by flushes. */
-   si_need_cs_space((struct si_context*)ctx);
+   si_need_gfx_cs_space((struct si_context*)ctx);
 
LIST_FOR_EACH_ENTRY(query, >active_queries, list) {
r600_query_hw_emit_start(ctx, query);
diff --git a/src/gallium/drivers/radeonsi/si_compute.c 
b/src/gallium/drivers/radeonsi/si_compute.c
index 46873cc..e15d6f9 100644
--- a/src/gallium/drivers/radeonsi/si_compute.c
+++ b/src/gallium/drivers/radeonsi/si_compute.c
@@ -849,7 +849,7 @@ static void si_launch_grid(
}
}
 
-   si_need_cs_space(sctx);
+   si_need_gfx_cs_space(sctx);
 
if (!sctx->cs_shader_state.initialized)
si_initialize_compute(sctx);
diff --git a/src/gallium/drivers/radeonsi/si_cp_dma.c 
b/src/gallium/drivers/radeonsi/si_cp_dma.c
index 15bd305..cd88d38 100644
--- a/src/gallium/drivers/radeonsi/si_cp_dma.c
+++ b/src/gallium/drivers/radeonsi/si_cp_dma.c
@@ -171,7 +171,7 @@ static void si_cp_dma_prepare(struct si_context *sctx, 
struct pipe_resource *dst
}
 
if (!(user_flags & SI_CPDMA_SKIP_CHECK_CS_SPACE))
-   si_need_cs_space(sctx);
+   si_need_gfx_cs_space(sctx);
 
/* This must be done after need_cs_space. */
if (!(user_flags & SI_CPDMA_SKIP_BO_LIST_UPDATE)) {
diff --git a/src/gallium/drivers/radeonsi/si_hw_context.c 
b/src/gallium/drivers/radeonsi/si_hw_context.c
index 0f7fbc6..615e881 100644
--- a/src/gallium/drivers/radeonsi/si_hw_context.c
+++ b/src/gallium/drivers/radeonsi/si_hw_context.c
@@ -34,7 +34,7 @@ void si_destroy_saved_cs(struct si_saved_cs *scs)
 }
 
 /* initialize */
-void si_need_cs_space(struct si_context *ctx)
+void si_need_gfx_cs_space(struct si_context *ctx)
 {
struct radeon_winsys_cs *cs = ctx->b.gfx.cs;
 
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h 
b/src/gallium/drivers/radeonsi/si_pipe.h
index 62ddcce..9b9aa15 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -730,7 +730,7 @@ void si_destroy_saved_cs(struct si_saved_cs *scs);
 void si_flush_gfx_cs(void *context, unsigned flags,
 struct pipe_fence_handle **fence);
 void si_begin_new_cs(struct si_context *ctx);
-void si_need_cs_space(struct si_context *ctx);
+void si_need_gfx_cs_space(struct si_context *ctx);
 
 /* si_compute.c */
 void si_init_compute_functions(struct si_context *sctx);
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c 
b/src/gallium/drivers/radeonsi/si_state_draw.c
index ad470fd..8779a94 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -1404,7 +1404,7 @@ void si_draw_vbo(struct pipe_context *ctx, const struct 
pipe_draw_info *info)
}
}
 
-   si_need_cs_space(sctx);
+   si_need_gfx_cs_space(sctx);
 
/* Since we've called r600_context_add_resource_size for vertex buffers,
 * this must be called after si_need_cs_space, because we must let
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 05/55] radeonsi: use num_cs_dw_queries_suspend

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeonsi/si_hw_context.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_hw_context.c 
b/src/gallium/drivers/radeonsi/si_hw_context.c
index 6fc85ea..0f7fbc6 100644
--- a/src/gallium/drivers/radeonsi/si_hw_context.c
+++ b/src/gallium/drivers/radeonsi/si_hw_context.c
@@ -62,7 +62,8 @@ void si_need_cs_space(struct si_context *ctx)
/* If the CS is sufficiently large, don't count the space needed
 * and just flush if there is not enough space left.
 */
-   if (!ctx->b.ws->cs_check_space(cs, 2048))
+   unsigned need_dwords = 2048 + ctx->b.num_cs_dw_queries_suspend;
+   if (!ctx->b.ws->cs_check_space(cs, need_dwords))
si_flush_gfx_cs(ctx, PIPE_FLUSH_ASYNC, NULL);
 }
 
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 08/55] radeonsi: remove r600_common_context::set_occlusion_query_state

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

and remove unused old_enable parameter.
---
 src/gallium/drivers/radeon/r600_pipe_common.h | 5 -
 src/gallium/drivers/radeon/r600_query.c   | 3 +--
 src/gallium/drivers/radeonsi/si_state.c   | 6 ++
 src/gallium/drivers/radeonsi/si_state.h   | 2 ++
 4 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index 99bba0a..1381a67 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -504,11 +504,6 @@ struct r600_common_context {
 * the invalidation. */
void (*rebind_buffer)(struct pipe_context *ctx, struct pipe_resource 
*buf,
  uint64_t old_gpu_address);
-
-   /* Enable or disable occlusion queries. */
-   void (*set_occlusion_query_state)(struct pipe_context *ctx,
- bool old_enable,
- bool old_perfect_enable);
 };
 
 /* r600_buffer_common.c */
diff --git a/src/gallium/drivers/radeon/r600_query.c 
b/src/gallium/drivers/radeon/r600_query.c
index d9c402c..aa23aac 100644
--- a/src/gallium/drivers/radeon/r600_query.c
+++ b/src/gallium/drivers/radeon/r600_query.c
@@ -713,8 +713,7 @@ static void r600_update_occlusion_query_state(struct 
r600_common_context *rctx,
perfect_enable = rctx->num_perfect_occlusion_queries != 0;
 
if (enable != old_enable || perfect_enable != 
old_perfect_enable) {
-   rctx->set_occlusion_query_state(>b, old_enable,
-   old_perfect_enable);
+   si_set_occlusion_query_state(>b, 
old_perfect_enable);
}
}
 }
diff --git a/src/gallium/drivers/radeonsi/si_state.c 
b/src/gallium/drivers/radeonsi/si_state.c
index 06dcecc..ee4f96d 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -1347,9 +1347,8 @@ static void si_set_active_query_state(struct pipe_context 
*ctx, boolean enable)
}
 }
 
-static void si_set_occlusion_query_state(struct pipe_context *ctx,
-bool old_enable,
-bool old_perfect_enable)
+void si_set_occlusion_query_state(struct pipe_context *ctx,
+ bool old_perfect_enable)
 {
struct si_context *sctx = (struct si_context*)ctx;
 
@@ -4582,7 +4581,6 @@ void si_init_state_functions(struct si_context *sctx)
sctx->b.b.set_tess_state = si_set_tess_state;
 
sctx->b.b.set_active_query_state = si_set_active_query_state;
-   sctx->b.set_occlusion_query_state = si_set_occlusion_query_state;
 
sctx->b.b.draw_vbo = si_draw_vbo;
 
diff --git a/src/gallium/drivers/radeonsi/si_state.h 
b/src/gallium/drivers/radeonsi/si_state.h
index 60a724a..95dc2d3 100644
--- a/src/gallium/drivers/radeonsi/si_state.h
+++ b/src/gallium/drivers/radeonsi/si_state.h
@@ -396,6 +396,8 @@ si_create_sampler_view_custom(struct pipe_context *ctx,
  unsigned force_level);
 void si_update_fb_dirtiness_after_rendering(struct si_context *sctx);
 void si_save_qbo_state(struct pipe_context *ctx, struct r600_qbo_state *st);
+void si_set_occlusion_query_state(struct pipe_context *ctx,
+ bool old_perfect_enable);
 
 /* si_state_binning.c */
 void si_emit_dpbb_state(struct si_context *sctx, struct r600_atom *state);
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 02/55] radeonsi: remove r600_pipe_common::check_vm_faults

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_pipe_common.c | 6 ++
 src/gallium/drivers/radeon/r600_pipe_common.h | 4 
 src/gallium/drivers/radeonsi/si_debug.c   | 1 -
 3 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c 
b/src/gallium/drivers/radeon/r600_pipe_common.c
index de191e4..8344a55 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -239,9 +239,7 @@ void si_flush_dma_cs(void *ctx, unsigned flags, struct 
pipe_fence_handle **fence
struct r600_common_context *rctx = (struct r600_common_context *)ctx;
struct radeon_winsys_cs *cs = rctx->dma.cs;
struct radeon_saved_cs saved;
-   bool check_vm =
-   (rctx->screen->debug_flags & DBG(CHECK_VM)) &&
-   rctx->check_vm_faults;
+   bool check_vm = (rctx->screen->debug_flags & DBG(CHECK_VM));
 
if (!radeon_emitted(cs, 0)) {
if (fence)
@@ -262,7 +260,7 @@ void si_flush_dma_cs(void *ctx, unsigned flags, struct 
pipe_fence_handle **fence
 */
rctx->ws->fence_wait(rctx->ws, rctx->last_sdma_fence, 
800*1000*1000);
 
-   rctx->check_vm_faults(rctx, , RING_DMA);
+   si_check_vm_faults(rctx, , RING_DMA);
si_clear_saved_cs();
}
 }
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index db4eae0..f5837bd 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -518,10 +518,6 @@ struct r600_common_context {
 
void (*set_atom_dirty)(struct r600_common_context *ctx,
   struct r600_atom *atom, bool dirty);
-
-   void (*check_vm_faults)(struct r600_common_context *ctx,
-   struct radeon_saved_cs *saved,
-   enum ring_type ring);
 };
 
 /* r600_buffer_common.c */
diff --git a/src/gallium/drivers/radeonsi/si_debug.c 
b/src/gallium/drivers/radeonsi/si_debug.c
index 1f25f4e..30b45ee 100644
--- a/src/gallium/drivers/radeonsi/si_debug.c
+++ b/src/gallium/drivers/radeonsi/si_debug.c
@@ -1109,7 +1109,6 @@ void si_check_vm_faults(struct r600_common_context *ctx,
 void si_init_debug_functions(struct si_context *sctx)
 {
sctx->b.b.dump_debug_state = si_dump_debug_state;
-   sctx->b.check_vm_faults = si_check_vm_faults;
 
/* Set the initial dmesg timestamp for this context, so that
 * only new messages will be checked for VM faults.
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 03/55] radeonsi: remove r600_pipe_common::set_atom_dirty

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_pipe_common.h | 3 ---
 src/gallium/drivers/radeon/r600_query.c   | 2 +-
 src/gallium/drivers/radeonsi/si_pipe.c| 1 -
 3 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index f5837bd..ca456e4 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -515,9 +515,6 @@ struct r600_common_context {
/* This ensures there is enough space in the command stream. */
void (*need_gfx_cs_space)(struct pipe_context *ctx, unsigned num_dw,
  bool include_draw_vbo);
-
-   void (*set_atom_dirty)(struct r600_common_context *ctx,
-  struct r600_atom *atom, bool dirty);
 };
 
 /* r600_buffer_common.c */
diff --git a/src/gallium/drivers/radeon/r600_query.c 
b/src/gallium/drivers/radeon/r600_query.c
index e736875..0ec53dd 100644
--- a/src/gallium/drivers/radeon/r600_query.c
+++ b/src/gallium/drivers/radeon/r600_query.c
@@ -1832,7 +1832,7 @@ static void r600_render_condition(struct pipe_context 
*ctx,
rctx->render_cond_invert = condition;
rctx->render_cond_mode = mode;
 
-   rctx->set_atom_dirty(rctx, atom, query != NULL);
+   si_set_atom_dirty((struct si_context*)rctx, atom, query != NULL);
 }
 
 void si_suspend_queries(struct r600_common_context *ctx)
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c 
b/src/gallium/drivers/radeonsi/si_pipe.c
index 3456dff..7e7a8b7 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -258,7 +258,6 @@ static struct pipe_context *si_create_context(struct 
pipe_screen *screen,
sctx->b.b.emit_string_marker = si_emit_string_marker;
sctx->b.b.set_debug_callback = si_set_debug_callback;
sctx->b.b.set_log_context = si_set_log_context;
-   sctx->b.set_atom_dirty = (void *)si_set_atom_dirty;
sctx->screen = sscreen; /* Easy accessing of screen/winsys. */
sctx->is_debug = (flags & PIPE_CONTEXT_DEBUG) != 0;
 
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 01/55] radeonsi: call CS flush functions directly whenever possible

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeon/r600_buffer_common.c |  8 
 src/gallium/drivers/radeon/r600_pipe_common.c   | 15 +++
 src/gallium/drivers/radeon/r600_pipe_common.h   |  1 +
 src/gallium/drivers/radeon/r600_texture.c   |  2 +-
 src/gallium/drivers/radeonsi/si_hw_context.c| 10 +-
 src/gallium/drivers/radeonsi/si_pipe.c  |  4 ++--
 src/gallium/drivers/radeonsi/si_pipe.h  |  4 ++--
 src/gallium/drivers/radeonsi/si_state_shaders.c |  4 ++--
 8 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c 
b/src/gallium/drivers/radeon/r600_buffer_common.c
index 2b4b7bb..a9ae007 100644
--- a/src/gallium/drivers/radeon/r600_buffer_common.c
+++ b/src/gallium/drivers/radeon/r600_buffer_common.c
@@ -64,10 +64,10 @@ void *si_buffer_map_sync_with_rings(struct 
r600_common_context *ctx,
ctx->ws->cs_is_buffer_referenced(ctx->gfx.cs,
 resource->buf, rusage)) {
if (usage & PIPE_TRANSFER_DONTBLOCK) {
-   ctx->gfx.flush(ctx, PIPE_FLUSH_ASYNC, NULL);
+   si_flush_gfx_cs(ctx, PIPE_FLUSH_ASYNC, NULL);
return NULL;
} else {
-   ctx->gfx.flush(ctx, 0, NULL);
+   si_flush_gfx_cs(ctx, 0, NULL);
busy = true;
}
}
@@ -75,10 +75,10 @@ void *si_buffer_map_sync_with_rings(struct 
r600_common_context *ctx,
ctx->ws->cs_is_buffer_referenced(ctx->dma.cs,
 resource->buf, rusage)) {
if (usage & PIPE_TRANSFER_DONTBLOCK) {
-   ctx->dma.flush(ctx, PIPE_FLUSH_ASYNC, NULL);
+   si_flush_dma_cs(ctx, PIPE_FLUSH_ASYNC, NULL);
return NULL;
} else {
-   ctx->dma.flush(ctx, 0, NULL);
+   si_flush_dma_cs(ctx, 0, NULL);
busy = true;
}
}
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c 
b/src/gallium/drivers/radeon/r600_pipe_common.c
index 3496d6e..de191e4 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -186,7 +186,7 @@ void si_need_dma_space(struct r600_common_context *ctx, 
unsigned num_dw,
 (src &&
  ctx->ws->cs_is_buffer_referenced(ctx->gfx.cs, src->buf,
   RADEON_USAGE_WRITE
-   ctx->gfx.flush(ctx, PIPE_FLUSH_ASYNC, NULL);
+   si_flush_gfx_cs(ctx, PIPE_FLUSH_ASYNC, NULL);
 
/* Flush if there's not enough space, or if the memory usage per IB
 * is too large.
@@ -204,7 +204,7 @@ void si_need_dma_space(struct r600_common_context *ctx, 
unsigned num_dw,
if (!ctx->ws->cs_check_space(ctx->dma.cs, num_dw) ||
ctx->dma.cs->used_vram + ctx->dma.cs->used_gart > 64 * 1024 * 1024 
||
!radeon_cs_memory_below_limit(ctx->screen, ctx->dma.cs, vram, gtt)) 
{
-   ctx->dma.flush(ctx, PIPE_FLUSH_ASYNC, NULL);
+   si_flush_dma_cs(ctx, PIPE_FLUSH_ASYNC, NULL);
assert((num_dw + ctx->dma.cs->current.cdw) <= 
ctx->dma.cs->current.max_dw);
}
 
@@ -234,8 +234,7 @@ void si_need_dma_space(struct r600_common_context *ctx, 
unsigned num_dw,
ctx->num_dma_calls++;
 }
 
-static void r600_flush_dma_ring(void *ctx, unsigned flags,
-   struct pipe_fence_handle **fence)
+void si_flush_dma_cs(void *ctx, unsigned flags, struct pipe_fence_handle 
**fence)
 {
struct r600_common_context *rctx = (struct r600_common_context *)ctx;
struct radeon_winsys_cs *cs = rctx->dma.cs;
@@ -380,12 +379,12 @@ static bool r600_resource_commit(struct pipe_context 
*pctx,
if (radeon_emitted(ctx->gfx.cs, ctx->initial_gfx_cs_size) &&
ctx->ws->cs_is_buffer_referenced(ctx->gfx.cs,
 res->buf, RADEON_USAGE_READWRITE)) 
{
-   ctx->gfx.flush(ctx, PIPE_FLUSH_ASYNC, NULL);
+   si_flush_gfx_cs(ctx, PIPE_FLUSH_ASYNC, NULL);
}
if (radeon_emitted(ctx->dma.cs, 0) &&
ctx->ws->cs_is_buffer_referenced(ctx->dma.cs,
 res->buf, RADEON_USAGE_READWRITE)) 
{
-   ctx->dma.flush(ctx, PIPE_FLUSH_ASYNC, NULL);
+   si_flush_dma_cs(ctx, PIPE_FLUSH_ASYNC, NULL);
}
 
ctx->ws->cs_sync_flush(ctx->dma.cs);
@@ -463,9 +462,9 @@ bool si_common_context_init(struct r600_common_context 
*rctx,
 
if (sscreen->info.num_sdma_rings && !(sscreen->debug_flags & 
DBG(NO_ASYNC_DMA))) {
rctx->dma.cs = rctx->ws->cs_create(rctx->ctx, RING_DMA,
-  r600_flush_dma_ring,
+  

[Mesa-dev] [PATCH 00/55] RadeonSI Mega cleanup

2018-04-01 Thread Marek Olšák
Hi,

This mostly removes code from drivers/radeon and moves most of it into
drivers/radeonsi. There are still a few things left in drivers/radeon.

There are also some file & function renames and cleanups all over
the place.

The net decrease is ~300 lines of code.

Patch 50 might be too huge for the list, so it's here:
https://cgit.freedesktop.org/~mareko/mesa/commit/?h=mega-cleanup=c9b4691ef41cc8aefb8f2428771c1830d9a05036

The whole series:
https://cgit.freedesktop.org/~mareko/mesa/log/?h=mega-cleanup

Marek Olšák (55):
  radeonsi: call CS flush functions directly whenever possible
  radeonsi: remove r600_pipe_common::check_vm_faults
  radeonsi: remove r600_pipe_common::set_atom_dirty
  radeonsi: remove r600_pipe_common::need_gfx_cs_space
  radeonsi: use num_cs_dw_queries_suspend
  radeonsi: remove unused query code
  radeonsi: remove r600_pipe_common::save_qbo_state
  radeonsi: remove r600_common_context::set_occlusion_query_state
  radeonsi: remove r600_pipe_common::rebind_buffer
  radeonsi: remove r600_pipe_common::invalidate_buffer
  radeonsi: remove r600_pipe_common::decompress_dcc
  radeonsi: remove r600_pipe_common::blit_decompress_depth
  radeonsi: rename si_need_cs_space -> si_need_gfx_cs_space
  radeonsi: rename si_begin_new_cs -> si_begin_new_gfx_cs
  radeonsi: move si_destroy_saved_cs to si_debug.c
  radeonsi: rename si_hw_context.c -> si_gfx_cs.c
  radeonsi: move EOP event code from r600_pipe_common.c to si_fence.c
  radeonsi: move DMA CS functions from r600_pipe_common.c to si_dma_cs.c
  radeonsi: move saved_cs functions from r600_pipe_common.c to si_debug.c
  radeonsi: add_to_buffer_list functions can return void
  radeonsi: make radeon_add_to_buffer_list_check_mem be gfx-only
  radeonsi: remove r600_ring::flush callback
  radeonsi: flatten / remove struct r600_ring
  radeonsi: switch r600_atom::emit parameter to si_context
  radeonsi: don't use r600_common_context in si_emit_cache_flush
  radeonsi: use r600_common_context less pt1
  radeonsi: use r600_common_context less pt2
  radeonsi: use r600_common_context less pt3
  radeonsi: use r600_common_context less pt4
  radeonsi: use r600_common_context less pt5
  radeonsi: switch radeon_add_to_buffer_list parameter to si_context
  radeonsi: update copyrights
  radeonsi: use r600_common_context less pt6
  radeonsi: use r600_common_context less pt7
  radeonsi: pass sctx to si_rebind_buffer and clean up
  radeonsi: use si_context instead of pipe_context in parameters pt1
  radeonsi: use si_context instead of pipe_context in parameters pt2
  radeonsi: use si_context instead of pipe_context in parameters pt3
  radeonsi: rename r600 -> si in some places
  radeonsi: move functions out of and remove r600_pipe_common.c
  radeonsi: move definitions out of r600_pipe_common.h
  radeonsi: rename a few R600/r600_ -> SI_/si_
  radeonsi: move and rename R600_ERR out of r600_pipe_common.h
  radeonsi: rename query definitions R600_ -> SI_
  radeonsi: move r600_cs.h contents into si_pipe.h, si_build_pm4.h
  radeonsi: move r600_query.c/h files to si_query.c/h
  radeonsi: move r600_gpu_load.c to si_gpu_load.c
  radeonsi: move r600_buffer_common.c and r600_texture.c into radeonsi
  radeonsi: remove r600_pipe_common::screen
  radeonsi: remove r600_common_context
  radeonsi: clean up GET_MAX_VIEWPORT_RANGE definition
  radeonsi: don't build libradeon.la separately
  radeonsi: try to fix meson
  radeonsi: try to fix android
  radeonsi: remove more R600 references

Please review or ack.

Thanks,
Marek
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] radeonsi: skip DCC render feedback checking if color writes are disabled

2018-04-01 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeonsi/si_blit.c  |  5 +
 src/gallium/drivers/radeonsi/si_pipe.h  | 17 +
 src/gallium/drivers/radeonsi/si_state_shaders.c |  6 +-
 3 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_blit.c 
b/src/gallium/drivers/radeonsi/si_blit.c
index f1c4f6d..c34d677 100644
--- a/src/gallium/drivers/radeonsi/si_blit.c
+++ b/src/gallium/drivers/radeonsi/si_blit.c
@@ -706,20 +706,25 @@ static void 
si_check_render_feedback_resident_images(struct si_context *sctx)
si_check_render_feedback_texture(sctx, tex,
 view->u.tex.level,
 view->u.tex.level,
 view->u.tex.first_layer,
 view->u.tex.last_layer);
}
 }
 
 static void si_check_render_feedback(struct si_context *sctx)
 {
+   /* There is no render feedback if color writes are disabled.
+* (e.g. a pixel shader with image stores)
+*/
+   if (!si_get_total_colormask(sctx))
+   return;
 
if (!sctx->need_check_render_feedback)
return;
 
for (int i = 0; i < SI_NUM_SHADERS; ++i) {
si_check_render_feedback_images(sctx, >images[i]);
si_check_render_feedback_textures(sctx, >samplers[i]);
}
 
si_check_render_feedback_resident_images(sctx);
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h 
b/src/gallium/drivers/radeonsi/si_pipe.h
index 2053dcb..e75e6c1 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -923,11 +923,28 @@ si_htile_enabled(struct r600_texture *tex, unsigned level)
return tex->htile_offset && level == 0;
 }
 
 static inline bool
 vi_tc_compat_htile_enabled(struct r600_texture *tex, unsigned level)
 {
assert(!tex->tc_compatible_htile || tex->htile_offset);
return tex->tc_compatible_htile && level == 0;
 }
 
+static inline unsigned si_get_total_colormask(struct si_context *sctx)
+{
+   if (sctx->queued.named.rasterizer->rasterizer_discard)
+   return 0;
+
+   struct si_shader_selector *ps = sctx->ps_shader.cso;
+   unsigned colormask = sctx->framebuffer.colorbuf_enabled_4bit &
+sctx->queued.named.blend->cb_target_mask;
+
+   if (!ps->info.properties[TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS])
+   colormask &= ps->colors_written_4bit;
+   else if (!ps->colors_written_4bit)
+   colormask = 0; /* color0 writes all cbufs, but it's not written 
*/
+
+   return colormask;
+}
+
 #endif
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c 
b/src/gallium/drivers/radeonsi/si_state_shaders.c
index 8fe4c04..45eded9 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -1208,25 +1208,21 @@ static void si_shader_selector_key_hw_vs(struct 
si_context *sctx,
bool ps_disabled = true;
if (ps) {
const struct si_state_blend *blend = sctx->queued.named.blend;
bool alpha_to_coverage = blend && blend->alpha_to_coverage;
bool ps_modifies_zs = ps->info.uses_kill ||
  ps->info.writes_z ||
  ps->info.writes_stencil ||
  ps->info.writes_samplemask ||
  alpha_to_coverage ||
  si_get_alpha_test_func(sctx) != 
PIPE_FUNC_ALWAYS;
-
-   unsigned ps_colormask = sctx->framebuffer.colorbuf_enabled_4bit 
&
-   
sctx->queued.named.blend->cb_target_mask;
-   if 
(!ps->info.properties[TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS])
-   ps_colormask &= ps->colors_written_4bit;
+   unsigned ps_colormask = si_get_total_colormask(sctx);
 
ps_disabled = sctx->queued.named.rasterizer->rasterizer_discard 
||
  (!ps_colormask &&
   !ps_modifies_zs &&
   !ps->info.writes_memory);
}
 
/* Find out which VS outputs aren't used by the PS. */
uint64_t outputs_written = vs->outputs_written;
uint64_t inputs_read = 0;
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] radeonsi/nir: fix explicit component packing for geom/tess doubles

2018-04-01 Thread Marek Olšák
Reviewed-by: Marek Olšák 

Marek


On Tue, Mar 27, 2018 at 10:22 PM, Timothy Arceri 
wrote:

> ---
>  src/gallium/drivers/radeonsi/si_shader.c | 19 +++
>  1 file changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_shader.c
> b/src/gallium/drivers/radeonsi/si_shader.c
> index 8ae742c93f6..d5607a99d32 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.c
> +++ b/src/gallium/drivers/radeonsi/si_shader.c
> @@ -1290,12 +1290,13 @@ static LLVMValueRef si_nir_load_tcs_varyings(struct
> ac_shader_abi *abi,
>   is_patch);
>
> LLVMValueRef value[4];
> -   for (unsigned i = 0; i < num_components + component; i++) {
> +   for (unsigned i = 0; i < num_components; i++) {
> unsigned offset = i;
> if (llvm_type_is_64bit(ctx, type))
> offset *= 2;
>
> -   value[i] = lds_load(bld_base, type, offset, dw_addr);
> +   offset += component;
> +   value[i + component] = lds_load(bld_base, type, offset,
> dw_addr);
> }
>
> return ac_build_varying_gather_values(>ac, value,
> num_components, component);
> @@ -1377,13 +1378,14 @@ LLVMValueRef si_nir_load_input_tes(struct
> ac_shader_abi *abi,
>  * between the NIR and TGSI backends.
>  */
> LLVMValueRef value[4];
> -   for (unsigned i = component; i < num_components + component; i++) {
> +   for (unsigned i = 0; i < num_components; i++) {
> unsigned offset = i;
> if (llvm_type_is_64bit(ctx, type))
> offset *= 2;
>
> -   value[i] = buffer_load(>bld_base, type, offset,
> -  ctx->tess_offchip_ring, base, addr,
> true);
> +   offset += component;
> +   value[i + component] = buffer_load(>bld_base, type,
> offset,
> +  ctx->tess_offchip_ring,
> base, addr, true);
> }
>
> return ac_build_varying_gather_values(>ac, value,
> num_components, component);
> @@ -1693,13 +1695,14 @@ static LLVMValueRef si_nir_load_input_gs(struct
> ac_shader_abi *abi,
> struct si_shader_context *ctx = si_shader_context_from_abi(abi);
>
> LLVMValueRef value[4];
> -   for (unsigned i = component; i < num_components + component; i++) {
> +   for (unsigned i = 0; i < num_components; i++) {
> unsigned offset = i;
> if (llvm_type_is_64bit(ctx, type))
> offset *= 2;
>
> -   value[i] = si_llvm_load_input_gs(>abi,
> driver_location  / 4,
> -vertex_index, type,
> offset);
> +   offset += component;
> +   value[i + component] = si_llvm_load_input_gs(>abi,
> driver_location  / 4,
> +vertex_index,
> type, offset);
> }
>
> return ac_build_varying_gather_values(>ac, value,
> num_components, component);
> --
> 2.14.3
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v4 1/4] mesa: add support for nvidia conservative rasterization extensions

2018-04-01 Thread Marek Olšák
On Wed, Mar 28, 2018 at 3:22 PM, Rhys Perry 
wrote:

> Although the specs are written against compatibility GL 4.3 and allows core
> profile and GLES2+, it is exposed for GL 1.0+ and GLES1 and GLES2+.
> ---
>  src/mapi/glapi/gen/gl_API.xml   |  47 
>  src/mapi/glapi/gen/gl_genexec.py|   1 +
>  src/mesa/Makefile.sources   |   2 +
>  src/mesa/main/attrib.c  |  60 ---
>  src/mesa/main/conservativeraster.c  | 128
> 
>  src/mesa/main/conservativeraster.h  |  48 
>  src/mesa/main/context.c |  10 +++
>  src/mesa/main/dlist.c   |  86 +
>  src/mesa/main/enable.c  |  14 
>  src/mesa/main/extensions_table.h|   4 +
>  src/mesa/main/get.c |   3 +
>  src/mesa/main/get_hash_params.py|  13 
>  src/mesa/main/mtypes.h  |  28 ++-
>  src/mesa/main/tests/dispatch_sanity.cpp |  27 +++
>  src/mesa/main/viewport.c|  57 ++
>  src/mesa/main/viewport.h|   6 ++
>  src/mesa/meson.build|   2 +
>  17 files changed, 525 insertions(+), 11 deletions(-)
>  create mode 100644 src/mesa/main/conservativeraster.c
>  create mode 100644 src/mesa/main/conservativeraster.h
>
> diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
> index 38c1921047..db312370b1 100644
> --- a/src/mapi/glapi/gen/gl_API.xml
> +++ b/src/mapi/glapi/gen/gl_API.xml
> @@ -12871,6 +12871,53 @@
>
>  
>
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
> + no_error="true">
> +
> +
> +
> +
> +
> +
> +  value="0x9379">
> +
> +
> +  value="0x937A">
> +
> +
> + value="0x937B">
> +
> +
> + no_error="true">
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +  value="0x954F"/>
> + no_error="true">
> +
> +
> +
> +
> +
>  http://www.w3.org/2001/XInclude"/>
>
>  
> diff --git a/src/mapi/glapi/gen/gl_genexec.py b/src/mapi/glapi/gen/gl_
> genexec.py
> index aaff9f230b..be8013b62b 100644
> --- a/src/mapi/glapi/gen/gl_genexec.py
> +++ b/src/mapi/glapi/gen/gl_genexec.py
> @@ -62,6 +62,7 @@ header = """/**
>  #include "main/colortab.h"
>  #include "main/compute.h"
>  #include "main/condrender.h"
> +#include "main/conservativeraster.h"
>  #include "main/context.h"
>  #include "main/convolve.h"
>  #include "main/copyimage.h"
> diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
> index 0446078136..43ec55f580 100644
> --- a/src/mesa/Makefile.sources
> +++ b/src/mesa/Makefile.sources
> @@ -49,6 +49,8 @@ MAIN_FILES = \
> main/condrender.c \
> main/condrender.h \
> main/config.h \
> +   main/conservativeraster.c \
> +   main/conservativeraster.h \
> main/context.c \
> main/context.h \
> main/convolve.c \
> diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
> index 9d3aa728a1..e785aa5549 100644
> --- a/src/mesa/main/attrib.c
> +++ b/src/mesa/main/attrib.c
> @@ -138,6 +138,9 @@ struct gl_enable_attrib
>
> /* GL_ARB_framebuffer_sRGB / GL_EXT_framebuffer_sRGB */
> GLboolean sRGBEnabled;
> +
> +   /* GL_NV_conservative_raster */
> +   GLboolean ConservativeRasterization;
>  };
>
>
> @@ -178,6 +181,13 @@ struct texture_state
>  };
>
>
> +struct viewport_state
> +{
> +   struct gl_viewport_attrib ViewportArray[MAX_VIEWPORTS];
> +   GLuint SubpixelPrecisionBias[2];
> +};
> +
> +
>  /** An unused GL_*_BIT value */
>  #define DUMMY_BIT 0x1000
>
> @@ -394,6 +404,9 @@ _mesa_PushAttrib(GLbitfield mask)
>
>/* GL_ARB_framebuffer_sRGB / GL_EXT_framebuffer_sRGB */
>attr->sRGBEnabled = ctx->Color.sRGBEnabled;
> +
> +  /* GL_NV_conservative_raster */
> +  attr->ConservativeRasterization = ctx->ConservativeRasterization;
> }
>
> if (mask & GL_EVAL_BIT) {
> @@ -545,11 +558,23 @@ _mesa_PushAttrib(GLbitfield mask)
> }
>
> if (mask & GL_VIEWPORT_BIT) {
> -  if (!push_attrib(ctx, , GL_VIEWPORT_BIT,
> -   sizeof(struct gl_viewport_attrib)
> -   * ctx->Const.MaxViewports,
> -   (void*)>ViewportArray))
> +  struct viewport_state *viewstate = CALLOC_STRUCT(viewport_state);
> +  if (!viewstate) {
> + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib(GL_VIEWPORT_BIT)
> ");
> + goto end;
> +  }
> +
> +  if (!save_attrib_data(, GL_VIEWPORT_BIT, viewstate)) {
> + free(viewstate);
> + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib(GL_VIEWPORT_BIT)
> ");
>   goto end;
> +  }
> +
> +  memcpy(>ViewportArray, >ViewportArray,
> + sizeof(struct gl_viewport_attrib)*ctx->Const.MaxViewports);
> +
> +  

Re: [Mesa-dev] [PATCH v4 3/4] st/mesa: add support for nvidia conservative rasterization extensions

2018-04-01 Thread Marek Olšák
Reviewed-by: Marek Olšák 

Marek



On Wed, Mar 28, 2018 at 3:22 PM, Rhys Perry 
wrote:

> Reviewed-by: Brian Paul 
>
> ---
>  src/mesa/state_tracker/st_atom_rasterizer.c | 15 +
>  src/mesa/state_tracker/st_context.c |  2 ++
>  src/mesa/state_tracker/st_extensions.c  | 34
> +
>  3 files changed, 51 insertions(+)
>
> diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c
> b/src/mesa/state_tracker/st_atom_rasterizer.c
> index 1be072e6e3..5b747a924e 100644
> --- a/src/mesa/state_tracker/st_atom_rasterizer.c
> +++ b/src/mesa/state_tracker/st_atom_rasterizer.c
> @@ -298,5 +298,20 @@ st_update_rasterizer(struct st_context *st)
> raster->clip_plane_enable = ctx->Transform.ClipPlanesEnabled;
> raster->clip_halfz = (ctx->Transform.ClipDepthMode == GL_ZERO_TO_ONE);
>
> +/* ST_NEW_RASTERIZER */
> +   if (ctx->ConservativeRasterization) {
> +  if (ctx->ConservativeRasterMode == GL_CONSERVATIVE_RASTER_MODE_
> POST_SNAP_NV)
> + raster->conservative_raster_mode =
> PIPE_CONSERVATIVE_RASTER_POST_SNAP;
> +  else
> + raster->conservative_raster_mode = PIPE_CONSERVATIVE_RASTER_PRE_
> SNAP;
> +   } else {
> +  raster->conservative_raster_mode = PIPE_CONSERVATIVE_RASTER_OFF;
> +   }
> +
> +   raster->conservative_raster_dilate = ctx->ConservativeRasterDilate;
> +
> +   raster->subpixel_precision_x = ctx->NvSubpixelPrecisionBias[0];
> +   raster->subpixel_precision_y = ctx->NvSubpixelPrecisionBias[1];
> +
> cso_set_rasterizer(st->cso_context, raster);
>  }
> diff --git a/src/mesa/state_tracker/st_context.c
> b/src/mesa/state_tracker/st_context.c
> index 90b7f9359a..0709681e16 100644
> --- a/src/mesa/state_tracker/st_context.c
> +++ b/src/mesa/state_tracker/st_context.c
> @@ -344,6 +344,8 @@ st_init_driver_flags(struct st_context *st)
> f->NewPolygonState = ST_NEW_RASTERIZER;
> f->NewPolygonStipple = ST_NEW_POLY_STIPPLE;
> f->NewViewport = ST_NEW_VIEWPORT;
> +   f->NewNvConservativeRasterization = ST_NEW_RASTERIZER;
> +   f->NewNvConservativeRasterizationParams = ST_NEW_RASTERIZER;
>  }
>
>
> diff --git a/src/mesa/state_tracker/st_extensions.c
> b/src/mesa/state_tracker/st_extensions.c
> index bea61f21cb..539ba7e245 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -494,6 +494,16 @@ void st_init_limits(struct pipe_screen *screen,
> c->UseSTD430AsDefaultPacking =
>screen->get_param(screen, PIPE_CAP_LOAD_CONSTBUF);
>
> +   c->MaxSubpixelPrecisionBiasBits =
> +  screen->get_param(screen, PIPE_CAP_MAX_CONSERVATIVE_
> RASTER_SUBPIXEL_PRECISION_BIAS);
> +
> +   c->ConservativeRasterDilateRange[0] =
> +  screen->get_paramf(screen, PIPE_CAPF_MIN_CONSERVATIVE_
> RASTER_DILATE);
> +   c->ConservativeRasterDilateRange[1] =
> +  screen->get_paramf(screen, PIPE_CAPF_MAX_CONSERVATIVE_
> RASTER_DILATE);
> +   c->ConservativeRasterDilateGranularity =
> +  screen->get_paramf(screen, PIPE_CAPF_CONSERVATIVE_RASTER_
> DILATE_GRANULARITY);
> +
> /* limit the max combined shader output resources to a driver limit */
> temp = screen->get_param(screen, PIPE_CAP_MAX_COMBINED_SHADER_
> OUTPUT_RESOURCES);
> if (temp > 0 && c->MaxCombinedShaderOutputResources > temp)
> @@ -1363,4 +1373,28 @@ void st_init_extensions(struct pipe_screen *screen,
>extensions->ARB_texture_cube_map_array &&
>extensions->ARB_texture_stencil8 &&
>extensions->ARB_texture_multisample;
> +
> +   if (screen->get_param(screen, 
> PIPE_CAP_CONSERVATIVE_RASTER_POST_SNAP_TRIANGLES)
> &&
> +   screen->get_param(screen, 
> PIPE_CAP_CONSERVATIVE_RASTER_POST_SNAP_POINTS_LINES)
> &&
> +   screen->get_param(screen, 
> PIPE_CAP_CONSERVATIVE_RASTER_POST_DEPTH_COVERAGE))
> {
> +  float max_dilate;
> +  bool pre_snap_triangles, pre_snap_points_lines;
> +
> +  max_dilate = screen->get_paramf(screen, PIPE_CAPF_MAX_CONSERVATIVE_
> RASTER_DILATE);
> +
> +  pre_snap_triangles =
> + screen->get_param(screen, PIPE_CAP_CONSERVATIVE_RASTER_
> PRE_SNAP_TRIANGLES);
> +  pre_snap_points_lines =
> + screen->get_param(screen, PIPE_CAP_CONSERVATIVE_RASTER_
> PRE_SNAP_POINTS_LINES);
> +
> +  extensions->NV_conservative_raster =
> + screen->get_param(screen, PIPE_CAP_MAX_CONSERVATIVE_
> RASTER_SUBPIXEL_PRECISION_BIAS) > 1;
> +
> +  if (extensions->NV_conservative_raster) {
> + extensions->NV_conservative_raster_dilate = max_dilate >= 0.75;
> + extensions->NV_conservative_raster_pre_snap_triangles =
> pre_snap_triangles;
> + extensions->NV_conservative_raster_pre_snap =
> +pre_snap_triangles && pre_snap_points_lines;
> +  }
> +   }
>  }
> --
> 2.14.3
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>

Re: [Mesa-dev] [PATCH v3 2/4] gallium: add initial support for conservative rasterization

2018-04-01 Thread Marek Olšák
Reviewed-by: Marek Olšák 

Marek

On Wed, Mar 28, 2018 at 6:35 AM, Rhys Perry 
wrote:

> ---
>  src/gallium/docs/source/cso/rasterizer.rst   | 23
> +++
>  src/gallium/docs/source/screen.rst   | 18 ++
>  src/gallium/drivers/etnaviv/etnaviv_screen.c | 10 ++
>  src/gallium/drivers/freedreno/freedreno_screen.c | 10 ++
>  src/gallium/drivers/i915/i915_screen.c   | 13 +
>  src/gallium/drivers/llvmpipe/lp_screen.c | 12 
>  src/gallium/drivers/nouveau/nv30/nv30_screen.c   | 10 ++
>  src/gallium/drivers/nouveau/nv50/nv50_screen.c   | 10 ++
>  src/gallium/drivers/nouveau/nvc0/nvc0_screen.c   | 10 ++
>  src/gallium/drivers/r300/r300_screen.c   | 10 ++
>  src/gallium/drivers/r600/r600_pipe.c |  6 ++
>  src/gallium/drivers/r600/r600_pipe_common.c  |  4 
>  src/gallium/drivers/radeonsi/si_get.c| 10 ++
>  src/gallium/drivers/softpipe/sp_screen.c | 12 
>  src/gallium/drivers/svga/svga_screen.c   | 13 +
>  src/gallium/drivers/swr/swr_screen.cpp   | 10 ++
>  src/gallium/drivers/vc4/vc4_screen.c | 13 -
>  src/gallium/drivers/vc5/vc5_screen.c | 13 -
>  src/gallium/drivers/virgl/virgl_screen.c | 10 ++
>  src/gallium/include/pipe/p_defines.h | 20
> 
>  src/gallium/include/pipe/p_state.h   |  8 
>  21 files changed, 243 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/docs/source/cso/rasterizer.rst
> b/src/gallium/docs/source/cso/rasterizer.rst
> index 616e4511a2..4dabcc032f 100644
> --- a/src/gallium/docs/source/cso/rasterizer.rst
> +++ b/src/gallium/docs/source/cso/rasterizer.rst
> @@ -340,3 +340,26 @@ clip_plane_enable
>  If any clip distance output is written, those half-spaces for which no
>  clip distance is written count as disabled; i.e. user clip planes and
>  shader clip distances cannot be mixed, and clip distances take
> precedence.
> +
> +conservative_raster_mode
> +The conservative rasterization mode.  For
> PIPE_CONSERVATIVE_RASTER_OFF,
> +conservative rasterization is disabled.  For
> IPE_CONSERVATIVE_RASTER_POST_SNAP
> +or PIPE_CONSERVATIVE_RASTER_PRE_SNAP, conservative rasterization is
> nabled.
> +When conservative rasterization is enabled, the polygon smooth, line
> mooth,
> +point smooth and line stipple settings are ignored.
> +With the post-snap mode, unlike the pre-snap mode, fragments are never
> +generated for degenerate primitives.  Degenerate primitives, when
> rasterized,
> +are considered back-facing and the vertex attributes and depth are
> that of
> +the provoking vertex.
> +If the post-snap mode is used with an unsupported primitive, the
> pre-snap
> +mode is used, if supported.  Behavior is similar for the pre-snap
> mode.
> +If the pre-snap mode is used, fragments are generated with respect to
> the primitive
> +before vertex snapping.
> +
> +conservative_raster_dilate
> +The amount of dilation during conservative rasterization.
> +
> +subpixel_precision_x
> +A bias added to the horizontal subpixel precision during conservative
> rasterization.
> +subpixel_precision_y
> +A bias added to the vertical subpixel precision during conservative
> rasterization.
> diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/
> screen.rst
> index 3837360fb4..5bc6ee99f0 100644
> --- a/src/gallium/docs/source/screen.rst
> +++ b/src/gallium/docs/source/screen.rst
> @@ -420,6 +420,18 @@ The integer capabilities:
>by the driver, and the driver can throw assertion failures.
>  * ``PIPE_CAP_PACKED_UNIFORMS``: True if the driver supports packed
> uniforms
>as opposed to padding to vec4s.
> +* ``PIPE_CAP_CONSERVATIVE_RASTER_POST_SNAP_TRIANGLES``: Whether the
> +  PIPE_CONSERVATIVE_RASTER_POST_SNAP mode is supported for triangles.
> +* ``PIPE_CAP_CONSERVATIVE_RASTER_POST_SNAP_POINTS_LINES``: Whether the
> +PIPE_CONSERVATIVE_RASTER_POST_SNAP mode is supported for points and
> lines.
> +* ``PIPE_CAP_CONSERVATIVE_RASTER_PRE_SNAP_TRIANGLES``: Whether the
> +PIPE_CONSERVATIVE_RASTER_PRE_SNAP mode is supported for triangles.
> +* ``PIPE_CAP_CONSERVATIVE_RASTER_PRE_SNAP_POINTS_LINES``: Whether the
> +PIPE_CONSERVATIVE_RASTER_PRE_SNAP mode is supported for points and lines.
> +* ``PIPE_CAP_CONSERVATIVE_RASTER_POST_DEPTH_COVERAGE``: Whether
> PIPE_CAP_POST_DEPTH_COVERAGE
> +works with conservative rasterization.
> +* ``PIPE_CAP_MAX_CONSERVATIVE_RASTER_SUBPIXEL_PRECISION_BIAS``: The
> maximum
> +subpixel precision bias in bits during conservative rasterization.
>
>
>  .. _pipe_capf:
> @@ -437,6 +449,12 @@ The floating-point capabilities are:
>applied to anisotropically filtered textures.
>  * 

Re: [Mesa-dev] [PATCH v2] radeonsi/nir: gather buffers declared more accurately and use const fast path

2018-04-01 Thread Marek Olšák
On Fri, Mar 30, 2018 at 4:18 AM, Timothy Arceri 
wrote:

> For now we skip SI && HAVE_LLVM < 0x0600 for simplicity. We also skip
> setting the more accurate masks for some builtin uniforms for now as
> it causes some piglit regressions.
> ---
>  src/gallium/drivers/radeonsi/si_shader.c |  7 +++
>  src/gallium/drivers/radeonsi/si_shader_nir.c | 90
> ++--
>  2 files changed, 91 insertions(+), 6 deletions(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_shader.c
> b/src/gallium/drivers/radeonsi/si_shader.c
> index 714415edba7..13b588eb68f 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.c
> +++ b/src/gallium/drivers/radeonsi/si_shader.c
> @@ -2374,8 +2374,15 @@ static LLVMValueRef load_const_buffer_desc(struct
> si_shader_context *ctx, int i)
>  static LLVMValueRef load_ubo(struct ac_shader_abi *abi, LLVMValueRef
> index)
>  {
> struct si_shader_context *ctx = si_shader_context_from_abi(abi);
> +   struct si_shader_selector *sel = ctx->shader->selector;
> +
> LLVMValueRef ptr = LLVMGetParam(ctx->main_fn,
> ctx->param_const_and_shader_buffers);
>
> +   if (sel->info.const_buffers_declared == 1 &&
> +   sel->info.shader_buffers_declared == 0) {
> +   return load_const_buffer_desc_fast_path(ctx);
> +   }
> +
> index = si_llvm_bound_index(ctx, index, ctx->num_const_buffers);
> index = LLVMBuildAdd(ctx->ac.builder, index,
>  LLVMConstInt(ctx->i32, SI_NUM_SHADER_BUFFERS,
> 0), "");
> diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c
> b/src/gallium/drivers/radeonsi/si_shader_nir.c
> index 437eefc54d0..e116c23815b 100644
> --- a/src/gallium/drivers/radeonsi/si_shader_nir.c
> +++ b/src/gallium/drivers/radeonsi/si_shader_nir.c
> @@ -600,23 +600,98 @@ void si_nir_scan_shader(const struct nir_shader *nir,
>
> info->num_outputs = num_outputs;
>
> +   struct set *ubo_set = _mesa_set_create(NULL, _mesa_hash_pointer,
> +  _mesa_key_pointer_equal);
> +
> +   unsigned ubo_idx = 1;
> nir_foreach_variable(variable, >uniforms) {
> const struct glsl_type *type = variable->type;
> enum glsl_base_type base_type =
> glsl_get_base_type(glsl_without_array(type));
> unsigned aoa_size = MAX2(1, glsl_get_aoa_size(type));
>
> +   /* Gather buffers declared bitmasks. Note: radeonsi doesn't
> +* really use the mask (other than ubo_idx == 1 for regular
> +* uniforms) its really only used for getting the buffer
> count
> +* so we don't need to worry about the ordering.
> +*/
> +   if (variable->interface_type != NULL) {
> +   if (variable->data.mode == nir_var_uniform) {
> +
> +   unsigned block_count;
> +   if (base_type != GLSL_TYPE_INTERFACE) {
> +   struct set_entry *entry =
> +   _mesa_set_search(ubo_set,
> variable->interface_type);
> +
> +   /* Check if we have already
> processed
> +* a member from this ubo.
> +*/
> +   if (entry)
> +   continue;
> +
> +   block_count = 1;
> +   } else {
> +   block_count = aoa_size;
> +   }
> +
> +   info->const_buffers_declared |=
> u_bit_consecutive(ubo_idx, block_count);
> +   ubo_idx += block_count;
> +
> +   _mesa_set_add(ubo_set,
> variable->interface_type);
> +   }
> +
> +   if (variable->data.mode == nir_var_shader_storage)
> {
> +   /* TODO: make this more accurate */
> +   info->shader_buffers_declared =
> +   u_bit_consecutive(0,
> SI_NUM_SHADER_BUFFERS);
> +   }
> +
> +   continue;
> +   }
> +
> /* We rely on the fact that nir_lower_samplers_as_deref has
>  * eliminated struct dereferences.
>  */
> -   if (base_type == GLSL_TYPE_SAMPLER)
> +   if (base_type == GLSL_TYPE_SAMPLER) {
> info->samplers_declared |=
> u_bit_consecutive(variable->data.binding,
> aoa_size);
> -   else if (base_type == GLSL_TYPE_IMAGE)
> +
> +   if (variable->data.bindless) {
> +   info->const_buffers_declared |= 1;

[Mesa-dev] [Bug 102204] GL_ARB_buffer_storage crippled extension on r600, radeonsi and amdgpu Mesa drivers

2018-04-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=102204

farmboy0+freedesk...@googlemail.com changed:

   What|Removed |Added

 CC||farmboy0+freedesktop@google
   ||mail.com

-- 
You are receiving this mail because:
You are the assignee for the bug.___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v2 4/4] swr: Fix include for createPromoteMemoryToRegisterPass

2018-04-01 Thread Mike Lothian
Include llvm/Transforms/Utils.h with the newest LLVM 7

v2: Include with " " rather than < >

Signed-of-by: Mike Lothian 
Tested-by: Vinson Lee 
---
 src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp 
b/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp
index 031bced8a0..512fe8fc1f 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp
@@ -67,6 +67,9 @@ using PassManager = llvm::legacy::PassManager;
 #include "llvm/Support/DynamicLibrary.h"
 #include "llvm/Transforms/IPO.h"
 #include "llvm/Transforms/Scalar.h"
+#if HAVE_LLVM >= 0x0700
+#include "llvm/Transforms/Utils.h"
+#endif
 #include "llvm/Support/Host.h"
 #include "llvm/Support/DynamicLibrary.h"
 
-- 
2.16.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 0/3] Fix include for LLVMAddPromoteMemoryToRegisterPass

2018-04-01 Thread Vinson Lee
On Sat, Mar 31, 2018 at 5:32 PM, Mike Lothian  wrote:
> Hi
>
> I've split this into three patches, one for each area affected
>
> I think I've got the right prefixes now
>
> I've also removed the fixes line and included the testing and reviewed
> by tags
>
> Hope that's OK and again if you're happy with this please can you commit
> as I don't have git rights
>
> Thanks
>
> Mike
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Tested-by: Vinson Lee 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 4/4] swr: Fix include for createPromoteMemoryToRegisterPass

2018-04-01 Thread Vinson Lee
On Sun, Apr 1, 2018 at 1:10 AM, Mike Lothian  wrote:
> Include llvm/Transforms/Utils.h with the newest LLVM 7
>
> Signed-of-by: Mike Lothian 
> ---
>  src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp 
> b/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp
> index 031bced8a0..d726d4844e 100644
> --- a/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp
> +++ b/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp
> @@ -67,6 +67,9 @@ using PassManager = llvm::legacy::PassManager;
>  #include "llvm/Support/DynamicLibrary.h"
>  #include "llvm/Transforms/IPO.h"
>  #include "llvm/Transforms/Scalar.h"
> +#if HAVE_LLVM >= 0x0700
> +#include 
> +#endif
>  #include "llvm/Support/Host.h"
>  #include "llvm/Support/DynamicLibrary.h"
>
> --
> 2.16.3
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


The added include uses <> delimiters whereas the other includes use ""
delimiters.

Tested-by: Vinson Lee 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 01/11] mesa: Compute effective buffer bindings in the vao.

2018-04-01 Thread Mathias . Froehlich
From: Mathias Fröhlich 

Compute VAO buffer binding information past the position/generic0 mapping.
Also scan for duplicate buffer bindings and collapse them into derived
effective buffer binding index and effective attribute mask variables.
Also provide a set of helper functions to access the distilled
information in the VAO. All of them prefixed with _mesa_draw_...
to indicate that they are meant to query draw information.

Signed-off-by: Mathias Fröhlich 
---
 src/mesa/main/arrayobj.c   | 292 -
 src/mesa/main/arrayobj.h   | 171 ++
 src/mesa/main/attrib.c |   1 +
 src/mesa/main/mtypes.h |  38 ++
 src/mesa/main/varray.c |   2 +
 src/mesa/vbo/vbo.h |   8 ++
 src/mesa/vbo/vbo_context.c |  17 +++
 7 files changed, 523 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index 0d2f7a918a..4ef4046c4b 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -452,8 +452,69 @@ _mesa_initialize_vao(struct gl_context *ctx,
 
 
 /**
- * Updates the derived gl_vertex_arrays when a gl_array_attributes
- * or a gl_vertex_buffer_binding has changed.
+ * Update the unique binding and pos/generic0 map tracking in the vao.
+ *
+ * The idea is to build up information in the vao so that a consuming
+ * backend can execute the following to set up buffer and vertex element
+ * information:
+ *
+ * const GLbitfield inputs_read = VERT_BIT_ALL; // backend vp inputs
+ *
+ * // Attribute data is in a VBO.
+ * GLbitfield vbomask = inputs_read & _mesa_draw_vbo_array_bits(ctx);
+ * while (vbomask) {
+ *// The attribute index to start pulling a binding
+ *const gl_vert_attrib i = ffs(vbomask) - 1;
+ *const struct gl_vertex_buffer_binding *const binding
+ *   = _mesa_draw_buffer_binding(vao, i);
+ *
+ *
+ *
+ *const GLbitfield boundmask = _mesa_draw_bound_attrib_bits(binding);
+ *GLbitfield attrmask = vbomask & boundmask;
+ *assert(attrmask);
+ *// Walk attributes belonging to the binding
+ *while (attrmask) {
+ *   const gl_vert_attrib attr = u_bit_scan();
+ *   const struct gl_array_attributes *const attrib
+ *  = _mesa_draw_array_attrib(vao, attr);
+ *
+ *   
+ *}
+ *vbomask &= ~boundmask;
+ * }
+ *
+ * // Process user space buffers
+ * GLbitfield usermask = inputs_read & _mesa_draw_user_array_bits(ctx);
+ * while (usermask) {
+ *// The attribute index to start pulling a binding
+ *const gl_vert_attrib i = ffs(usermask) - 1;
+ *const struct gl_vertex_buffer_binding *const binding
+ *   = _mesa_draw_buffer_binding(vao, i);
+ *
+ *const GLbitfield boundmask = _mesa_draw_bound_attrib_bits(binding);
+ *GLbitfield attrmask = usermask & boundmask;
+ *assert(attrmask);
+ *// Walk attributes with a common stride and instance divisor
+ *while (attrmask) {
+ *   const gl_vert_attrib attr = u_bit_scan();
+ *   const struct gl_array_attributes *const attrib
+ *  = _mesa_draw_array_attrib(vao, attr);
+ *
+ *   
+ *}
+ *usermask &= ~boundmask;
+ * }
+ *
+ * // Process values that should have better been uniforms in the application
+ * GLbitfield curmask = inputs_read & _mesa_draw_current_bits(ctx);
+ * while (curmask) {
+ *const gl_vert_attrib attr = u_bit_scan();
+ *const struct gl_array_attributes *const attrib
+ *   = _mesa_draw_current_attrib(ctx, attr);
+ *
+ *
+ * }
  */
 void
 _mesa_update_vao_derived_arrays(struct gl_context *ctx,
@@ -462,11 +523,230 @@ _mesa_update_vao_derived_arrays(struct gl_context *ctx,
/* Make sure we do not run into problems with shared objects */
assert(!vao->SharedAndImmutable || vao->NewArrays == 0);
 
-   /*
-* Stay tuned, the next series scans for duplicate bindings in this
-* function. So that drivers can easily know the minimum unique set
-* of bindings.
+   /* Limit used for common binding scanning below. */
+   const int MaxRelativeOffset =
+  (0 < ctx->Const.MaxVertexAttribRelativeOffset) ?
+  ctx->Const.MaxVertexAttribRelativeOffset : 2047;
+
+   /* The gl_vertex_array_object::_AttributeMapMode denotes the way
+* VERT_ATTRIB_{POS,GENERIC0} mapping is done.
+*
+* This mapping is used to map between the OpenGL api visible
+* VERT_ATTRIB_* arrays to mesa driver arrayinputs or shader inputs.
+* The mapping only depends on the enabled bits of the
+* VERT_ATTRIB_{POS,GENERIC0} arrays and is tracked in the VAO.
 */
+   const gl_attribute_map_mode map_mode = vao->_AttributeMapMode;
+   const unsigned char *const map =_mesa_vao_attribute_map[map_mode];
+   /* Enabled array bits past VERT_ATTRIB_{POS,GENERIC0} mapping. */
+   const GLbitfield enabled =
+  _mesa_vao_enable_to_vp_inputs(map_mode, vao->_Enabled);
+   /* VBO array bits past VERT_ATTRIB_{POS,GENERIC0} mapping. */
+   const GLbitfield vbos =
+  

[Mesa-dev] [PATCH 10/11] mesa: Remove Array._DrawArrays.

2018-04-01 Thread Mathias . Froehlich
From: Mathias Fröhlich 

Only tnl based drivers still use this array. So remove it
from core mesa and use Array._DrawVAO instead.

Signed-off-by: Mathias Fröhlich 
---
 src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c |  4 ++--
 src/mesa/main/arrayobj.c |  1 -
 src/mesa/main/attrib.c   |  1 -
 src/mesa/main/mtypes.h   |  6 --
 src/mesa/main/varray.h   | 14 --
 src/mesa/tnl/t_draw.c| 11 +--
 src/mesa/tnl/tnl.h   |  2 +-
 7 files changed, 8 insertions(+), 31 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c 
b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
index 79b444cf55..d031ebeabd 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
@@ -550,9 +550,9 @@ TAG(vbo_draw)(struct gl_context *ctx,
  struct gl_buffer_object *indirect)
 {
/* Borrow and update the inputs list from the tnl context */
-   _tnl_bind_inputs(ctx);
+   const struct gl_vertex_array* arrays = _tnl_bind_inputs(ctx);
 
-   TAG(vbo_check_render_prims)(ctx, ctx->Array._DrawArrays,
+   TAG(vbo_check_render_prims)(ctx, arrays,
prims, nr_prims, ib,
index_bounds_valid, min_index, max_index,
tfb_vertcount, stream, indirect);
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index 4ef4046c4b..0a66b6b719 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -873,7 +873,6 @@ bind_vertex_array(struct gl_context *ctx, GLuint id, bool 
no_error)
 * or to prevent a crash if the VAO being unbound is going to be
 * deleted.
 */
-   _mesa_set_drawing_arrays(ctx, NULL);
_mesa_set_draw_vao(ctx, ctx->Array._EmptyVAO, 0);
 
ctx->NewState |= _NEW_ARRAY;
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 3330e451ce..5fe214b472 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -1549,7 +1549,6 @@ copy_array_attrib(struct gl_context *ctx,
/* skip IndexBufferObj */
 
/* Invalidate array state. It will be updated during the next draw. */
-   _mesa_set_drawing_arrays(ctx, NULL);
_mesa_set_draw_vao(ctx, ctx->Array._EmptyVAO, 0);
 }
 
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index ac05a2aa4f..284c48dda5 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1741,12 +1741,6 @@ struct gl_array_attrib
 */
struct gl_vertex_array_object *_EmptyVAO;
 
-   /**
-* Vertex arrays as consumed by a driver.
-* The array pointer is set up only by the VBO module.
-*/
-   const struct gl_vertex_array *_DrawArrays; /**< 0..VERT_ATTRIB_MAX-1 */
-
/** Legal array datatypes and the API for which they have been computed */
GLbitfield LegalTypesMask;
gl_api LegalTypesMaskAPI;
diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h
index 77027be800..3888e5f469 100644
--- a/src/mesa/main/varray.h
+++ b/src/mesa/main/varray.h
@@ -55,20 +55,6 @@ _mesa_attr_zero_aliases_vertex(const struct gl_context *ctx)
 }
 
 
-/**
- * This specifies the set of vertex arrays used by the driver for drawing.
- */
-static inline void
-_mesa_set_drawing_arrays(struct gl_context *ctx,
- const struct gl_vertex_array *arrays)
-{
-   if (ctx->Array._DrawArrays != arrays) {
-  ctx->Array._DrawArrays = arrays;
-  ctx->NewDriverState |= ctx->DriverFlags.NewArray;
-   }
-}
-
-
 extern void
 _mesa_update_array_format(struct gl_context *ctx,
   struct gl_vertex_array_object *vao,
diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c
index a83b98eede..9814cdcec1 100644
--- a/src/mesa/tnl/t_draw.c
+++ b/src/mesa/tnl/t_draw.c
@@ -537,12 +537,12 @@ void _tnl_draw_prims(struct gl_context *ctx,
 }
 
 
-void
+const struct gl_vertex_array*
 _tnl_bind_inputs( struct gl_context *ctx )
 {
TNLcontext *tnl = TNL_CONTEXT(ctx);
-   _mesa_set_drawing_arrays(ctx, tnl->draw_arrays.inputs);
_vbo_update_inputs(ctx, >draw_arrays);
+   return tnl->draw_arrays.inputs;
 }
 
 
@@ -558,12 +558,11 @@ _tnl_draw(struct gl_context *ctx,
   struct gl_transform_feedback_object *tfb_vertcount,
   unsigned stream, struct gl_buffer_object *indirect)
 {
-   /* Update TNLcontext::draw_arrays and set that pointer
-* into Array._DrawArrays.
+   /* Update TNLcontext::draw_arrays and return that pointer.
 */
-   _tnl_bind_inputs(ctx);
+   const struct gl_vertex_array* arrays = _tnl_bind_inputs(ctx);
 
-   _tnl_draw_prims(ctx, ctx->Array._DrawArrays, prim, nr_prims, ib,
+   _tnl_draw_prims(ctx, arrays, prim, nr_prims, ib,
index_bounds_valid, min_index, max_index,
tfb_vertcount, stream, indirect);
 }
diff --git a/src/mesa/tnl/tnl.h b/src/mesa/tnl/tnl.h
index 

[Mesa-dev] [PATCH 05/11] gallium: Make feedback draw and rasterpos use _DrawVAO.

2018-04-01 Thread Mathias . Froehlich
From: Mathias Fröhlich 

Instead of playing with Array._DrawArrays, make the feedback draw
path use Array._DrawVAO. Also st_RasterPos needs to use the VAO then.

Signed-off-by: Mathias Fröhlich 
---
 src/mesa/state_tracker/st_cb_rasterpos.c  | 38 --
 src/mesa/state_tracker/st_draw_feedback.c | 39 +--
 2 files changed, 21 insertions(+), 56 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c 
b/src/mesa/state_tracker/st_cb_rasterpos.c
index 4e5417baad..67ec3a6756 100644
--- a/src/mesa/state_tracker/st_cb_rasterpos.c
+++ b/src/mesa/state_tracker/st_cb_rasterpos.c
@@ -38,8 +38,11 @@
 
 #include "main/imports.h"
 #include "main/macros.h"
+#include "main/arrayobj.h"
 #include "main/feedback.h"
 #include "main/rastpos.h"
+#include "main/state.h"
+#include "main/varray.h"
 
 #include "st_context.h"
 #include "st_atom.h"
@@ -60,9 +63,7 @@ struct rastpos_stage
struct gl_context *ctx;/**< Rendering context */
 
/* vertex attrib info we can setup once and re-use */
-   struct gl_vertex_buffer_binding binding;
-   struct gl_array_attributes attrib[VERT_ATTRIB_MAX];
-   struct gl_vertex_array array[VERT_ATTRIB_MAX];
+   struct gl_vertex_array_object *VAO;
struct _mesa_prim prim;
 };
 
@@ -102,6 +103,8 @@ rastpos_line( struct draw_stage *stage, struct prim_header 
*prim )
 static void
 rastpos_destroy(struct draw_stage *stage)
 {
+   struct rastpos_stage *rstage = (struct rastpos_stage*)stage;
+   _mesa_reference_vao(rstage->ctx, >VAO, NULL);
free(stage);
 }
 
@@ -181,7 +184,6 @@ static struct rastpos_stage *
 new_draw_rastpos_stage(struct gl_context *ctx, struct draw_context *draw)
 {
struct rastpos_stage *rs = ST_CALLOC_STRUCT(rastpos_stage);
-   GLuint i;
 
rs->stage.draw = draw;
rs->stage.next = NULL;
@@ -194,17 +196,11 @@ new_draw_rastpos_stage(struct gl_context *ctx, struct 
draw_context *draw)
rs->stage.destroy = rastpos_destroy;
rs->ctx = ctx;
 
-   rs->binding.Stride = 0;
-   rs->binding.BufferObj = NULL;
-   for (i = 0; i < ARRAY_SIZE(rs->array); i++) {
-  rs->attrib[i].Size = 4;
-  rs->attrib[i].Type = GL_FLOAT;
-  rs->attrib[i].Format = GL_RGBA;
-  rs->attrib[i].Ptr = (GLubyte *) ctx->Current.Attrib[i];
-  rs->attrib[i].Normalized = GL_TRUE;
-  rs->array[i].BufferBinding = >binding;
-  rs->array[i].VertexAttrib = >attrib[i];
-   }
+   rs->VAO = _mesa_new_vao(ctx, ~((GLuint)0));
+   _mesa_vertex_attrib_binding(ctx, rs->VAO, VERT_ATTRIB_POS, 0, false);
+   _mesa_update_array_format(ctx, rs->VAO, VERT_ATTRIB_POS, 4, GL_FLOAT,
+ GL_RGBA, GL_FALSE, GL_FALSE, GL_FALSE, 0);
+   _mesa_enable_vertex_array_attrib(ctx, rs->VAO, 0, false);
 
rs->prim.mode = GL_POINTS;
rs->prim.indexed = 0;
@@ -224,7 +220,6 @@ st_RasterPos(struct gl_context *ctx, const GLfloat v[4])
struct st_context *st = st_context(ctx);
struct draw_context *draw = st_get_draw_context(st);
struct rastpos_stage *rs;
-   const struct gl_vertex_array *saved_arrays = ctx->Array._DrawArrays;
 
if (!st->draw)
   return;
@@ -260,16 +255,13 @@ st_RasterPos(struct gl_context *ctx, const GLfloat v[4])
/* All vertex attribs but position were previously initialized above.
 * Just plug in position pointer now.
 */
-   rs->attrib[0].Ptr = (GLubyte *) v;
+   rs->VAO->VertexAttrib[VERT_ATTRIB_POS].Ptr = (GLubyte *) v;
+   /* FIXME this DOES set DriverFlags.NewArray */
+   _mesa_set_draw_vao(ctx, rs->VAO, VERT_BIT_POS);
 
-   /* Draw the point.
-*
-* Don't set DriverFlags.NewArray.
-* st_feedback_draw_vbo doesn't check for that flag. */
-   ctx->Array._DrawArrays = rs->array;
+   /* Draw the point. */
st_feedback_draw_vbo(ctx, >prim, 1, NULL, GL_TRUE, 0, 1,
 NULL, 0, NULL);
-   ctx->Array._DrawArrays = saved_arrays;
 
/* restore draw's rasterization stage depending on rendermode */
if (ctx->RenderMode == GL_FEEDBACK) {
diff --git a/src/mesa/state_tracker/st_draw_feedback.c 
b/src/mesa/state_tracker/st_draw_feedback.c
index fa96b4e2e2..1e3f52c12e 100644
--- a/src/mesa/state_tracker/st_draw_feedback.c
+++ b/src/mesa/state_tracker/st_draw_feedback.c
@@ -26,6 +26,7 @@
  **/
 
 #include "main/imports.h"
+#include "main/arrayobj.h"
 #include "main/image.h"
 #include "main/macros.h"
 #include "main/varray.h"
@@ -131,9 +132,7 @@ st_feedback_draw_vbo(struct gl_context *ctx,
struct pipe_vertex_element velements[PIPE_MAX_ATTRIBS];
struct pipe_transfer *vb_transfer[PIPE_MAX_ATTRIBS] = {NULL};
struct pipe_transfer *ib_transfer = NULL;
-   const struct gl_vertex_array *arrays = ctx->Array._DrawArrays;
GLuint attr, i;
-   const GLubyte *low_addr = NULL;
const void *mapped_indices = NULL;
 
if (!draw)
@@ -168,56 +167,30 @@ st_feedback_draw_vbo(struct gl_context *ctx,

[Mesa-dev] [PATCH 11/11] mesa/vbo/tnl: Move gl_vertex_array related stuff to tnl.

2018-04-01 Thread Mathias . Froehlich
From: Mathias Fröhlich 

The only remaining users of gl_vertex_array are tnl based
drivers. So move everything related to that into tnl and
rename it accordingly.

Signed-off-by: Mathias Fröhlich 
---
 src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c | 38 +--
 src/mesa/main/mtypes.h   | 14 
 src/mesa/main/varray.h   | 12 
 src/mesa/state_tracker/st_draw.h |  1 -
 src/mesa/state_tracker/st_draw_feedback.c|  2 +-
 src/mesa/tnl/t_context.c |  4 +-
 src/mesa/tnl/t_context.h | 41 +++-
 src/mesa/tnl/t_draw.c| 95 ++--
 src/mesa/tnl/t_rebase.c  |  4 +-
 src/mesa/tnl/t_rebase.h  |  2 +-
 src/mesa/tnl/t_split.c   |  2 +-
 src/mesa/tnl/t_split.h   |  4 +-
 src/mesa/tnl/t_split_copy.c  | 34 ++
 src/mesa/tnl/t_split_inplace.c   |  4 +-
 src/mesa/tnl/tnl.h   | 24 +--
 src/mesa/vbo/vbo.h   | 37 ---
 src/mesa/vbo/vbo_exec.c  | 86 -
 17 files changed, 200 insertions(+), 204 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c 
b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
index d031ebeabd..3900c770cb 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
@@ -41,7 +41,7 @@
  * structures. */
 
 static int
-get_array_stride(struct gl_context *ctx, const struct gl_vertex_array *a)
+get_array_stride(struct gl_context *ctx, const struct tnl_vertex_array *a)
 {
struct nouveau_render_state *render = to_render_state(ctx);
const struct gl_vertex_buffer_binding *binding = a->BufferBinding;
@@ -57,7 +57,7 @@ get_array_stride(struct gl_context *ctx, const struct 
gl_vertex_array *a)
 
 static void
 vbo_init_arrays(struct gl_context *ctx, const struct _mesa_index_buffer *ib,
-   const struct gl_vertex_array *arrays)
+   const struct tnl_vertex_array *arrays)
 {
struct nouveau_render_state *render = to_render_state(ctx);
GLboolean imm = (render->mode == IMM);
@@ -78,7 +78,7 @@ vbo_init_arrays(struct gl_context *ctx, const struct 
_mesa_index_buffer *ib,
}
 
FOR_EACH_BOUND_ATTR(render, i, attr) {
-   const struct gl_vertex_array *array = [attr];
+   const struct tnl_vertex_array *array = [attr];
const struct gl_vertex_buffer_binding *binding =
array->BufferBinding;
const struct gl_array_attributes *attrib = array->VertexAttrib;
@@ -94,7 +94,7 @@ vbo_init_arrays(struct gl_context *ctx, const struct 
_mesa_index_buffer *ib,
 
 static void
 vbo_deinit_arrays(struct gl_context *ctx, const struct _mesa_index_buffer *ib,
- const struct gl_vertex_array *arrays)
+ const struct tnl_vertex_array *arrays)
 {
struct nouveau_render_state *render = to_render_state(ctx);
int i, attr;
@@ -118,7 +118,7 @@ vbo_deinit_arrays(struct gl_context *ctx, const struct 
_mesa_index_buffer *ib,
 /* Make some rendering decisions from the GL context. */
 
 static void
-vbo_choose_render_mode(struct gl_context *ctx, const struct gl_vertex_array 
*arrays)
+vbo_choose_render_mode(struct gl_context *ctx, const struct tnl_vertex_array 
*arrays)
 {
struct nouveau_render_state *render = to_render_state(ctx);
int i;
@@ -136,12 +136,12 @@ vbo_choose_render_mode(struct gl_context *ctx, const 
struct gl_vertex_array *arr
 }
 
 static void
-vbo_emit_attr(struct gl_context *ctx, const struct gl_vertex_array *arrays,
+vbo_emit_attr(struct gl_context *ctx, const struct tnl_vertex_array *arrays,
  int attr)
 {
struct nouveau_pushbuf *push = context_push(ctx);
struct nouveau_render_state *render = to_render_state(ctx);
-   const struct gl_vertex_array *array = [attr];
+   const struct tnl_vertex_array *array = [attr];
const struct gl_vertex_buffer_binding *binding = array->BufferBinding;
const struct gl_array_attributes *attrib = array->VertexAttrib;
const GLubyte *p = _mesa_vertex_attrib_address(attrib, binding);
@@ -179,7 +179,7 @@ vbo_emit_attr(struct gl_context *ctx, const struct 
gl_vertex_array *arrays,
 #define MAT(a) VERT_ATTRIB_MAT(MAT_ATTRIB_##a)
 
 static void
-vbo_choose_attrs(struct gl_context *ctx, const struct gl_vertex_array *arrays)
+vbo_choose_attrs(struct gl_context *ctx, const struct tnl_vertex_array *arrays)
 {
struct nouveau_render_state *render = to_render_state(ctx);
int i;
@@ -222,13 +222,13 @@ vbo_choose_attrs(struct gl_context *ctx, const struct 
gl_vertex_array *arrays)
 }
 
 static int
-get_max_client_stride(struct gl_context *ctx, const struct gl_vertex_array 

[Mesa-dev] [PATCH 02/11] gallium: Use _DrawVAO for edgeflag enabled check.

2018-04-01 Thread Mathias . Froehlich
From: Mathias Fröhlich 

Signed-off-by: Mathias Fröhlich 
---
 src/mesa/state_tracker/st_atom.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c
index 45a45960a3..df1a94e831 100644
--- a/src/mesa/state_tracker/st_atom.c
+++ b/src/mesa/state_tracker/st_atom.c
@@ -27,6 +27,7 @@
 
 
 #include 
+#include "main/arrayobj.h"
 #include "main/glheader.h"
 #include "main/context.h"
 
@@ -138,19 +139,15 @@ static void check_program_state( struct st_context *st )
 
 static void check_attrib_edgeflag(struct st_context *st)
 {
-   const struct gl_vertex_array *arrays = st->ctx->Array._DrawArrays;
-   const struct gl_vertex_buffer_binding *binding;
GLboolean vertdata_edgeflags, edgeflag_culls_prims, edgeflags_enabled;
struct gl_program *vp = st->ctx->VertexProgram._Current;
 
-   if (!arrays)
-  return;
-
edgeflags_enabled = st->ctx->Polygon.FrontMode != GL_FILL ||
st->ctx->Polygon.BackMode != GL_FILL;
 
-   binding = arrays[VERT_ATTRIB_EDGEFLAG].BufferBinding;
-   vertdata_edgeflags = edgeflags_enabled && binding->Stride != 0;
+   vertdata_edgeflags = edgeflags_enabled &&
+  _mesa_draw_edge_flag_array_enabled(st->ctx);
+
if (vertdata_edgeflags != st->vertdata_edgeflags) {
   st->vertdata_edgeflags = vertdata_edgeflags;
   if (vp)
-- 
2.14.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 07/11] i965: Implement all_varyings_in_vbos in terms of Array._DrawVAO.

2018-04-01 Thread Mathias . Froehlich
From: Mathias Fröhlich 

Signed-off-by: Mathias Fröhlich 
---
 src/mesa/drivers/dri/i965/brw_draw.c | 17 ++---
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_draw.c 
b/src/mesa/drivers/dri/i965/brw_draw.c
index 4caaadd560..8ee2535971 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -25,6 +25,7 @@
 
 #include 
 
+#include "main/arrayobj.h"
 #include "main/blend.h"
 #include "main/context.h"
 #include "main/condrender.h"
@@ -913,20 +914,6 @@ retry:
 }
 
 
-static bool
-all_varyings_in_vbos(const struct gl_vertex_array *arrays)
-{
-   GLuint i;
-
-   for (i = 0; i < VERT_ATTRIB_MAX; i++)
-  if (arrays[i].BufferBinding->Stride &&
-  arrays[i].BufferBinding->BufferObj->Name == 0)
- return false;
-
-   return true;
-}
-
-
 
 void
 brw_draw_prims(struct gl_context *ctx,
@@ -978,7 +965,7 @@ brw_draw_prims(struct gl_context *ctx,
 * get the minimum and maximum of their index buffer so we know what range
 * to upload.
 */
-   if (!index_bounds_valid && !all_varyings_in_vbos(arrays)) {
+   if (!index_bounds_valid && _mesa_draw_user_array_bits(ctx) != 0) {
   perf_debug("Scanning index buffer to compute index buffer bounds.  "
  "Use glDrawRangeElements() to avoid this.\n");
   vbo_get_minmax_indices(ctx, prims, ib, _index, _index, nr_prims);
-- 
2.14.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 09/11] i965: Remove the now unused gl_vertex_array.

2018-04-01 Thread Mathias . Froehlich
From: Mathias Fröhlich 

Was meant to be temporary in i965.

Signed-off-by: Mathias Fröhlich 
---
 src/mesa/drivers/dri/i965/brw_context.h | 4 
 src/mesa/drivers/dri/i965/brw_draw.c| 7 ---
 2 files changed, 11 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
b/src/mesa/drivers/dri/i965/brw_context.h
index b82fbfa57b..6551ec6ec0 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -36,7 +36,6 @@
 #include 
 #include "main/macros.h"
 #include "main/mtypes.h"
-#include "vbo/vbo.h"
 #include "brw_structs.h"
 #include "brw_pipe_control.h"
 #include "compiler/brw_compiler.h"
@@ -956,9 +955,6 @@ struct brw_context
* These bitfields indicate which workarounds are needed.
*/
   uint8_t attrib_wa_flags[VERT_ATTRIB_MAX];
-
-  /* For the initial pushdown, keep the list of vbo inputs. */
-  struct vbo_inputs draw_arrays;
} vb;
 
struct {
diff --git a/src/mesa/drivers/dri/i965/brw_draw.c 
b/src/mesa/drivers/dri/i965/brw_draw.c
index 1a595d88cc..59f3f0c57e 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -932,10 +932,6 @@ brw_draw_prims(struct gl_context *ctx,
struct brw_transform_feedback_object *xfb_obj =
   (struct brw_transform_feedback_object *) gl_xfb_obj;
 
-   /* The initial pushdown of the inputs array into the drivers */
-   _mesa_set_drawing_arrays(ctx, brw->vb.draw_arrays.inputs);
-   _vbo_update_inputs(ctx, >vb.draw_arrays);
-
if (!brw_check_conditional_render(brw))
   return;
 
@@ -1074,9 +1070,6 @@ brw_init_draw_functions(struct dd_function_table 
*functions)
 void
 brw_draw_init(struct brw_context *brw)
 {
-   /* Keep our list of gl_vertex_array inputs */
-   _vbo_init_inputs(>vb.draw_arrays);
-
for (int i = 0; i < VERT_ATTRIB_MAX; i++)
   brw->vb.inputs[i].buffer = -1;
brw->vb.nr_buffers = 0;
-- 
2.14.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 03/11] gallium: Make the input_to_index array available.

2018-04-01 Thread Mathias . Froehlich
From: Mathias Fröhlich 

The input_to_index array is already available internally
when preparing vertex programs. Store the map in
struct st_vertex_program.
Also store the bitmask of mesa vertex processing inputs in
struct st_vp_variant.

Signed-off-by: Mathias Fröhlich 
---
 src/mesa/state_tracker/st_program.c  | 17 -
 src/mesa/state_tracker/st_program.h  |  5 +
 src/mesa/state_tracker/st_shader_cache.c |  4 
 3 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/src/mesa/state_tracker/st_program.c 
b/src/mesa/state_tracker/st_program.c
index 5bf76e1b88..b76457f578 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -387,11 +387,11 @@ st_translate_vertex_program(struct st_context *st,
enum pipe_error error;
unsigned num_outputs = 0;
unsigned attr;
-   ubyte input_to_index[VERT_ATTRIB_MAX] = {0};
ubyte output_semantic_name[VARYING_SLOT_MAX] = {0};
ubyte output_semantic_index[VARYING_SLOT_MAX] = {0};
 
stvp->num_inputs = 0;
+   memset(stvp->input_to_index, ~0, sizeof(stvp->input_to_index));
 
if (stvp->Base.arb.IsPositionInvariant)
   _mesa_insert_mvp_code(st->ctx, >Base);
@@ -402,7 +402,7 @@ st_translate_vertex_program(struct st_context *st,
 */
for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
   if ((stvp->Base.info.inputs_read & BITFIELD64_BIT(attr)) != 0) {
- input_to_index[attr] = stvp->num_inputs;
+ stvp->input_to_index[attr] = stvp->num_inputs;
  stvp->index_to_input[stvp->num_inputs] = attr;
  stvp->num_inputs++;
  if ((stvp->Base.info.vs.double_inputs_read &
@@ -414,7 +414,7 @@ st_translate_vertex_program(struct st_context *st,
   }
}
/* bit of a hack, presetup potentially unused edgeflag input */
-   input_to_index[VERT_ATTRIB_EDGEFLAG] = stvp->num_inputs;
+   stvp->input_to_index[VERT_ATTRIB_EDGEFLAG] = stvp->num_inputs;
stvp->index_to_input[stvp->num_inputs] = VERT_ATTRIB_EDGEFLAG;
 
/* Compute mapping of vertex program outputs to slots.
@@ -494,7 +494,7 @@ st_translate_vertex_program(struct st_context *st,
>Base,
/* inputs */
stvp->num_inputs,
-   input_to_index,
+   stvp->input_to_index,
NULL, /* inputSlotToAttr */
NULL, /* input semantic name */
NULL, /* input semantic index */
@@ -517,7 +517,7 @@ st_translate_vertex_program(struct st_context *st,
 >Base,
 /* inputs */
 stvp->num_inputs,
-input_to_index,
+stvp->input_to_index,
 NULL, /* input semantic name */
 NULL, /* input semantic index */
 NULL,
@@ -597,6 +597,13 @@ st_create_vp_variant(struct st_context *st,
  fprintf(stderr, "mesa: cannot emulate deprecated features\n");
}
 
+   for (unsigned index = 0; index < vpv->num_inputs; ++index) {
+  unsigned attr = stvp->index_to_input[index];
+  if (attr == ST_DOUBLE_ATTRIB_PLACEHOLDER)
+ continue;
+  vpv->vert_attrib_mask |= 1u << attr;
+   }
+
if (ST_DEBUG & DEBUG_TGSI) {
   tgsi_dump(vpv->tgsi.tokens, 0);
   debug_printf("\n");
diff --git a/src/mesa/state_tracker/st_program.h 
b/src/mesa/state_tracker/st_program.h
index a520ffbecb..f67ea5eb20 100644
--- a/src/mesa/state_tracker/st_program.h
+++ b/src/mesa/state_tracker/st_program.h
@@ -196,6 +196,9 @@ struct st_vp_variant
 
/** similar to that in st_vertex_program, but with edgeflags info too */
GLuint num_inputs;
+
+   /** Bitfield of VERT_BIT_* bits of mesa vertex processing inputs */
+   GLbitfield vert_attrib_mask;
 };
 
 
@@ -215,6 +218,8 @@ struct st_vertex_program
/** maps a TGSI input index back to a Mesa VERT_ATTRIB_x */
ubyte index_to_input[PIPE_MAX_ATTRIBS];
ubyte num_inputs;
+   /** Reverse mapping of the above */
+   ubyte input_to_index[VERT_ATTRIB_MAX];
 
/** Maps VARYING_SLOT_x to slot */
ubyte result_to_output[VARYING_SLOT_MAX];
diff --git a/src/mesa/state_tracker/st_shader_cache.c 
b/src/mesa/state_tracker/st_shader_cache.c
index 3ca3fef1df..17f84180ca 100644
--- a/src/mesa/state_tracker/st_shader_cache.c
+++ b/src/mesa/state_tracker/st_shader_cache.c
@@ -84,6 +84,8 @@ st_serialise_ir_program(struct gl_context *ctx, struct 
gl_program *prog,
   blob_write_uint32(, stvp->num_inputs);
   blob_write_bytes(, stvp->index_to_input,
sizeof(stvp->index_to_input));
+  blob_write_bytes(, 

[Mesa-dev] [PATCH 08/11] i965: Remove the gl_vertex_array indirection.

2018-04-01 Thread Mathias . Froehlich
From: Mathias Fröhlich 

For now store binding and attrib in brw_vertex_element.
The i965 driver still provides lots of opportunity to make use
of the unique binding information in the VAO which is currently not
taken from the VAO.

Signed-off-by: Mathias Fröhlich 
---
 src/mesa/drivers/dri/i965/brw_context.h   |  3 ++-
 src/mesa/drivers/dri/i965/brw_draw.c  | 25 
 src/mesa/drivers/dri/i965/brw_draw_upload.c   | 33 +--
 src/mesa/drivers/dri/i965/genX_state_upload.c | 12 --
 4 files changed, 32 insertions(+), 41 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
b/src/mesa/drivers/dri/i965/brw_context.h
index f049d08649..b82fbfa57b 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -438,7 +438,8 @@ struct brw_vertex_buffer {
GLuint step_rate;
 };
 struct brw_vertex_element {
-   const struct gl_vertex_array *glarray;
+   const struct gl_array_attributes *glattrib;
+   const struct gl_vertex_buffer_binding *glbinding;
 
int buffer;
bool is_dual_slot;
diff --git a/src/mesa/drivers/dri/i965/brw_draw.c 
b/src/mesa/drivers/dri/i965/brw_draw.c
index 8ee2535971..1a595d88cc 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -278,8 +278,7 @@ brw_emit_prim(struct brw_context *brw,
 
 
 static void
-brw_merge_inputs(struct brw_context *brw,
- const struct gl_vertex_array *arrays)
+brw_merge_inputs(struct brw_context *brw)
 {
const struct gen_device_info *devinfo = >screen->devinfo;
const struct gl_context *ctx = >ctx;
@@ -292,8 +291,10 @@ brw_merge_inputs(struct brw_context *brw,
brw->vb.nr_buffers = 0;
 
for (i = 0; i < VERT_ATTRIB_MAX; i++) {
-  brw->vb.inputs[i].buffer = -1;
-  brw->vb.inputs[i].glarray = [i];
+  struct brw_vertex_element *input = >vb.inputs[i];
+  input->buffer = -1;
+  _mesa_draw_attrib_and_binding(ctx, i,
+>glattrib, >glbinding);
}
 
if (devinfo->gen < 8 && !devinfo->is_haswell) {
@@ -306,7 +307,7 @@ brw_merge_inputs(struct brw_context *brw,
  uint8_t wa_flags = 0;
 
  i = u_bit_scan64();
- glattrib = brw->vb.inputs[i].glarray->VertexAttrib;
+ glattrib = brw->vb.inputs[i].glattrib;
 
  switch (glattrib->Type) {
 
@@ -693,7 +694,6 @@ brw_postdraw_reconcile_align_wa_slices(struct brw_context 
*brw)
 
 static void
 brw_prepare_drawing(struct gl_context *ctx,
-const struct gl_vertex_array *arrays,
 const struct _mesa_index_buffer *ib,
 bool index_bounds_valid,
 GLuint min_index,
@@ -746,7 +746,7 @@ brw_prepare_drawing(struct gl_context *ctx,
 
/* Bind all inputs, derive varying and size information:
 */
-   brw_merge_inputs(brw, arrays);
+   brw_merge_inputs(brw);
 
brw->ib.ib = ib;
brw->ctx.NewDriverState |= BRW_NEW_INDICES;
@@ -780,7 +780,6 @@ brw_finish_drawing(struct gl_context *ctx)
  */
 static void
 brw_draw_single_prim(struct gl_context *ctx,
- const struct gl_vertex_array *arrays,
  const struct _mesa_prim *prim,
  unsigned prim_id,
  struct brw_transform_feedback_object *xfb_obj,
@@ -811,7 +810,7 @@ brw_draw_single_prim(struct gl_context *ctx,
   brw->baseinstance = prim->base_instance;
   if (prim_id > 0) { /* For i == 0 we just did this before the loop */
  brw->ctx.NewDriverState |= BRW_NEW_VERTICES;
- brw_merge_inputs(brw, arrays);
+ brw_merge_inputs(brw);
   }
}
 
@@ -929,14 +928,12 @@ brw_draw_prims(struct gl_context *ctx,
 {
unsigned i;
struct brw_context *brw = brw_context(ctx);
-   const struct gl_vertex_array *arrays;
int predicate_state = brw->predicate.state;
struct brw_transform_feedback_object *xfb_obj =
   (struct brw_transform_feedback_object *) gl_xfb_obj;
 
/* The initial pushdown of the inputs array into the drivers */
_mesa_set_drawing_arrays(ctx, brw->vb.draw_arrays.inputs);
-   arrays = ctx->Array._DrawArrays;
_vbo_update_inputs(ctx, >vb.draw_arrays);
 
if (!brw_check_conditional_render(brw))
@@ -972,8 +969,7 @@ brw_draw_prims(struct gl_context *ctx,
   index_bounds_valid = true;
}
 
-   brw_prepare_drawing(ctx, arrays, ib, index_bounds_valid, min_index,
-   max_index);
+   brw_prepare_drawing(ctx, ib, index_bounds_valid, min_index, max_index);
/* Try drawing with the hardware, but don't do anything else if we can't
 * manage it.  swrast doesn't support our featureset, so we can't fall back
 * to it.
@@ -1010,8 +1006,7 @@ brw_draw_prims(struct gl_context *ctx,
  brw->predicate.state = BRW_PREDICATE_STATE_USE_BIT;
   }
 
-  brw_draw_single_prim(ctx, arrays, [i], i, xfb_obj, stream,
-  

[Mesa-dev] [PATCH 06/11] gallium: Remove the now unused gl_vertex_array.

2018-04-01 Thread Mathias . Froehlich
From: Mathias Fröhlich 

Was meant to be temporary in gallium.

Signed-off-by: Mathias Fröhlich 
---
 src/mesa/state_tracker/st_cb_feedback.c | 32 ++--
 src/mesa/state_tracker/st_context.c |  3 ---
 src/mesa/state_tracker/st_context.h |  3 ---
 src/mesa/state_tracker/st_draw.c|  8 
 4 files changed, 2 insertions(+), 44 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_feedback.c 
b/src/mesa/state_tracker/st_cb_feedback.c
index b7a082fca3..6e48be6f5d 100644
--- a/src/mesa/state_tracker/st_cb_feedback.c
+++ b/src/mesa/state_tracker/st_cb_feedback.c
@@ -272,34 +272,6 @@ draw_glselect_stage(struct gl_context *ctx, struct 
draw_context *draw)
 }
 
 
-static void
-feedback_draw_vbo(struct gl_context *ctx,
-  const struct _mesa_prim *prims,
-  GLuint nr_prims,
-  const struct _mesa_index_buffer *ib,
-  GLboolean index_bounds_valid,
-  GLuint min_index,
-  GLuint max_index,
-  struct gl_transform_feedback_object *tfb_vertcount,
-  unsigned stream,
-  struct gl_buffer_object *indirect)
-{
-   struct st_context *st = st_context(ctx);
-
-   /* The initial pushdown of the inputs array into the drivers */
-   _mesa_set_drawing_arrays(ctx, st->draw_arrays.inputs);
-   _vbo_update_inputs(ctx, >draw_arrays);
-
-   /* The above needs to happen outside of st_feedback_draw_vbo,
-* since st_RasterPossets _DrawArrays and does not want that to be
-* overwritten by _mesa_set_drawing_arrays.
-*/
-   st_feedback_draw_vbo(ctx, prims, nr_prims, ib, index_bounds_valid,
-min_index, max_index, tfb_vertcount,
-stream, indirect);
-}
-
-
 static void
 st_RenderMode(struct gl_context *ctx, GLenum newMode )
 {
@@ -318,7 +290,7 @@ st_RenderMode(struct gl_context *ctx, GLenum newMode )
  st->selection_stage = draw_glselect_stage(ctx, draw);
   draw_set_rasterize_stage(draw, st->selection_stage);
   /* Plug in new vbo draw function */
-  ctx->Driver.Draw = feedback_draw_vbo;
+  ctx->Driver.Draw = st_feedback_draw_vbo;
}
else {
   struct gl_program *vp = st->ctx->VertexProgram._Current;
@@ -327,7 +299,7 @@ st_RenderMode(struct gl_context *ctx, GLenum newMode )
  st->feedback_stage = draw_glfeedback_stage(ctx, draw);
   draw_set_rasterize_stage(draw, st->feedback_stage);
   /* Plug in new vbo draw function */
-  ctx->Driver.Draw = feedback_draw_vbo;
+  ctx->Driver.Draw = st_feedback_draw_vbo;
   /* need to generate/use a vertex program that emits pos/color/tex */
   if (vp)
  st->dirty |= ST_NEW_VERTEX_PROGRAM(st, st_vertex_program(vp));
diff --git a/src/mesa/state_tracker/st_context.c 
b/src/mesa/state_tracker/st_context.c
index a3da0f8f1f..454aba87da 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -550,9 +550,6 @@ st_create_context_priv(struct gl_context *ctx, struct 
pipe_context *pipe,
/* Initialize context's winsys buffers list */
LIST_INITHEAD(>winsys_buffers);
 
-   /* Keep our list of gl_vertex_array inputs */
-   _vbo_init_inputs(>draw_arrays);
-
return st;
 }
 
diff --git a/src/mesa/state_tracker/st_context.h 
b/src/mesa/state_tracker/st_context.h
index 5125fc5839..9f5bfba3fd 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -295,9 +295,6 @@ struct st_context
 
/* Winsys buffers */
struct list_head winsys_buffers;
-
-   /* For the initial pushdown, keep the list of vbo inputs. */
-   struct vbo_inputs draw_arrays;
 };
 
 
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index e9ffc18d91..de7fca682b 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -145,10 +145,6 @@ st_draw_vbo(struct gl_context *ctx,
unsigned i;
unsigned start = 0;
 
-   /* The initial pushdown of the inputs array into the drivers */
-   _mesa_set_drawing_arrays(ctx, st->draw_arrays.inputs);
-   _vbo_update_inputs(ctx, >draw_arrays);
-
prepare_draw(st, ctx);
 
if (st->vertex_array_out_of_memory)
@@ -247,10 +243,6 @@ st_indirect_draw_vbo(struct gl_context *ctx,
struct pipe_draw_info info;
struct pipe_draw_indirect_info indirect;
 
-   /* The initial pushdown of the inputs array into the drivers */
-   _mesa_set_drawing_arrays(ctx, st->draw_arrays.inputs);
-   _vbo_update_inputs(ctx, >draw_arrays);
-
assert(stride);
prepare_draw(st, ctx);
 
-- 
2.14.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 04/11] gallium: Use Array._DrawVAO in st_atom_array.c.

2018-04-01 Thread Mathias . Froehlich
From: Mathias Fröhlich 

Finally make use of the binding information in the VAO when
setting up arrays for draw.

Signed-off-by: Mathias Fröhlich 
---
 src/mesa/state_tracker/st_atom_array.c | 448 +
 1 file changed, 124 insertions(+), 324 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_array.c 
b/src/mesa/state_tracker/st_atom_array.c
index 2fd67e8d84..46934a718a 100644
--- a/src/mesa/state_tracker/st_atom_array.c
+++ b/src/mesa/state_tracker/st_atom_array.c
@@ -48,6 +48,7 @@
 #include "main/bufferobj.h"
 #include "main/glformats.h"
 #include "main/varray.h"
+#include "main/arrayobj.h"
 
 /* vertex_formats[gltype - GL_BYTE][integer*2 + normalized][size - 1] */
 static const uint16_t vertex_formats[][4][4] = {
@@ -306,79 +307,6 @@ st_pipe_vertex_format(const struct gl_array_attributes 
*attrib)
return vertex_formats[type - GL_BYTE][index][size-1];
 }
 
-static const struct gl_vertex_array *
-get_client_array(const struct gl_vertex_array *arrays,
- unsigned mesaAttr)
-{
-   /* st_program uses 0x to denote a double placeholder attribute */
-   if (mesaAttr == ST_DOUBLE_ATTRIB_PLACEHOLDER)
-  return NULL;
-   return [mesaAttr];
-}
-
-/**
- * Examine the active arrays to determine if we have interleaved
- * vertex arrays all living in one VBO, or all living in user space.
- */
-static GLboolean
-is_interleaved_arrays(const struct st_vertex_program *vp,
-  const struct gl_vertex_array *arrays,
-  unsigned num_inputs)
-{
-   GLuint attr;
-   const struct gl_buffer_object *firstBufObj = NULL;
-   GLint firstStride = -1;
-   const GLubyte *firstPtr = NULL;
-   GLboolean userSpaceBuffer = GL_FALSE;
-
-   for (attr = 0; attr < num_inputs; attr++) {
-  const struct gl_vertex_array *array;
-  const struct gl_vertex_buffer_binding *binding;
-  const struct gl_array_attributes *attrib;
-  const GLubyte *ptr;
-  const struct gl_buffer_object *bufObj;
-  GLsizei stride;
-
-  array = get_client_array(arrays, vp->index_to_input[attr]);
-  if (!array)
-continue;
-
-  binding = array->BufferBinding;
-  attrib = array->VertexAttrib;
-  stride = binding->Stride; /* in bytes */
-  ptr = _mesa_vertex_attrib_address(attrib, binding);
-
-  /* To keep things simple, don't allow interleaved zero-stride attribs. */
-  if (stride == 0)
- return false;
-
-  bufObj = binding->BufferObj;
-  if (attr == 0) {
- /* save info about the first array */
- firstStride = stride;
- firstPtr = ptr;
- firstBufObj = bufObj;
- userSpaceBuffer = !_mesa_is_bufferobj(bufObj);
-  }
-  else {
- /* check if other arrays interleave with the first, in same buffer */
- if (stride != firstStride)
-return GL_FALSE; /* strides don't match */
-
- if (bufObj != firstBufObj)
-return GL_FALSE; /* arrays in different VBOs */
-
- if (llabs(ptr - firstPtr) > firstStride)
-return GL_FALSE; /* arrays start too far apart */
-
- if ((!_mesa_is_bufferobj(bufObj)) != userSpaceBuffer)
-return GL_FALSE; /* mix of VBO and user-space arrays */
-  }
-   }
-
-   return GL_TRUE;
-}
-
 static void init_velement(struct pipe_vertex_element *velement,
   int src_offset, int format,
   int instance_divisor, int vbo_index)
@@ -392,13 +320,14 @@ static void init_velement(struct pipe_vertex_element 
*velement,
 
 static void init_velement_lowered(const struct st_vertex_program *vp,
   struct pipe_vertex_element *velements,
-  int src_offset, int format,
-  int instance_divisor, int vbo_index,
-  int nr_components, GLboolean doubles,
-  GLuint *attr_idx)
+  const struct gl_array_attributes *attrib,
+  int src_offset, int instance_divisor,
+  int vbo_index, int idx)
 {
-   int idx = *attr_idx;
-   if (doubles) {
+   const unsigned format = st_pipe_vertex_format(attrib);
+   const GLubyte nr_components = attrib->Size;
+
+   if (attrib->Doubles) {
   int lower_format;
 
   if (nr_components < 2)
@@ -427,15 +356,11 @@ static void init_velement_lowered(const struct 
st_vertex_program *vp,
 init_velement([idx], src_offset, PIPE_FORMAT_R32G32_UINT,
   instance_divisor, vbo_index);
  }
-
- idx++;
   }
} else {
   init_velement([idx], src_offset,
 format, instance_divisor, vbo_index);
-  idx++;
}
-   *attr_idx = idx;
 }
 
 static void
@@ -457,274 +382,149 @@ set_vertex_attribs(struct st_context *st,

[Mesa-dev] [PATCH 00/11] Use binding information from DrawVAO.

2018-04-01 Thread Mathias . Froehlich
From: Mathias Fröhlich 

Hi Brian,

We are getting there somehow.
The series builds up unique binding information internal to a VAO.
This shall help drivers to get as few buffer objects as possible.
The first patch implements building up this unique binding information.
Then there is a bunch of gallium changes that do utilize this unique
set of buffer objects for array setup.
Followed by some changes to i965 to get again somehow closer to
utilizing that unique binding information. But here we are not yet
there.
After all we have tnl as only user of gl_vertex_array and consequently
move all that into tnl and rename accordingly.
The changeset has been tested locally with piglit on radeonsi, classic
swrast and i965(Sandybridge Mobile) as well as with intels CI system without
regressions.

There is still a lot of possible cleanup and optimization around
drawing, but with this change gl_vertex_array is pushed into legacy
tnl based drivers.

please review
Thanks!

Mathias



Mathias Fröhlich (11):
  mesa: Compute effective buffer bindings in the vao.
  gallium: Use _DrawVAO for edgeflag enabled check.
  gallium: Make the input_to_index array available.
  gallium: Use Array._DrawVAO in st_atom_array.c.
  gallium: Make feedback draw and rasterpos use _DrawVAO.
  gallium: Remove the now unused gl_vertex_array.
  i965: Implement all_varyings_in_vbos in terms of Array._DrawVAO.
  i965: Remove the gl_vertex_array indirection.
  i965: Remove the now unused gl_vertex_array.
  mesa: Remove Array._DrawArrays.
  mesa/vbo/tnl: Move gl_vertex_array related stuff to tnl.

 src/mesa/drivers/dri/i965/brw_context.h   |   7 +-
 src/mesa/drivers/dri/i965/brw_draw.c  |  49 +--
 src/mesa/drivers/dri/i965/brw_draw_upload.c   |  33 +-
 src/mesa/drivers/dri/i965/genX_state_upload.c |  12 +-
 src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c  |  40 +--
 src/mesa/main/arrayobj.c  | 293 -
 src/mesa/main/arrayobj.h  | 171 ++
 src/mesa/main/attrib.c|   2 +-
 src/mesa/main/mtypes.h|  56 ++--
 src/mesa/main/varray.c|   2 +
 src/mesa/main/varray.h|  26 --
 src/mesa/state_tracker/st_atom.c  |  11 +-
 src/mesa/state_tracker/st_atom_array.c| 448 +++---
 src/mesa/state_tracker/st_cb_feedback.c   |  32 +-
 src/mesa/state_tracker/st_cb_rasterpos.c  |  38 +--
 src/mesa/state_tracker/st_context.c   |   3 -
 src/mesa/state_tracker/st_context.h   |   3 -
 src/mesa/state_tracker/st_draw.c  |   8 -
 src/mesa/state_tracker/st_draw.h  |   1 -
 src/mesa/state_tracker/st_draw_feedback.c |  41 +--
 src/mesa/state_tracker/st_program.c   |  17 +-
 src/mesa/state_tracker/st_program.h   |   5 +
 src/mesa/state_tracker/st_shader_cache.c  |   4 +
 src/mesa/tnl/t_context.c  |   4 +-
 src/mesa/tnl/t_context.h  |  41 ++-
 src/mesa/tnl/t_draw.c | 100 +-
 src/mesa/tnl/t_rebase.c   |   4 +-
 src/mesa/tnl/t_rebase.h   |   2 +-
 src/mesa/tnl/t_split.c|   2 +-
 src/mesa/tnl/t_split.h|   4 +-
 src/mesa/tnl/t_split_copy.c   |  34 +-
 src/mesa/tnl/t_split_inplace.c|   4 +-
 src/mesa/tnl/tnl.h|  24 +-
 src/mesa/vbo/vbo.h|  37 +--
 src/mesa/vbo/vbo_context.c|  17 +
 src/mesa/vbo/vbo_exec.c   |  86 -
 36 files changed, 927 insertions(+), 734 deletions(-)

-- 
2.14.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 00/11 v2] TGSI: improved live range tracking, also including arrays

2018-04-01 Thread Gert Wollny
Am Freitag, den 30.03.2018, 17:05 +0200 schrieb Dieter Nützel:
> Am 30.03.2018 17:01, schrieb Ilia Mirkin:
> > On Fri, Mar 30, 2018 at 10:33 AM, Dieter Nützel  > de> 
> > wrote:
> > > For the series:
> > > 
> > > Tested-by: Dieter Nützel 
> > > 
> > > with glmark2, UH, UV, KDE Plasma5 (my desktop)
> > > R600_DEBUG=sisched,nir
> > > but on radeonsi, Polaris 20 (RX580) not r600 ;-)
> > 
> > This series is relevant to TGSI. However you're forcing the nir
> > path.
> > Your testing was largely a no-op, I'm afraid.
> > 
> >   -ilia
> 
> Oh dear, yes shit ;-)
> I'll retry without 'nir' then...

Thanks for the effort in testing this series, but on radeonsi also on
the TGSI path this series is mostly irrelevant, because apart from the
first patch it is only enabled when the driver doesn't request skipping
"merge_registers" and radionsi is one of the drivers who does return a
non-zero value for PIPE_SHADER_CAP_TGSI_SKIP_MERGE_REGISTERS (I guess
the llvm backend takes care of this optimization anyway).

Best, 
Gert

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 102204] GL_ARB_buffer_storage crippled extension on r600, radeonsi and amdgpu Mesa drivers

2018-04-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=102204

mirh  changed:

   What|Removed |Added

 CC||m...@protonmail.ch

-- 
You are receiving this mail because:
You are the assignee for the bug.___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 105832] radeonsi NIR missing bindless textures support

2018-04-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105832

--- Comment #16 from b...@besd.de  ---
Not a big thing, but might save you from stupid questions ;)

kindly review and push

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are the QA Contact for the bug.___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] Disable bindless textures with radeonsi NIR until there is support for them.

2018-04-01 Thread Benedikt Schemmer
From: Benedikt Schemmer 
Date: Sun, 1 Apr 2018 13:18:02 +0200
Subject: [PATCH] Disable bindless textures with radeonsi NIR until there
is support for them.

- Allows to build and use a debug build of mesa with
 shader-db (crashes otherwise with affected shaders)

- Dirt Rally doesnt care about bindless, but Warhammer 40k Dawn 3 does
and crashes with nir when ARB_bindless_texture is reported

---
 src/gallium/drivers/radeonsi/si_get.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_get.c
b/src/gallium/drivers/radeonsi/si_get.c
--- a/src/gallium/drivers/radeonsi/si_get.c
+++ b/src/gallium/drivers/radeonsi/si_get.c
@@ -176,7 +176,6 @@ static int si_get_param(struct pipe_screen *pscreen,
enum pipe_cap param)
case PIPE_CAP_DOUBLES:
case PIPE_CAP_TGSI_TEX_TXF_LZ:
case PIPE_CAP_TGSI_TES_LAYER_VIEWPORT:
-   case PIPE_CAP_BINDLESS_TEXTURE:
case PIPE_CAP_QUERY_TIMESTAMP:
case PIPE_CAP_QUERY_TIME_ELAPSED:
case PIPE_CAP_NIR_SAMPLERS_AS_DEREF:
@@ -257,6 +256,11 @@ static int si_get_param(struct pipe_screen
*pscreen, enum pipe_cap param)
return 1;
return 0;

+   case PIPE_CAP_BINDLESS_TEXTURE:
+   if (sscreen->debug_flags & DBG(NIR))
+   return 0;
+   return 1;
+
/* Unsupported features. */
case PIPE_CAP_BUFFER_SAMPLER_VIEW_RGBA_ONLY:
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
-- 
2.14.1
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 105832] radeonsi NIR missing bindless textures support

2018-04-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105832

b...@besd.de  changed:

   What|Removed |Added

 Attachment #138474|0   |1
is obsolete||

--- Comment #15 from b...@besd.de  ---
Created attachment 138478
  --> https://bugs.freedesktop.org/attachment.cgi?id=138478=edit
v2 Disable bindless textures with radeonsi NIR until there is support for them.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are the QA Contact for the bug.___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [AppVeyor] mesa master #7349 failed

2018-04-01 Thread AppVeyor



Build mesa 7349 failed


Commit 2f175bfe5d by Rob Clark on 4/1/2018 3:26 PM:

freedreno/a5xx: don't align height for PIPE_BUFFER\n\nBuffers can be large, so we probably don't want to make them all 32x\nbigger.  But they can't be rendered to (at least in GL) so we don't\nneed this workaround to prevent page faults on mem<->gmem.\n\nCc: "18.0" \nSigned-off-by: Rob Clark 


Configure your notification preferences

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] gallium/pipebuffer: fix bracket location

2018-04-01 Thread Marek Olšák
Reviewed-by: Marek Olšák 

Marek

On Sat, Mar 31, 2018 at 7:32 PM, Timothy Arceri 
wrote:

> Without this the return value will never get set to -1. This
> was first added in 49866c8f3457 and copied in 2b396eeed983.
>
> Fixes: 2b396eeed983 "gallium/pb_cache: add a copy of cache bufmgr
> independent of pb_manager"
>
> Cc: Marek Olšák 
> Cc: Dave Airlie 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102342
> ---
>  src/gallium/auxiliary/pipebuffer/pb_cache.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/gallium/auxiliary/pipebuffer/pb_cache.c
> b/src/gallium/auxiliary/pipebuffer/pb_cache.c
> index 0aaedbfae4c..2b9ad498045 100644
> --- a/src/gallium/auxiliary/pipebuffer/pb_cache.c
> +++ b/src/gallium/auxiliary/pipebuffer/pb_cache.c
> @@ -169,7 +169,7 @@ pb_cache_reclaim_buffer(struct pb_cache *mgr, pb_size
> size,
>cur_entry = LIST_ENTRY(struct pb_cache_entry, cur, head);
>
>if (!entry && (ret = pb_cache_is_buffer_compat(cur_entry, size,
> - alignment, usage) >
> 0))
> + alignment, usage)) >
> 0)
>   entry = cur_entry;
>else if (os_time_timeout(cur_entry->start, cur_entry->end, now))
>   destroy_buffer_locked(cur_entry);
> --
> 2.14.3
>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 102204] GL_ARB_buffer_storage crippled extension on r600, radeonsi and amdgpu Mesa drivers

2018-04-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=102204

soredake  changed:

   What|Removed |Added

 CC||fds...@krutt.org

-- 
You are receiving this mail because:
You are the assignee for the bug.___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 105832] radeonsi NIR missing bindless textures support

2018-04-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105832

--- Comment #14 from b...@besd.de  ---
No cheating ;)

Main reason for using the debug build were these lines
shaders/csgo/595.shader_test - LLVM diagnostic (remark): :0:0: 11
instructions in function

because I thought unknown might be replaced by something useful, which isn't
the case.

Also contrary to the shader-db README there is absolutely no reason to use a
debug build. The output is identical.

Off to test Dirt Rally with my patch, lets see if it fails now.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are the QA Contact for the bug.___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [RFC] - Rewrite mesa website in Sphinx

2018-04-01 Thread Jean Hertel
Hi Laura,


The commits have the idea of being atomic, so it makes sense to have a lot of 
them.

Some of them are just fixes, and can be squashed.


Please keep in mind that no CSS file is supposed to live there, as we are using 
an existing template from readTheDocs.

The commits are doing mainly two things:

1 - Create a new file and translate the old HTML content into a rst format.

2 - Delete the old file


Kind Regards,

Jean Hertel


De: Laura Ekstrand 
Enviado: sábado, 31 de março de 2018 22:06
Para: Jean Hertel
Cc: Emil Velikov; Vedran Miletić; mesa-dev@lists.freedesktop.org; Jason Ekstrand
Assunto: Re: [Mesa-dev] [RFC] - Rewrite mesa website in Sphinx

Jean,

I've taken at look at your sphinx-docs branch 
(https://github.com/jlHertel/mesa).

Oh my you have a lot of commits there!  It would be simpler for me to review if 
you could squash some of them together.

I am thinking a series on the order of 30 patches to start - just the pretty 
CSS stuff in Sphinx.

Once we get the page to look nicer, then we can start editing the content for 
readability!!!

Thanks.

Laura

On Sat, Mar 31, 2018 at 5:57 PM, Laura Ekstrand 
> wrote:
Hello Jean,

Has anyone reviewed your patch series yet?   I would like to get these website 
updates moving.

Thanks.

Laura

On Tue, Jun 6, 2017 at 10:43 AM, Jean Hertel 
> wrote:
Hello Emil,

I've updated the website with the new release notes template.

Please take a look at: http://mesa2.jeanhertel.com.br/relnotes.html


What about rebasing my current work on top of mesa-master?
(Remembering that github comments referencing directly the commit will be loss)


The repository: https://github.com/jlHertel/mesa
Demo site: http://mesa2.jeanhertel.com.br/

Best regards,
Jean Hertel
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [RFC] - Rewrite mesa website in Sphinx

2018-04-01 Thread Jean Hertel
Hi Laura,


Unfortunately this repository was not reviewed.

It is already one year old, so its pretty outdated now.


If you are able to get enough people to review it, I can of course update it to 
mesa-git.


Kind Regards,

Jean Hertel


De: Laura Ekstrand 
Enviado: sábado, 31 de março de 2018 21:57
Para: Jean Hertel
Cc: Emil Velikov; Vedran Miletić; mesa-dev@lists.freedesktop.org; Jason Ekstrand
Assunto: Re: [Mesa-dev] [RFC] - Rewrite mesa website in Sphinx

Hello Jean,

Has anyone reviewed your patch series yet?   I would like to get these website 
updates moving.

Thanks.

Laura

On Tue, Jun 6, 2017 at 10:43 AM, Jean Hertel 
> wrote:
Hello Emil,

I've updated the website with the new release notes template.

Please take a look at: http://mesa2.jeanhertel.com.br/relnotes.html


What about rebasing my current work on top of mesa-master?
(Remembering that github comments referencing directly the commit will be loss)


The repository: https://github.com/jlHertel/mesa
Demo site: http://mesa2.jeanhertel.com.br/

Best regards,
Jean Hertel
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 105832] radeonsi NIR missing bindless textures support

2018-04-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105832

--- Comment #13 from Timothy Arceri  ---
(In reply to b...@besd.de from comment #11)
> The funny thing is that I tested Dirt Rally with nir and it didnt crash
> although it supposedly requires bindless.
> 
> Im currently running tests again, but it will take a long time because in
> the debug build NIR takes about 8x as much time as TGSI to compile all
> shaders with the above patch to disable bindless (1000s per thread vs 160s)
> 
> Lets see what happens ;)

You can use the NIR_VALIDATE=0 environment var to speed things up.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 103852] Rendering errors when running dolphin-emu with Vulkan backend, radv (Super Smash Bros. Melee)

2018-04-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=103852

--- Comment #9 from Timothy Arceri  ---
(In reply to Ben Clapp from comment #8)
> Today I spent a number of hours looking at the background rendering errors
> in RenderDoc.
> 
> The vertex shader outputs some vertices that have two vertex colors,
> colors_0 and colors_1. (Only colors_0 is relevant here)
> 
> The fragment shader does a bunch of fiddling around with colors_0, a lot of
> unnecessary conversions and re-assignments that effectively do nothing, and
> ultimately the colors_0 value is passed to rastemp and tevin_d.
> Some more fiddling around and, in the case of the areas of the screen where
> there are rendering errors, the value of colors_0/rastemp/tevin_d ("tevin"
> means "TEV input", referring to the Gamecube/Wii's Texture EnVironment
> hardware) becomes the color value written to the framebuffer.
> 
> The problem is not in the vertex shader, nor is it in the fragment shader.
> For some reason, the value of colors_0 coming out of the vertex shader is
> correct, but the value of colors_0 in the fragment shader is inverted! So
> blue will appear yellow, black while appear white, etc...
> 
> This seems to be a driver bug after all, and so I did try to spend some time
> looking into radv's code to try and see if I could figure out a fix.
> The issue might lie in radv_pipeline.c, I would think it probably has
> something to do with the inter-stage varying colors_0 not getting filled or
> interpreted correctly.
> 
> I've done lots of OpenGL and Vulkan programming, but I have little
> experience with the driver side of things, so while it might be interesting
> to talk a bit with the radv devs and learn a thing or two, I'm not sure how
> much further I can go in terms of looking into this on my own without
> assistance.
> 

Do you think you could get a dump of the NIR and LLVM IR for the shaders in
question and attach it here? You can use the following environment var to dump
the shaders: RADV_DEBUG=shaders

You also might be able to catch the attention of some devs if you jump on the
freenode #radeon IRC channel.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 105832] radeonsi NIR missing bindless textures support

2018-04-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105832

--- Comment #12 from b...@besd.de  ---
also it seems only five shaders are affected
** Tests only in 'before' results are ignored:
shaders/w40kdawn3/958.shader_test, shaders/w40kdawn3/1088.shader_test,
shaders/w40kdawn3/1068.shader_test, shaders/w40kdawn3/960.shader_test,
shaders/w40kdawn3/1070.shader_test

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are the QA Contact for the bug.___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 105832] radeonsi NIR missing bindless textures support

2018-04-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105832

--- Comment #11 from b...@besd.de  ---
The funny thing is that I tested Dirt Rally with nir and it didnt crash
although it supposedly requires bindless.

Im currently running tests again, but it will take a long time because in the
debug build NIR takes about 8x as much time as TGSI to compile all shaders with
the above patch to disable bindless (1000s per thread vs 160s)

Lets see what happens ;)

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 105832] radeonsi NIR missing bindless textures support

2018-04-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105832

--- Comment #10 from b...@besd.de  ---
Created attachment 138474
  --> https://bugs.freedesktop.org/attachment.cgi?id=138474=edit
Disable bindless textures with radeonsi NIR until there is  support for them.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 105832] radeonsi NIR missing bindless textures support

2018-04-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105832

--- Comment #9 from Timothy Arceri  ---
(In reply to b...@besd.de from comment #7)
> Why doesnt it crash in the release build then?

Oh that was why *doesn't* it crash. No idea it probably doesn't even get far
enough along to crash. It might even skip it due to not meeting the minimum GL
version (I've no idea what NIR supports in 18.0).

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 105832] radeonsi NIR missing bindless textures support

2018-04-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105832

--- Comment #8 from Timothy Arceri  ---
(In reply to b...@besd.de from comment #7)
> Why doesnt it crash in the release build then?

Lots of things will crash when using NIR in 18.0 if that's what you mean. It's
still experimental and disabled by default. When 18.0 was branched many
piglit/cts tests were failing and the patches weren't and won't be back ported
to 18.0.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are the QA Contact for the bug.___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 105832] radeonsi NIR missing bindless textures support

2018-04-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=105832

--- Comment #7 from b...@besd.de  ---
Why doesnt it crash in the release build then?

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] ac/nir: Fix include for LLVMAddPromoteMemoryToRegisterPass

2018-04-01 Thread Mike Lothian
Thanks for pointing that out

I've sent a 4th patch, I've never compiled swr before, would you mind
testing to see if it fixes things for you, it's using the llvm include
rather than the llvm-c include

On Sun, 1 Apr 2018 at 06:15 Vinson Lee  wrote:

> On Sat, Mar 31, 2018 at 5:08 PM, Mike Lothian  wrote:
> > On 1 April 2018 at 00:03, Vinson Lee  wrote:
> >>
> >> A similar change is needed in
> >> src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp.
> >>
> >> Vinson
> >
> > Hi
> >
> > I'm not convinced that it does
> >
> > Utils.h defines two functions LLVMAddLowerSwitchPass &
> > LLVMAddPromoteMemoryToRegisterPass. Whilst jit_pch.hpp does use
> > Scalar.h, it doesn't use either of the two functions in Utils.h so it
> > doesn't need to be included
> >
> > Cheers
> >
> > Mike
>
> I see this build errors with llvm 7.0.0svn. These errors are fixed if
> Utils.h is added to the list of includes.
>
>   CXX  rasterizer/jitter/libmesaswr_la-blend_jit.lo
> rasterizer/jitter/blend_jit.cpp:796:20: error: use of undeclared
> identifier 'createBreakCriticalEdgesPass'
> passes.add(createBreakCriticalEdgesPass());
>^
> rasterizer/jitter/blend_jit.cpp:799:20: error: use of undeclared
> identifier 'createPromoteMemoryToRegisterPass'
> passes.add(createPromoteMemoryToRegisterPass());
>^
> rasterizer/jitter/blend_jit.cpp:803:20: error: use of undeclared
> identifier 'createInstructionSimplifierPass'; did you mean
>   'createInstructionCombiningPass'?
> passes.add(createInstructionSimplifierPass());
>^~~
>createInstructionCombiningPass
>
> Vinson
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 4/4] swr: Fix include for createPromoteMemoryToRegisterPass

2018-04-01 Thread Mike Lothian
Include llvm/Transforms/Utils.h with the newest LLVM 7

Signed-of-by: Mike Lothian 
---
 src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp 
b/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp
index 031bced8a0..d726d4844e 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/jit_pch.hpp
@@ -67,6 +67,9 @@ using PassManager = llvm::legacy::PassManager;
 #include "llvm/Support/DynamicLibrary.h"
 #include "llvm/Transforms/IPO.h"
 #include "llvm/Transforms/Scalar.h"
+#if HAVE_LLVM >= 0x0700
+#include 
+#endif
 #include "llvm/Support/Host.h"
 #include "llvm/Support/DynamicLibrary.h"
 
-- 
2.16.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev