From b08dbc84fe5ba861d8a4d224bf4c7c467bbf33fe Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Thu, 25 Feb 2016 16:07:45 +0000 Subject: st/nine: don't forget to bundle the nine_limits.h file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without this mesa 11.2.0-rc1 ended up busted :-( Cc: "11.2" Repored-by: Ondřej Súkup Signed-off-by: Emil Velikov --- src/gallium/state_trackers/nine/Makefile.sources | 1 + 1 file changed, 1 insertion(+) (limited to 'src/gallium/state_trackers') diff --git a/src/gallium/state_trackers/nine/Makefile.sources b/src/gallium/state_trackers/nine/Makefile.sources index 05eb1655376..af80532ce37 100644 --- a/src/gallium/state_trackers/nine/Makefile.sources +++ b/src/gallium/state_trackers/nine/Makefile.sources @@ -35,6 +35,7 @@ C_SOURCES := \ nine_flags.h \ nine_helpers.c \ nine_helpers.h \ + nine_limits.h \ nine_lock.c \ nine_lock.h \ nine_pdata.h \ -- cgit v1.2.3 From 04bc09fdf9e353fbb1303635236da551785373c9 Mon Sep 17 00:00:00 2001 From: Koop Mast Date: Mon, 28 Dec 2015 20:26:48 +0100 Subject: st/clover: Add libelf cflags to the build Otherwise the build will fail, when the library is in a non default location. v2 [Emil Velikov] - drop the unneeded cflags from targets/opencl. Cc: "11.1 11.2" Fixes: 7f585a6a98d "configure.ac: use pkg-config for libelf" Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93524 Signed-off-by: Emil Velikov --- src/gallium/state_trackers/clover/Makefile.am | 1 + src/gallium/targets/opencl/Makefile.am | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) (limited to 'src/gallium/state_trackers') diff --git a/src/gallium/state_trackers/clover/Makefile.am b/src/gallium/state_trackers/clover/Makefile.am index 3c9421692fc..4c9d7d9b7be 100644 --- a/src/gallium/state_trackers/clover/Makefile.am +++ b/src/gallium/state_trackers/clover/Makefile.am @@ -41,6 +41,7 @@ libclllvm_la_CXXFLAGS = \ $(VISIBILITY_CXXFLAGS) \ $(LLVM_CXXFLAGS) \ $(DEFINES) \ + $(LIBELF_CFLAGS) \ -DLIBCLC_INCLUDEDIR=\"$(LIBCLC_INCLUDEDIR)/\" \ -DLIBCLC_LIBEXECDIR=\"$(LIBCLC_LIBEXECDIR)/\" \ -DCLANG_RESOURCE_DIR=\"$(CLANG_RESOURCE_DIR)\" diff --git a/src/gallium/targets/opencl/Makefile.am b/src/gallium/targets/opencl/Makefile.am index f3ba1e32d1b..99532f06d81 100644 --- a/src/gallium/targets/opencl/Makefile.am +++ b/src/gallium/targets/opencl/Makefile.am @@ -2,9 +2,6 @@ include $(top_srcdir)/src/gallium/Automake.inc lib_LTLIBRARIES = lib@OPENCL_LIBNAME@.la -AM_CPPFLAGS = \ - $(LIBELF_CFLAGS) - lib@OPENCL_LIBNAME@_la_LDFLAGS = \ $(LLVM_LDFLAGS) \ -no-undefined \ -- cgit v1.2.3 From f08c990af53e91114257b19e5679e2dbbc277e45 Mon Sep 17 00:00:00 2001 From: Axel Davy Date: Sun, 21 Feb 2016 16:30:15 +0100 Subject: st/nine: Introduce helper for Position shader input Cc: "11.2" Signed-off-by: Axel Davy --- src/gallium/state_trackers/nine/nine_shader.c | 31 +++++++++++++-------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'src/gallium/state_trackers') diff --git a/src/gallium/state_trackers/nine/nine_shader.c b/src/gallium/state_trackers/nine/nine_shader.c index a7a7da27903..f0c5236fd75 100644 --- a/src/gallium/state_trackers/nine/nine_shader.c +++ b/src/gallium/state_trackers/nine/nine_shader.c @@ -830,6 +830,18 @@ nine_ureg_dst_register(unsigned file, int index) return ureg_dst(ureg_src_register(file, index)); } +static inline struct ureg_src +nine_get_position_input(struct shader_translator *tx) +{ + struct ureg_program *ureg = tx->ureg; + + if (tx->wpos_is_sysval) + return ureg_DECL_system_value(ureg, TGSI_SEMANTIC_POSITION, 0); + else + return ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_POSITION, + 0, TGSI_INTERPOLATE_LINEAR); +} + static struct ureg_src tx_src_param(struct shader_translator *tx, const struct sm1_src_param *param) { @@ -955,16 +967,8 @@ tx_src_param(struct shader_translator *tx, const struct sm1_src_param *param) case D3DSPR_MISCTYPE: switch (param->idx) { case D3DSMO_POSITION: - if (ureg_src_is_undef(tx->regs.vPos)) { - if (tx->wpos_is_sysval) { - tx->regs.vPos = - ureg_DECL_system_value(ureg, TGSI_SEMANTIC_POSITION, 0); - } else { - tx->regs.vPos = - ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_POSITION, 0, - TGSI_INTERPOLATE_LINEAR); - } - } + if (ureg_src_is_undef(tx->regs.vPos)) + tx->regs.vPos = nine_get_position_input(tx); if (tx->shift_wpos) { /* TODO: do this only once */ struct ureg_dst wpos = tx_scratch(tx); @@ -3269,12 +3273,7 @@ shader_add_ps_fog_stage(struct shader_translator *tx, struct ureg_src src_col) } if (tx->info->fog_mode != D3DFOG_NONE) { - if (tx->wpos_is_sysval) { - depth = ureg_DECL_system_value(ureg, TGSI_SEMANTIC_POSITION, 0); - } else { - depth = ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_POSITION, 0, - TGSI_INTERPOLATE_LINEAR); - } + depth = nine_get_position_input(tx); depth = ureg_scalar(depth, TGSI_SWIZZLE_Z); } -- cgit v1.2.3 From 8a8affdfdace486f4e416e66e2dd0ed122505a90 Mon Sep 17 00:00:00 2001 From: Axel Davy Date: Sun, 21 Feb 2016 16:35:31 +0100 Subject: st/nine: Use Position input helper for ps3 declared inputs When the semantic is Position (which can happen with index 0 only), use the helper to get Position input. Cc: "11.2" Signed-off-by: Axel Davy --- src/gallium/state_trackers/nine/nine_shader.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/gallium/state_trackers') diff --git a/src/gallium/state_trackers/nine/nine_shader.c b/src/gallium/state_trackers/nine/nine_shader.c index f0c5236fd75..eb6479bb4d9 100644 --- a/src/gallium/state_trackers/nine/nine_shader.c +++ b/src/gallium/state_trackers/nine/nine_shader.c @@ -2052,9 +2052,16 @@ DECL_SPECIAL(DCL) unsigned interp_location = 0; /* SM3 only, SM2 input semantic determined by file */ assert(sem.reg.idx < Elements(tx->regs.v)); + + if (tgsi.Name == TGSI_SEMANTIC_POSITION) { + tx->regs.v[sem.reg.idx] = nine_get_position_input(tx); + return D3D_OK; + } + if (sem.reg.mod & NINED3DSPDM_CENTROID || (tgsi.Name == TGSI_SEMANTIC_COLOR && tx->info->force_color_in_centroid)) interp_location = TGSI_INTERPOLATE_LOC_CENTROID; + tx->regs.v[sem.reg.idx] = ureg_DECL_fs_input_cyl_centroid( ureg, tgsi.Name, tgsi.Index, nine_tgsi_to_interp_mode(&tgsi), -- cgit v1.2.3 From 35c858c42c818d5bf5b4bfee03a342df52acface Mon Sep 17 00:00:00 2001 From: Axel Davy Date: Wed, 24 Feb 2016 23:44:40 +0100 Subject: st/nine: Handle READONLY for buffer MANAGED pool READONLY won't trigger an upload. Cc: "11.2" Signed-off-by: Axel Davy --- src/gallium/state_trackers/nine/buffer9.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/gallium/state_trackers') diff --git a/src/gallium/state_trackers/nine/buffer9.c b/src/gallium/state_trackers/nine/buffer9.c index e066fc59f45..8efb4cefb1f 100644 --- a/src/gallium/state_trackers/nine/buffer9.c +++ b/src/gallium/state_trackers/nine/buffer9.c @@ -174,13 +174,16 @@ NineBuffer9_Lock( struct NineBuffer9 *This, u_box_1d(OffsetToLock, SizeToLock, &box); if (This->base.pool == D3DPOOL_MANAGED) { - if (!This->managed.dirty) { - assert(LIST_IS_EMPTY(&This->managed.list)); - list_add(&This->managed.list, &This->base.base.device->update_buffers); - This->managed.dirty = TRUE; - This->managed.dirty_box = box; - } else { - u_box_union_2d(&This->managed.dirty_box, &This->managed.dirty_box, &box); + /* READONLY doesn't dirty the buffer */ + if (!(Flags & D3DLOCK_READONLY)) { + if (!This->managed.dirty) { + assert(LIST_IS_EMPTY(&This->managed.list)); + list_add(&This->managed.list, &This->base.base.device->update_buffers); + This->managed.dirty = TRUE; + This->managed.dirty_box = box; + } else { + u_box_union_2d(&This->managed.dirty_box, &This->managed.dirty_box, &box); + } } *ppbData = (char *)This->managed.data + OffsetToLock; DBG("returning pointer %p\n", *ppbData); -- cgit v1.2.3 From 44246fe99d4c880b70a58043624bf023237009f5 Mon Sep 17 00:00:00 2001 From: Axel Davy Date: Thu, 25 Feb 2016 19:07:37 +0100 Subject: st/nine: Fix Multithreading issue with MANAGED buffers d3d calls are protected by mutexes, however if app is doing in two threads: Thread 1: buffer Lock Thread 2: Draw call Thread 1: writes data Thread 1: Unlock Then before this patch, the Draw call would begin to upload the buffer. Solves this by moving the moment we add the buffer to the queue of things to upload (We move it from Lock time to Unlock time). Cc: "11.2" Signed-off-by: Axel Davy --- src/gallium/state_trackers/nine/buffer9.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/gallium/state_trackers') diff --git a/src/gallium/state_trackers/nine/buffer9.c b/src/gallium/state_trackers/nine/buffer9.c index 8efb4cefb1f..6d5d9d691f8 100644 --- a/src/gallium/state_trackers/nine/buffer9.c +++ b/src/gallium/state_trackers/nine/buffer9.c @@ -178,7 +178,6 @@ NineBuffer9_Lock( struct NineBuffer9 *This, if (!(Flags & D3DLOCK_READONLY)) { if (!This->managed.dirty) { assert(LIST_IS_EMPTY(&This->managed.list)); - list_add(&This->managed.list, &This->base.base.device->update_buffers); This->managed.dirty = TRUE; This->managed.dirty_box = box; } else { @@ -232,8 +231,13 @@ NineBuffer9_Unlock( struct NineBuffer9 *This ) user_assert(This->nmaps > 0, D3DERR_INVALIDCALL); if (This->base.pool != D3DPOOL_MANAGED) This->pipe->transfer_unmap(This->pipe, This->maps[--(This->nmaps)]); - else + else { This->nmaps--; + /* TODO: Fix this to upload at the first draw call needing the data, + * instead of at the next draw call */ + if (!This->nmaps && This->managed.dirty && LIST_IS_EMPTY(&This->managed.list)) + list_add(&This->managed.list, &This->base.base.device->update_buffers); + } return D3D_OK; } -- cgit v1.2.3 From 83bc2acfe90fd2e503bab4b5a586c1e2822863f5 Mon Sep 17 00:00:00 2001 From: Axel Davy Date: Sat, 27 Feb 2016 11:02:21 +0100 Subject: st/nine: Fix second Multithreading issue with MANAGED buffers Here is another threading issue with MANAGED buffers: Thread 1: buffer creation Thread 1: buffer lock Thread 2: Draw call Thread 1: writes data Thread 1: Unlock Without this patch, the buffer is initially dirty and in the list of things to upload after its creation. The draw call will then upload the data and unset the dirty flag, and the Unlock won't trigger a second upload. Fixes regression introduced by cc0114f30b587a10766ec212afb3ad356099ef23: "st/nine: Implement Managed vertex/index buffers" Cc: "11.2" Signed-off-by: Axel Davy --- src/gallium/state_trackers/nine/buffer9.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/gallium/state_trackers') diff --git a/src/gallium/state_trackers/nine/buffer9.c b/src/gallium/state_trackers/nine/buffer9.c index 6d5d9d691f8..1103741f7ee 100644 --- a/src/gallium/state_trackers/nine/buffer9.c +++ b/src/gallium/state_trackers/nine/buffer9.c @@ -182,6 +182,9 @@ NineBuffer9_Lock( struct NineBuffer9 *This, This->managed.dirty_box = box; } else { u_box_union_2d(&This->managed.dirty_box, &This->managed.dirty_box, &box); + /* Do not upload while we are locking, we'll add it back later */ + if (!LIST_IS_EMPTY(&This->managed.list)) + list_delinit(&This->managed.list); } } *ppbData = (char *)This->managed.data + OffsetToLock; -- cgit v1.2.3