Re: [Mesa-dev] [PATCH v2 01/49] util: move process.[ch] to u_process.[ch]

2018-07-10 Thread Marek Olšák
Reviewed-by: Marek Olšák 

Marek

On Tue, Jul 10, 2018 at 7:17 PM, Dylan Baker  wrote:
> On windows process.h is a system provided header, and it's required in
> include/c11/threads_win32.h. This header interferes with searching for
> that header, and results in windows build warnings with scons, but
> errors in meson which doesn't allow implicit function declarations. Just
> rename process to u_process, which follows the style of utils anyway.
> ---
>  src/gallium/auxiliary/os/os_process.c | 2 +-
>  src/util/Makefile.sources | 4 ++--
>  src/util/meson.build  | 4 ++--
>  src/util/{process.c => u_process.c}   | 2 +-
>  src/util/{process.h => u_process.h}   | 0
>  src/util/u_queue.c| 2 +-
>  src/util/xmlconfig.c  | 2 +-
>  7 files changed, 8 insertions(+), 8 deletions(-)
>  rename src/util/{process.c => u_process.c} (99%)
>  rename src/util/{process.h => u_process.h} (100%)
>
> diff --git a/src/gallium/auxiliary/os/os_process.c 
> b/src/gallium/auxiliary/os/os_process.c
> index 87072f0b046..766cf806153 100644
> --- a/src/gallium/auxiliary/os/os_process.c
> +++ b/src/gallium/auxiliary/os/os_process.c
> @@ -29,7 +29,7 @@
>  #include "pipe/p_config.h"
>  #include "os/os_process.h"
>  #include "util/u_memory.h"
> -#include "util/process.h"
> +#include "util/u_process.h"
>
>  #if defined(PIPE_SUBSYSTEM_WINDOWS_USER)
>  #  include 
> diff --git a/src/util/Makefile.sources b/src/util/Makefile.sources
> index fe34fc26690..531fd833c7f 100644
> --- a/src/util/Makefile.sources
> +++ b/src/util/Makefile.sources
> @@ -24,8 +24,8 @@ MESA_UTIL_FILES := \
> mesa-sha1.h \
> os_time.c \
> os_time.h \
> -   process.c \
> -   process.h \
> +   u_process.c \
> +   u_process.h \
> sha1/sha1.c \
> sha1/sha1.h \
> ralloc.c \
> diff --git a/src/util/meson.build b/src/util/meson.build
> index 1838719d271..27a6fc118e5 100644
> --- a/src/util/meson.build
> +++ b/src/util/meson.build
> @@ -48,8 +48,8 @@ files_mesa_util = files(
>'mesa-sha1.h',
>'os_time.c',
>'os_time.h',
> -  'process.c',
> -  'process.h',
> +  'u_process.c',
> +  'u_process.h',
>'sha1/sha1.c',
>'sha1/sha1.h',
>'ralloc.c',
> diff --git a/src/util/process.c b/src/util/u_process.c
> similarity index 99%
> rename from src/util/process.c
> rename to src/util/u_process.c
> index 6e6376986f3..5bf3f56db4e 100644
> --- a/src/util/process.c
> +++ b/src/util/u_process.c
> @@ -25,7 +25,7 @@
>   * of the Software.
>   */
>
> -#include "process.h"
> +#include "u_process.h"
>  #include 
>  #include 
>  #include 
> diff --git a/src/util/process.h b/src/util/u_process.h
> similarity index 100%
> rename from src/util/process.h
> rename to src/util/u_process.h
> diff --git a/src/util/u_queue.c b/src/util/u_queue.c
> index be95d9eec3f..4ce1af518b3 100644
> --- a/src/util/u_queue.c
> +++ b/src/util/u_queue.c
> @@ -31,7 +31,7 @@
>  #include "util/os_time.h"
>  #include "util/u_string.h"
>  #include "util/u_thread.h"
> -#include "process.h"
> +#include "u_process.h"
>
>  static void util_queue_killall_and_wait(struct util_queue *queue);
>
> diff --git a/src/util/xmlconfig.c b/src/util/xmlconfig.c
> index d3847911baa..ba657294c1c 100644
> --- a/src/util/xmlconfig.c
> +++ b/src/util/xmlconfig.c
> @@ -37,7 +37,7 @@
>  #include 
>  #include 
>  #include "xmlconfig.h"
> -#include "process.h"
> +#include "u_process.h"
>
>
>  /** \brief Find an option in an option cache with the name as key */
> --
> 2.18.0
>
> ___
> 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] i965/fs: Generalize grf127 hack to dispatch_width >

2018-07-10 Thread Jason Ekstrand
On July 10, 2018 18:50:51 Caio Marcelo de Oliveira Filho 
 wrote:



Change the hack to always apply, adjusting the register number
according to the dispatch_width.

The original change assumed that given for dispatch_width > 8 we
already prevent the overlap of source and destination for send, it
would not be necessary to explicitly add an interference with a
register that covers r127.

The problem is that the code for spilling registers ends up generating
scratch reads, that in Gen7+ will reuse the destination register,
causing a send with both source and destination overlaping. So prevent
r127 (or the overlapping wider register) to be used as destination for
sends.

This patch fixes piglit test
tests/spec/arb_compute_shader/linker/bug-93840.shader_test.

Fixes: 232ed898021 "i965/fs: Register allocator shoudn't use grf127 for 
sends dest"

---

After more digging on the piglit failure, I came up with this
patch. I'm still seeing crashes with for some shader-db executions
(master have them too), but didn't have time today to drill into them.

src/intel/compiler/brw_fs_reg_allocate.cpp | 11 ---
1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/intel/compiler/brw_fs_reg_allocate.cpp 
b/src/intel/compiler/brw_fs_reg_allocate.cpp

index 59e047483c0..417ddeba09c 100644
--- a/src/intel/compiler/brw_fs_reg_allocate.cpp
+++ b/src/intel/compiler/brw_fs_reg_allocate.cpp
@@ -549,7 +549,7 @@ fs_visitor::assign_regs(bool allow_spilling, bool 
spill_all)

   if (devinfo->gen >= 7)
  node_count += BRW_MAX_GRF - GEN7_MRF_HACK_START;
   int grf127_send_hack_node = node_count;
-   if (devinfo->gen >= 8 && dispatch_width == 8)
+   if (devinfo->gen >= 8 && dispatch_width >= 8)


dispatch_width is always >= 8.


  node_count ++;
   struct ra_graph *g =
  ra_alloc_interference_graph(compiler->fs_reg_sets[rsi].regs, node_count);
@@ -656,7 +656,7 @@ fs_visitor::assign_regs(bool allow_spilling, bool 
spill_all)

  }
   }

-   if (devinfo->gen >= 8 && dispatch_width == 8) {
+   if (devinfo->gen >= 8 && dispatch_width >= 8) {


Same here


  /* At Intel Broadwell PRM, vol 07, section "Instruction Set Reference",
   * subsection "EUISA Instructions", Send Message (page 990):
   *
@@ -665,12 +665,9 @@ fs_visitor::assign_regs(bool allow_spilling, bool 
spill_all)

   *
   * We are avoiding using grf127 as part of the destination of send
   * messages adding a node interference to the grf127_send_hack_node.
-   * This node has a fixed asignment to grf127.
-   *
-   * We don't apply it to SIMD16 because previous code avoids any register
-   * overlap between sources and destination.
+   * This node has a fixed assignment that overlaps with grf127.
   */
-  ra_set_node_reg(g, grf127_send_hack_node, 127);
+  ra_set_node_reg(g, grf127_send_hack_node, 128 - reg_width);
  foreach_block_and_inst(block, fs_inst, inst, cfg) {
 if (inst->is_send_from_grf() && inst->dst.file == VGRF) {
ra_add_node_interference(g, inst->dst.nr, grf127_send_hack_node);
--
2.18.0

___
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] [RFC] i965/fs: Generalize grf127 hack to dispatch_width > 8

2018-07-10 Thread Caio Marcelo de Oliveira Filho
Change the hack to always apply, adjusting the register number
according to the dispatch_width.

The original change assumed that given for dispatch_width > 8 we
already prevent the overlap of source and destination for send, it
would not be necessary to explicitly add an interference with a
register that covers r127.

The problem is that the code for spilling registers ends up generating
scratch reads, that in Gen7+ will reuse the destination register,
causing a send with both source and destination overlaping. So prevent
r127 (or the overlapping wider register) to be used as destination for
sends.

This patch fixes piglit test
tests/spec/arb_compute_shader/linker/bug-93840.shader_test.

Fixes: 232ed898021 "i965/fs: Register allocator shoudn't use grf127 for sends 
dest"
---

After more digging on the piglit failure, I came up with this
patch. I'm still seeing crashes with for some shader-db executions
(master have them too), but didn't have time today to drill into them.

 src/intel/compiler/brw_fs_reg_allocate.cpp | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/intel/compiler/brw_fs_reg_allocate.cpp 
b/src/intel/compiler/brw_fs_reg_allocate.cpp
index 59e047483c0..417ddeba09c 100644
--- a/src/intel/compiler/brw_fs_reg_allocate.cpp
+++ b/src/intel/compiler/brw_fs_reg_allocate.cpp
@@ -549,7 +549,7 @@ fs_visitor::assign_regs(bool allow_spilling, bool spill_all)
if (devinfo->gen >= 7)
   node_count += BRW_MAX_GRF - GEN7_MRF_HACK_START;
int grf127_send_hack_node = node_count;
-   if (devinfo->gen >= 8 && dispatch_width == 8)
+   if (devinfo->gen >= 8 && dispatch_width >= 8)
   node_count ++;
struct ra_graph *g =
   ra_alloc_interference_graph(compiler->fs_reg_sets[rsi].regs, node_count);
@@ -656,7 +656,7 @@ fs_visitor::assign_regs(bool allow_spilling, bool spill_all)
   }
}
 
-   if (devinfo->gen >= 8 && dispatch_width == 8) {
+   if (devinfo->gen >= 8 && dispatch_width >= 8) {
   /* At Intel Broadwell PRM, vol 07, section "Instruction Set Reference",
* subsection "EUISA Instructions", Send Message (page 990):
*
@@ -665,12 +665,9 @@ fs_visitor::assign_regs(bool allow_spilling, bool 
spill_all)
*
* We are avoiding using grf127 as part of the destination of send
* messages adding a node interference to the grf127_send_hack_node.
-   * This node has a fixed asignment to grf127.
-   *
-   * We don't apply it to SIMD16 because previous code avoids any register
-   * overlap between sources and destination.
+   * This node has a fixed assignment that overlaps with grf127.
*/
-  ra_set_node_reg(g, grf127_send_hack_node, 127);
+  ra_set_node_reg(g, grf127_send_hack_node, 128 - reg_width);
   foreach_block_and_inst(block, fs_inst, inst, cfg) {
  if (inst->is_send_from_grf() && inst->dst.file == VGRF) {
 ra_add_node_interference(g, inst->dst.nr, grf127_send_hack_node);
-- 
2.18.0

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


Re: [Mesa-dev] [PATCH v2 45/49] meson: Use python module to find python2 on windows

2018-07-10 Thread Dylan Baker
I did something bad while rebasing this apparently...

Quoting Dylan Baker (2018-07-10 16:18:13)
> The python installer on Windows installs two `python.exe`, one for
> python2 and one for python3 and no `python2.exe` nor `python3.exe`.
> 
> This seems utterly broken to me, but luckily for us meson handles this
> craziness for us, but only since version 0.46.
> 
> This is higher than we require for now, but since we only need this on
> Windows, I suggest bumping the required version only on windows, and
> leaving all the other OSes as is.
> 
> (Note: some future version of Meson (0.48 probably) will handle this
>  internally in the find_program() call.)
> 
> Reported-by: Alexander Ashevchenko 
> Cc: Mathieu Bridon 
> Signed-off-by: Eric Engestrom 
> Reviewed-by: Dylan Baker 
> ---
>  meson.build | 31 ++-
>  1 file changed, 30 insertions(+), 1 deletion(-)
> 
> diff --git a/meson.build b/meson.build
> index dfb7fe8c900..f63fd9b6926 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -710,7 +710,15 @@ if with_platform_haiku
>pre_args += '-DHAVE_HAIKU_PLATFORM'
>  endif
>  
> -prog_python2 = find_program('python2')
> +if build_machine.system() == 'windows'
> +  if meson.version().version_compare('< 0.46')
> +error('Windows requires Meson 0.46+; please update and try again.')
> +  else
> +prog_python2 = import('python').find_installation('python2')
> +  endif
> +else
> +  prog_python2 = find_program('python2')
> +endif
>  has_mako = run_command(prog_python2, '-c', 'import mako')
>  if has_mako.returncode() != 0
>error('Python (2.x) mako module required to build mesa.')
> @@ -879,6 +887,27 @@ else
>endforeach
>  endif
>  
> +# set linker arguments
> +if host_machine.system() == 'windows'
> +  if cc.get_id() == 'msvc'
> +add_project_link_arguments(
> +  '/fixed:no',
> +  '/incremental:no',
> +  '/dynamicbase',
> +  '/nxcompat',
> +  language : ['c', 'cpp'],
> +)
> +  else
> +add_project_link_arguments(
> +  '-Wl,--nxcompat',
> +  '-Wl,--dynamicbase',
> +  '-static-libgcc',
> +  '-static-libstdc++',
> +  language : ['c', 'cpp'],
> +)
> +  endif
> +endif
> +
>  if host_machine.cpu_family().startswith('x86') and cc.get_id() != 'msvc'
>pre_args += '-DUSE_SSE41'
>with_sse41 = true
> -- 
> 2.18.0
> 


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


[Mesa-dev] [PATCH v2 34/49] meson: don't define GLX_USE_TLS for windows

2018-07-10 Thread Dylan Baker
Because the macros for exporting dll symbols and using TLS are mutually
exclusive.
---
 meson.build | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 5a6c08c8570..dfb7fe8c900 100644
--- a/meson.build
+++ b/meson.build
@@ -329,7 +329,10 @@ if with_egl and not (with_platform_drm or 
with_platform_surfaceless)
   endif
 endif
 
-pre_args += '-DGLX_USE_TLS'
+if host_machine.system() != 'windows'
+  # On windows Thread local storage and dll export are mutually exclusive
+  pre_args += '-DGLX_USE_TLS'
+endif
 if with_glx != 'disabled'
   if not (with_platform_x11 and with_any_opengl)
 error('Cannot build GLX support without X11 platform support and at least 
one OpenGL API')
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 24/49] meson: Add support for wrapping llvm

2018-07-10 Thread Dylan Baker
For building on Windows (when not using cygwin), the assumption is that
LLVM will have to be handled via a binary wrap. In this case the user
wanting to use LLVM is this way will need to create a directory in
subprojects (any name is fine), and pass that name via the -Dllvm-wrap
option (for example, assuming subprojects/llvm, -Dllvm-wrap=llvm), which
must have a meson.build file and the installed LLVM to link with (this
can be either static or dynamic). There is documentation for what this
needs to look like and how to define it.

v2: - Use  in html docs
---
 docs/meson.html   |  66 
 meson.build   | 147 ++
 meson_options.txt |   6 +
 .../drivers/swr/rasterizer/jitter/meson.build |  13 +-
 4 files changed, 163 insertions(+), 69 deletions(-)

diff --git a/docs/meson.html b/docs/meson.html
index 29907a60a9c..b64ca2ec35e 100644
--- a/docs/meson.html
+++ b/docs/meson.html
@@ -132,6 +132,72 @@ dependency interface. It will search $PATH 
(or %PATH%
 llvm-config, so using an LLVM from a non-standard path is as easy as
 PATH=/path/with/llvm-config:$PATH meson build.
 
+
+On windows (and in other cases), using llvm-config is either undesirable
+or impossible. Meson's solution for this is a
+http://mesonbuild.com/Wrap-dependency-system-manual.html;>wrap, in
+this case a "binary wrap". Follow the steps below:
+
+Install the binaries and headers into a directory under the 
$mesa_src/subprojects
+Add a meson build.build file to that directory (more on that 
later)
+add -Dllvm-wrap=$directory to your meson configuration 
(where $directory is the the directory under subprojects
+
+
+The wrap file must define the following:
+
+ext_llvm: a declare_dependency() object with 
include_directories, dependencies, and version set)
+
+
+It may also define:
+
+irbuilder_h: a file() object pointing to 
llvm/IR/IRBuilder.h (for SWR)
+
+
+such a meson.build file might look like:
+
+project('llvm', ['cpp'])
+
+cpp = meson.get_compiler('cpp')
+
+_deps = []
+_search = join_paths(meson.current_source_dir(), 'lib')
+foreach d : ['libLLVMCodeGen', 'libLLVMScalarOpts', 'libLLVMAnalysis',
+ 'libLLVMTransformUtils', 'libLLVMCore', 'libLLVMX86CodeGen',
+ 'libLLVMSelectionDAG', 'libLLVMipo', 'libLLVMAsmPrinter',
+ 'libLLVMInstCombine', 'libLLVMInstrumentation', 'libLLVMMC',
+ 'libLLVMGlobalISel', 'libLLVMObjectYAML', 'libLLVMDebugInfoPDB',
+ 'libLLVMVectorize', 'libLLVMPasses', 'libLLVMSupport',
+ 'libLLVMLTO', 'libLLVMObject', 'libLLVMDebugInfoCodeView',
+ 'libLLVMDebugInfoDWARF', 'libLLVMOrcJIT', 'libLLVMProfileData',
+ 'libLLVMObjCARCOpts', 'libLLVMBitReader', 'libLLVMCoroutines',
+ 'libLLVMBitWriter', 'libLLVMRuntimeDyld', 'libLLVMMIRParser',
+ 'libLLVMX86Desc', 'libLLVMAsmParser', 'libLLVMTableGen',
+ 'libLLVMFuzzMutate', 'libLLVMLinker', 'libLLVMMCParser',
+ 'libLLVMExecutionEngine', 'libLLVMCoverage', 'libLLVMInterpreter',
+ 'libLLVMTarget', 'libLLVMX86AsmParser', 'libLLVMSymbolize',
+ 'libLLVMDebugInfoMSF', 'libLLVMMCJIT', 'libLLVMXRay',
+ 'libLLVMX86AsmPrinter', 'libLLVMX86Disassembler',
+ 'libLLVMMCDisassembler', 'libLLVMOption', 'libLLVMIRReader',
+ 'libLLVMLibDriver', 'libLLVMDlltoolDriver', 'libLLVMDemangle',
+ 'libLLVMBinaryFormat', 'libLLVMLineEditor',
+ 'libLLVMWindowsManifest', 'libLLVMX86Info', 'libLLVMX86Utils']
+  _deps += cpp.find_library(d, dirs : _search)
+endforeach
+
+ext_llvm = declare_dependency(
+  include_directories : include_directories('include'),
+  dependencies : _deps,
+  version : '6.0.0',
+)
+
+irbuilder_h = files('include/llvm/IR/IRBuilder.h')
+
+
+It is very important that version is defined and is accurate, if it is not,
+workarounds for the wrong version of LLVM might be used resulting in build
+failures.
+
+
 
 
 
diff --git a/meson.build b/meson.build
index 9d9adffac4b..12b4811c953 100644
--- a/meson.build
+++ b/meson.build
@@ -1193,22 +1193,6 @@ if dep_libdrm.found()
   endif
 endif
 
-llvm_modules = ['bitwriter', 'engine', 'mcdisassembler', 'mcjit']
-llvm_optional_modules = []
-if with_amd_vk or with_gallium_radeonsi or with_gallium_r600
-  llvm_modules += ['amdgpu', 'bitreader', 'ipo']
-  if with_gallium_r600
-llvm_modules += 'asmparser'
-  endif
-endif
-if with_gallium_opencl
-  llvm_modules += [
-'all-targets', 'linker', 'coverage', 'instrumentation', 'ipo', 'irreader',
-'lto', 'option', 'objcarcopts', 'profiledata',
-  ]
-  llvm_optional_modules += ['coroutines', 'opencl']
-endif
-
 if with_amd_vk or with_gallium_radeonsi or with_gallium_swr
   _llvm_version = '>= 5.0.0'
 elif with_gallium_opencl or with_gallium_r600
@@ -1218,59 +1202,94 @@ else
 endif
 
 _llvm = get_option('llvm')
-if _llvm == 'auto'
-  dep_llvm = dependency(
-

[Mesa-dev] [PATCH v2 41/49] meosn: don't build gallium trivial tests on windows

2018-07-10 Thread Dylan Baker
They require the pipe-loaders, which require xmlconfig, which doesn't
build with msvc.
---
 src/gallium/tests/meson.build | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/tests/meson.build b/src/gallium/tests/meson.build
index 0ee04350c87..15b9f549647 100644
--- a/src/gallium/tests/meson.build
+++ b/src/gallium/tests/meson.build
@@ -18,7 +18,10 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-subdir('trivial')
+if not with_platform_windows
+  # pipe-loader doesn't build on windows.
+  subdir('trivial')
+endif
 if with_gallium_softpipe
   subdir('unit')
 endif
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 44/49] meson: don't build or run mesa-sha1 test on windows

2018-07-10 Thread Dylan Baker
It crashes hard (pop-up window and all).
---
 src/util/meson.build | 21 -
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/util/meson.build b/src/util/meson.build
index 27a6fc118e5..27e1fae41a9 100644
--- a/src/util/meson.build
+++ b/src/util/meson.build
@@ -150,16 +150,19 @@ if with_tests
 )
   )
 
-  test(
-'mesa-sha1',
-executable(
-  'mesa-sha1_test',
-  files('mesa-sha1_test.c'),
-  include_directories : inc_common,
-  link_with : libmesa_util,
-  c_args : [c_msvc_compat_args],
+  if host_machine.system() != 'windows'
+# this test doesn't work on windows
+test(
+  'mesa-sha1',
+  executable(
+'mesa-sha1_test',
+files('mesa-sha1_test.c'),
+include_directories : inc_common,
+link_with : libmesa_util,
+c_args : [c_msvc_compat_args],
+  )
 )
-  )
+  endif
 
   subdir('tests/hash_table')
   subdir('tests/string_buffer')
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 45/49] meson: Use python module to find python2 on windows

2018-07-10 Thread Dylan Baker
The python installer on Windows installs two `python.exe`, one for
python2 and one for python3 and no `python2.exe` nor `python3.exe`.

This seems utterly broken to me, but luckily for us meson handles this
craziness for us, but only since version 0.46.

This is higher than we require for now, but since we only need this on
Windows, I suggest bumping the required version only on windows, and
leaving all the other OSes as is.

(Note: some future version of Meson (0.48 probably) will handle this
 internally in the find_program() call.)

Reported-by: Alexander Ashevchenko 
Cc: Mathieu Bridon 
Signed-off-by: Eric Engestrom 
Reviewed-by: Dylan Baker 
---
 meson.build | 31 ++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index dfb7fe8c900..f63fd9b6926 100644
--- a/meson.build
+++ b/meson.build
@@ -710,7 +710,15 @@ if with_platform_haiku
   pre_args += '-DHAVE_HAIKU_PLATFORM'
 endif
 
-prog_python2 = find_program('python2')
+if build_machine.system() == 'windows'
+  if meson.version().version_compare('< 0.46')
+error('Windows requires Meson 0.46+; please update and try again.')
+  else
+prog_python2 = import('python').find_installation('python2')
+  endif
+else
+  prog_python2 = find_program('python2')
+endif
 has_mako = run_command(prog_python2, '-c', 'import mako')
 if has_mako.returncode() != 0
   error('Python (2.x) mako module required to build mesa.')
@@ -879,6 +887,27 @@ else
   endforeach
 endif
 
+# set linker arguments
+if host_machine.system() == 'windows'
+  if cc.get_id() == 'msvc'
+add_project_link_arguments(
+  '/fixed:no',
+  '/incremental:no',
+  '/dynamicbase',
+  '/nxcompat',
+  language : ['c', 'cpp'],
+)
+  else
+add_project_link_arguments(
+  '-Wl,--nxcompat',
+  '-Wl,--dynamicbase',
+  '-static-libgcc',
+  '-static-libstdc++',
+  language : ['c', 'cpp'],
+)
+  endif
+endif
+
 if host_machine.cpu_family().startswith('x86') and cc.get_id() != 'msvc'
   pre_args += '-DUSE_SSE41'
   with_sse41 = true
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 31/49] meson: for incluse of inttypes.h for glcpp with msvc

2018-07-10 Thread Dylan Baker
Because we provide a copy if MSVC doesn't, and we need it to make flex
do what we want.
---
 src/compiler/glsl/glcpp/meson.build | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/compiler/glsl/glcpp/meson.build 
b/src/compiler/glsl/glcpp/meson.build
index 09d44ddd687..80f51a3e48e 100644
--- a/src/compiler/glsl/glcpp/meson.build
+++ b/src/compiler/glsl/glcpp/meson.build
@@ -35,13 +35,23 @@ glcpp_lex = custom_target(
   command : [prog_flex, '-o', '@OUTPUT@', '@INPUT@'],
 )
 
+_extra_args = []
+if cpp.get_id() == 'msvc'
+  # Flex relies on __STDC_VERSION__>=199901L to decide when to include C99
+  # inttypes.h.  We always have inttypes.h available with MSVC (either the one
+  # bundled with MSVC 2013, or the one we bundle ourselves), but we can't just
+  # define __STDC_VERSION__ without breaking stuff, as MSVC doesn't fully
+  # support C99.  There's also no way to premptively include stdint.
+  _extra_args += '-FIinttypes.h'
+endif
+
 libglcpp = static_library(
   'glcpp',
   [glcpp_lex, glcpp_parse, files('glcpp.h', 'pp.c')],
   link_with : libmesa_util,
   include_directories : [inc_common],
-  c_args : [c_vis_args, no_override_init_args, c_msvc_compat_args],
-  cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
+  c_args : [c_vis_args, no_override_init_args, c_msvc_compat_args, 
_extra_args],
+  cpp_args : [cpp_vis_args, cpp_msvc_compat_args, _extra_args],
   build_by_default : false,
 )
 
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 38/49] glsl/tests: define ssize_t on windows

2018-07-10 Thread Dylan Baker
---
 src/compiler/glsl/tests/blob_test.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/compiler/glsl/tests/blob_test.c 
b/src/compiler/glsl/tests/blob_test.c
index 1cc97236e7e..21b8b1efdc1 100644
--- a/src/compiler/glsl/tests/blob_test.c
+++ b/src/compiler/glsl/tests/blob_test.c
@@ -28,6 +28,10 @@
 #include 
 #include 
 #include 
+#ifdef _MSC_VER
+#include 
+typedef SSIZE_T ssize_t;
+#endif
 
 #include "util/ralloc.h"
 #include "blob.h"
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 40/49] meson: Set visibility and compat args for graw

2018-07-10 Thread Dylan Baker
---
 src/gallium/targets/graw-gdi/meson.build  | 1 +
 src/gallium/targets/graw-null/meson.build | 2 ++
 src/gallium/targets/graw-xlib/meson.build | 1 +
 3 files changed, 4 insertions(+)

diff --git a/src/gallium/targets/graw-gdi/meson.build 
b/src/gallium/targets/graw-gdi/meson.build
index e04b454ab53..b742b0a11a2 100644
--- a/src/gallium/targets/graw-gdi/meson.build
+++ b/src/gallium/targets/graw-gdi/meson.build
@@ -21,6 +21,7 @@
 libgraw_gdi = shared_library(
   'graw',
   'graw_gdi.c',
+  c_args : [c_vis_args, c_msvc_compat_args],
   include_directories : [
 inc_include, inc_src, inc_gallium, inc_gallium_aux, inc_gallium_drivers,
 inc_gallium_winsys_sw,
diff --git a/src/gallium/targets/graw-null/meson.build 
b/src/gallium/targets/graw-null/meson.build
index 8a294f41307..0b7c6ff40e6 100644
--- a/src/gallium/targets/graw-null/meson.build
+++ b/src/gallium/targets/graw-null/meson.build
@@ -21,12 +21,14 @@
 libgraw_util = static_library(
   'graw_util',
   ['graw_util.c'],
+  c_args : [c_vis_args, c_msvc_compat_args],
   include_directories : inc_common,
 )
 
 libgraw_null = shared_library(
   'graw_null',
   ['graw_null.c'],
+  c_args : [c_vis_args, c_msvc_compat_args],
   include_directories : inc_common,
   link_with : [libmesa_util, libgallium],
 )
diff --git a/src/gallium/targets/graw-xlib/meson.build 
b/src/gallium/targets/graw-xlib/meson.build
index aab99ba64c1..13567355d2c 100644
--- a/src/gallium/targets/graw-xlib/meson.build
+++ b/src/gallium/targets/graw-xlib/meson.build
@@ -21,6 +21,7 @@
 libgraw_xlib = shared_library(
   'graw_xlib',
   ['graw_xlib.c'],
+  c_args : [c_vis_args],
   include_directories : [inc_common, inc_gallium_drivers, inc_gallium_winsys],
   link_with : [
 libgraw_util, libmesa_util, libgallium, libws_xlib
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 33/49] meson: add switches for SWR with MSVC

2018-07-10 Thread Dylan Baker
---
 src/gallium/drivers/swr/meson.build | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/swr/meson.build 
b/src/gallium/drivers/swr/meson.build
index b95c8bc1bf8..ec4d80e4bb2 100644
--- a/src/gallium/drivers/swr/meson.build
+++ b/src/gallium/drivers/swr/meson.build
@@ -191,6 +191,7 @@ swr_arch_defines = []
 
 swr_avx_args = cpp.first_supported_argument(
   '-target-cpu=sandybridge', '-mavx', '-march=core-avx', '-tp=sandybridge',
+  '/arch:AVX',
   prefix : '''
 #if !defined(__AVX__)
 # error
@@ -215,7 +216,7 @@ endif
 
 if with_swr_arches.contains('avx2')
   swr_avx2_args = cpp.first_supported_argument(
-'-target-cpu=haswell', '-march=core-avx2', '-tp=haswell',
+'-target-cpu=haswell', '-march=core-avx2', '-tp=haswell', '/arch:AVX2',
 prefix : '''
   #if !defined(__AVX2__)
   # error
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 49/49] meson: maintain names of shared API libraries

2018-07-10 Thread Dylan Baker
Mesa uses the lib prefix, and doesn't use a version for it's dynamic
libraries, which meson defaults to.

v2: - this patch
---
 src/mapi/es1api/meson.build   | 2 ++
 src/mapi/es2api/meson.build   | 2 ++
 src/mapi/shared-glapi/meson.build | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/src/mapi/es1api/meson.build b/src/mapi/es1api/meson.build
index 448cf1c73d2..4e4f35df969 100644
--- a/src/mapi/es1api/meson.build
+++ b/src/mapi/es1api/meson.build
@@ -46,7 +46,9 @@ libglesv1_cm = shared_library(
   include_directories : [inc_src, inc_include, inc_mapi],
   link_with : libglapi,
   dependencies : [dep_thread, dep_libdrm, dep_m, dep_dl],
+  soversion : host_machine.system() == 'windows' ? '' : '1',
   version : '1.0.0',
+  name_prefix : 'lib',
   install : true,
 )
 
diff --git a/src/mapi/es2api/meson.build b/src/mapi/es2api/meson.build
index cb6a70a2e90..a8d032672e2 100644
--- a/src/mapi/es2api/meson.build
+++ b/src/mapi/es2api/meson.build
@@ -46,7 +46,9 @@ libgles2 = shared_library(
   include_directories : [inc_src, inc_include, inc_mapi],
   link_with : libglapi,
   dependencies : [dep_thread, dep_libdrm, dep_m, dep_dl],
+  soversion : host_machine.system() == 'windows' ? '' : '2',
   version : '2.0.0',
+  name_prefix : 'lib',
   install : true,
 )
 
diff --git a/src/mapi/shared-glapi/meson.build 
b/src/mapi/shared-glapi/meson.build
index e1f68691b48..05459a5116e 100644
--- a/src/mapi/shared-glapi/meson.build
+++ b/src/mapi/shared-glapi/meson.build
@@ -53,7 +53,9 @@ libglapi = shared_library(
   link_args : [ld_args_gc_sections],
   include_directories : [inc_src, inc_include, inc_mapi],
   dependencies : [dep_thread, dep_selinux],
+  soversion : host_machine.system() == 'windows' ? '' : '0',
   version : '0.0.0',
+  name_prefix : 'lib',
   install : true,
 )
 
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 46/49] appveyor: Add support for meson as well as scons

2018-07-10 Thread Dylan Baker
---
 appveyor.yml | 28 +++-
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/appveyor.yml b/appveyor.yml
index 86440f0d76a..bdf1ba8388a 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -42,6 +42,9 @@ os: Visual Studio 2015
 environment:
   WINFLEXBISON_ARCHIVE: win_flex_bison-2.5.9.zip
   LLVM_ARCHIVE: llvm-5.0.1-msvc2015-mtd.7z
+  matrix:
+- BUILD_SYSTEM: meson
+- BUILD_SYSTEM: scons
 
 install:
 # Check pip
@@ -49,13 +52,16 @@ install:
 - python -m pip --version
 # Install Mako
 - python -m pip install Mako==1.0.6
-# Install pywin32 extensions, needed by SCons
-- python -m pip install pypiwin32
-# Install python wheels, necessary to install SCons via pip
-- python -m pip install wheel
-# Install SCons
-- python -m pip install scons==2.5.1
-- scons --version
+- if "%BUILD_SYSTEM%"=="scons" python -m pip install pypiwin32 wheel
+- if "%BUILD_SYSTEM%"=="scons" python -m pip install scons==2.5.1
+- if "%BUILD_SYSTEM%"=="scons" scons --version
+- if "%BUILD_SYSTEM%"=="meson" C:\Python36\python.exe -m pip install meson
+- if "%BUILD_SYSTEM%"=="meson" set Path=C:\Python36\Scripts;%Path%
+- if "%BUILD_SYSTEM%"=="meson" set Path=C:\Python27;%Path%
+- if "%BUILD_SYSTEM%"=="meson" meson.py --version
+- if "%BUILD_SYSTEM%"=="meson" cinst -y ninja pkgconfiglite
+- if "%BUILD_SYSTEM%"=="meson" ninja --version
+- if "%BUILD_SYSTEM%"=="meson" call "C:\Program Files (x86)\Microsoft Visual 
Studio 14.0\VC\vcvarsall.bat" x86_amd64
 # Install flex/bison
 - if not exist "%WINFLEXBISON_ARCHIVE%" appveyor DownloadFile 
"https://downloads.sourceforge.net/project/winflexbison/old_versions/%WINFLEXBISON_ARCHIVE%;
 - 7z x -y -owinflexbison\ "%WINFLEXBISON_ARCHIVE%" > nul
@@ -69,10 +75,14 @@ install:
 - set LLVM=%CD%\llvm
 
 build_script:
-- scons -j%NUMBER_OF_PROCESSORS% MSVC_VERSION=14.0 llvm=1
+- if "%BUILD_SYSTEM%"=="scons" scons -j%NUMBER_OF_PROCESSORS% 
MSVC_VERSION=14.0 llvm=1
+- if "%BUILD_SYSTEM%"=="meson" meson builddir -Dbuild-tests=true
+- if "%BUILD_SYSTEM%"=="meson" ninja -C builddir
 
 after_build:
-- scons -j%NUMBER_OF_PROCESSORS% MSVC_VERSION=14.0 llvm=1 check
+- if "%BUILD_SYSTEM%"=="scons" scons -j%NUMBER_OF_PROCESSORS% 
MSVC_VERSION=14.0 llvm=1 check
+# Doesn't work yet, a large number of tests fail
+#- if "%BUILD_SYSTEM%"=="meson" ninja -C builddir test
 
 
 # It's possible to setup notification here, as described in
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 39/49] nir/meson: fix c vs cpp args for nir test

2018-07-10 Thread Dylan Baker
Fixes: d1992255bb29054fa51763376d125183a9f602f3
   ("meson: Add build Intel "anv" vulkan driver")
Signed-off-by: Dylan Baker 
Reviewed-by: Eric Engestrom 
---
 src/compiler/nir/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/nir/meson.build b/src/compiler/nir/meson.build
index 28aa8de7014..64cadd3c2a9 100644
--- a/src/compiler/nir/meson.build
+++ b/src/compiler/nir/meson.build
@@ -235,7 +235,7 @@ if with_tests
 executable(
   'nir_control_flow_test',
   files('tests/control_flow_tests.cpp'),
-  c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
+  cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
   include_directories : [inc_common],
   dependencies : [dep_thread, idep_gtest, idep_nir],
   link_with : libmesa_util,
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 48/49] tests/vma: fix build with MSVC

2018-07-10 Thread Dylan Baker
---
 src/util/tests/vma/vma_random_test.cpp | 8 
 1 file changed, 8 insertions(+)

diff --git a/src/util/tests/vma/vma_random_test.cpp 
b/src/util/tests/vma/vma_random_test.cpp
index 1f194fcdf92..9246176cbf2 100644
--- a/src/util/tests/vma/vma_random_test.cpp
+++ b/src/util/tests/vma/vma_random_test.cpp
@@ -34,7 +34,15 @@
 #include 
 #include 
 
+#ifndef _WIN32
 #include 
+#else
+#define errx(code, msg, ...) \
+   do {  \
+  fprintf(stderr, msg, __VA_ARGS__); \
+  exit(code);\
+   } while (0);
+#endif
 
 #include "vma.h"
 
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 15/49] meson: Make shader-cache a trillean instead of boolean

2018-07-10 Thread Dylan Baker
So that it can be implicitly disabled on windows, where it doesn't
compile.

v2: - Use an auto-option rather than automagic.
- fix shader_cache check (== -> !=)
---
 meson.build   | 16 +---
 meson_options.txt |  5 +++--
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/meson.build b/meson.build
index ceda8af562b..756c2dad083 100644
--- a/meson.build
+++ b/meson.build
@@ -722,9 +722,19 @@ if get_option('buildtype') == 'debug'
   pre_args += '-DDEBUG'
 endif
 
-if get_option('shader-cache')
-  pre_args += '-DENABLE_SHADER_CACHE'
-elif with_amd_vk
+with_shader_cache = false
+_shader_cache = get_option('shader-cache')
+if _shader_cache != 'false'
+  if host_machine.system() == 'windows'
+if _shader_cache == 'true'
+  error('Shader Cache does not currently work on Windows')
+endif
+  else
+pre_args += '-DENABLE_SHADER_CACHE'
+with_shader_cache = true
+  endif
+endif
+if with_amd_vk and not with_shader_cache
   error('Radv requires shader cache support')
 endif
 
diff --git a/meson_options.txt b/meson_options.txt
index ccc3872b24e..a37c953d691 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -158,8 +158,9 @@ option(
 )
 option(
   'shader-cache',
-  type : 'boolean',
-  value : true,
+  type : 'combo',
+  value : 'auto',
+  choices : ['auto', 'true', 'false'],
   description : 'Build with on-disk shader cache support'
 )
 option(
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 35/49] meson: Add idep_getopt for tests

2018-07-10 Thread Dylan Baker
There are quite a few tests that require getopt, when using MSVC we need
to use the bundled version of getopt since there isn't a system version.
---
 src/compiler/glsl/glcpp/meson.build | 2 +-
 src/compiler/glsl/meson.build   | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/compiler/glsl/glcpp/meson.build 
b/src/compiler/glsl/glcpp/meson.build
index 80f51a3e48e..3ab8ddee7f0 100644
--- a/src/compiler/glsl/glcpp/meson.build
+++ b/src/compiler/glsl/glcpp/meson.build
@@ -58,7 +58,7 @@ libglcpp = static_library(
 glcpp = executable(
   'glcpp',
   'glcpp.c',
-  dependencies : [dep_m],
+  dependencies : [dep_m, idep_getopt],
   include_directories : [inc_common],
   link_with : [libglcpp, libglsl_util],
   c_args : [c_vis_args, no_override_init_args, c_msvc_compat_args],
diff --git a/src/compiler/glsl/meson.build b/src/compiler/glsl/meson.build
index 96536b80168..4cc6a6d1ee6 100644
--- a/src/compiler/glsl/meson.build
+++ b/src/compiler/glsl/meson.build
@@ -229,7 +229,7 @@ libglsl_standalone = static_library(
   cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
   include_directories : [inc_common],
   link_with : [libglsl, libglsl_util, libmesa_util],
-  dependencies : [dep_thread],
+  dependencies : [dep_thread, idep_getopt],
   build_by_default : false,
 )
 
@@ -238,7 +238,7 @@ glsl_compiler = executable(
   'main.cpp',
   c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
   cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
-  dependencies : [dep_clock, dep_thread],
+  dependencies : [dep_clock, dep_thread, idep_getopt],
   include_directories : [inc_common],
   link_with : [libglsl_standalone],
   build_by_default : with_tools.contains('glsl'),
@@ -252,7 +252,7 @@ glsl_test = executable(
   c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
   cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
   include_directories : [inc_common],
-  dependencies : [dep_clock, dep_thread],
+  dependencies : [dep_clock, dep_thread, idep_getopt],
   link_with : [libglsl, libglsl_standalone, libglsl_util],
   build_by_default : with_tools.contains('glsl'),
   install : with_tools.contains('glsl'),
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 43/49] meson: disable graw tests on mingw

2018-07-10 Thread Dylan Baker
I can't figure out why symbols are being exposed that shouldn't.
---
 src/gallium/tests/meson.build | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/gallium/tests/meson.build b/src/gallium/tests/meson.build
index 15b9f549647..1d08da2ac10 100644
--- a/src/gallium/tests/meson.build
+++ b/src/gallium/tests/meson.build
@@ -25,4 +25,8 @@ endif
 if with_gallium_softpipe
   subdir('unit')
 endif
-subdir('graw')
+if host_machine.system() == 'windows' and cpp.get_id() != 'gcc'
+  # This has linking errors I can't figure out with MinGW. works fine with
+  # MSVC, works fine with GCC on Linux.
+  subdir('graw')
+endif
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 26/49] util/xmlconfig: include strndup.h for windows

2018-07-10 Thread Dylan Baker
---
 src/util/xmlconfig.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/util/xmlconfig.c b/src/util/xmlconfig.c
index ba657294c1c..e204e52b71d 100644
--- a/src/util/xmlconfig.c
+++ b/src/util/xmlconfig.c
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include "strndup.h"
 #include "xmlconfig.h"
 #include "u_process.h"
 
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 47/49] appveyor: use chocolatey (cinst) to install winflexbison

2018-07-10 Thread Dylan Baker
v2: - fix typos in commit message
---
 appveyor.yml | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/appveyor.yml b/appveyor.yml
index bdf1ba8388a..ee08786685a 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -34,13 +34,11 @@ branches:
 clone_depth: 100
 
 cache:
-- win_flex_bison-2.5.9.zip
 - llvm-5.0.1-msvc2015-mtd.7z
 
 os: Visual Studio 2015
 
 environment:
-  WINFLEXBISON_ARCHIVE: win_flex_bison-2.5.9.zip
   LLVM_ARCHIVE: llvm-5.0.1-msvc2015-mtd.7z
   matrix:
 - BUILD_SYSTEM: meson
@@ -63,9 +61,7 @@ install:
 - if "%BUILD_SYSTEM%"=="meson" ninja --version
 - if "%BUILD_SYSTEM%"=="meson" call "C:\Program Files (x86)\Microsoft Visual 
Studio 14.0\VC\vcvarsall.bat" x86_amd64
 # Install flex/bison
-- if not exist "%WINFLEXBISON_ARCHIVE%" appveyor DownloadFile 
"https://downloads.sourceforge.net/project/winflexbison/old_versions/%WINFLEXBISON_ARCHIVE%;
-- 7z x -y -owinflexbison\ "%WINFLEXBISON_ARCHIVE%" > nul
-- set Path=%CD%\winflexbison;%Path%
+- cinst -y winflexbison
 - win_flex --version
 - win_bison --version
 # Download and extract LLVM
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 30/49] meson: make nm binary optional

2018-07-10 Thread Dylan Baker
This makes nm not required, but used if found. In general I imagine that
this means that on windows nm wont be found, and on other platforms it
will.

v2: - fix gbm and egl symbols check tests to only be run if nm is found
- reword commit message to reflect the code change
---
 meson.build | 5 -
 src/egl/meson.build | 2 +-
 src/gbm/meson.build | 2 +-
 src/mapi/es1api/meson.build | 2 +-
 src/mapi/es2api/meson.build | 2 +-
 5 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/meson.build b/meson.build
index 164917eae1a..4a57cc12bb3 100644
--- a/meson.build
+++ b/meson.build
@@ -1526,8 +1526,11 @@ endif
 
 pkg = import('pkgconfig')
 
+prog_nm = find_program('nm', required : false)
 env_test = environment()
-env_test.set('NM', find_program('nm').path())
+if prog_nm.found()
+  env_test.set('NM', prog_nm.path())
+endif
 
 subdir('include')
 subdir('bin')
diff --git a/src/egl/meson.build b/src/egl/meson.build
index 5f30bbba89a..4f26cefe361 100644
--- a/src/egl/meson.build
+++ b/src/egl/meson.build
@@ -194,7 +194,7 @@ pkg.generate(
   extra_cflags : gl_pkgconfig_c_flags,
 )
 
-if with_tests
+if with_tests and prog_nm.found()
   if with_glvnd
 # TODO: add glvnd symbol check
   else
diff --git a/src/gbm/meson.build b/src/gbm/meson.build
index 2e9d380c0b4..97516dfbc6c 100644
--- a/src/gbm/meson.build
+++ b/src/gbm/meson.build
@@ -68,7 +68,7 @@ pkg.generate(
   libraries_private : '-ldl',  # FIXME: autotools lists this a incomplete
 )
 
-if with_tests
+if with_tests and prog_nm.found()
   test(
 'gbm-symbols-check',
 find_program('gbm-symbols-check'),
diff --git a/src/mapi/es1api/meson.build b/src/mapi/es1api/meson.build
index dcf0aa57492..448cf1c73d2 100644
--- a/src/mapi/es1api/meson.build
+++ b/src/mapi/es1api/meson.build
@@ -59,7 +59,7 @@ pkg.generate(
   libraries_private : gl_priv_libs,
 )
 
-if with_tests
+if with_tests and prog_nm.found()
   test(
 'es1-ABI-check',
 find_program('ABI-check'),
diff --git a/src/mapi/es2api/meson.build b/src/mapi/es2api/meson.build
index abd633fbb6b..cb6a70a2e90 100644
--- a/src/mapi/es2api/meson.build
+++ b/src/mapi/es2api/meson.build
@@ -59,7 +59,7 @@ pkg.generate(
   libraries_private : gl_priv_libs,
 )
 
-if with_tests
+if with_tests and prog_nm.found()
   test(
 'es2-ABI-check',
 find_program('ABI-check'),
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 37/49] meson: Don't build glsl cache_test for windows

2018-07-10 Thread Dylan Baker
v2: - Use new with_shader_cache variable instead of
  host_machine.system() == 'windows'
---
 src/compiler/glsl/tests/meson.build | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/compiler/glsl/tests/meson.build 
b/src/compiler/glsl/tests/meson.build
index fc7b863a278..a08e9fcb904 100644
--- a/src/compiler/glsl/tests/meson.build
+++ b/src/compiler/glsl/tests/meson.build
@@ -29,18 +29,19 @@ test(
   )
 )
 
-test(
-  'cache_test',
-  executable(
+if with_shader_cache
+  test(
 'cache_test',
-'cache_test.c',
-c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
-include_directories : [inc_common, inc_glsl],
-link_with : [libglsl],
-dependencies : [dep_clock, dep_thread],
+executable(
+  'cache_test',
+  'cache_test.c',
+  c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
+  include_directories : [inc_common, inc_glsl],
+  link_with : [libglsl],
+  dependencies : [dep_clock, dep_thread],
+)
   )
-)
-
+endif
 
 test(
   'general_ir_test',
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 23/49] meson: Don't check for posix_memalign on windows

2018-07-10 Thread Dylan Baker
There's a mingw bug for this, it exports __builtin_posix_memalign but
not posix_memalign, so the check will succeed, but compiling will fail.
---
 meson.build | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index 756c2dad083..9d9adffac4b 100644
--- a/meson.build
+++ b/meson.build
@@ -1014,13 +1014,22 @@ foreach h : ['xlocale.h', 'sys/sysctl.h', 
'linux/futex.h', 'endian.h']
 pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify())
   endif
 endforeach
-
-foreach f : ['strtof', 'mkostemp', 'posix_memalign', 'timespec_get', 
'memfd_create']
+foreach f : ['strtof', 'mkostemp', 'timespec_get', 'memfd_create']
   if cc.has_function(f)
 pre_args += '-DHAVE_@0@'.format(f.to_upper())
   endif
 endforeach
 
+# MinGW provides a __builtin_posix_memalign function, but not a posix_memalign.
+# This means that this check will succeed, but then compilation will later
+# fail. MSVC doesn't have this function at all, so only check for it on
+# non-windows platforms.
+if host_machine.system() != 'windows'
+  if cc.has_function('posix_memalign')
+pre_args += '-DHAVE_POSIX_MEMALIGN'
+  endif
+endif
+
 # strtod locale support
 if cc.links('''
 #define _GNU_SOURCE
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 28/49] meson: don't look for rt on windows

2018-07-10 Thread Dylan Baker
---
 meson.build | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 12b4811c953..03b37708ee2 100644
--- a/meson.build
+++ b/meson.build
@@ -1101,7 +1101,9 @@ elif with_dri_i965 and get_option('shader-cache')
 endif
 
 # Determine whether or not the rt library is needed for time functions
-if cc.has_function('clock_gettime')
+if host_machine.system() == 'windows'
+  dep_clock = null_dep
+elif cc.has_function('clock_gettime')
   dep_clock = null_dep
 else
   dep_clock = cc.find_library('rt')
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 25/49] docs/meson.html: fix numerous issues spotted by xmllint

2018-07-10 Thread Dylan Baker
---
 docs/meson.html | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/docs/meson.html b/docs/meson.html
index b64ca2ec35e..d4b1861ff26 100644
--- a/docs/meson.html
+++ b/docs/meson.html
@@ -1,9 +1,9 @@
 http://www.w3.org/TR/html4/loose.dtd;>
 
 
-  
+  
   Compilation and Installation using Meson
-  
+  
 
 
 
@@ -247,7 +247,6 @@ is unrelated to the buildtype; setting the 
latter to
 
 
 
-
 
 
 
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 19/49] meson: build wgl state tracker

2018-07-10 Thread Dylan Baker
---
 src/gallium/meson.build|  3 ++
 src/gallium/state_trackers/wgl/meson.build | 50 ++
 2 files changed, 53 insertions(+)
 create mode 100644 src/gallium/state_trackers/wgl/meson.build

diff --git a/src/gallium/meson.build b/src/gallium/meson.build
index 7754dbdee3c..a4f28dc4757 100644
--- a/src/gallium/meson.build
+++ b/src/gallium/meson.build
@@ -191,6 +191,9 @@ if with_gallium_st_nine
   subdir('state_trackers/nine')
   subdir('targets/d3dadapter9')
 endif
+if with_platform_windows
+  subdir('state_trackers/wgl')
+endif
 if with_tests
   subdir('targets/graw-null')
   if with_glx == 'gallium-xlib'
diff --git a/src/gallium/state_trackers/wgl/meson.build 
b/src/gallium/state_trackers/wgl/meson.build
new file mode 100644
index 000..d78d2b02e83
--- /dev/null
+++ b/src/gallium/state_trackers/wgl/meson.build
@@ -0,0 +1,50 @@
+# Copyright © 2018 Intel Corporation
+
+# 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.
+
+inc_wgl = include_directories('.')
+
+libwgl = static_library(
+  'wgl',
+  files(
+'stw_context.c',
+'stw_device.c',
+'stw_ext_context.c',
+'stw_ext_extensionsstring.c',
+'stw_ext_pbuffer.c',
+'stw_ext_pixelformat.c',
+'stw_ext_rendertexture.c',
+'stw_ext_swapinterval.c',
+'stw_framebuffer.c',
+'stw_getprocaddress.c',
+'stw_nopfuncs.c',
+'stw_nopfuncs.h',
+'stw_pixelformat.c',
+'stw_st.c',
+'stw_tls.c',
+'stw_wgl.c',
+  ),
+  c_args : [
+'-D_GDI32_', '-DBUILD_GL32', '-DWIN32_LEAN_AND_MEAN',
+'-D_GLAPI_NO_EXPORTS', # XXX: only without gles
+  ],
+  include_directories : [
+inc_include, inc_src, inc_gallium, inc_gallium_aux, inc_mapi, inc_mesa,
+  ],
+)
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 36/49] util/tests: Use define instead of VLA

2018-07-10 Thread Dylan Baker
To allow the this test to be built with MSVC, which doesn't support
VLAs.
---
 src/util/tests/hash_table/clear.c | 13 +++--
 src/util/tests/hash_table/delete_management.c | 13 +++--
 src/util/tests/hash_table/insert_many.c   | 11 ++-
 src/util/tests/hash_table/meson.build |  1 +
 src/util/tests/hash_table/random_entry.c  |  7 ---
 src/util/tests/string_buffer/meson.build  |  1 +
 6 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/src/util/tests/hash_table/clear.c 
b/src/util/tests/hash_table/clear.c
index 526700bfb0f..19494844608 100644
--- a/src/util/tests/hash_table/clear.c
+++ b/src/util/tests/hash_table/clear.c
@@ -23,6 +23,8 @@
 
 #include "hash_table.h"
 
+#define SIZE 1000
+
 static void *make_key(uint32_t i)
 {
   return (void *)(uintptr_t)(1 + i);
@@ -54,13 +56,12 @@ int main()
 {
struct hash_table *ht;
struct hash_entry *entry;
-   const uint32_t size = 1000;
-   bool flags[size];
+   bool flags[SIZE];
uint32_t i;
 
ht = _mesa_hash_table_create(NULL, key_hash, key_equal);
 
-   for (i = 0; i < size; ++i) {
+   for (i = 0; i < SIZE; ++i) {
   flags[i] = false;
   _mesa_hash_table_insert(ht, make_key(i), [i]);
}
@@ -70,19 +71,19 @@ int main()
 
/* Check that delete_function was called and that repopulating the table
 * works. */
-   for (i = 0; i < size; ++i) {
+   for (i = 0; i < SIZE; ++i) {
   assert(flags[i]);
   flags[i] = false;
   _mesa_hash_table_insert(ht, make_key(i), [i]);
}
 
/* Check that exactly the right set of entries is in the table. */
-   for (i = 0; i < size; ++i) {
+   for (i = 0; i < SIZE; ++i) {
   assert(_mesa_hash_table_search(ht, make_key(i)));
}
 
hash_table_foreach(ht, entry) {
-  assert(key_id(entry->key) < size);
+  assert(key_id(entry->key) < SIZE);
}
 
_mesa_hash_table_destroy(ht, NULL);
diff --git a/src/util/tests/hash_table/delete_management.c 
b/src/util/tests/hash_table/delete_management.c
index 127d81b3ca9..e3be9fb3d99 100644
--- a/src/util/tests/hash_table/delete_management.c
+++ b/src/util/tests/hash_table/delete_management.c
@@ -30,6 +30,8 @@
 #include 
 #include "hash_table.h"
 
+#define SIZE 1
+
 static uint32_t
 key_value(const void *key)
 {
@@ -47,8 +49,7 @@ main(int argc, char **argv)
 {
struct hash_table *ht;
struct hash_entry *entry;
-   unsigned size = 1;
-   uint32_t keys[size];
+   uint32_t keys[SIZE];
uint32_t i;
 
(void) argc;
@@ -56,7 +57,7 @@ main(int argc, char **argv)
 
ht = _mesa_hash_table_create(NULL, key_value, uint32_t_key_equals);
 
-   for (i = 0; i < size; i++) {
+   for (i = 0; i < SIZE; i++) {
   keys[i] = i;
 
   _mesa_hash_table_insert(ht, keys + i, NULL);
@@ -69,7 +70,7 @@ main(int argc, char **argv)
}
 
/* Make sure that all our entries were present at the end. */
-   for (i = size - 100; i < size; i++) {
+   for (i = SIZE - 100; i < SIZE; i++) {
   entry = _mesa_hash_table_search(ht, keys + i);
   assert(entry);
   assert(key_value(entry->key) == i);
@@ -79,8 +80,8 @@ main(int argc, char **argv)
for (entry = _mesa_hash_table_next_entry(ht, NULL);
 entry != NULL;
 entry = _mesa_hash_table_next_entry(ht, entry)) {
-  assert(key_value(entry->key) >= size - 100 &&
- key_value(entry->key) < size);
+  assert(key_value(entry->key) >= SIZE - 100 &&
+ key_value(entry->key) < SIZE);
}
assert(ht->entries == 100);
 
diff --git a/src/util/tests/hash_table/insert_many.c 
b/src/util/tests/hash_table/insert_many.c
index b07e40842bf..6bd35d5c0c7 100644
--- a/src/util/tests/hash_table/insert_many.c
+++ b/src/util/tests/hash_table/insert_many.c
@@ -30,6 +30,8 @@
 #include 
 #include "hash_table.h"
 
+#define SIZE 1
+
 static uint32_t
 key_value(const void *key)
 {
@@ -47,8 +49,7 @@ main(int argc, char **argv)
 {
struct hash_table *ht;
struct hash_entry *entry;
-   unsigned size = 1;
-   uint32_t keys[size];
+   uint32_t keys[SIZE];
uint32_t i;
 
(void) argc;
@@ -56,18 +57,18 @@ main(int argc, char **argv)
 
ht = _mesa_hash_table_create(NULL, key_value, uint32_t_key_equals);
 
-   for (i = 0; i < size; i++) {
+   for (i = 0; i < SIZE; i++) {
   keys[i] = i;
 
   _mesa_hash_table_insert(ht, keys + i, NULL);
}
 
-   for (i = 0; i < size; i++) {
+   for (i = 0; i < SIZE; i++) {
   entry = _mesa_hash_table_search(ht, keys + i);
   assert(entry);
   assert(key_value(entry->key) == i);
}
-   assert(ht->entries == size);
+   assert(ht->entries == SIZE);
 
_mesa_hash_table_destroy(ht, NULL);
 
diff --git a/src/util/tests/hash_table/meson.build 
b/src/util/tests/hash_table/meson.build
index 4bbc5100ea3..38127013044 100644
--- a/src/util/tests/hash_table/meson.build
+++ b/src/util/tests/hash_table/meson.build
@@ -26,6 +26,7 @@ foreach t : ['clear', 'collision', 'delete_and_lookup', 
'delete_management',
 executable(
  

[Mesa-dev] [PATCH v2 21/49] meson: build graw-gdi target

2018-07-10 Thread Dylan Baker
---
 src/gallium/meson.build  |  4 ++-
 src/gallium/targets/graw-gdi/meson.build | 36 
 2 files changed, 39 insertions(+), 1 deletion(-)
 create mode 100644 src/gallium/targets/graw-gdi/meson.build

diff --git a/src/gallium/meson.build b/src/gallium/meson.build
index 5019477788b..e4e0b88e7fc 100644
--- a/src/gallium/meson.build
+++ b/src/gallium/meson.build
@@ -197,7 +197,9 @@ if with_platform_windows
 endif
 if with_tests
   subdir('targets/graw-null')
-  if with_glx == 'gallium-xlib'
+  if with_platform_windows
+subdir('targets/graw-gdi')
+  elif with_glx == 'gallium-xlib'
 subdir('targets/graw-xlib')
   endif
   subdir('tests')
diff --git a/src/gallium/targets/graw-gdi/meson.build 
b/src/gallium/targets/graw-gdi/meson.build
new file mode 100644
index 000..e04b454ab53
--- /dev/null
+++ b/src/gallium/targets/graw-gdi/meson.build
@@ -0,0 +1,36 @@
+# Copyright © 2018 Intel Corporation
+
+# 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.
+
+libgraw_gdi = shared_library(
+  'graw',
+  'graw_gdi.c',
+  include_directories : [
+inc_include, inc_src, inc_gallium, inc_gallium_aux, inc_gallium_drivers,
+inc_gallium_winsys_sw,
+  ],
+  link_with : [
+libgraw_util, libmesa_util, libgallium, libwsgdi,
+  ],
+  dependencies : [
+dep_ws2_32, driver_swrast,
+  ],
+)
+
+libgraw = libgraw_gdi
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 14/49] meson: add windows compiler checks and libraries

2018-07-10 Thread Dylan Baker
---
 meson.build | 129 
 1 file changed, 79 insertions(+), 50 deletions(-)

diff --git a/meson.build b/meson.build
index 4f4d4cf61bb..ceda8af562b 100644
--- a/meson.build
+++ b/meson.build
@@ -775,69 +775,96 @@ endif
 # TODO: this is very incomplete
 if ['linux', 'cygwin'].contains(host_machine.system())
   pre_args += '-D_GNU_SOURCE'
+elif host_machine.system() == 'windows'
+  pre_args += [
+'-D_WINDOWS', '-D_WIN32_WINNT=0x0601', '-D_WINVER=0x0601',
+'-DPIPE_SUBSYSTEM_WINDOWS_USER',
+'-D_USE_MATH_DEFINES',  # XXX: scons doesn't use this for mingw
+  ]
+  if cc.get_id() == 'msvc'
+pre_args += [
+  '-DVC_EXTRALEAN',
+  '-D_CRT_SECURE_NO_WARNINGS',
+  '-D_CRT_SECURE_NO_DEPRECATE',
+  '-D_SCL_SECURE_NO_WARNINGS',
+  '-D_SCL_SECURE_NO_DEPRECATE',
+  '-D_ALLOW_KEYWORD_MACROS',
+  '-D_HAS_EXCEPTIONS=0', # Tell C++ STL to not use exceptions
+]
+  else
+pre_args += ['-D__MSVCRT_VERSION__=0x0700']
+  endif
 endif
 
 # Check for generic C arguments
 c_args = []
-foreach a : ['-Wall', '-Werror=implicit-function-declaration',
- '-Werror=missing-prototypes', '-fno-math-errno',
- '-fno-trapping-math', '-Qunused-arguments']
-  if cc.has_argument(a)
-c_args += a
-  endif
-endforeach
-if cc.has_argument('-Wmissing-field-initializers')
-  c_args += '-Wno-missing-field-initializers'
-endif
-
 c_vis_args = []
-if cc.has_argument('-fvisibility=hidden')
-  c_vis_args += '-fvisibility=hidden'
-endif
-
-# Check for generic C++ arguments
+c_msvc_compat_args = []
+no_override_init_args = []
 cpp_args = []
-foreach a : ['-Wall', '-fno-math-errno', '-fno-trapping-math',
- '-Qunused-arguments']
-  if cpp.has_argument(a)
-cpp_args += a
+cpp_vis_args = []
+cpp_msvc_compat_args = []
+if cc.get_id() == 'msvc'
+  foreach a : ['/wd4018', '/wd4056', '/wd4244', '/wd4246', '/wd4305',
+   '/wd4351', '/wd4756', '/wd4800', '/wd4996']
+if cc.has_argument(a)
+  c_args += a
+endif
+if cpp.has_argument(a)
+  cpp_args += a
+endif
+  endforeach
+  if cc.has_argument('-Wmicrosoft-enum-value')  # Clang
+c_args += '-Wno-microsoft-enum-value'
+cpp_args += '-Wno-microsoft-enum-value'
   endif
-endforeach
-
-# For some reason, the test for -Wno-foo always succeeds with gcc, even if the
-# option is not supported. Hence, check for -Wfoo instead.
-
-foreach a : ['non-virtual-dtor', 'missing-field-initializers']
-  if cpp.has_argument('-W' + a)
-cpp_args += '-Wno-' + a
+else
+  foreach a : ['-Wall', '-Werror=implicit-function-declaration',
+   '-Werror=missing-prototypes', '-fno-math-errno',
+   '-fno-trapping-math', '-Qunused-arguments']
+if cc.has_argument(a)
+  c_args += a
+endif
+  endforeach
+  if cc.has_argument('-Wmissing-field-initializers')
+c_args += '-Wno-missing-field-initializers'
   endif
-endforeach
 
-no_override_init_args = []
-foreach a : ['override-init', 'initializer-overrides']
-  if cc.has_argument('-W' + a)
-no_override_init_args += '-Wno-' + a
+  c_vis_args = []
+  if cc.has_argument('-fvisibility=hidden')
+c_vis_args += '-fvisibility=hidden'
   endif
-endforeach
 
-cpp_vis_args = []
-if cpp.has_argument('-fvisibility=hidden')
-  cpp_vis_args += '-fvisibility=hidden'
-endif
+  # For some reason, the test for -Wno-foo always succeeds with gcc, even if
+  # the option is not supported. Hence, check for -Wfoo instead.
+  foreach a : ['non-virtual-dtor', 'missing-field-initializers']
+if cpp.has_argument('-W' + a)
+  cpp_args += '-Wno-' + a
+endif
+  endforeach
 
-# Check for C and C++ arguments for MSVC2013 compatibility. These are only used
-# in parts of the mesa code base that need to compile with old versions of
-# MSVC, mainly common code
-c_msvc_compat_args = []
-cpp_msvc_compat_args = []
-foreach a : ['-Werror=pointer-arith', '-Werror=vla']
-  if cc.has_argument(a)
-c_msvc_compat_args += a
-  endif
-  if cpp.has_argument(a)
-cpp_msvc_compat_args += a
+  foreach a : ['override-init', 'initializer-overrides']
+if cc.has_argument('-W' + a)
+  no_override_init_args += '-Wno-' + a
+endif
+  endforeach
+
+  if cpp.has_argument('-fvisibility=hidden')
+cpp_vis_args += '-fvisibility=hidden'
   endif
-endforeach
+
+  # Check for C and C++ arguments for MSVC2013 compatibility. These are only
+  # used in parts of the mesa code base that need to compile with old versions
+  # of MSVC, mainly common code
+  foreach a : ['-Werror=pointer-arith', '-Werror=vla']
+if cc.has_argument(a)
+  c_msvc_compat_args += a
+endif
+if cpp.has_argument(a)
+  cpp_msvc_compat_args += a
+endif
+  endforeach
+endif
 
 if host_machine.cpu_family().startswith('x86')
   pre_args += '-DUSE_SSE41'
@@ -896,6 +923,8 @@ if not cc.links('''#include 
   pre_args += '-DMISSING_64_BIT_ATOMICS'
 endif
 
+dep_ws2_32 = cc.find_library('ws2_32', required : with_platform_windows) 
+
 

[Mesa-dev] [PATCH v2 32/49] meson: disable sse4.1 optimizations with msvc

2018-07-10 Thread Dylan Baker
There isn't an obvious command line switch here, /arch:AVX *might* be
the right thing, but meson doesn't know what to do here either and
leaves the -msse4.1 and -mstackrealign.
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 4a57cc12bb3..5a6c08c8570 100644
--- a/meson.build
+++ b/meson.build
@@ -876,7 +876,7 @@ else
   endforeach
 endif
 
-if host_machine.cpu_family().startswith('x86')
+if host_machine.cpu_family().startswith('x86') and cc.get_id() != 'msvc'
   pre_args += '-DUSE_SSE41'
   with_sse41 = true
   sse41_args = ['-msse4.1']
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 12/49] meson: don't build glx or dri by default on windows

2018-07-10 Thread Dylan Baker
---
 meson.build | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index ce3b3406510..f29ffd65035 100644
--- a/meson.build
+++ b/meson.build
@@ -264,8 +264,12 @@ if with_glx == 'auto'
   elif with_platform_haiku
 with_glx = 'disabled'
   elif with_gallium
-# Even when building just gallium drivers the user probably wants dri
-with_glx = 'dri'
+if host_machine.system() == 'windows'
+  with_glx = 'disabled'
+else
+  # Even when building just gallium drivers the user probably wants dri
+  with_glx = 'dri'
+endif
   elif with_platform_x11 and with_any_opengl and not with_any_vk
 # The automatic behavior should not be to turn on xlib based glx when
 # building only vulkan drivers
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 29/49] meson: Add support for using win_flex and win_bison on windows

2018-07-10 Thread Dylan Baker
---
 meson.build | 27 +--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index 03b37708ee2..164917eae1a 100644
--- a/meson.build
+++ b/meson.build
@@ -1311,8 +1311,31 @@ endif
 
 # pthread stubs. Lets not and say we didn't
 
-prog_bison = find_program('bison', required : with_any_opengl)
-prog_flex = find_program('flex', required : with_any_opengl)
+if host_machine.system() == 'windows'
+  # Prefer the winflexbison versions, they're much easier to install and have
+  # better windows support.
+
+  prog_flex = find_program('win_flex', required : false)
+  if prog_flex.found()
+# windows compatibility (uses  instead of  and _isatty,
+# _fileno functions)
+prog_flex = [prog_flex, '--wincompat']
+  else
+prog_flex = [find_program('lex', 'flex', required : with_any_opengl)]
+  endif
+  # Force flex to use const keyword in prototypes, as relies on __cplusplus or
+  # __STDC__ macro to determine whether it's safe to use const keyword, but
+  # MSVC never defines __STDC__ unless we disable all MSVC extensions.
+  prog_flex += '-DYY_USE_CONST='
+
+  prog_bison = find_program('win_bison', required : false)
+  if not prog_bison.found()
+prog_bison = find_program('yacc', 'bison', required : with_any_opengl)
+  endif
+else
+  prog_bison = find_program('bison', required : with_any_opengl)
+  prog_flex = find_program('flex', required : with_any_opengl)
+endif
 
 dep_selinux = null_dep
 if get_option('selinux')
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 42/49] meson: Fix gtest linkage on msvc

2018-07-10 Thread Dylan Baker
We need to add an extra flag (/SUBSYSTEM:CONSOLE) to get the msvc linker
to find main() in a static library.
---
 src/gtest/meson.build | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/src/gtest/meson.build b/src/gtest/meson.build
index 91a49240416..ed0d6974bd3 100644
--- a/src/gtest/meson.build
+++ b/src/gtest/meson.build
@@ -25,7 +25,14 @@ libgtest = static_library(
   build_by_default : false,
 )
 
+_gtest_link_args = []
+if cpp.get_id() == 'msvc'
+  # required to use main() from a static library
+  _gtest_link_args += '/SUBSYSTEM:CONSOLE'
+endif
+
 idep_gtest = declare_dependency(
   link_with : libgtest,
+  link_args : _gtest_link_args,
   include_directories : include_directories('include', is_system : true),
 )
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 16/49] meson: Add windows defines to glapi

2018-07-10 Thread Dylan Baker
These are needed to control the export or symbols due to differences
between the way windows and *nix handle symbol exports.
---
 src/mapi/es1api/meson.build   | 10 +-
 src/mapi/es2api/meson.build   | 10 +-
 src/mapi/glapi/meson.build| 13 -
 src/mapi/shared-glapi/meson.build |  9 -
 4 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/src/mapi/es1api/meson.build b/src/mapi/es1api/meson.build
index 657dc2d9eff..dcf0aa57492 100644
--- a/src/mapi/es1api/meson.build
+++ b/src/mapi/es1api/meson.build
@@ -27,11 +27,19 @@ es1_glapi_mapi_tmp_h = custom_target(
   capture : true,
 )
 
+_es1_c_args = []
+if with_platform_windows
+  _es1_c_args += ['-D_GDI32_', '-DBUILD_GL32']
+endif
+
 libglesv1_cm = shared_library(
   'GLESv1_CM',
   ['../entry.c', es1_glapi_mapi_tmp_h],
   c_args : [
-c_msvc_compat_args, c_vis_args, '-DMAPI_MODE_BRIDGE',
+c_msvc_compat_args,
+c_vis_args,
+_es1_c_args,
+'-DMAPI_MODE_BRIDGE',
 '-DMAPI_ABI_HEADER="@0@"'.format(es1_glapi_mapi_tmp_h.full_path()),
   ],
   link_args : [ld_args_gc_sections],
diff --git a/src/mapi/es2api/meson.build b/src/mapi/es2api/meson.build
index da5198ed6e8..abd633fbb6b 100644
--- a/src/mapi/es2api/meson.build
+++ b/src/mapi/es2api/meson.build
@@ -27,11 +27,19 @@ es2_glapi_mapi_tmp_h = custom_target(
   capture : true,
 )
 
+_es2_c_args = []
+if with_platform_windows
+  _es2_c_args += ['-D_GDI32_', '-DBUILD_GL32']
+endif
+
 libgles2 = shared_library(
   'GLESv2',
   ['../entry.c', es2_glapi_mapi_tmp_h],
   c_args : [
-c_msvc_compat_args, c_vis_args, '-DMAPI_MODE_BRIDGE',
+c_msvc_compat_args,
+c_vis_args,
+_es2_c_args,
+'-DMAPI_MODE_BRIDGE',
 '-DMAPI_ABI_HEADER="@0@"'.format(es2_glapi_mapi_tmp_h.full_path()),
   ],
   link_args : [ld_args_gc_sections],
diff --git a/src/mapi/glapi/meson.build b/src/mapi/glapi/meson.build
index 2509e19eaa3..9ecc29ece31 100644
--- a/src/mapi/glapi/meson.build
+++ b/src/mapi/glapi/meson.build
@@ -25,7 +25,7 @@ inc_glapi = include_directories('.')
 static_glapi_files = []
 static_glapi_args = []
 
-if ['apple', 'windows'].contains(with_dri_platform)
+if with_dri and ['apple', 'windows'].contains(with_dri_platform)
   static_glapi_files += [glapi_gentable_c, glapitable_h]
 endif
 
@@ -45,8 +45,19 @@ if with_shared_glapi
 '-DMAPI_MODE_BRIDGE',
 '-DMAPI_ABI_HEADER="@0@"'.format(glapi_mapi_tmp_h.full_path()),
   ]
+  if with_platform_windows
+static_glapi_args += ['-D_GDI32_', '-DBUILD_GL32']
+  endif
 else
   static_glapi_args += '-DMAPI_MODE_UTIL'
+  if with_platform_windows
+static_glapi_args += ['-D_GDI32_', '-DBUILD_GL32', '-DKHRONOS_DLL_EXPORTS']
+if with_gles1 or with_gles2
+  static_glapi_args += '-D_GLAPI_DLL_EXPORTS'
+else
+  static_glapi_args += '-D_GLAPI_NO_EXPORTS'
+endif
+  endif
   static_glapi_files += files(
 'glapi_dispatch.c',
 'glapi_entrypoint.c',
diff --git a/src/mapi/shared-glapi/meson.build 
b/src/mapi/shared-glapi/meson.build
index c7d136ced2c..e1f68691b48 100644
--- a/src/mapi/shared-glapi/meson.build
+++ b/src/mapi/shared-glapi/meson.build
@@ -36,11 +36,18 @@ shared_glapi_mapi_tmp_h = custom_target(
   capture : true,
 )
 
+_glapi_c_args = []
+if with_platform_windows
+  _glapi_c_args += ['-D_GLAPI_DLL_EXPORTS']
+endif
+
 libglapi = shared_library(
   'glapi',
   [files_mapi_glapi, files_mapi_util, shared_glapi_mapi_tmp_h],
   c_args : [
-c_msvc_compat_args, '-DMAPI_MODE_GLAPI',
+_glapi_c_args,
+c_msvc_compat_args,
+'-DMAPI_MODE_GLAPI',
 '-DMAPI_ABI_HEADER="@0@"'.format(shared_glapi_mapi_tmp_h.full_path()),
   ],
   link_args : [ld_args_gc_sections],
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 20/49] meson: build libgl-gdi target

2018-07-10 Thread Dylan Baker
---
 src/gallium/meson.build   |  1 +
 src/gallium/targets/libgl-gdi/meson.build | 44 +++
 2 files changed, 45 insertions(+)
 create mode 100644 src/gallium/targets/libgl-gdi/meson.build

diff --git a/src/gallium/meson.build b/src/gallium/meson.build
index a4f28dc4757..5019477788b 100644
--- a/src/gallium/meson.build
+++ b/src/gallium/meson.build
@@ -193,6 +193,7 @@ if with_gallium_st_nine
 endif
 if with_platform_windows
   subdir('state_trackers/wgl')
+  subdir('targets/libgl-gdi')
 endif
 if with_tests
   subdir('targets/graw-null')
diff --git a/src/gallium/targets/libgl-gdi/meson.build 
b/src/gallium/targets/libgl-gdi/meson.build
new file mode 100644
index 000..63cc40b97bc
--- /dev/null
+++ b/src/gallium/targets/libgl-gdi/meson.build
@@ -0,0 +1,44 @@
+# Copyright © 2018 Intel Corporation
+
+# 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.
+
+if cc.get_id() == 'gcc' and host_machine.cpu_family() == 'x86_64'
+  ogldef = files('../../state_trackers/wgl/opengl32.mingw.def')[0]
+else
+  ogldef = files('../../state_trackers/wgl/opengl32.def')[0]
+endif
+
+libopengl32 = shared_library(
+  'opengl32',
+  ['libgl_gdi.c'],
+  vs_module_defs : ogldef,
+  include_directories : [
+inc_common, inc_wgl, inc_gallium_winsys_sw, inc_gallium_drivers,
+  ],
+  link_whole : [libwgl],
+  link_with : [
+libmesa_util, libgallium, libglsl, libmesa_gallium, libwsgdi,
+libglapi_static, libglapi
+  ],
+  dependencies : [
+dep_ws2_32, idep_nir, driver_swrast, driver_swr,
+  ],
+  name_prefix : '',  # otherwise mingw will create libopengl32.dll
+  install : true,
+)
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 11/49] meson: Add a platform for windows

2018-07-10 Thread Dylan Baker
This mirrors the haiku build which uses a platform.

v2: - Fix some rebase problems
---
 meson.build   | 8 ++--
 meson_options.txt | 1 +
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index 40c59f13f1e..ce3b3406510 100644
--- a/meson.build
+++ b/meson.build
@@ -225,10 +225,12 @@ _platforms = get_option('platforms')
 if _platforms.contains('auto')
   if system_has_kms_drm
 _platforms = ['x11', 'wayland', 'drm', 'surfaceless']
-  elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
+  elif ['darwin', 'cygwin'].contains(host_machine.system())
 _platforms = ['x11', 'surfaceless']
   elif ['haiku'].contains(host_machine.system())
 _platforms = ['haiku']
+  elif host_machine.system() == 'windows'
+_platforms = ['windows']
   else
 error('Unknown OS. Please pass -Dplatforms to set platforms. Patches 
gladly accepted to fix this.')
   endif
@@ -240,6 +242,7 @@ with_platform_wayland = _platforms.contains('wayland')
 with_platform_drm = _platforms.contains('drm')
 with_platform_haiku = _platforms.contains('haiku')
 with_platform_surfaceless = _platforms.contains('surfaceless')
+with_platform_windows = _platforms.contains('windows')
 
 with_platforms = false
 if _platforms.length() != 0 and _platforms != ['']
@@ -375,7 +378,8 @@ if with_any_vk and (with_platform_x11 and not with_dri3)
   error('Vulkan drivers require dri3 for X11 support')
 endif
 if with_dri or with_gallium
-  if with_glx == 'disabled' and not with_egl and not with_platform_haiku
+  if (with_glx == 'disabled' and not with_egl and not with_platform_haiku and
+  not with_platform_windows)
 error('building dri or gallium drivers require at least one window system')
   endif
 endif
diff --git a/meson_options.txt b/meson_options.txt
index 5de73536bf7..ccc3872b24e 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -24,6 +24,7 @@ option(
   value : ['auto'],
   choices : [
 '', 'auto', 'x11', 'wayland', 'drm', 'surfaceless', 'haiku', 'android',
+'windows',
   ],
   description : 'comma separated list of window systems to support. If this is 
set to auto all platforms applicable to the OS will be enabled.'
 )
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 03/49] add a git ignore for subprojects

2018-07-10 Thread Dylan Baker
---
 subprojects/.gitignore | 3 +++
 1 file changed, 3 insertions(+)
 create mode 100644 subprojects/.gitignore

diff --git a/subprojects/.gitignore b/subprojects/.gitignore
new file mode 100644
index 000..68a882edba6
--- /dev/null
+++ b/subprojects/.gitignore
@@ -0,0 +1,3 @@
+*
+!*.wrap
+!.gitignore
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 27/49] meson: fix pipe-loader compilation for windows

2018-07-10 Thread Dylan Baker
v2: - Add missing D to pound define
- Simply define the variable rather than set it to 1 (mirrors
  android.mk not scons)
---
 src/gallium/auxiliary/pipe-loader/meson.build | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/pipe-loader/meson.build 
b/src/gallium/auxiliary/pipe-loader/meson.build
index 32e8188c68b..c5db4e18203 100644
--- a/src/gallium/auxiliary/pipe-loader/meson.build
+++ b/src/gallium/auxiliary/pipe-loader/meson.build
@@ -27,13 +27,18 @@ files_pipe_loader = files(
 )
 
 libpipe_loader_defines = []
+libpipe_loader_links = []
 
 if dep_libdrm.found()
   files_pipe_loader += files('pipe_loader_drm.c')
+  libpipe_loader_links += libloader
 endif
 if with_gallium_drisw_kms
   libpipe_loader_defines += '-DHAVE_PIPE_LOADER_KMS'
 endif
+if not (with_gallium_st_nine or with_gallium_opencl)
+  libpipe_loader_defines += '-DDROP_PIPE_LOADER_MISC'
+endif
 
 libpipe_loader_static = static_library(
   'pipe_loader_static',
@@ -46,7 +51,7 @@ libpipe_loader_static = static_library(
 c_vis_args, '-DHAVE_PIPE_LOADER_DRI', '-DGALLIUM_STATIC_TARGETS=1',
 libpipe_loader_defines,
   ],
-  link_with : [libloader, libxmlconfig],
+  link_with : [libpipe_loader_links, libxmlconfig],
   dependencies : [dep_libdrm],
   build_by_default : false,
 )
@@ -64,7 +69,7 @@ libpipe_loader_dynamic = static_library(
   join_paths(get_option('prefix'), get_option('libdir'), 'gallium-pipe')
 )
   ],
-  link_with : [libloader, libxmlconfig],
+  link_with : [libpipe_loader_links, libxmlconfig],
   dependencies : [dep_libdrm],
   build_by_default : false,
 )
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 13/49] meson: don't allow glvnd on windows

2018-07-10 Thread Dylan Baker
---
 meson.build | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index f29ffd65035..4f4d4cf61bb 100644
--- a/meson.build
+++ b/meson.build
@@ -356,7 +356,9 @@ endif
 
 with_glvnd = get_option('glvnd')
 if with_glvnd
-  if with_glx == 'xlib' or with_glx == 'gallium-xlib'
+  if with_platform_windows
+error('glvnd cannot be used on Windows')
+  elif with_glx == 'xlib' or with_glx == 'gallium-xlib'
 error('Cannot build glvnd support for GLX that is not DRI based.')
   elif with_glx == 'disabled' and not with_egl
 error('glvnd requires DRI based GLX and/or EGL')
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 09/49] meson: fix dl detection on non cygwin windows

2018-07-10 Thread Dylan Baker
---
 meson.build | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index c317851b0c6..40c59f13f1e 100644
--- a/meson.build
+++ b/meson.build
@@ -1027,9 +1027,9 @@ endif
 if cc.has_function('dlopen')
   dep_dl = null_dep
 else
-  dep_dl = cc.find_library('dl')
+  dep_dl = cc.find_library('dl', required : host_machine.system() != 'windows')
 endif
-if cc.has_function('dladdr', dependencies : dep_dl)
+if host_machine.system() != 'windows' and cc.has_function('dladdr', 
dependencies : dep_dl)
   # This is really only required for megadrivers
   pre_args += '-DHAVE_DLADDR'
 endif
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 18/49] meson: build gallium gdi winsys

2018-07-10 Thread Dylan Baker
---
 src/gallium/meson.build   |  6 ++
 src/gallium/winsys/sw/gdi/meson.build | 27 +++
 2 files changed, 33 insertions(+)
 create mode 100644 src/gallium/winsys/sw/gdi/meson.build

diff --git a/src/gallium/meson.build b/src/gallium/meson.build
index 561af9d339c..7754dbdee3c 100644
--- a/src/gallium/meson.build
+++ b/src/gallium/meson.build
@@ -21,6 +21,7 @@
 
 inc_gallium_drivers = include_directories('drivers')
 inc_gallium_winsys = include_directories('winsys')
+inc_gallium_winsys_sw = include_directories('winsys/sw')
 
 subdir('auxiliary')
 subdir('auxiliary/pipe-loader')
@@ -35,6 +36,11 @@ if with_gallium_drisw_kms
 else
   libswkmsdri = []
 endif
+if with_platform_windows
+  subdir('winsys/sw/gdi')
+else
+  libwsgdi = []
+endif
 subdir('winsys/sw/wrapper')
 if with_platform_haiku
   subdir('winsys/sw/hgl')
diff --git a/src/gallium/winsys/sw/gdi/meson.build 
b/src/gallium/winsys/sw/gdi/meson.build
new file mode 100644
index 000..ac6c7cf0aa2
--- /dev/null
+++ b/src/gallium/winsys/sw/gdi/meson.build
@@ -0,0 +1,27 @@
+# Copyright © 2018 Intel Corporation
+
+# 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.
+
+libwsgdi = static_library(
+  'wsgdi',
+  'gdi_sw_winsys.c',
+  include_directories : [
+inc_src, inc_include, inc_gallium, inc_gallium_aux, inc_gallium_drivers,
+  ],
+)
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 05/49] meson: add a expat subproject

2018-07-10 Thread Dylan Baker
---
 meson.build|  2 +-
 subprojects/expat.wrap | 10 ++
 2 files changed, 11 insertions(+), 1 deletion(-)
 create mode 100644 subprojects/expat.wrap

diff --git a/meson.build b/meson.build
index 26f1c48563b..c317851b0c6 100644
--- a/meson.build
+++ b/meson.build
@@ -1064,7 +1064,7 @@ if with_amd_vk or with_gallium_radeonsi or 
with_gallium_r600 or with_gallium_ope
 else
   dep_elf = null_dep
 endif
-dep_expat = dependency('expat')
+dep_expat = dependency('expat', fallback : ['expat', 'expat_dep'])
 # this only exists on linux so either this is linux and it will be found, or
 # its not linux and and wont
 dep_m = cc.find_library('m', required : false)
diff --git a/subprojects/expat.wrap b/subprojects/expat.wrap
new file mode 100644
index 000..0b7c53e54db
--- /dev/null
+++ b/subprojects/expat.wrap
@@ -0,0 +1,10 @@
+[wrap-file]
+directory = expat-2.2.5
+
+source_url = 
https://github.com/libexpat/libexpat/releases/download/R_2_2_5/expat-2.2.5.tar.bz2
+source_filename = expat-2.2.5.tar.bz2
+source_hash = d9dc32efba7e74f788fcc4f212a43216fc37cf5f23f4c2339664d473353aedf6
+
+patch_url = https://wrapdb.mesonbuild.com/v1/projects/expat/2.2.5/4/get_zip
+patch_filename = expat-2.2.5-4-wrap.zip
+patch_hash = 25748839be2bbdd2ff586d1a05aa6fc37aeada75c78416df6e8347a6321abaac
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 17/49] meson: Add necessary defines for mesa_gallium on windows

2018-07-10 Thread Dylan Baker
---
 src/mesa/meson.build | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/mesa/meson.build b/src/mesa/meson.build
index 8fb7db215c8..37baff51cfd 100644
--- a/src/mesa/meson.build
+++ b/src/mesa/meson.build
@@ -726,11 +726,19 @@ libmesa_classic = static_library(
   build_by_default : false,
 )
 
+_mesa_gallium_args = []
+if with_platform_windows
+  _mesa_gallium_args += ['-D_GDI32_', '-DBUILD_GL32']
+  if not with_gles2
+_mesa_gallium_args += '-D_GLAPI_NO_EXPORTS'
+  endif
+endif
+
 libmesa_gallium = static_library(
   'mesa_gallium',
   [files_libmesa_common, files_libmesa_gallium],
-  c_args : [c_vis_args, c_msvc_compat_args],
-  cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
+  c_args : [c_vis_args, c_msvc_compat_args, _mesa_gallium_args],
+  cpp_args : [cpp_vis_args, cpp_msvc_compat_args, _mesa_gallium_args],
   include_directories : [inc_common, inc_libmesa_asm, 
include_directories('main')],
   link_with : [libglsl, libmesa_sse41],
   dependencies : [idep_nir_headers, dep_vdpau],
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 22/49] meson: fix gallium-osmesa to build for windows

2018-07-10 Thread Dylan Baker
v2: - set so_version to '' (only affects windows)
- always set lib prefix to 'lib', even on msvc
---
 src/gallium/state_trackers/osmesa/meson.build | 12 ++--
 src/gallium/targets/osmesa/meson.build| 11 ++-
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/src/gallium/state_trackers/osmesa/meson.build 
b/src/gallium/state_trackers/osmesa/meson.build
index 912a6226f74..26ec8084f93 100644
--- a/src/gallium/state_trackers/osmesa/meson.build
+++ b/src/gallium/state_trackers/osmesa/meson.build
@@ -1,4 +1,4 @@
-# Copyright © 2017 Intel Corporation
+# Copyright © 2017-2018 Intel Corporation
 
 # Permission is hereby granted, free of charge, to any person obtaining a copy
 # of this software and associated documentation files (the "Software"), to deal
@@ -18,10 +18,18 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
+osmesa_st_c_args = []
+if with_platform_windows
+  osmesa_st_c_args += ['-DBUILD_GL32', '-DWIN32_LEAN_AND_MEAN']
+  if not with_gles1
+osmesa_st_c_args += ['-D_GLAPI_NO_EXPORTS']
+  endif
+endif
+
 libosmesa_st = static_library(
   'osmesa_st',
   'osmesa.c',
-  c_args : ['-DGALLIUM_SOFTPIPE'],
+  c_args : osmesa_st_c_args,
   include_directories : [
 inc_include, inc_src, inc_gallium, inc_gallium_aux, inc_mapi, inc_mesa,
   ],
diff --git a/src/gallium/targets/osmesa/meson.build 
b/src/gallium/targets/osmesa/meson.build
index b4ae8f4b6ec..d92117988eb 100644
--- a/src/gallium/targets/osmesa/meson.build
+++ b/src/gallium/targets/osmesa/meson.build
@@ -32,12 +32,19 @@ if with_ld_version_script
   osmesa_link_deps += files('osmesa.sym')
 endif
 
+if cc.get_id() == 'gcc' and host_machine.cpu_family() != 'x86_64'
+  osmesa_def = 'osmesa.mingw.def'
+else
+  osmesa_def = 'osmesa.def'
+endif
+
 libosmesa = shared_library(
   osmesa_lib_name,
   'target.c',
   c_args : [c_vis_args],
   cpp_args : cpp_vis_args,
   link_args : [ld_args_gc_sections, osmesa_link_args],
+  vs_module_defs : osmesa_def,
   include_directories : [
 inc_include, inc_src, inc_gallium, inc_gallium_aux, inc_gallium_winsys,
 inc_gallium_drivers,
@@ -48,10 +55,12 @@ libosmesa = shared_library(
 libmesa_gallium, libgallium, libglapi_static, libws_null, osmesa_link_with,
   ],
   dependencies : [
-dep_selinux, dep_thread, dep_clock, dep_unwind,
+dep_ws2_32, dep_selinux, dep_thread, dep_clock, dep_unwind,
 driver_swrast, driver_swr,
   ],
+  soversion : host_machine.system() == 'windows' ? '' : '8',
   version : '8.0.0',
+  name_prefix : 'lib',
   install : true,
 )
 
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 06/49] gallium: fix ddebug on windows

2018-07-10 Thread Dylan Baker
By including the proper headers for getpid and for mkdir.

Signed-off-by: Dylan Baker 
Reviewed-by: Marek Olšák 
---
 src/gallium/auxiliary/driver_ddebug/dd_util.h | 6 +-
 src/gallium/auxiliary/meson.build | 6 ++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/driver_ddebug/dd_util.h 
b/src/gallium/auxiliary/driver_ddebug/dd_util.h
index 8953e34d588..bcf026f2ef9 100644
--- a/src/gallium/auxiliary/driver_ddebug/dd_util.h
+++ b/src/gallium/auxiliary/driver_ddebug/dd_util.h
@@ -37,9 +37,13 @@
 #include "util/u_debug.h"
 
 #include "pipe/p_config.h"
-#ifdef PIPE_OS_UNIX
+#if defined(PIPE_OS_UNIX)
 #include 
 #include 
+#elif defined(PIPE_OS_WINDOWS)
+#include 
+#include 
+#define mkdir(dir, mode) _mkdir(dir)
 #endif
 
 
diff --git a/src/gallium/auxiliary/meson.build 
b/src/gallium/auxiliary/meson.build
index 98542d7ef3e..4facaae08d6 100644
--- a/src/gallium/auxiliary/meson.build
+++ b/src/gallium/auxiliary/meson.build
@@ -106,6 +106,12 @@ files_libgallium = files(
   'driver_trace/tr_screen.h',
   'driver_trace/tr_texture.c',
   'driver_trace/tr_texture.h',
+  'driver_ddebug/dd_context.c',
+  'driver_ddebug/dd_draw.c',
+  'driver_ddebug/dd_pipe.h',
+  'driver_ddebug/dd_public.h',
+  'driver_ddebug/dd_screen.c',
+  'driver_ddebug/dd_util.h',
   'hud/font.c',
   'hud/font.h',
   'hud/hud_context.c',
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 02/49] meson: always define libglapi

2018-07-10 Thread Dylan Baker
This allows the identifier to be used even if shared-glapi isn't build,
which simplifies a bunch of things.
---
 src/mapi/meson.build | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/mapi/meson.build b/src/mapi/meson.build
index 798586bfb0c..0be80047e4d 100644
--- a/src/mapi/meson.build
+++ b/src/mapi/meson.build
@@ -30,6 +30,8 @@ mapi_abi_py = files('mapi_abi.py')
 subdir('glapi')
 if with_shared_glapi
   subdir('shared-glapi')
+else
+  libglapi = []
 endif
 if with_gles1
   subdir('es1api')
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 07/49] glapi: export glapi_destroy_multithread when building shared-glapi on windows

2018-07-10 Thread Dylan Baker
Which will allow meson to build a shared glapi build with mingw.
---
 src/mapi/glapi/glapi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mapi/glapi/glapi.h b/src/mapi/glapi/glapi.h
index d5d4e0a03a6..cbdef2e4c5a 100644
--- a/src/mapi/glapi/glapi.h
+++ b/src/mapi/glapi/glapi.h
@@ -114,7 +114,7 @@ _GLAPI_EXPORT extern void *_glapi_Context;
 #endif /* defined (GLX_USE_TLS) */
 
 
-void
+_GLAPI_EXPORT void
 _glapi_destroy_multithread(void);
 
 
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 08/49] glsl: fix general_ir_test with mingw

2018-07-10 Thread Dylan Baker
Somewhere down in the depths of the mingw headers 'interface' is
defined, change it to iface like a similar patch did.
---
 src/compiler/glsl/tests/general_ir_test.cpp | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/compiler/glsl/tests/general_ir_test.cpp 
b/src/compiler/glsl/tests/general_ir_test.cpp
index 57917f33734..c8bc16b7ad0 100644
--- a/src/compiler/glsl/tests/general_ir_test.cpp
+++ b/src/compiler/glsl/tests/general_ir_test.cpp
@@ -34,7 +34,7 @@ TEST(ir_variable_constructor, interface)
   glsl_struct_field(glsl_type::vec(4), "v")
};
 
-   const glsl_type *const interface =
+   const glsl_type *const iface =
   glsl_type::get_interface_instance(f,
 ARRAY_SIZE(f),
 GLSL_INTERFACE_PACKING_STD140,
@@ -44,12 +44,12 @@ TEST(ir_variable_constructor, interface)
static const char name[] = "named_instance";
 
ir_variable *const v =
-  new(mem_ctx) ir_variable(interface, name, ir_var_uniform);
+  new(mem_ctx) ir_variable(iface, name, ir_var_uniform);
 
EXPECT_STREQ(name, v->name);
EXPECT_NE(name, v->name);
-   EXPECT_EQ(interface, v->type);
-   EXPECT_EQ(interface, v->get_interface_type());
+   EXPECT_EQ(iface, v->type);
+   EXPECT_EQ(iface, v->get_interface_type());
 }
 
 TEST(ir_variable_constructor, interface_array)
@@ -60,7 +60,7 @@ TEST(ir_variable_constructor, interface_array)
   glsl_struct_field(glsl_type::vec(4), "v")
};
 
-   const glsl_type *const interface =
+   const glsl_type *const iface =
   glsl_type::get_interface_instance(f,
 ARRAY_SIZE(f),
 GLSL_INTERFACE_PACKING_STD140,
@@ -68,7 +68,7 @@ TEST(ir_variable_constructor, interface_array)
 "simple_interface");
 
const glsl_type *const interface_array =
-  glsl_type::get_array_instance(interface, 2);
+  glsl_type::get_array_instance(iface, 2);
 
static const char name[] = "array_instance";
 
@@ -78,5 +78,5 @@ TEST(ir_variable_constructor, interface_array)
EXPECT_STREQ(name, v->name);
EXPECT_NE(name, v->name);
EXPECT_EQ(interface_array, v->type);
-   EXPECT_EQ(interface, v->get_interface_type());
+   EXPECT_EQ(iface, v->get_interface_type());
 }
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 04/49] meson: add a zlib subproject

2018-07-10 Thread Dylan Baker
To help windows build
---
 meson.build   |  2 +-
 subprojects/zlib.wrap | 10 ++
 2 files changed, 11 insertions(+), 1 deletion(-)
 create mode 100644 subprojects/zlib.wrap

diff --git a/meson.build b/meson.build
index 7d12af3d510..26f1c48563b 100644
--- a/meson.build
+++ b/meson.build
@@ -1050,7 +1050,7 @@ else
 endif
 
 # TODO: some of these may be conditional
-dep_zlib = dependency('zlib', version : '>= 1.2.3')
+dep_zlib = dependency('zlib', version : '>= 1.2.3', fallback : ['zlib', 
'zlib_dep'])
 pre_args += '-DHAVE_ZLIB'
 dep_thread = dependency('threads')
 if dep_thread.found() and host_machine.system() != 'windows'
diff --git a/subprojects/zlib.wrap b/subprojects/zlib.wrap
new file mode 100644
index 000..f459463bb59
--- /dev/null
+++ b/subprojects/zlib.wrap
@@ -0,0 +1,10 @@
+[wrap-file]
+directory = zlib-1.2.11
+
+source_url = http://zlib.net/fossils/zlib-1.2.11.tar.gz
+source_filename = zlib-1.2.11.tar.gz
+source_hash = c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1
+
+patch_url = https://wrapdb.mesonbuild.com/v1/projects/zlib/1.2.11/2/get_zip
+patch_filename = zlib-1.2.11-2-wrap.zip
+patch_hash = aed811a48707be2a374a230c01e2efa17b385fe7e88f4ac0ee122093766aab2b
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 01/49] util: move process.[ch] to u_process.[ch]

2018-07-10 Thread Dylan Baker
On windows process.h is a system provided header, and it's required in
include/c11/threads_win32.h. This header interferes with searching for
that header, and results in windows build warnings with scons, but
errors in meson which doesn't allow implicit function declarations. Just
rename process to u_process, which follows the style of utils anyway.
---
 src/gallium/auxiliary/os/os_process.c | 2 +-
 src/util/Makefile.sources | 4 ++--
 src/util/meson.build  | 4 ++--
 src/util/{process.c => u_process.c}   | 2 +-
 src/util/{process.h => u_process.h}   | 0
 src/util/u_queue.c| 2 +-
 src/util/xmlconfig.c  | 2 +-
 7 files changed, 8 insertions(+), 8 deletions(-)
 rename src/util/{process.c => u_process.c} (99%)
 rename src/util/{process.h => u_process.h} (100%)

diff --git a/src/gallium/auxiliary/os/os_process.c 
b/src/gallium/auxiliary/os/os_process.c
index 87072f0b046..766cf806153 100644
--- a/src/gallium/auxiliary/os/os_process.c
+++ b/src/gallium/auxiliary/os/os_process.c
@@ -29,7 +29,7 @@
 #include "pipe/p_config.h"
 #include "os/os_process.h"
 #include "util/u_memory.h"
-#include "util/process.h"
+#include "util/u_process.h"
 
 #if defined(PIPE_SUBSYSTEM_WINDOWS_USER)
 #  include 
diff --git a/src/util/Makefile.sources b/src/util/Makefile.sources
index fe34fc26690..531fd833c7f 100644
--- a/src/util/Makefile.sources
+++ b/src/util/Makefile.sources
@@ -24,8 +24,8 @@ MESA_UTIL_FILES := \
mesa-sha1.h \
os_time.c \
os_time.h \
-   process.c \
-   process.h \
+   u_process.c \
+   u_process.h \
sha1/sha1.c \
sha1/sha1.h \
ralloc.c \
diff --git a/src/util/meson.build b/src/util/meson.build
index 1838719d271..27a6fc118e5 100644
--- a/src/util/meson.build
+++ b/src/util/meson.build
@@ -48,8 +48,8 @@ files_mesa_util = files(
   'mesa-sha1.h',
   'os_time.c',
   'os_time.h',
-  'process.c',
-  'process.h',
+  'u_process.c',
+  'u_process.h',
   'sha1/sha1.c',
   'sha1/sha1.h',
   'ralloc.c',
diff --git a/src/util/process.c b/src/util/u_process.c
similarity index 99%
rename from src/util/process.c
rename to src/util/u_process.c
index 6e6376986f3..5bf3f56db4e 100644
--- a/src/util/process.c
+++ b/src/util/u_process.c
@@ -25,7 +25,7 @@
  * of the Software.
  */
 
-#include "process.h"
+#include "u_process.h"
 #include 
 #include 
 #include 
diff --git a/src/util/process.h b/src/util/u_process.h
similarity index 100%
rename from src/util/process.h
rename to src/util/u_process.h
diff --git a/src/util/u_queue.c b/src/util/u_queue.c
index be95d9eec3f..4ce1af518b3 100644
--- a/src/util/u_queue.c
+++ b/src/util/u_queue.c
@@ -31,7 +31,7 @@
 #include "util/os_time.h"
 #include "util/u_string.h"
 #include "util/u_thread.h"
-#include "process.h"
+#include "u_process.h"
 
 static void util_queue_killall_and_wait(struct util_queue *queue);
 
diff --git a/src/util/xmlconfig.c b/src/util/xmlconfig.c
index d3847911baa..ba657294c1c 100644
--- a/src/util/xmlconfig.c
+++ b/src/util/xmlconfig.c
@@ -37,7 +37,7 @@
 #include 
 #include 
 #include "xmlconfig.h"
-#include "process.h"
+#include "u_process.h"
 
 
 /** \brief Find an option in an option cache with the name as key */
-- 
2.18.0

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


[Mesa-dev] [PATCH v2 00/49] meson for windows

2018-07-10 Thread Dylan Baker
This is the second spin of my meson for windows series. It fixes a few issues
from the first version, and is rebased on current master. The biggest changes
are changing shader-cache to a trillian (auto, true, false), changing the lib
names to match the scons names, and fixing process.h interfering with the build.

This also includes a patch from Eric Engstrom to do a better job of finding
python2 on windows.

Dylan Baker (49):
  util: move process.[ch] to u_process.[ch]
  meson: always define libglapi
  add a git ignore for subprojects
  meson: add a zlib subproject
  meson: add a expat subproject
  gallium: fix ddebug on windows
  glapi: export glapi_destroy_multithread when building shared-glapi on
windows
  glsl: fix general_ir_test with mingw
  meson: fix dl detection on non cygwin windows
  meson: build getopt when using msvc
  meson: Add a platform for windows
  meson: don't build glx or dri by default on windows
  meson: don't allow glvnd on windows
  meson: add windows compiler checks and libraries
  meson: Make shader-cache a trillean instead of boolean
  meson: Add windows defines to glapi
  meson: Add necessary defines for mesa_gallium on windows
  meson: build gallium gdi winsys
  meson: build wgl state tracker
  meson: build libgl-gdi target
  meson: build graw-gdi target
  meson: fix gallium-osmesa to build for windows
  meson: Don't check for posix_memalign on windows
  meson: Add support for wrapping llvm
  docs/meson.html: fix numerous issues spotted by xmllint
  util/xmlconfig: include strndup.h for windows
  meson: fix pipe-loader compilation for windows
  meson: don't look for rt on windows
  meson: Add support for using win_flex and win_bison on windows
  meson: make nm binary optional
  meson: for incluse of inttypes.h for glcpp with msvc
  meson: disable sse4.1 optimizations with msvc
  meson: add switches for SWR with MSVC
  meson: don't define GLX_USE_TLS for windows
  meson: Add idep_getopt for tests
  util/tests: Use define instead of VLA
  meson: Don't build glsl cache_test for windows
  glsl/tests: define ssize_t on windows
  nir/meson: fix c vs cpp args for nir test
  meson: Set visibility and compat args for graw
  meosn: don't build gallium trivial tests on windows
  meson: Fix gtest linkage on msvc
  meson: disable graw tests on mingw
  meson: don't build or run mesa-sha1 test on windows
  meson: Use python module to find python2 on windows
  appveyor: Add support for meson as well as scons
  appveyor: use chocolatey (cinst) to install winflexbison
  tests/vma: fix build with MSVC
  meson: maintain names of shared API libraries

 appveyor.yml  |  34 +-
 docs/meson.html   |  71 ++-
 meson.build   | 405 --
 meson_options.txt |  12 +-
 src/compiler/glsl/glcpp/meson.build   |  16 +-
 src/compiler/glsl/meson.build |   6 +-
 src/compiler/glsl/tests/blob_test.c   |   4 +
 src/compiler/glsl/tests/general_ir_test.cpp   |  14 +-
 src/compiler/glsl/tests/meson.build   |  21 +-
 src/compiler/nir/meson.build  |   2 +-
 src/egl/meson.build   |   2 +-
 src/gallium/auxiliary/driver_ddebug/dd_util.h |   6 +-
 src/gallium/auxiliary/meson.build |   6 +
 src/gallium/auxiliary/os/os_process.c |   2 +-
 src/gallium/auxiliary/pipe-loader/meson.build |   9 +-
 src/gallium/drivers/swr/meson.build   |   3 +-
 .../drivers/swr/rasterizer/jitter/meson.build |  13 +-
 src/gallium/meson.build   |  14 +-
 src/gallium/state_trackers/osmesa/meson.build |  12 +-
 .../{osmesa => wgl}/meson.build   |  32 +-
 .../{graw-xlib => graw-gdi}/meson.build   |  21 +-
 src/gallium/targets/graw-null/meson.build |   2 +
 src/gallium/targets/graw-xlib/meson.build |   1 +
 .../{graw-xlib => libgl-gdi}/meson.build  |  30 +-
 src/gallium/targets/osmesa/meson.build|  11 +-
 src/gallium/tests/meson.build |  11 +-
 .../{tests => winsys/sw/gdi}/meson.build  |  12 +-
 src/gbm/meson.build   |   2 +-
 src/{gallium/tests => getopt}/meson.build |  14 +-
 src/gtest/meson.build |   7 +
 src/mapi/es1api/meson.build   |  14 +-
 src/mapi/es2api/meson.build   |  14 +-
 src/mapi/glapi/glapi.h|   2 +-
 src/mapi/glapi/meson.build|  13 +-
 src/mapi/meson.build  |   2 +
 src/mapi/shared-glapi/meson.build |  11 +-
 src/mesa/meson.build  |  12 +-
 src/meson.build   |   5 +
 src/util/Makefile.sources |   4 +-
 src/util/meson.build  |  25 +-
 src/util/tests/hash_table/clear.c |  13 +-
 src/util/tests/hash_table/delete_management.c |  13 +-
 

[Mesa-dev] [PATCH v2 10/49] meson: build getopt when using msvc

2018-07-10 Thread Dylan Baker
completely untested
---
 src/getopt/meson.build | 29 +
 src/meson.build|  5 +
 2 files changed, 34 insertions(+)
 create mode 100644 src/getopt/meson.build

diff --git a/src/getopt/meson.build b/src/getopt/meson.build
new file mode 100644
index 000..5e106a6bc60
--- /dev/null
+++ b/src/getopt/meson.build
@@ -0,0 +1,29 @@
+# Copyright © 2018 Intel Corporation
+
+# 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.
+
+libgetopt = static_library(
+  'getopt',
+  ['getopt_long.c'],
+)
+
+idep_getopt = declare_dependency(
+  link_with : libgetopt,
+  include_directories : include_directories('.', is_system : true),
+)
diff --git a/src/meson.build b/src/meson.build
index c2566b7a687..6bbb0d87e7e 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -47,6 +47,11 @@ sha1_h = custom_target(
 )
 
 subdir('gtest')
+if cc.get_id() == 'msvc'
+  subdir('getopt')
+else
+  idep_getopt = []
+endif
 subdir('util')
 subdir('mapi')
 # TODO: opengl
-- 
2.18.0

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


Re: [Mesa-dev] [PATCH 2/9] i965/fs: Register allocator shoudn't use grf127 for sends dest

2018-07-10 Thread Caio Marcelo de Oliveira Filho
> Since Gen8+ Intel PRM states that "r127 must not be used for return
> address when there is a src and dest overlap in send instruction."

The previous patch, that verifies the condition above is causing

tests/spec/arb_compute_shader/linker/bug-93840.shader_test

to crash with

shader_runner: ../src/intel/compiler/brw_fs_generator.cpp:2455: int 
fs_generator::generate_code(const cfg_t*, int): Assertion `validated' failed.

I also could reproduce the crash locally. It happens even with this
patch (which adds the hack) applied.


> This patch implements this restriction creating new grf127_send_hack_node
> at the register allocator. This node has a fixed assignation to grf127.
> 
> For vgrf that are used as destination of send messages we create node
> interfereces with the grf127_send_hack_node. So the register allocator
> will never assign to these vgrf a register that involves grf127.
> 
> If dispatch_width > 8 we don't create these interferences to the because
> all instructions have node interferences between sources and destination.
> That is enough to avoid the r127 restriction.

I think for both widths will not be enough. The instruction that fails
the validation is:

mov(8)  g126<1>UD   g0<8,8,1>UD { align1 WE_all 
1Q };
mov(1)  g126.2<1>UD 0x0090UD{ align1 WE_all 
1N };
send(16)g126<1>UW   g126<8,8,1>UD
data ( DC OWORD block read, 253, 3) mlen 1 rlen 2 { 
align1 WE_all 1H };
ERROR: r127 must not be used for return address when there is a src and 
dest overlap

Which if I understood correctly comes from the scratch reading being
created by the spilling logic. In brw_oword_block_read_scratch() we
see

   if (p->devinfo->gen >= 7) {
  /* On gen 7 and above, we no longer have message registers and we can
   * send from any register we want.  By using the destination register
   * for the message, we guarantee that the implied message write won't
   * accidentally overwrite anything.  This has been a problem because
   * the MRF registers and source for the final FB write are both fixed
   * and may overlap.
   */
  mrf = retype(dest, BRW_REGISTER_TYPE_UD);
   } else {
  mrf = retype(mrf, BRW_REGISTER_TYPE_UD);
   }
   dest = retype(dest, BRW_REGISTER_TYPE_UW);

It seems to me we'll have to handle r127 there as well.


Thanks,
Caio



> 
> This fixes CTS tests that raised this issue as they were executed as SIMD8:
> 
> dEQP-VK.spirv_assembly.instruction.graphics.8bit_storage.8struct_to_32struct.storage_buffer_*int_geom
> 
> Shader-db results on Skylake:
>total instructions in shared programs: 7686798 -> 7686797 (<.01%)
>instructions in affected programs: 301 -> 300 (-0.33%)
>helped: 1
>HURT: 0
> 
>total cycles in shared programs: 337092322 -> 337091919 (<.01%)
>cycles in affected programs: 22420415 -> 22420012 (<.01%)
>helped: 712
>HURT: 588
> 
> Shader-db results on Broadwell:
> 
>total instructions in shared programs: 7658574 -> 7658625 (<.01%)
>instructions in affected programs: 19610 -> 19661 (0.26%)
>helped: 3
>HURT: 4
> 
>total cycles in shared programs: 340694553 -> 340676378 (<.01%)
>cycles in affected programs: 24724915 -> 24706740 (-0.07%)
>helped: 998
>HURT: 916
> 
>total spills in shared programs: 4300 -> 4311 (0.26%)
>spills in affected programs: 333 -> 344 (3.30%)
>helped: 1
>HURT: 3
> 
>total fills in shared programs: 5370 -> 5378 (0.15%)
>fills in affected programs: 274 -> 282 (2.92%)
>helped: 1
>HURT: 3
> 
> v2: Avoid duplicating register classes without grf127. Let's use a node
> with a fixed assignation to grf127 and create interferences to send
> message vgrf destinations. (Eric Anholt)
> v3: Update reference to CTS VK_KHR_8bit_storage failing tests.
> (Jose Maria Casanova)
> ---
>  src/intel/compiler/brw_fs_reg_allocate.cpp | 25 ++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/src/intel/compiler/brw_fs_reg_allocate.cpp 
> b/src/intel/compiler/brw_fs_reg_allocate.cpp
> index ec8e116cb38..59e047483c0 100644
> --- a/src/intel/compiler/brw_fs_reg_allocate.cpp
> +++ b/src/intel/compiler/brw_fs_reg_allocate.cpp
> @@ -548,6 +548,9 @@ fs_visitor::assign_regs(bool allow_spilling, bool 
> spill_all)
> int first_mrf_hack_node = node_count;
> if (devinfo->gen >= 7)
>node_count += BRW_MAX_GRF - GEN7_MRF_HACK_START;
> +   int grf127_send_hack_node = node_count;
> +   if (devinfo->gen >= 8 && dispatch_width == 8)
> +  node_count ++;
> struct ra_graph *g =
>ra_alloc_interference_graph(compiler->fs_reg_sets[rsi].regs, 
> node_count);
>  
> @@ -653,6 +656,28 @@ fs_visitor::assign_regs(bool allow_spilling, bool 
> spill_all)
>}
> }
>  
> +   if (devinfo->gen >= 8 && dispatch_width == 8) {
> +  /* At Intel Broadwell PRM, vol 07, section "Instruction Set 

Re: [Mesa-dev] [RFC v2 10/11] glsl: teach copy_propagation_elements to deal with whole variables

2018-07-10 Thread Eric Anholt
Caio Marcelo de Oliveira Filho  writes:

> Keep information in acp_entry whether the entry is full or not, and
> use the ACP in more nodes when visiting the instructions:
>
> - add_copy: write whole variables to the ACP state (regardless the
>   type).
>
> - visit(ir_dereference_variable *): perform the propagation here if we have a
>   full candidate. Element-wise here doesn't apply because the mask
>   isn't available at this point.
>
> - visit_leave(ir_assignment *): process beyond scalar and vector, as
>   the full variables might have other types.
>
> Also import an improvement from opt_copy_propagation.cpp: if ir_call
> is an intrinsic, we know the variables affected, so keep going.
> ---
>  .../glsl/opt_copy_propagation_elements.cpp| 142 ++
>  1 file changed, 113 insertions(+), 29 deletions(-)
>
> diff --git a/src/compiler/glsl/opt_copy_propagation_elements.cpp 
> b/src/compiler/glsl/opt_copy_propagation_elements.cpp
> index d2c24697203..701cce2dd30 100644
> --- a/src/compiler/glsl/opt_copy_propagation_elements.cpp
> +++ b/src/compiler/glsl/opt_copy_propagation_elements.cpp
> @@ -27,18 +27,9 @@
>   * Replaces usage of recently-copied components of variables with the
>   * previous copy of the variable.
>   *
> - * This pass can be compared with opt_copy_propagation, which operands
> - * on arbitrary whole-variable copies.  However, in order to handle
> - * the copy propagation of swizzled variables or writemasked writes,
> - * we want to track things on a channel-wise basis.  I found that
> - * trying to mix the swizzled/writemasked support here with the
> - * whole-variable stuff in opt_copy_propagation.cpp just made a mess,
> - * so this is separate despite the ACP handling being somewhat
> - * similar.
> - *
>   * This should reduce the number of MOV instructions in the generated
> - * programs unless copy propagation is also done on the LIR, and may
> - * help anyway by triggering other optimizations that live in the HIR.
> + * programs and help triggering other optimizations that live in GLSL
> + * level.
>   */
>  
>  #include "ir.h"
> @@ -58,6 +49,7 @@ class acp_entry
>  public:
> DECLARE_LINEAR_ZALLOC_CXX_OPERATORS(acp_entry)
>  

A comment would have helped me:

/* If set, rhs_full indicates that this ACP entry represents a
 * whole-variable copy.  The rhs_element[] array will still be filled,
 * to allow the swizzling from its components in case the variable
 * was a vector (and to simplify some of the erase() and write_vector()
 * logic).
 */

> +   ir_variable *rhs_full;
> ir_variable *rhs_element[4];
> unsigned rhs_channel[4];
>  

> -   void write(ir_variable *lhs, ir_variable *rhs, unsigned write_mask, int 
> swizzle[4])
> +   void write_elements(ir_variable *lhs, ir_variable *rhs, unsigned 
> write_mask, int swizzle[4])
> {
>acp_entry *lhs_entry = pull_acp(lhs);
> +  lhs_entry->rhs_full = NULL;
> +  bool already_reference_rhs = false;
>  
>for (int i = 0; i < 4; i++) {
> + if (lhs_entry->rhs_element[i] == rhs)
> +already_reference_rhs = true;
> +
>   if ((write_mask & (1 << i)) == 0)
>  continue;
>   ir_variable *to_remove = lhs_entry->rhs_element[i];
> @@ -160,8 +160,38 @@ public:
>   }
>}
>  
> +  if (!already_reference_rhs) {
> + acp_entry *rhs_entry = pull_acp(rhs);
> + _mesa_set_add(rhs_entry->dsts, lhs);
> +  }
> +   }

Though I think the logic would be simpler if we skip the checking that
we haven't added to the ACP and just _mesa_set_add() no matter what.

Optional, though.  Either way:

Reviewed-by: Eric Anholt 


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


Re: [Mesa-dev] [PATCH v2 08/11] glsl: change opt_copy_propagation_elements data structures

2018-07-10 Thread Eric Anholt
Caio Marcelo de Oliveira Filho  writes:

> Instead of keeping multiple acp_entries in lists, have a single
> acp_entry per variable. With this, the implementation of clone is more
> convenient and now fully implemented. In the previous code, clone was
> only partial.
>
> Before this patch, each acp_entry struct represented a write to a
> variable including LHS, RHS and a mask of what channels were written
> to. There were two main hash tables, the first (lhs_ht) stored a list
> of acp_entries per LHS variable, with the values available to copy for
> that variable; the second (rhs_ht) was a "reverse index" for the first
> hash table, so stored acp_entries per RHS variable.
>
> After the patch, there's a single acp_entry struct per LHS variable,
> it contains an array with references to the RHS variables per
> channel. There now is a single hash table, from LHS variable to the
> corresponding entry. The "reverse index" is stored in the ACP entry,
> in the form of a set of variables that copy from the LHS. To make the
> clone operation cheaper, the ACP entries are created on demand.
>
> This should not change the result of copy propagation, a later patch
> will take advantage of the clone operation.
>
> v2: Add note clarifying how the hashtable is destroyed.
> ---
>  .../glsl/opt_copy_propagation_elements.cpp| 244 +-
>  1 file changed, 128 insertions(+), 116 deletions(-)
>
> diff --git a/src/compiler/glsl/opt_copy_propagation_elements.cpp 
> b/src/compiler/glsl/opt_copy_propagation_elements.cpp
> index 05965128fd9..989bd81afae 100644
> --- a/src/compiler/glsl/opt_copy_propagation_elements.cpp
> +++ b/src/compiler/glsl/opt_copy_propagation_elements.cpp
> @@ -47,63 +47,30 @@
>  #include "ir_optimization.h"
>  #include "compiler/glsl_types.h"
>  #include "util/hash_table.h"
> +#include "util/set.h"
>  
>  static bool debug = false;
>  
>  namespace {
>  
> -class acp_entry;
> -
> -/* Class that refers to acp_entry in another exec_list. Used
> - * when making removals based on rhs.
> - */
> -class acp_ref : public exec_node
> -{
> -public:
> -   acp_ref(acp_entry *e)
> -   {
> -  entry = e;
> -   }
> -   acp_entry *entry;
> -};
> -
> -class acp_entry : public exec_node
> +class acp_entry
>  {
>  public:
> -   /* override operator new from exec_node */
> DECLARE_LINEAR_ZALLOC_CXX_OPERATORS(acp_entry)
>  
> -   acp_entry(ir_variable *lhs, ir_variable *rhs, int write_mask, int 
> swizzle[4])
> -  : rhs_node(this)
> -   {
> -  this->lhs = lhs;
> -  this->rhs = rhs;
> -  this->write_mask = write_mask;
> -  memcpy(this->swizzle, swizzle, sizeof(this->swizzle));
> -   }
> +   ir_variable *rhs_element[4];
> +   unsigned rhs_channel[4];
>  
> -   ir_variable *lhs;
> -   ir_variable *rhs;
> -   unsigned int write_mask;
> -   int swizzle[4];
> -   acp_ref rhs_node;
> +   set *dsts;
>  };
>  
>  class copy_propagation_state {
>  public:
> DECLARE_RZALLOC_CXX_OPERATORS(copy_propagation_state);
>  
> -   copy_propagation_state(void *mem_ctx, void *lin_ctx)
> -   {
> -  /* Use 'this' as context for the tables, no explicit destruction
> -   * needed later. */
> -  lhs_ht = _mesa_hash_table_create(this, _mesa_hash_pointer,
> -   _mesa_key_pointer_equal);
> -  rhs_ht = _mesa_hash_table_create(this, _mesa_hash_pointer,
> -   _mesa_key_pointer_equal);
> -  this->mem_ctx = mem_ctx;
> -  this->lin_ctx = lin_ctx;
> -   }
> +   copy_propagation_state()
> +  : copy_propagation_state(NULL)
> +   {}
>  
> copy_propagation_state* clone()
> {
> @@ -112,94 +79,139 @@ public:
>  
> void erase_all()
> {
> -  _mesa_hash_table_clear(lhs_ht, NULL);
> -  _mesa_hash_table_clear(rhs_ht, NULL);
> +  /* Individual elements were allocated from a linear allocator, so will
> +   * be destroyed when the state is destroyed. */
> +  _mesa_hash_table_clear(acp, NULL);
> +  fallback = NULL;
> }
>  
> void erase(ir_variable *var, unsigned write_mask)
> {
> -  /* removal of lhs entries */
> -  hash_entry *ht_entry = _mesa_hash_table_search(lhs_ht, var);
> -  if (ht_entry) {
> - exec_list *lhs_list = (exec_list *) ht_entry->data;
> - foreach_in_list_safe(acp_entry, entry, lhs_list) {
> -entry->write_mask = entry->write_mask & ~write_mask;
> -if (entry->write_mask == 0) {
> -   entry->remove();
> -   continue;
> +  acp_entry *entry = pull_acp(var);
> +
> +  for (int i = 0; i < 4; i++) {
> + if (!entry->rhs_element[i])
> +continue;
> + if ((write_mask & (1 << i)) == 0)
> +continue;
> +
> + ir_variable *to_remove = entry->rhs_element[i];
> + entry->rhs_element[i] = NULL;
> +

This loop was confusing to me.  Maybe:

 /* Don't remove from dsts until we're cleared the last use.
  * Some uses may be left over if the 

Re: [Mesa-dev] [PATCH] r600: Add spill output to group only if register or target index changes

2018-07-10 Thread Roland Scheidegger
Am 05.07.2018 um 19:11 schrieb Gert Wollny:
> The current spill code checks in each instruction of an instruction group 
> whether
> spliing
spilling

> is needed and if so, it adds spilling for each component as a seperate
> instruction and it allocates a new temporary for each component and since it 
> takes
> the write mask from the TGSI representation, all components might be written
> each time and as a result already written components might be overwritten with
> garbage like: 
> 
>...
>y: MOVR9.y,  [0x4214 37].x
>t: MOVR8.x,  [0x4204 33].y
>... 
>MEM_SCRATCH  WRITE_IND_ACK 0 R9.xy__, @R4.x  ES:3
>MEM_SCRATCH  WRITE_IND_ACK 0 R8.xy__, @R4.x  ES:3
>...
> 
> To resolve this isse accululate
accumulate

> spills to the same memory location so that only one
> memory write instruction is emmited
emitted

> for an instruction group that writes up to all
> four components.
> 
> Signed-off-by: Gert Wollny 
> ---
>  src/gallium/drivers/r600/r600_shader.c | 93 
> +-
>  1 file changed, 57 insertions(+), 36 deletions(-)
> 
> diff --git a/src/gallium/drivers/r600/r600_shader.c 
> b/src/gallium/drivers/r600/r600_shader.c
> index 5479861c58..354091322a 100644
> --- a/src/gallium/drivers/r600/r600_shader.c
> +++ b/src/gallium/drivers/r600/r600_shader.c
> @@ -4342,8 +4342,32 @@ static void tgsi_dst(struct r600_shader_ctx *ctx,
>  
>   if (spilled) {
>   struct r600_bytecode_output cf;
> - int reg = r600_get_temp(ctx);
> + int reg = 0;
>   int r;
> + bool add_pending_output = true;
> +
> + memset(, 0, sizeof(struct r600_bytecode_output));
> + get_spilled_array_base_and_size(ctx, 
> tgsi_dst->Register.Index,
> + _base, _size);
> +
> + /* If no componet
component

> has spilled, reserve a register and add the spill code
> +  *  ctx->bc->n_pending_outputs is cleared after each instruction 
> group */
> + if (ctx->bc->n_pending_outputs == 0) {
> + reg = r600_get_temp(ctx);
> + } else {
> + /* If we already spilling and the output 
> address is the same like
If we are

> +  * before then just reuse the same slot */
> +struct r600_bytecode_output *tmpl = 
> >bc->pending_outputs[ctx->bc->n_pending_outputs-1];
> +if ((cf.array_base + idx == tmpl->array_base) ||
> +(cf.array_base == tmpl->array_base &&
> +   tmpl->index_gpr == ctx->bc->ar_reg &&
> +   tgsi_dst->Register.Indirect)) {
> + reg = ctx->bc->pending_outputs[0].gpr;
> + add_pending_output = false;
> +} else {
> + reg = r600_get_temp(ctx);
> +}
> + }
>  
>   r600_dst->sel = reg;
>   r600_dst->chan = swizzle;
> @@ -4352,42 +4376,39 @@ static void tgsi_dst(struct r600_shader_ctx *ctx,
>   r600_dst->clamp = 1;
>   }
>  
> - // needs to be added after op using tgsi_dst
> - memset(, 0, sizeof(struct r600_bytecode_output));
> - cf.op = CF_OP_MEM_SCRATCH;
> - cf.elem_size = 3;
> - cf.gpr = reg;
> - cf.type = V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_WRITE;
> - cf.mark = 1;
> - cf.comp_mask = inst->Dst[0].Register.WriteMask;
> - cf.swizzle_x = 0;
> - cf.swizzle_y = 1;
> - cf.swizzle_z = 2;
> - cf.swizzle_w = 3;
> - cf.burst_count = 1;
> -
> - get_spilled_array_base_and_size(ctx, 
> tgsi_dst->Register.Index,
> - _base, _size);
> -
> - if (tgsi_dst->Register.Indirect) {
> - if (ctx->bc->chip_class < R700)
> - cf.type = 
> V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_WRITE_IND;
> - else
> - cf.type = 3; // 
> V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_WRITE_IND_ACK;
> - cf.index_gpr = ctx->bc->ar_reg;
> - }
> - else {
> - cf.array_base += idx;
> - cf.array_size = 0;
> + /* Add new outputs as pending */
> + if (add_pending_output) {
> + 

Re: [Mesa-dev] [PATCH] xvmc: Disable errors from tests when the host doesn't support XVMC.

2018-07-10 Thread Dylan Baker
I think meson will report skip the return code is 127 or 128 (can't remember),
but this seems fine too, or we can just remove them from the set of tests like
Ilia suggested. For any of the above options,

Reviewed-by: Dylan Baker 

Quoting Eric Anholt (2018-07-10 12:42:34)
> These are connected as unit tests, so no breaking the build just because
> the host can't do it.  If you wanted to test on a non-supporting host,
> you'd need some sort of mocking.
> ---
>  src/gallium/state_trackers/xvmc/tests/test_blocks.c | 2 +-
>  src/gallium/state_trackers/xvmc/tests/test_context.c| 2 +-
>  src/gallium/state_trackers/xvmc/tests/test_rendering.c  | 2 +-
>  src/gallium/state_trackers/xvmc/tests/test_subpicture.c | 2 +-
>  src/gallium/state_trackers/xvmc/tests/test_surface.c| 2 +-
>  src/gallium/state_trackers/xvmc/tests/xvmc_bench.c  | 2 +-
>  6 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/src/gallium/state_trackers/xvmc/tests/test_blocks.c 
> b/src/gallium/state_trackers/xvmc/tests/test_blocks.c
> index 53c29bc5ae1b..4a14b24b0a89 100644
> --- a/src/gallium/state_trackers/xvmc/tests/test_blocks.c
> +++ b/src/gallium/state_trackers/xvmc/tests/test_blocks.c
> @@ -66,7 +66,7 @@ int main(int argc, char **argv)
> {
> XCloseDisplay(display);
> fprintf(stderr, "Error, unable to find a good port.\n");
> -   exit(1);
> +   exit(0);
> }
>  
> if (is_overlay)
> diff --git a/src/gallium/state_trackers/xvmc/tests/test_context.c 
> b/src/gallium/state_trackers/xvmc/tests/test_context.c
> index 81d26fcffd57..573b5d535bcb 100644
> --- a/src/gallium/state_trackers/xvmc/tests/test_context.c
> +++ b/src/gallium/state_trackers/xvmc/tests/test_context.c
> @@ -62,7 +62,7 @@ int main(int argc, char **argv)
> {
> XCloseDisplay(display);
> fprintf(stderr, "Error, unable to find a good port.\n");
> -   exit(1);
> +   exit(0);
> }
>  
> if (is_overlay)
> diff --git a/src/gallium/state_trackers/xvmc/tests/test_rendering.c 
> b/src/gallium/state_trackers/xvmc/tests/test_rendering.c
> index c5494ecc8c2f..6f12f219af44 100644
> --- a/src/gallium/state_trackers/xvmc/tests/test_rendering.c
> +++ b/src/gallium/state_trackers/xvmc/tests/test_rendering.c
> @@ -171,7 +171,7 @@ int main(int argc, char **argv)
> {
> XCloseDisplay(display);
> fprintf(stderr, "Error, unable to find a good port.\n");
> -   exit(1);
> +   exit(0);
> }
>  
> if (is_overlay)
> diff --git a/src/gallium/state_trackers/xvmc/tests/test_subpicture.c 
> b/src/gallium/state_trackers/xvmc/tests/test_subpicture.c
> index 006972fa8ee7..673488a1fd25 100644
> --- a/src/gallium/state_trackers/xvmc/tests/test_subpicture.c
> +++ b/src/gallium/state_trackers/xvmc/tests/test_subpicture.c
> @@ -89,7 +89,7 @@ int main(int argc, char **argv)
> {
> XCloseDisplay(display);
> fprintf(stderr, "Error, unable to find a good port.\n");
> -   exit(1);
> +   exit(0);
> }
>  
> if (is_overlay)
> diff --git a/src/gallium/state_trackers/xvmc/tests/test_surface.c 
> b/src/gallium/state_trackers/xvmc/tests/test_surface.c
> index d5a121d5ab0d..6b455bc00ebe 100644
> --- a/src/gallium/state_trackers/xvmc/tests/test_surface.c
> +++ b/src/gallium/state_trackers/xvmc/tests/test_surface.c
> @@ -63,7 +63,7 @@ int main(int argc, char **argv)
> {
> XCloseDisplay(display);
> fprintf(stderr, "Error, unable to find a good port.\n");
> -   exit(1);
> +   exit(0);
> }
>  
> if (is_overlay)
> diff --git a/src/gallium/state_trackers/xvmc/tests/xvmc_bench.c 
> b/src/gallium/state_trackers/xvmc/tests/xvmc_bench.c
> index 3cd23173c7c7..bf6272b0a3e6 100644
> --- a/src/gallium/state_trackers/xvmc/tests/xvmc_bench.c
> +++ b/src/gallium/state_trackers/xvmc/tests/xvmc_bench.c
> @@ -219,7 +219,7 @@ int main(int argc, char **argv)
> {
> XCloseDisplay(display);
> fprintf(stderr, "Error, unable to find a good port.\n");
> -   exit(1);
> +   exit(0);
> }
>  
> if (is_overlay)
> -- 
> 2.18.0
> 


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


Re: [Mesa-dev] [PATCH v2 04/11] glsl: separate copy propagation state

2018-07-10 Thread Eric Anholt
Caio Marcelo de Oliveira Filho  writes:

> Separate higher level logic of visiting instructions and chosing when
> to store and use new copy data from the datastructure holding the copy
> propagation information. This will also make easier later patches that
> change the structure.
>
> v2: Remove empty destructor and clarify how hash tables are destroyed.
> ---
>  .../glsl/opt_copy_propagation_elements.cpp| 267 +-
>  1 file changed, 141 insertions(+), 126 deletions(-)
>
> diff --git a/src/compiler/glsl/opt_copy_propagation_elements.cpp 
> b/src/compiler/glsl/opt_copy_propagation_elements.cpp
> index 8975e727522..05965128fd9 100644
> --- a/src/compiler/glsl/opt_copy_propagation_elements.cpp
> +++ b/src/compiler/glsl/opt_copy_propagation_elements.cpp
> @@ -89,6 +89,119 @@ public:
> acp_ref rhs_node;
>  };
>  
> +class copy_propagation_state {
> +public:
> +   DECLARE_RZALLOC_CXX_OPERATORS(copy_propagation_state);
> +
> +   copy_propagation_state(void *mem_ctx, void *lin_ctx)
> +   {
> +  /* Use 'this' as context for the tables, no explicit destruction
> +   * needed later. */

Mesa style: */ on its own line.

Other than that,

Reviewed-by: Eric Anholt 


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


Re: [Mesa-dev] [PATCH v2 07/11] util/set: helper to remove entry by key

2018-07-10 Thread Eric Anholt
Caio Marcelo de Oliveira Filho  writes:

> v2: Add unit test. (Eric Anholt)

5-7 are:

Reviewed-by: Eric Anholt 


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


Re: [Mesa-dev] [PATCH] xvmc: Disable errors from tests when the host doesn't support XVMC.

2018-07-10 Thread Ilia Mirkin
Not opposed to this change, but FWIW these "tests" aren't tests at
all. They require the proper binary to be pointed to by libXvMCW in
order to operate properly. They're more like "programs to smoke-test
an installation of xvmc".

On Tue, Jul 10, 2018 at 3:42 PM, Eric Anholt  wrote:
> These are connected as unit tests, so no breaking the build just because
> the host can't do it.  If you wanted to test on a non-supporting host,
> you'd need some sort of mocking.
> ---
>  src/gallium/state_trackers/xvmc/tests/test_blocks.c | 2 +-
>  src/gallium/state_trackers/xvmc/tests/test_context.c| 2 +-
>  src/gallium/state_trackers/xvmc/tests/test_rendering.c  | 2 +-
>  src/gallium/state_trackers/xvmc/tests/test_subpicture.c | 2 +-
>  src/gallium/state_trackers/xvmc/tests/test_surface.c| 2 +-
>  src/gallium/state_trackers/xvmc/tests/xvmc_bench.c  | 2 +-
>  6 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/src/gallium/state_trackers/xvmc/tests/test_blocks.c 
> b/src/gallium/state_trackers/xvmc/tests/test_blocks.c
> index 53c29bc5ae1b..4a14b24b0a89 100644
> --- a/src/gallium/state_trackers/xvmc/tests/test_blocks.c
> +++ b/src/gallium/state_trackers/xvmc/tests/test_blocks.c
> @@ -66,7 +66,7 @@ int main(int argc, char **argv)
> {
> XCloseDisplay(display);
> fprintf(stderr, "Error, unable to find a good port.\n");
> -   exit(1);
> +   exit(0);
> }
>
> if (is_overlay)
> diff --git a/src/gallium/state_trackers/xvmc/tests/test_context.c 
> b/src/gallium/state_trackers/xvmc/tests/test_context.c
> index 81d26fcffd57..573b5d535bcb 100644
> --- a/src/gallium/state_trackers/xvmc/tests/test_context.c
> +++ b/src/gallium/state_trackers/xvmc/tests/test_context.c
> @@ -62,7 +62,7 @@ int main(int argc, char **argv)
> {
> XCloseDisplay(display);
> fprintf(stderr, "Error, unable to find a good port.\n");
> -   exit(1);
> +   exit(0);
> }
>
> if (is_overlay)
> diff --git a/src/gallium/state_trackers/xvmc/tests/test_rendering.c 
> b/src/gallium/state_trackers/xvmc/tests/test_rendering.c
> index c5494ecc8c2f..6f12f219af44 100644
> --- a/src/gallium/state_trackers/xvmc/tests/test_rendering.c
> +++ b/src/gallium/state_trackers/xvmc/tests/test_rendering.c
> @@ -171,7 +171,7 @@ int main(int argc, char **argv)
> {
> XCloseDisplay(display);
> fprintf(stderr, "Error, unable to find a good port.\n");
> -   exit(1);
> +   exit(0);
> }
>
> if (is_overlay)
> diff --git a/src/gallium/state_trackers/xvmc/tests/test_subpicture.c 
> b/src/gallium/state_trackers/xvmc/tests/test_subpicture.c
> index 006972fa8ee7..673488a1fd25 100644
> --- a/src/gallium/state_trackers/xvmc/tests/test_subpicture.c
> +++ b/src/gallium/state_trackers/xvmc/tests/test_subpicture.c
> @@ -89,7 +89,7 @@ int main(int argc, char **argv)
> {
> XCloseDisplay(display);
> fprintf(stderr, "Error, unable to find a good port.\n");
> -   exit(1);
> +   exit(0);
> }
>
> if (is_overlay)
> diff --git a/src/gallium/state_trackers/xvmc/tests/test_surface.c 
> b/src/gallium/state_trackers/xvmc/tests/test_surface.c
> index d5a121d5ab0d..6b455bc00ebe 100644
> --- a/src/gallium/state_trackers/xvmc/tests/test_surface.c
> +++ b/src/gallium/state_trackers/xvmc/tests/test_surface.c
> @@ -63,7 +63,7 @@ int main(int argc, char **argv)
> {
> XCloseDisplay(display);
> fprintf(stderr, "Error, unable to find a good port.\n");
> -   exit(1);
> +   exit(0);
> }
>
> if (is_overlay)
> diff --git a/src/gallium/state_trackers/xvmc/tests/xvmc_bench.c 
> b/src/gallium/state_trackers/xvmc/tests/xvmc_bench.c
> index 3cd23173c7c7..bf6272b0a3e6 100644
> --- a/src/gallium/state_trackers/xvmc/tests/xvmc_bench.c
> +++ b/src/gallium/state_trackers/xvmc/tests/xvmc_bench.c
> @@ -219,7 +219,7 @@ int main(int argc, char **argv)
> {
> XCloseDisplay(display);
> fprintf(stderr, "Error, unable to find a good port.\n");
> -   exit(1);
> +   exit(0);
> }
>
> if (is_overlay)
> --
> 2.18.0
>
> ___
> 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] [PATCH] xvmc: Disable errors from tests when the host doesn't support XVMC.

2018-07-10 Thread Eric Anholt
These are connected as unit tests, so no breaking the build just because
the host can't do it.  If you wanted to test on a non-supporting host,
you'd need some sort of mocking.
---
 src/gallium/state_trackers/xvmc/tests/test_blocks.c | 2 +-
 src/gallium/state_trackers/xvmc/tests/test_context.c| 2 +-
 src/gallium/state_trackers/xvmc/tests/test_rendering.c  | 2 +-
 src/gallium/state_trackers/xvmc/tests/test_subpicture.c | 2 +-
 src/gallium/state_trackers/xvmc/tests/test_surface.c| 2 +-
 src/gallium/state_trackers/xvmc/tests/xvmc_bench.c  | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/gallium/state_trackers/xvmc/tests/test_blocks.c 
b/src/gallium/state_trackers/xvmc/tests/test_blocks.c
index 53c29bc5ae1b..4a14b24b0a89 100644
--- a/src/gallium/state_trackers/xvmc/tests/test_blocks.c
+++ b/src/gallium/state_trackers/xvmc/tests/test_blocks.c
@@ -66,7 +66,7 @@ int main(int argc, char **argv)
{
XCloseDisplay(display);
fprintf(stderr, "Error, unable to find a good port.\n");
-   exit(1);
+   exit(0);
}
 
if (is_overlay)
diff --git a/src/gallium/state_trackers/xvmc/tests/test_context.c 
b/src/gallium/state_trackers/xvmc/tests/test_context.c
index 81d26fcffd57..573b5d535bcb 100644
--- a/src/gallium/state_trackers/xvmc/tests/test_context.c
+++ b/src/gallium/state_trackers/xvmc/tests/test_context.c
@@ -62,7 +62,7 @@ int main(int argc, char **argv)
{
XCloseDisplay(display);
fprintf(stderr, "Error, unable to find a good port.\n");
-   exit(1);
+   exit(0);
}
 
if (is_overlay)
diff --git a/src/gallium/state_trackers/xvmc/tests/test_rendering.c 
b/src/gallium/state_trackers/xvmc/tests/test_rendering.c
index c5494ecc8c2f..6f12f219af44 100644
--- a/src/gallium/state_trackers/xvmc/tests/test_rendering.c
+++ b/src/gallium/state_trackers/xvmc/tests/test_rendering.c
@@ -171,7 +171,7 @@ int main(int argc, char **argv)
{
XCloseDisplay(display);
fprintf(stderr, "Error, unable to find a good port.\n");
-   exit(1);
+   exit(0);
}
 
if (is_overlay)
diff --git a/src/gallium/state_trackers/xvmc/tests/test_subpicture.c 
b/src/gallium/state_trackers/xvmc/tests/test_subpicture.c
index 006972fa8ee7..673488a1fd25 100644
--- a/src/gallium/state_trackers/xvmc/tests/test_subpicture.c
+++ b/src/gallium/state_trackers/xvmc/tests/test_subpicture.c
@@ -89,7 +89,7 @@ int main(int argc, char **argv)
{
XCloseDisplay(display);
fprintf(stderr, "Error, unable to find a good port.\n");
-   exit(1);
+   exit(0);
}
 
if (is_overlay)
diff --git a/src/gallium/state_trackers/xvmc/tests/test_surface.c 
b/src/gallium/state_trackers/xvmc/tests/test_surface.c
index d5a121d5ab0d..6b455bc00ebe 100644
--- a/src/gallium/state_trackers/xvmc/tests/test_surface.c
+++ b/src/gallium/state_trackers/xvmc/tests/test_surface.c
@@ -63,7 +63,7 @@ int main(int argc, char **argv)
{
XCloseDisplay(display);
fprintf(stderr, "Error, unable to find a good port.\n");
-   exit(1);
+   exit(0);
}
 
if (is_overlay)
diff --git a/src/gallium/state_trackers/xvmc/tests/xvmc_bench.c 
b/src/gallium/state_trackers/xvmc/tests/xvmc_bench.c
index 3cd23173c7c7..bf6272b0a3e6 100644
--- a/src/gallium/state_trackers/xvmc/tests/xvmc_bench.c
+++ b/src/gallium/state_trackers/xvmc/tests/xvmc_bench.c
@@ -219,7 +219,7 @@ int main(int argc, char **argv)
{
XCloseDisplay(display);
fprintf(stderr, "Error, unable to find a good port.\n");
-   exit(1);
+   exit(0);
}
 
if (is_overlay)
-- 
2.18.0

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


Re: [Mesa-dev] [PATCH 06/10] util/set: helper to remove entry by key

2018-07-10 Thread Eric Anholt
Caio Marcelo de Oliveira Filho  writes:

> On Thu, Jul 05, 2018 at 01:56:11PM -0700, Eric Anholt wrote:
>> Caio Marcelo de Oliveira Filho  writes:
>> 
>> > ---
>> 
>> This one should be trivial to unit test, with a present and non-present
>> key.
>
> Done.
>
> Do you want the equivalent hash_table function even if I don't have
> use for it in the code at the moment?

It would be nice.  Given that the files started out as basically a sed
job, I like keeping them matching in API so you know what to expect once
you've used one or the other.


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


Re: [Mesa-dev] [PATCH mesa] egl: drop unused _EGL_BUILT_IN_DRIVER_DRI2

2018-07-10 Thread Eric Anholt
Eric Engestrom  writes:

> Unused since b174a1ae720cb404738c "egl: Simplify the "driver" interface".
>
> Signed-off-by: Eric Engestrom 

Reviewed-by: Eric Anholt 


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


Re: [Mesa-dev] [PATCH] gallium/u_transfer_helper: Fix MSAA mappings with nonzero x/y.

2018-07-10 Thread Rob Clark
On Mon, Jul 9, 2018 at 5:13 PM, Eric Anholt  wrote:
> We created a temporary with box->{width,height} and then tried to map
> width,height from a nonzero offset when we meant to just map the whole
> temporary.
>
> Fixes segfaults in V3D in dEQP-GLES3.functional.prerequisite.read_pixels
> with --deqp-egl-config-name=rgbad24s8ms4 and also piglit's read-front
> clear-front-first -samples=4

Reviewed-by: Rob Clark 

> ---
>  src/gallium/auxiliary/util/u_transfer_helper.c | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/auxiliary/util/u_transfer_helper.c 
> b/src/gallium/auxiliary/util/u_transfer_helper.c
> index 3b085fd99f09..fd8a5c3a0895 100644
> --- a/src/gallium/auxiliary/util/u_transfer_helper.c
> +++ b/src/gallium/auxiliary/util/u_transfer_helper.c
> @@ -207,7 +207,11 @@ transfer_map_msaa(struct pipe_context *pctx,
>pctx->blit(pctx, );
> }
>
> -   void *ss_map = pctx->transfer_map(pctx, trans->ss, 0, usage, box,
> +   struct pipe_box map_box = *box;
> +   map_box.x = 0;
> +   map_box.y = 0;
> +
> +   void *ss_map = pctx->transfer_map(pctx, trans->ss, 0, usage, _box,
>   >trans);
> if (!ss_map) {
>free(trans);
> --
> 2.18.0
>
> ___
> 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 mesa] meson: fix windows build

2018-07-10 Thread Dylan Baker
Quoting Eric Engestrom (2018-07-09 04:12:05)
> The python installer on Windows installs two `python.exe`, one for
> python2 and one for python3 and no `python2.exe` nor `python3.exe`.
> 
> This seems utterly broken to me, but luckily for us meson handles this
> craziness for us, but only since version 0.46.
> 
> This is higher than we require for now, but since we only need this on
> Windows, I suggest bumping the required version only on windows, and
> leaving all the other OSes as is.
> 
> (Note: some future version of Meson (0.48 probably) will handle this
>  internally in the find_program() call.)
> 
> Reported-by: Alexander Ashevchenko 
> Cc: Mathieu Bridon 
> Signed-off-by: Eric Engestrom 
> ---
>  meson.build | 10 +-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/meson.build b/meson.build
> index eccf7546108421eedca3..c62cdd0e395259ec984e 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -696,7 +696,15 @@ if with_platform_haiku
>pre_args += '-DHAVE_HAIKU_PLATFORM'
>  endif
>  
> -prog_python2 = find_program('python2')
> +if build_machine.system() == 'windows'
> +  if meson.version().version_compare('< 0.46')
> +error('Windows requires Meson 0.46+; please update and try again.')
> +  else
> +prog_python2 = import('python').find_installation('python2')
> +  endif
> +else
> +  prog_python2 = find_program('python2')
> +endif
>  has_mako = run_command(prog_python2, '-c', 'import mako')
>  if has_mako.returncode() != 0
>error('Python (2.x) mako module required to build mesa.')
> -- 
> Cheers,
>   Eric
> 

I've reviewed this patch and merged it into my meson-windows series, which I'm
about to send out a v2 of.

Dylan


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


Re: [Mesa-dev] [PATCH 1/3] vulkan: Define new VK_MESA_query_timestamp extension [v2]

2018-07-10 Thread Keith Packard
Pekka Paalanen  writes:

> On Sat, 23 Jun 2018 12:13:53 -0500
> Jason Ekstrand  wrote:
>
>> I haven't thought through this comment all that hard but would it make 
>> sense to have three timestamps, CPU, GPU, CPU so that you have error bars 
>> on the GPU timestamp?  At the very least, two timestamps would be better 
>> than one so that, when we pull it into the kernel, it can provide something 
>> more accurate than userspace trying to grab a snapshot.
>
> Hi,
>
> three timestamps sounds like a good idea to me, but you might want to
> reach out to media developers (e.g. gstreamer) who have experience in
> synchronizing different clocks and what that will actually take.

Oh, I know that's really hard, and I don't want to solve that problem
here. I explicitly *don't* solve it though -- I simply expose the
ability to get correlated values in the two application-visible time
domains that the Vulkan API already exposes (surface time and GPU
time). How to synchronize the application as those two clocks drift
around is outside the domain of this extension.

> When reading the CPU timestamp, I believe it would be necessary for
> userspace to tell which clock it should be reading. I'm not sure all
> userspace is always using CLOCK_MONOTONIC. But if you have a better
> rationale, that would be interesting to record and document.

The extension doesn't state which clock is returned, you provide a
device and a surface and get timestamps for both of them. This allows
applications to translate between the two Vulkan time domains.

As far as the implementation goes, it asks the device driver to get
correlated GPU and CLOCK_MONOTONIC values and then asks the WSI layer to
translate between CLOCK_MONOTONIC and surface time. Right now, all three
surface types already operate in CLOCK_MONOTONIC natively, so there
isn't any translation needed to surface time.

The anv and radv driver implementations are simplistic and could easily
be improved; they both simply fetch the GPU clock and then
CLOCK_MONOTONIC sequentially without attempting to bound the error
between them.

The entire reason for this extension is to allow me to implement the
GOOGLE_display_timing extension using only public interfaces into the
drivers. That patch is blocked on getting this functionality landed.

-- 
-keith


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


Re: [Mesa-dev] [PATCH mesa 1/3] vulkan: Define new VK_MESA_query_timestamp extension [v3]

2018-07-10 Thread Jason Ekstrand
On Tue, Jul 10, 2018 at 9:47 AM Jason Ekstrand  wrote:

> On Mon, Jul 9, 2018 at 5:35 PM Keith Packard  wrote:
>
>> This extension adds a single function to query the current GPU
>> timestamp, just like glGetInteger64v(GL_TIMESTAMP, ). This
>> function is needed to complete the implementation of
>> GOOGLE_display_timing, which needs to be able to correlate GPU and CPU
>> timestamps.
>>
>> v2: Adopt Jason Ekstrand's coding conventions
>>
>> Declare variables at first use, eliminate extra whitespace between
>> types and names. Wrap lines to 80 columns.
>>
>> Add extension to list in alphabetical order
>>
>> Suggested-by: Jason Ekstrand 
>>
>> v3: Report both device and surface timestamps
>>
>> This will allow us to get timestamps more closely aligned by
>> getting both in a single call from the kernel.
>>
>> To make this independent of the timebase used by the WSI
>> layer, provide a new wsi hook which converts CLOCK_MONOTONIC
>> into the matching WSI timebase. Right now, all of our backends
>> use CLOCK_MONOTONIC, so there's nothing actually doing
>> conversions, but it seemed best to put the infrastructure in
>> place so that I could validate the extension interface would
>> work if that became necessary.
>>
>> Signed-off-by: Keith Packard 
>> ---
>>  include/vulkan/vk_mesa_query_timestamp.h | 46 
>>  src/vulkan/registry/vk.xml   | 20 +++
>>  src/vulkan/wsi/wsi_common.c  | 17 +
>>  src/vulkan/wsi/wsi_common.h  |  7 
>>  src/vulkan/wsi/wsi_common_private.h  |  4 +++
>>  5 files changed, 94 insertions(+)
>>  create mode 100644 include/vulkan/vk_mesa_query_timestamp.h
>>
>> diff --git a/include/vulkan/vk_mesa_query_timestamp.h
>> b/include/vulkan/vk_mesa_query_timestamp.h
>> new file mode 100644
>> index 000..262f094db27
>> --- /dev/null
>> +++ b/include/vulkan/vk_mesa_query_timestamp.h
>> @@ -0,0 +1,46 @@
>> +/*
>> + * Copyright © 2018 Keith Packard
>> + *
>> + * Permission to use, copy, modify, distribute, and sell this software
>> and its
>> + * documentation for any purpose is hereby granted without fee, provided
>> that
>> + * the above copyright notice appear in all copies and that both that
>> copyright
>> + * notice and this permission notice appear in supporting documentation,
>> and
>> + * that the name of the copyright holders not be used in advertising or
>> + * publicity pertaining to distribution of the software without specific,
>> + * written prior permission.  The copyright holders make no
>> representations
>> + * about the suitability of this software for any purpose.  It is
>> provided "as
>> + * is" without express or implied warranty.
>> + *
>> + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
>> SOFTWARE,
>> + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
>> + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT
>> OR
>> + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
>> OF USE,
>> + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
>> + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
>> PERFORMANCE
>> + * OF THIS SOFTWARE.
>> + */
>> +
>> +#ifndef __VK_MESA_QUERY_TIMESTAMP_H__
>> +#define __VK_MESA_QUERY_TIMESTAMP_H__
>> +
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +typedef struct VkCurrentTimestampMESA {
>> +uint64_tdeviceTimestamp;
>> +uint64_tsurfaceTimestamp;
>> +} VkCurrentTimestampMESA;
>> +
>> +typedef VkResult (VKAPI_PTR *PFN_vkQueryCurrentTimestampMESA)(
>> +VkDevice device, VkSurfaceKHR surface, VkCurrentTimestampMESA
>> *timestamp);
>> +
>> +VKAPI_ATTR VkResult VKAPI_CALL vkQueryCurrentTimestampMESA(
>> +VkDevice device, VkSurfaceKHR surface, VkCurrentTimestampMESA
>> *timestamp);
>>
>
> I hate to salami extensions too much but it might be better if this were
> two extensions.  One would be
>
> typedef struct VkCurrentTimestampMESA {
> VkStructType sType;
> void *pNext;
> uint64_t timestamp;
> } VkCurrentTimestampMESA;
>
> VkResult vkGetCurrentTimestampMESA(VkDevice device, VkBaseInStructureKHR
> *pInfo, VkCurrentTimestampMESA *pTimestamp);
>
> And the second would just define two chain in structs
>
> typedef struct VkCurrentPresentTimestampGetInfoMESA {
> VkStructureType sType;
> void *pNext;
> VkSurfaceKHR surface;
> } VkCurrentPresentTimestampGetInfoMESA;
>
> typedef struct VkCurrentPresentTimestampMESA {
> VkStructureType sType;
> void *pNext;
> uint64_t presentTimestamp;
> } VkCurrentPresentTimestampMESA;
>
> You could probably also just make the surface part of
> VkCurrentPresentTimestampMESA and not have the extendible input struct.
> That might be a bit cleaner in some ways.  If the vkGetCurrentTimestampMESA
> call is extended to get the surface timestamp, the 

Re: [Mesa-dev] [PATCH] i965/tex: ignore the diff between GL_TEXTURE_2D and GL_TEXTURE_RECTANGLE

2018-07-10 Thread Jason Ekstrand
Ugh... not so good.  According to Oliver on the bug, this just make the
assert go away and doesn't actually fix anything.  Likely this is needed
but not sufficient.

--Jason

On Tue, Jul 10, 2018 at 8:17 AM Jason Ekstrand  wrote:

> On Tue, Jul 10, 2018 at 4:13 AM Andrii Simiklit 
> wrote:
>
>> the difference between GL_TEXTURE_2D and GL_TEXTURE_RECTANGLE
>> doesn't matter as far as the miptree is concerned;
>> genX(update_sampler_state) only looks at the
>> gl_texture_object and not the miptree when determining whether or
>> not to use normalized coordinates.
>>
>> Signed-off-by: Andrii Simiklit 
>>
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107117
>>
>> ---
>>  src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 10 +-
>>  1 file changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
>> b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
>> index 7d1fa96..dc45a06 100644
>> --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
>> +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
>> @@ -58,6 +58,12 @@ static void *intel_miptree_map_raw(struct brw_context
>> *brw,
>>
>>  static void intel_miptree_unmap_raw(struct intel_mipmap_tree *mt);
>>
>> +static GLenum
>> +tex_rect_to_tex2d(GLenum val)
>> +{
>> +return (GL_TEXTURE_RECTANGLE == val) ? GL_TEXTURE_2D : val;
>> +}
>> +
>>  static bool
>>  intel_miptree_supports_mcs(struct brw_context *brw,
>> const struct intel_mipmap_tree *mt)
>> @@ -1320,13 +1326,15 @@ intel_miptree_match_image(struct
>> intel_mipmap_tree *mt,
>>  {
>> struct intel_texture_image *intelImage = intel_texture_image(image);
>> GLuint level = intelImage->base.Base.Level;
>> +   GLenum texObjTarget = tex_rect_to_tex2d(mt->target);
>> +   GLenum mipmapTreeTarget = tex_rect_to_tex2d(image->TexObject->Target);
>> int width, height, depth;
>>
>> /* glTexImage* choose the texture object based on the target passed
>> in, and
>>  * objects can't change targets over their lifetimes, so this should
>> be
>>  * true.
>>  */
>> -   assert(image->TexObject->Target == mt->target);
>> +   assert(texObjTarget == mipmapTreeTarget);
>>
>
> If the only use of that helper is in an assert, just put the calls to the
> helper inside the assert.  Otherwise, good job debugging. :-)
>
> --Jason
>
>
>> mesa_format mt_format = mt->format;
>> if (mt->format == MESA_FORMAT_Z24_UNORM_X8_UINT && mt->stencil_mt)
>> --
>> 2.7.4
>>
>> ___
>> 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 mesa 1/3] vulkan: Define new VK_MESA_query_timestamp extension [v3]

2018-07-10 Thread Jason Ekstrand
On Mon, Jul 9, 2018 at 5:35 PM Keith Packard  wrote:

> This extension adds a single function to query the current GPU
> timestamp, just like glGetInteger64v(GL_TIMESTAMP, ). This
> function is needed to complete the implementation of
> GOOGLE_display_timing, which needs to be able to correlate GPU and CPU
> timestamps.
>
> v2: Adopt Jason Ekstrand's coding conventions
>
> Declare variables at first use, eliminate extra whitespace between
> types and names. Wrap lines to 80 columns.
>
> Add extension to list in alphabetical order
>
> Suggested-by: Jason Ekstrand 
>
> v3: Report both device and surface timestamps
>
> This will allow us to get timestamps more closely aligned by
> getting both in a single call from the kernel.
>
> To make this independent of the timebase used by the WSI
> layer, provide a new wsi hook which converts CLOCK_MONOTONIC
> into the matching WSI timebase. Right now, all of our backends
> use CLOCK_MONOTONIC, so there's nothing actually doing
> conversions, but it seemed best to put the infrastructure in
> place so that I could validate the extension interface would
> work if that became necessary.
>
> Signed-off-by: Keith Packard 
> ---
>  include/vulkan/vk_mesa_query_timestamp.h | 46 
>  src/vulkan/registry/vk.xml   | 20 +++
>  src/vulkan/wsi/wsi_common.c  | 17 +
>  src/vulkan/wsi/wsi_common.h  |  7 
>  src/vulkan/wsi/wsi_common_private.h  |  4 +++
>  5 files changed, 94 insertions(+)
>  create mode 100644 include/vulkan/vk_mesa_query_timestamp.h
>
> diff --git a/include/vulkan/vk_mesa_query_timestamp.h
> b/include/vulkan/vk_mesa_query_timestamp.h
> new file mode 100644
> index 000..262f094db27
> --- /dev/null
> +++ b/include/vulkan/vk_mesa_query_timestamp.h
> @@ -0,0 +1,46 @@
> +/*
> + * Copyright © 2018 Keith Packard
> + *
> + * Permission to use, copy, modify, distribute, and sell this software
> and its
> + * documentation for any purpose is hereby granted without fee, provided
> that
> + * the above copyright notice appear in all copies and that both that
> copyright
> + * notice and this permission notice appear in supporting documentation,
> and
> + * that the name of the copyright holders not be used in advertising or
> + * publicity pertaining to distribution of the software without specific,
> + * written prior permission.  The copyright holders make no
> representations
> + * about the suitability of this software for any purpose.  It is
> provided "as
> + * is" without express or implied warranty.
> + *
> + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
> SOFTWARE,
> + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
> + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT
> OR
> + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
> USE,
> + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
> + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
> PERFORMANCE
> + * OF THIS SOFTWARE.
> + */
> +
> +#ifndef __VK_MESA_QUERY_TIMESTAMP_H__
> +#define __VK_MESA_QUERY_TIMESTAMP_H__
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +typedef struct VkCurrentTimestampMESA {
> +uint64_tdeviceTimestamp;
> +uint64_tsurfaceTimestamp;
> +} VkCurrentTimestampMESA;
> +
> +typedef VkResult (VKAPI_PTR *PFN_vkQueryCurrentTimestampMESA)(
> +VkDevice device, VkSurfaceKHR surface, VkCurrentTimestampMESA
> *timestamp);
> +
> +VKAPI_ATTR VkResult VKAPI_CALL vkQueryCurrentTimestampMESA(
> +VkDevice device, VkSurfaceKHR surface, VkCurrentTimestampMESA
> *timestamp);
>

I hate to salami extensions too much but it might be better if this were
two extensions.  One would be

typedef struct VkCurrentTimestampMESA {
VkStructType sType;
void *pNext;
uint64_t timestamp;
} VkCurrentTimestampMESA;

VkResult vkGetCurrentTimestampMESA(VkDevice device, VkBaseInStructureKHR
*pInfo, VkCurrentTimestampMESA *pTimestamp);

And the second would just define two chain in structs

typedef struct VkCurrentPresentTimestampGetInfoMESA {
VkStructureType sType;
void *pNext;
VkSurfaceKHR surface;
} VkCurrentPresentTimestampGetInfoMESA;

typedef struct VkCurrentPresentTimestampMESA {
VkStructureType sType;
void *pNext;
uint64_t presentTimestamp;
} VkCurrentPresentTimestampMESA;

You could probably also just make the surface part of
VkCurrentPresentTimestampMESA and not have the extendible input struct.
That might be a bit cleaner in some ways.  If the vkGetCurrentTimestampMESA
call is extended to get the surface timestamp, the driver would have the
option to call the kernel for the more accurate thing or it could just
return the two separate things that your implementation already does.

The reason I suggest this is that Vulkan 

[Mesa-dev] [Bug 107179] mm

2018-07-10 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107179

Bug ID: 107179
   Summary: mm
   Product: Mesa
   Version: 18.0
  Hardware: Other
OS: All
Status: NEW
  Severity: critical
  Priority: medium
 Component: Demos
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: sweety21sa...@gmail.com
QA Contact: mesa-dev@lists.freedesktop.org

-- 
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 48/48] tests/vma: fix build with MSVC

2018-07-10 Thread Liviu Prodea
For the series https://patchwork.freedesktop.org/series/44596/
Updating Meson from 0.46.1 to 0.47.0 sorted the build system generating failure 
posted about earlier and eventually got a successful build. Note that I am 
using Python 3.7. Though I remember getting very similar errors with Python 
3.6.5.

There is an alternative patch for patch 45 in the series somewhere on this 
mailing 
list:https://lists.freedesktop.org/archives/mesa-dev/2018-July/199683.html
As an extra it bumps the requirement of Meson to 0.46.0 but now I wonder if 
it's enough.

Also I noticed that after build was done some dlls have names slightly 
different than Scons build's counterparts. I think they should be consistent:

- OSMesa-8.dll instead osmesa.dll (osmesa gallium, didn't try building osmesa 
classic);- glapi-0.dll instead of libglapi.dll;- GLESv1_CM-1.dll instead of 
libGLESv1_CM.dll;- GLESv2-2.dll instead of libGLESv2.dll;- also I think 
expat-1.dll can be just expat.dll.
On the bright side bug 106843 only affects Scons.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 107170] Build fails if building against X server/libxrandr with no leases support

2018-07-10 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107170

Eero Tamminen  changed:

   What|Removed |Added

   See Also||https://bugs.freedesktop.or
   ||g/show_bug.cgi?id=107176

-- 
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 106843] Cannot build osmesa with GLES (shared glapi) using Scons and MSVC

2018-07-10 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=106843

--- Comment #9 from Alex Granni  ---
(In reply to Alex Granni from comment #8)
> (In reply to Alex Granni from comment #7)
> > (In reply to Eric Engestrom from comment #4)
> > > Hi Alex,
> > > Would you mind testing the work-in-progress branch and report if it works
> > > when building with Meson?
> > > git://people.freedesktop.org/~dbaker/mesa meson-windows
> > That branch appears to be incomplete. It has only 24 of the 48 patches in
> > the series:
> > https://cgit.freedesktop.org/~dbaker/mesa/log/?h=meson-windows
> > Full series: https://patchwork.freedesktop.org/series/44596/
> > After looking at the 46th patch in the series that acts like a blueprint I
> > noticed the branch is incomplete.
> Dylan posted the Meson windows branch on Freedesktop Gitlab. I'll test this
> issue with Meson soon.

Tested and it builds successfully, so it's a Scons only issue. Because Meson
has GLES enabled by default unlike Scons it is not much of a surprise it's
unaffected.

-- 
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 107176] Mesa Vulkan build fails on Ubuntu 16.04 for dependencies not caught by Mesa configure

2018-07-10 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107176

Jason Ekstrand  changed:

   What|Removed |Added

   Assignee|mesa-dev@lists.freedesktop. |kei...@keithp.com
   |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


Re: [Mesa-dev] [PATCH 1/3] i965: Sweep NIR after linking phase to free held memory

2018-07-10 Thread Danylo Piliaiev

Indeed it would be better to move it, will be done.

On 10.07.18 18:04, Jason Ekstrand wrote:
I think we can just move it up a couple of loops to the place where we 
do the final lowering and call gather_info. Other than that, this 
seems like a good idea to me.  NIR passes are pretty sloppy about 
memory and assume nir_sweep gets called.  Hanging on to linked shaders 
with all that garbage floating around is a bad plan.


On Tue, Jul 10, 2018 at 1:53 AM Danylo Piliaiev 
mailto:danylo.pilia...@gmail.com>> wrote:


After optimization passes and many trasfromations most of memory
NIR holds is a garbage which was being freed only after shader
deletion.
Freeing it at the end of linking will save memory which would be
useful
in case there are a lot of complex shaders being compiled.
The common case for this issue is 32bit game running under Wine.

The cost of the optimization is around ~3-5% of compilation speed
with complex shaders.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103274

Signed-off-by: Danylo Piliaiev mailto:danylo.pilia...@globallogic.com>>
---
 src/mesa/drivers/dri/i965/brw_link.cpp | 9 +
 1 file changed, 9 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp
b/src/mesa/drivers/dri/i965/brw_link.cpp
index 1071056f14..8f34a58ce7 100644
--- a/src/mesa/drivers/dri/i965/brw_link.cpp
+++ b/src/mesa/drivers/dri/i965/brw_link.cpp
@@ -359,6 +359,15 @@ brw_link_shader(struct gl_context *ctx,
struct gl_shader_program *shProg)
       }
    }

+   for (stage = 0; stage < ARRAY_SIZE(shProg->_LinkedShaders);
stage++) {
+      struct gl_linked_shader *shader =
shProg->_LinkedShaders[stage];
+      if (!shader)
+         continue;
+
+      struct gl_program *prog = shader->Program;
+      nir_sweep(prog->nir);
+   }
+
    if (brw->ctx.Cache) {
       for (stage = 0; stage < ARRAY_SIZE(shProg->_LinkedShaders);
stage++) {
          struct gl_linked_shader *shader =
shProg->_LinkedShaders[stage];
-- 
2.17.1




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


Re: [Mesa-dev] [PATCH] i965/tex: ignore the diff between GL_TEXTURE_2D and GL_TEXTURE_RECTANGLE

2018-07-10 Thread Jason Ekstrand
On Tue, Jul 10, 2018 at 4:13 AM Andrii Simiklit 
wrote:

> the difference between GL_TEXTURE_2D and GL_TEXTURE_RECTANGLE
> doesn't matter as far as the miptree is concerned;
> genX(update_sampler_state) only looks at the
> gl_texture_object and not the miptree when determining whether or
> not to use normalized coordinates.
>
> Signed-off-by: Andrii Simiklit 
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107117
>
> ---
>  src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 10 +-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> index 7d1fa96..dc45a06 100644
> --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> @@ -58,6 +58,12 @@ static void *intel_miptree_map_raw(struct brw_context
> *brw,
>
>  static void intel_miptree_unmap_raw(struct intel_mipmap_tree *mt);
>
> +static GLenum
> +tex_rect_to_tex2d(GLenum val)
> +{
> +return (GL_TEXTURE_RECTANGLE == val) ? GL_TEXTURE_2D : val;
> +}
> +
>  static bool
>  intel_miptree_supports_mcs(struct brw_context *brw,
> const struct intel_mipmap_tree *mt)
> @@ -1320,13 +1326,15 @@ intel_miptree_match_image(struct intel_mipmap_tree
> *mt,
>  {
> struct intel_texture_image *intelImage = intel_texture_image(image);
> GLuint level = intelImage->base.Base.Level;
> +   GLenum texObjTarget = tex_rect_to_tex2d(mt->target);
> +   GLenum mipmapTreeTarget = tex_rect_to_tex2d(image->TexObject->Target);
> int width, height, depth;
>
> /* glTexImage* choose the texture object based on the target passed
> in, and
>  * objects can't change targets over their lifetimes, so this should be
>  * true.
>  */
> -   assert(image->TexObject->Target == mt->target);
> +   assert(texObjTarget == mipmapTreeTarget);
>

If the only use of that helper is in an assert, just put the calls to the
helper inside the assert.  Otherwise, good job debugging. :-)

--Jason


> mesa_format mt_format = mt->format;
> if (mt->format == MESA_FORMAT_Z24_UNORM_X8_UINT && mt->stencil_mt)
> --
> 2.7.4
>
> ___
> 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 PATCH] mesa/st: don't prematurely optimize for render targets when on virgl

2018-07-10 Thread Gert Wollny
Am Dienstag, den 10.07.2018, 11:03 -0400 schrieb Ilia Mirkin:
> 
> Here's how every real driver handles it:
> 
> If it's a texture, don't support rgb-only formats (except r11g11b10f
> and so on).
> 
> In the is_format_supported check, there are explicit tests for target
> == PIPE_BUFFER in order to allow the tbo_rgb32 case.

Great, thanks for the pointer, 
Gert 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/3] i965: Sweep NIR after linking phase to free held memory

2018-07-10 Thread Jason Ekstrand
I think we can just move it up a couple of loops to the place where we do
the final lowering and call gather_info.  Other than that, this seems like
a good idea to me.  NIR passes are pretty sloppy about memory and assume
nir_sweep gets called.  Hanging on to linked shaders with all that garbage
floating around is a bad plan.

On Tue, Jul 10, 2018 at 1:53 AM Danylo Piliaiev 
wrote:

> After optimization passes and many trasfromations most of memory
> NIR holds is a garbage which was being freed only after shader deletion.
> Freeing it at the end of linking will save memory which would be useful
> in case there are a lot of complex shaders being compiled.
> The common case for this issue is 32bit game running under Wine.
>
> The cost of the optimization is around ~3-5% of compilation speed
> with complex shaders.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103274
>
> Signed-off-by: Danylo Piliaiev 
> ---
>  src/mesa/drivers/dri/i965/brw_link.cpp | 9 +
>  1 file changed, 9 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp
> b/src/mesa/drivers/dri/i965/brw_link.cpp
> index 1071056f14..8f34a58ce7 100644
> --- a/src/mesa/drivers/dri/i965/brw_link.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_link.cpp
> @@ -359,6 +359,15 @@ brw_link_shader(struct gl_context *ctx, struct
> gl_shader_program *shProg)
>}
> }
>
> +   for (stage = 0; stage < ARRAY_SIZE(shProg->_LinkedShaders); stage++) {
> +  struct gl_linked_shader *shader = shProg->_LinkedShaders[stage];
> +  if (!shader)
> + continue;
> +
> +  struct gl_program *prog = shader->Program;
> +  nir_sweep(prog->nir);
> +   }
> +
> if (brw->ctx.Cache) {
>for (stage = 0; stage < ARRAY_SIZE(shProg->_LinkedShaders);
> stage++) {
>   struct gl_linked_shader *shader = shProg->_LinkedShaders[stage];
> --
> 2.17.1
>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [RFC PATCH] mesa/st: don't prematurely optimize for render targets when on virgl

2018-07-10 Thread Ilia Mirkin
On Tue, Jul 10, 2018 at 10:59 AM, Gert Wollny  wrote:
> Am Dienstag, den 10.07.2018, 10:47 -0400 schrieb Ilia Mirkin:
>> In practice, no one allocates GL_RGB textures. Only RGBX/RGBA. In
>> part due to this issue, an in part due to the hardware not being able
>> to support rendering to such textures (and usually not texturing
>> either).
> I see. Well, I was close to solve this problem by exactly doing that,
> but on the way I lost ARB_tbo_rgb32. Anyway, if I understand you
> correctly, then this should be solvable on the driver level.
>
>> ARB_tbo_rgb32 is part of GLES 3.1 as I recall, but this only has to
>> do with buffer objects, so not renderable.
> I actually dind't find it at all in the spec. only that all the GL_RGB
> textures don't need to be renderable in general.
>
>>
>> Separately, glCopyImageSubData has to work between compatible
>> internal formats, irrespective of what happens under the hood. If
>> i965 can't copy from a GL_RGB32F texture to a GL_RGB32I texture,
>> that's a i965 bug.
> Intel is doing just fine, it's gallium that has a problem here. I think
> it assumes that the checks for compatibility done on the mesa side are
> sufficient, and doesn't check whether the actual internal formats are
> compatible (with the exception of an assertion though). I'm just not
> sure whether the copy fallback path implemented there is also useful
> for this case.

Right ... that logic is a bit finicky. It assumes that the driver
presents a logical group of formats.

Here's how every real driver handles it:

If it's a texture, don't support rgb-only formats (except r11g11b10f and so on).

In the is_format_supported check, there are explicit tests for target
== PIPE_BUFFER in order to allow the tbo_rgb32 case.

Cheers,

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


Re: [Mesa-dev] [RFC PATCH] mesa/st: don't prematurely optimize for render targets when on virgl

2018-07-10 Thread Gert Wollny
Am Dienstag, den 10.07.2018, 10:47 -0400 schrieb Ilia Mirkin:
> In practice, no one allocates GL_RGB textures. Only RGBX/RGBA. In
> part due to this issue, an in part due to the hardware not being able
> to support rendering to such textures (and usually not texturing
> either).
I see. Well, I was close to solve this problem by exactly doing that,
but on the way I lost ARB_tbo_rgb32. Anyway, if I understand you
correctly, then this should be solvable on the driver level.

> ARB_tbo_rgb32 is part of GLES 3.1 as I recall, but this only has to
> do with buffer objects, so not renderable.
I actually dind't find it at all in the spec. only that all the GL_RGB
textures don't need to be renderable in general. 

> 
> Separately, glCopyImageSubData has to work between compatible
> internal formats, irrespective of what happens under the hood. If
> i965 can't copy from a GL_RGB32F texture to a GL_RGB32I texture,
> that's a i965 bug.
Intel is doing just fine, it's gallium that has a problem here. I think
it assumes that the checks for compatibility done on the mesa side are
sufficient, and doesn't check whether the actual internal formats are
compatible (with the exception of an assertion though). I'm just not
sure whether the copy fallback path implemented there is also useful
for this case. 

Best, 
Gert 



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


Re: [Mesa-dev] [RFC PATCH] mesa/st: don't prematurely optimize for render targets when on virgl

2018-07-10 Thread Gert Wollny
Am Dienstag, den 10.07.2018, 16:30 +0200 schrieb Erik Faye-Lund:
> > 
[snip]


> On 10. juli 2018 16:23, Gert Wollny wrote:
> > Since this is also written in the 4.5 spec, and the Intel driver
> > advertises this version, but the test to attach such a texture to a
> > frame buffer device results in an incomplete framebuffer, the Intel
> > driver is not up to spec or so it would seem ...
> 
> OpenGL has this other excape hatch, where it alllows drivers to say 
> FRAMEBUFFER_UNSUPPORTED for basically any combination of attachments
> it  doesn't like. Perhaps the Intel is using this as a way out? 
FRAMEBUFFER_UNSUPPORTED is exactly the error message that Intel shows. 

> If so, we  might have to be prepared to do something similar.
In any case, IMHO allocating a 3-comp texture should still try to
succeed without resorting to a four comp texture if possible (and if
render-target was not requested, then it would succeed, hence the way I
proposed the patch).

This is essentially what the Intel driver does: It gives you a texture
like requested without trying to be smart about it and  when you try to
use it as FBO attachment, it sais no. 

The other question is, of course, that gallium should not hit that
assertion ...  

> I don't think Gallium has a way of rejecting framebuffers in this
> way, though. So if that's what's going on, we might have to introduce
> one.
I guess I'll do a bit code-reading ... 

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


Re: [Mesa-dev] [RFC PATCH] mesa/st: don't prematurely optimize for render targets when on virgl

2018-07-10 Thread Ilia Mirkin
In practice, no one allocates GL_RGB textures. Only RGBX/RGBA. In part
due to this issue, an in part due to the hardware not being able to
support rendering to such textures (and usually not texturing either).

ARB_tbo_rgb32 is part of GLES 3.1 as I recall, but this only has to do
with buffer objects, so not renderable.

Separately, glCopyImageSubData has to work between compatible internal
formats, irrespective of what happens under the hood. If i965 can't
copy from a GL_RGB32F texture to a GL_RGB32I texture, that's a i965
bug.

  -ilia


On Tue, Jul 10, 2018 at 10:30 AM, Erik Faye-Lund
 wrote:
> On 10. juli 2018 16:23, Gert Wollny wrote:
>>
>> Am Dienstag, den 10.07.2018, 16:01 +0200 schrieb Erik Faye-Lund:
>>>
>>> On 10. juli 2018 15:42, Gert Wollny wrote:

 For three component textures virgl faces the problem that the host
 driver
 may report that these can not be used as a render target, and when
 the
 client requests such a texture a four-componet texture will be
 choosen
 even if only a sampler view was requested. One example where this
 happens
 is with the Intel i965 driver that doesn't support RGB32* as render
 target.
 The result is that when allocating a GL_RGB32F and a GL_RGB32I
 texture, and
 then glCopyImageSubData is called for these two texture, gallium
 will fail
 with an assertion, because it reports a different per pixel bit
 count.

 Therefore, when using the virgl driver, don't try to enable
 BIND_RENDER_TARGET
 for RGB textures that were requested with only BIND_SAMPLER_VIEW.

 Signed-off-by: Gert Wollny 
 ---

 I'm aware that instead of using the device ID, I should probably
 add a new caps
 flag, but apart from that I was wondering whether there may be
 better approaches
 to achieve the same goal: The a texture is allocated with the
 internal format
 as closely as possible to the requested one. Especially it
 shouldn't change the
 percieved pixel bit count.

 In fact, I was a bit surprised to see that the assertions regarding
 the
 different sizes was hit in st_copy_image:307 (swizzled_copy). It
 seems that
 there is some check missing that should redirect the copy in such a
 case.

 Many thanks for any comments,
 Gert

src/mesa/state_tracker/st_format.c | 22 +++---
1 file changed, 15 insertions(+), 7 deletions(-)

 diff --git a/src/mesa/state_tracker/st_format.c
 b/src/mesa/state_tracker/st_format.c
 index 9ae796eca9..2d8ff756a9 100644
 --- a/src/mesa/state_tracker/st_format.c
 +++ b/src/mesa/state_tracker/st_format.c
 @@ -2285,19 +2285,27 @@ st_ChooseTextureFormat(struct gl_context
 *ctx, GLenum target,
  /* GL textures may wind up being render targets, but we don't
 know
* that in advance.  Specify potential render target flags now
 for formats
 -* that we know should always be renderable.
 +* that we know should always be renderable, except when we are
 on virgl,
 +* we don't try this for three component textures, because the
 host might
 +* not support rendering to them, and then Gallium chooses a
 four component
 +* internal format and calls to e.g. glCopyImageSubData will
 fail for format
 +* that should be compatible.
*/
   bindings = PIPE_BIND_SAMPLER_VIEW;
   if (_mesa_is_depth_or_stencil_format(internalFormat))
  bindings |= PIPE_BIND_DEPTH_STENCIL;
 -   else if (is_renderbuffer || internalFormat == 3 ||
 internalFormat == 4 ||
 -internalFormat == GL_RGB || internalFormat == GL_RGBA
 ||
 -internalFormat == GL_RGB8 || internalFormat ==
 GL_RGBA8 ||
 +   else if (is_renderbuffer  ||
 +internalFormat == GL_RGBA ||
 +internalFormat == GL_RGBA8 ||
internalFormat == GL_BGRA ||
 -internalFormat == GL_RGB16F ||
internalFormat == GL_RGBA16F ||
 -internalFormat == GL_RGB32F ||
 -internalFormat == GL_RGBA32F)
 +internalFormat == GL_RGBA32F ||
 +((st->pipe->screen->get_param(st->pipe->screen,
 PIPE_CAP_DEVICE_ID) != 0x1010) &&
 + (internalFormat == 3 || internalFormat == 4 ||
 +  internalFormat == GL_RGB ||
 +  internalFormat == GL_RGB8 ||
 +  internalFormat == GL_RGB16F ||
 +  internalFormat == GL_RGB32F )))
  bindings |= PIPE_BIND_RENDER_TARGET;
>>>
>>> I don't think this is correct.
>>
>> I'm also quite sure that this would just be a work-around-something ...
>>
>>> The problem is that the spec defines GL_RGB et al as color-
>>> renderable, and in OpenGL any color-renderable texture can become a
>>> 

Re: [Mesa-dev] [RFC PATCH] mesa/st: don't prematurely optimize for render targets when on virgl

2018-07-10 Thread Erik Faye-Lund

On 10. juli 2018 16:23, Gert Wollny wrote:

Am Dienstag, den 10.07.2018, 16:01 +0200 schrieb Erik Faye-Lund:

On 10. juli 2018 15:42, Gert Wollny wrote:

For three component textures virgl faces the problem that the host
driver
may report that these can not be used as a render target, and when
the
client requests such a texture a four-componet texture will be
choosen
even if only a sampler view was requested. One example where this
happens
is with the Intel i965 driver that doesn't support RGB32* as render
target.
The result is that when allocating a GL_RGB32F and a GL_RGB32I
texture, and
then glCopyImageSubData is called for these two texture, gallium
will fail
with an assertion, because it reports a different per pixel bit
count.

Therefore, when using the virgl driver, don't try to enable
BIND_RENDER_TARGET
for RGB textures that were requested with only BIND_SAMPLER_VIEW.

Signed-off-by: Gert Wollny 
---

I'm aware that instead of using the device ID, I should probably
add a new caps
flag, but apart from that I was wondering whether there may be
better approaches
to achieve the same goal: The a texture is allocated with the
internal format
as closely as possible to the requested one. Especially it
shouldn't change the
percieved pixel bit count.

In fact, I was a bit surprised to see that the assertions regarding
the
different sizes was hit in st_copy_image:307 (swizzled_copy). It
seems that
there is some check missing that should redirect the copy in such a
case.

Many thanks for any comments,
Gert

   src/mesa/state_tracker/st_format.c | 22 +++---
   1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/src/mesa/state_tracker/st_format.c
b/src/mesa/state_tracker/st_format.c
index 9ae796eca9..2d8ff756a9 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -2285,19 +2285,27 @@ st_ChooseTextureFormat(struct gl_context
*ctx, GLenum target,
   
  /* GL textures may wind up being render targets, but we don't

know
   * that in advance.  Specify potential render target flags now
for formats
-* that we know should always be renderable.
+* that we know should always be renderable, except when we are
on virgl,
+* we don't try this for three component textures, because the
host might
+* not support rendering to them, and then Gallium chooses a
four component
+* internal format and calls to e.g. glCopyImageSubData will
fail for format
+* that should be compatible.
   */
  bindings = PIPE_BIND_SAMPLER_VIEW;
  if (_mesa_is_depth_or_stencil_format(internalFormat))
 bindings |= PIPE_BIND_DEPTH_STENCIL;
-   else if (is_renderbuffer || internalFormat == 3 ||
internalFormat == 4 ||
-internalFormat == GL_RGB || internalFormat == GL_RGBA
||
-internalFormat == GL_RGB8 || internalFormat ==
GL_RGBA8 ||
+   else if (is_renderbuffer  ||
+internalFormat == GL_RGBA ||
+internalFormat == GL_RGBA8 ||
   internalFormat == GL_BGRA ||
-internalFormat == GL_RGB16F ||
   internalFormat == GL_RGBA16F ||
-internalFormat == GL_RGB32F ||
-internalFormat == GL_RGBA32F)
+internalFormat == GL_RGBA32F ||
+((st->pipe->screen->get_param(st->pipe->screen,
PIPE_CAP_DEVICE_ID) != 0x1010) &&
+ (internalFormat == 3 || internalFormat == 4 ||
+  internalFormat == GL_RGB ||
+  internalFormat == GL_RGB8 ||
+  internalFormat == GL_RGB16F ||
+  internalFormat == GL_RGB32F )))
 bindings |= PIPE_BIND_RENDER_TARGET;

I don't think this is correct.

I'm also quite sure that this would just be a work-around-something ...


The problem is that the spec defines GL_RGB et al as color-
renderable, and in OpenGL any color-renderable texture can become a
render-target at any point. So the driver *has* to be prepared for
rendering to GL_RGB.

The OpenGL 4.6 spec, section 9.4 "Framebuffer completeness" has this
to say:

"An internal format is color-renderable if it is RED, RG, RGB, RGBA,
or one of the sized internal formats from table 8.12 whose “CR”
(color-renderable) column is checked in that table"

Since this is also written in the 4.5 spec, and the Intel driver
advertises this version, but the test to attach such a texture to a
frame buffer device results in an incomplete framebuffer, the Intel
driver is not up to spec or so it would seem ...


OpenGL has this other excape hatch, where it alllows drivers to say 
FRAMEBUFFER_UNSUPPORTED for basically any combination of attachments it 
doesn't like. Perhaps the Intel is using this as a way out? If so, we 
might have to be prepared to do something similar.


I don't think Gallium has a way of rejecting framebuffers in this way, 
though. So if that's what's going on, we might have to introduce one.



I wonder at which point this was introduced, 3.3 also has it, and on
r600 these tests were not resulting in 

Re: [Mesa-dev] [RFC PATCH] mesa/st: don't prematurely optimize for render targets when on virgl

2018-07-10 Thread Gert Wollny
Am Dienstag, den 10.07.2018, 16:01 +0200 schrieb Erik Faye-Lund:
> On 10. juli 2018 15:42, Gert Wollny wrote:
> > For three component textures virgl faces the problem that the host
> > driver
> > may report that these can not be used as a render target, and when
> > the
> > client requests such a texture a four-componet texture will be
> > choosen
> > even if only a sampler view was requested. One example where this
> > happens
> > is with the Intel i965 driver that doesn't support RGB32* as render
> > target.
> > The result is that when allocating a GL_RGB32F and a GL_RGB32I
> > texture, and
> > then glCopyImageSubData is called for these two texture, gallium
> > will fail
> > with an assertion, because it reports a different per pixel bit
> > count.
> > 
> > Therefore, when using the virgl driver, don't try to enable
> > BIND_RENDER_TARGET
> > for RGB textures that were requested with only BIND_SAMPLER_VIEW.
> > 
> > Signed-off-by: Gert Wollny 
> > ---
> > 
> > I'm aware that instead of using the device ID, I should probably
> > add a new caps
> > flag, but apart from that I was wondering whether there may be
> > better approaches
> > to achieve the same goal: The a texture is allocated with the
> > internal format
> > as closely as possible to the requested one. Especially it
> > shouldn't change the
> > percieved pixel bit count.
> > 
> > In fact, I was a bit surprised to see that the assertions regarding
> > the
> > different sizes was hit in st_copy_image:307 (swizzled_copy). It
> > seems that
> > there is some check missing that should redirect the copy in such a
> > case.
> > 
> > Many thanks for any comments,
> > Gert
> > 
> >   src/mesa/state_tracker/st_format.c | 22 +++---
> >   1 file changed, 15 insertions(+), 7 deletions(-)
> > 
> > diff --git a/src/mesa/state_tracker/st_format.c
> > b/src/mesa/state_tracker/st_format.c
> > index 9ae796eca9..2d8ff756a9 100644
> > --- a/src/mesa/state_tracker/st_format.c
> > +++ b/src/mesa/state_tracker/st_format.c
> > @@ -2285,19 +2285,27 @@ st_ChooseTextureFormat(struct gl_context
> > *ctx, GLenum target,
> >   
> >  /* GL textures may wind up being render targets, but we don't
> > know
> >   * that in advance.  Specify potential render target flags now
> > for formats
> > -* that we know should always be renderable.
> > +* that we know should always be renderable, except when we are
> > on virgl,
> > +* we don't try this for three component textures, because the
> > host might
> > +* not support rendering to them, and then Gallium chooses a
> > four component
> > +* internal format and calls to e.g. glCopyImageSubData will
> > fail for format
> > +* that should be compatible.
> >   */
> >  bindings = PIPE_BIND_SAMPLER_VIEW;
> >  if (_mesa_is_depth_or_stencil_format(internalFormat))
> > bindings |= PIPE_BIND_DEPTH_STENCIL;
> > -   else if (is_renderbuffer || internalFormat == 3 ||
> > internalFormat == 4 ||
> > -internalFormat == GL_RGB || internalFormat == GL_RGBA
> > ||
> > -internalFormat == GL_RGB8 || internalFormat ==
> > GL_RGBA8 ||
> > +   else if (is_renderbuffer  ||
> > +internalFormat == GL_RGBA ||
> > +internalFormat == GL_RGBA8 ||
> >   internalFormat == GL_BGRA ||
> > -internalFormat == GL_RGB16F ||
> >   internalFormat == GL_RGBA16F ||
> > -internalFormat == GL_RGB32F ||
> > -internalFormat == GL_RGBA32F)
> > +internalFormat == GL_RGBA32F ||
> > +((st->pipe->screen->get_param(st->pipe->screen,
> > PIPE_CAP_DEVICE_ID) != 0x1010) &&
> > + (internalFormat == 3 || internalFormat == 4 ||
> > +  internalFormat == GL_RGB ||
> > +  internalFormat == GL_RGB8 ||
> > +  internalFormat == GL_RGB16F ||
> > +  internalFormat == GL_RGB32F )))
> > bindings |= PIPE_BIND_RENDER_TARGET;
> 
> I don't think this is correct. 
I'm also quite sure that this would just be a work-around-something ...

> The problem is that the spec defines GL_RGB et al as color-
> renderable, and in OpenGL any color-renderable texture can become a
> render-target at any point. So the driver *has* to be prepared for
> rendering to GL_RGB.
> 
> The OpenGL 4.6 spec, section 9.4 "Framebuffer completeness" has this
> to say:
> 
> "An internal format is color-renderable if it is RED, RG, RGB, RGBA,
> or one of the sized internal formats from table 8.12 whose “CR” 
> (color-renderable) column is checked in that table"
Since this is also written in the 4.5 spec, and the Intel driver
advertises this version, but the test to attach such a texture to a
frame buffer device results in an incomplete framebuffer, the Intel
driver is not up to spec or so it would seem ... 

I wonder at which point this was introduced, 3.3 also has it, and on
r600 these tests were not resulting in assertion failures, only some
textures (sRGB I think) were 

Re: [Mesa-dev] [PATCH v4 7/7] i965: enable INTEL_blackhole_render

2018-07-10 Thread Lionel Landwerlin

On 10/07/18 15:04, Daniel Vetter wrote:

On Wed, Jun 20, 2018 at 06:25:34PM +0100, Lionel Landwerlin wrote:

v2: condition the extension on context isolation support from the
 kernel (Chris)

v3: (Lionel)

 The initial version of this change used a feature of the Gen7+
 command parser to turn the primitive instructions into no-ops.
 Unfortunately this doesn't play well with how we're using the
 hardware outside of the user submitted commands. For example
 resolves are implicit operations which should not be turned into
 no-ops as part of the previously submitted commands (before
 blackhole_render is enabled) might not be disabled. For example
 this sequence :

glClear();
glEnable(GL_BLACKHOLE_RENDER_INTEL);
glDrawArrays(...);
glReadPixels(...);
glDisable(GL_BLACKHOLE_RENDER_INTEL);

 While clear has been emitted outside the blackhole render, it
 should still be resolved properly in the read pixels. Hence we
 need to be more selective and only disable user submitted
 commands.

 This v3 manually turns primitives into MI_NOOP if blackhole render
 is enabled. This lets us enable this feature on any platform.

v4: Limit support to gen7.5+ (Lionel)

v5: Enable Gen7.5 support again, requires a kernel update of the
 command parser (Lionel)

v6: Disable Gen7.5 again... Kernel devs want these patches landed
 before they accept the kernel patches to whitelist INSTPM (Lionel)

Hm, this doesn't quite read how kernel patches are usually handled:
Ordering sequence is:
1. get everything reviewed and tested (both kernel and userspace), but do
not yet start merging
2. merge kernel (if you feel paranoid, wait until Dave Airlie accepted it
into drm-next)
3. merge userspace

Insisting that the userspace stuff lands before the kernel (even if it's
just prep work) is kinda the wrong way round, and needlessly complicates
the process.

This is all documented in full details in

https://dri.freedesktop.org/docs/drm/gpu/drm-uapi.html#open-source-userspace-requirements

Cheers, Daniel


Hey Daniel,

I remember somebody using the work "land" on IRC but it could have been 
a mistake :)
This is also to avoid committing code that might end up being wrong if 
somebody bumps the command parser version before my patches.


Thanks for reminder,

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


[Mesa-dev] [PATCH 2/5] radv: remove unnecessary verification code around ring_offsets_idx

2018-07-10 Thread Samuel Pitoiset
I don't want to waste CPU cycles for nothing.

Signed-off-by: Samuel Pitoiset 
---
 src/amd/vulkan/radv_cmd_buffer.c | 17 -
 src/amd/vulkan/radv_private.h|  1 -
 2 files changed, 18 deletions(-)

diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index 32d71c63d9..5247413b33 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -310,8 +310,6 @@ radv_reset_cmd_buffer(struct radv_cmd_buffer *cmd_buffer)
 
cmd_buffer->record_result = VK_SUCCESS;
 
-   cmd_buffer->ring_offsets_idx = -1;
-
for (unsigned i = 0; i < VK_PIPELINE_BIND_POINT_RANGE_SIZE; i++) {
cmd_buffer->descriptors[i].dirty = 0;
cmd_buffer->descriptors[i].valid = 0;
@@ -2684,15 +2682,6 @@ void radv_CmdBindPipeline(
 
if (radv_pipeline_has_tess(pipeline))
cmd_buffer->tess_rings_needed = true;
-
-   if (radv_pipeline_has_gs(pipeline)) {
-   struct radv_userdata_info *loc = 
radv_lookup_user_sgpr(cmd_buffer->state.pipeline, MESA_SHADER_GEOMETRY,
-
AC_UD_SCRATCH_RING_OFFSETS);
-   if (cmd_buffer->ring_offsets_idx == -1)
-   cmd_buffer->ring_offsets_idx = loc->sgpr_idx;
-   else if (loc->sgpr_idx != -1)
-   assert(loc->sgpr_idx == 
cmd_buffer->ring_offsets_idx);
-   }
break;
default:
assert(!"invalid bind point");
@@ -2880,12 +2869,6 @@ void radv_CmdExecuteCommands(
if (secondary->sample_positions_needed)
primary->sample_positions_needed = true;
 
-   if (secondary->ring_offsets_idx != -1) {
-   if (primary->ring_offsets_idx == -1)
-   primary->ring_offsets_idx = 
secondary->ring_offsets_idx;
-   else
-   assert(secondary->ring_offsets_idx == 
primary->ring_offsets_idx);
-   }
primary->device->ws->cs_execute_secondary(primary->cs, 
secondary->cs);
 
 
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index 4e4b3a6037..8566de78a8 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -1037,7 +1037,6 @@ struct radv_cmd_buffer {
 
VkResult record_result;
 
-   int ring_offsets_idx; /* just used for verification */
uint32_t gfx9_fence_offset;
struct radeon_winsys_bo *gfx9_fence_bo;
uint32_t gfx9_fence_idx;
-- 
2.18.0

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


[Mesa-dev] [PATCH 4/5] radv: remove one useless check in radv_bind_descriptor_set()

2018-07-10 Thread Samuel Pitoiset
'set' shouldn't be NULL.

Signed-off-by: Samuel Pitoiset 
---
 src/amd/vulkan/radv_cmd_buffer.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index 5247413b33..11f4c29db4 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -2391,9 +2391,8 @@ radv_bind_descriptor_set(struct radv_cmd_buffer 
*cmd_buffer,
struct radeon_winsys *ws = cmd_buffer->device->ws;
 
radv_set_descriptor_set(cmd_buffer, bind_point, set, idx);
-   if (!set)
-   return;
 
+   assert(set);
assert(!(set->layout->flags & 
VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR));
 
if (!cmd_buffer->device->use_global_bo_list) {
-- 
2.18.0

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


[Mesa-dev] [PATCH 3/5] radv/meta: do not restore a NULL descriptor

2018-07-10 Thread Samuel Pitoiset
Signed-off-by: Samuel Pitoiset 
---
 src/amd/vulkan/radv_meta.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/amd/vulkan/radv_meta.c b/src/amd/vulkan/radv_meta.c
index 00a20d155e..a59f38fb21 100644
--- a/src/amd/vulkan/radv_meta.c
+++ b/src/amd/vulkan/radv_meta.c
@@ -80,10 +80,9 @@ radv_meta_save(struct radv_meta_saved_state *state,
}
 
if (state->flags & RADV_META_SAVE_DESCRIPTORS) {
-   if (descriptors_state->valid & (1 << 0))
-   state->old_descriptor_set0 = descriptors_state->sets[0];
-   else
-   state->old_descriptor_set0 = NULL;
+   state->old_descriptor_set0 = descriptors_state->sets[0];
+   if (!state->old_descriptor_set0)
+   state->flags &= ~RADV_META_SAVE_DESCRIPTORS;
}
 
if (state->flags & RADV_META_SAVE_CONSTANTS) {
-- 
2.18.0

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


[Mesa-dev] [PATCH 5/5] radv: simplify the logic in radv_set_descriptor_set()

2018-07-10 Thread Samuel Pitoiset
Now that 'set' can't be NULL because the meta operations no
longer bind a NULL descriptor, the logic can be simplified
a little bit.

Signed-off-by: Samuel Pitoiset 
---
 src/amd/vulkan/radv_cmd_buffer.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index 11f4c29db4..e85a9d7c98 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -518,10 +518,8 @@ void radv_set_descriptor_set(struct radv_cmd_buffer 
*cmd_buffer,
radv_get_descriptors_state(cmd_buffer, bind_point);
 
descriptors_state->sets[idx] = set;
-   if (set)
-   descriptors_state->valid |= (1u << idx);
-   else
-   descriptors_state->valid &= ~(1u << idx);
+
+   descriptors_state->valid |= (1u << idx); /* active descriptors */
descriptors_state->dirty |= (1u << idx);
 }
 
-- 
2.18.0

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


[Mesa-dev] [PATCH 1/5] radv: get rid of buffer object priorities

2018-07-10 Thread Samuel Pitoiset
We mostly use the same priority for all buffer objects, so
I don't think that matter much. This should reduce CPU
overhead a little bit.

Signed-off-by: Samuel Pitoiset 
---
 src/amd/vulkan/radv_cmd_buffer.c  | 36 +--
 src/amd/vulkan/radv_descriptor_set.c  |  6 +-
 src/amd/vulkan/radv_device.c  | 12 ++--
 src/amd/vulkan/radv_meta_buffer.c |  8 +--
 src/amd/vulkan/radv_query.c   |  8 +--
 src/amd/vulkan/radv_radeon_winsys.h   |  8 +--
 src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c | 59 +--
 7 files changed, 52 insertions(+), 85 deletions(-)

diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index 9da42fe03e..32d71c63d9 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -305,7 +305,7 @@ radv_reset_cmd_buffer(struct radv_cmd_buffer *cmd_buffer)
 
if (cmd_buffer->upload.upload_bo)
radv_cs_add_buffer(cmd_buffer->device->ws, cmd_buffer->cs,
-  cmd_buffer->upload.upload_bo, 8);
+  cmd_buffer->upload.upload_bo);
cmd_buffer->upload.offset = 0;
 
cmd_buffer->record_result = VK_SUCCESS;
@@ -355,7 +355,7 @@ radv_cmd_buffer_resize_upload_buf(struct radv_cmd_buffer 
*cmd_buffer,
return false;
}
 
-   radv_cs_add_buffer(device->ws, cmd_buffer->cs, bo, 8);
+   radv_cs_add_buffer(device->ws, cmd_buffer->cs, bo);
if (cmd_buffer->upload.upload_bo) {
upload = malloc(sizeof(*upload));
 
@@ -862,12 +862,12 @@ radv_emit_graphics_pipeline(struct radv_cmd_buffer 
*cmd_buffer)
continue;
 
radv_cs_add_buffer(cmd_buffer->device->ws, cmd_buffer->cs,
-  pipeline->shaders[i]->bo, 8);
+  pipeline->shaders[i]->bo);
}
 
if (radv_pipeline_has_gs(pipeline))
radv_cs_add_buffer(cmd_buffer->device->ws, cmd_buffer->cs,
-  pipeline->gs_copy_shader->bo, 8);
+  pipeline->gs_copy_shader->bo);
 
if (unlikely(cmd_buffer->device->trace_bo))
radv_save_pipeline(cmd_buffer, pipeline, RING_GFX);
@@ -1449,7 +1449,7 @@ radv_emit_framebuffer_state(struct radv_cmd_buffer 
*cmd_buffer)
struct radv_image *image = att->attachment->image;
VkImageLayout layout = subpass->color_attachments[i].layout;
 
-   radv_cs_add_buffer(cmd_buffer->device->ws, cmd_buffer->cs, 
att->attachment->bo, 8);
+   radv_cs_add_buffer(cmd_buffer->device->ws, cmd_buffer->cs, 
att->attachment->bo);
 
assert(att->attachment->aspect_mask & 
VK_IMAGE_ASPECT_COLOR_BIT);
radv_emit_fb_color_state(cmd_buffer, i, att, image, layout);
@@ -1462,7 +1462,7 @@ radv_emit_framebuffer_state(struct radv_cmd_buffer 
*cmd_buffer)
VkImageLayout layout = subpass->depth_stencil_attachment.layout;
struct radv_attachment_info *att = 
>attachments[idx];
struct radv_image *image = att->attachment->image;
-   radv_cs_add_buffer(cmd_buffer->device->ws, cmd_buffer->cs, 
att->attachment->bo, 8);
+   radv_cs_add_buffer(cmd_buffer->device->ws, cmd_buffer->cs, 
att->attachment->bo);
MAYBE_UNUSED uint32_t queue_mask = 
radv_image_queue_family_mask(image,

cmd_buffer->queue_family_index,

cmd_buffer->queue_family_index);
@@ -2239,7 +2239,7 @@ static void emit_gfx_buffer_state(struct radv_cmd_buffer 
*cmd_buffer)
struct radv_device *device = cmd_buffer->device;
if (device->gfx_init) {
uint64_t va = radv_buffer_get_va(device->gfx_init);
-   radv_cs_add_buffer(device->ws, cmd_buffer->cs, 
device->gfx_init, 8);
+   radv_cs_add_buffer(device->ws, cmd_buffer->cs, 
device->gfx_init);
radeon_emit(cmd_buffer->cs, PKT3(PKT3_INDIRECT_BUFFER_CIK, 2, 
0));
radeon_emit(cmd_buffer->cs, va);
radeon_emit(cmd_buffer->cs, va >> 32);
@@ -2307,7 +2307,7 @@ VkResult radv_BeginCommandBuffer(
struct radv_device *device = cmd_buffer->device;
 
radv_cs_add_buffer(device->ws, cmd_buffer->cs,
-  device->trace_bo, 8);
+  device->trace_bo);
 
radv_cmd_buffer_trace_emit(cmd_buffer);
}
@@ -2345,7 +2345,7 @@ void radv_CmdBindVertexBuffers(
vb[idx].offset = pOffsets[i];
 
radv_cs_add_buffer(cmd_buffer->device->ws, cmd_buffer->cs,
-  vb[idx].buffer->bo, 8);
+  

Re: [Mesa-dev] [PATCH v4 7/7] i965: enable INTEL_blackhole_render

2018-07-10 Thread Daniel Vetter
On Wed, Jun 20, 2018 at 06:25:34PM +0100, Lionel Landwerlin wrote:
> v2: condition the extension on context isolation support from the
> kernel (Chris)
> 
> v3: (Lionel)
> 
> The initial version of this change used a feature of the Gen7+
> command parser to turn the primitive instructions into no-ops.
> Unfortunately this doesn't play well with how we're using the
> hardware outside of the user submitted commands. For example
> resolves are implicit operations which should not be turned into
> no-ops as part of the previously submitted commands (before
> blackhole_render is enabled) might not be disabled. For example
> this sequence :
> 
>glClear();
>glEnable(GL_BLACKHOLE_RENDER_INTEL);
>glDrawArrays(...);
>glReadPixels(...);
>glDisable(GL_BLACKHOLE_RENDER_INTEL);
> 
> While clear has been emitted outside the blackhole render, it
> should still be resolved properly in the read pixels. Hence we
> need to be more selective and only disable user submitted
> commands.
> 
> This v3 manually turns primitives into MI_NOOP if blackhole render
> is enabled. This lets us enable this feature on any platform.
> 
> v4: Limit support to gen7.5+ (Lionel)
> 
> v5: Enable Gen7.5 support again, requires a kernel update of the
> command parser (Lionel)
> 
> v6: Disable Gen7.5 again... Kernel devs want these patches landed
> before they accept the kernel patches to whitelist INSTPM (Lionel)

Hm, this doesn't quite read how kernel patches are usually handled:
Ordering sequence is:
1. get everything reviewed and tested (both kernel and userspace), but do
not yet start merging
2. merge kernel (if you feel paranoid, wait until Dave Airlie accepted it
into drm-next)
3. merge userspace

Insisting that the userspace stuff lands before the kernel (even if it's
just prep work) is kinda the wrong way round, and needlessly complicates
the process.

This is all documented in full details in

https://dri.freedesktop.org/docs/drm/gpu/drm-uapi.html#open-source-userspace-requirements

Cheers, Daniel

> 
> Signed-off-by: Lionel Landwerlin 
> ---
>  src/mesa/drivers/dri/i965/brw_clear.c |  3 +
>  src/mesa/drivers/dri/i965/brw_context.h   |  2 +
>  src/mesa/drivers/dri/i965/brw_defines.h   |  8 ++-
>  src/mesa/drivers/dri/i965/brw_misc_state.c| 56 +++
>  src/mesa/drivers/dri/i965/brw_state.h |  4 ++
>  src/mesa/drivers/dri/i965/brw_state_upload.c  |  2 +
>  src/mesa/drivers/dri/i965/genX_state_upload.c |  4 ++
>  src/mesa/drivers/dri/i965/intel_extensions.c  |  8 +++
>  src/mesa/drivers/dri/i965/intel_fbo.c |  6 ++
>  src/mesa/drivers/dri/i965/intel_pixel_read.c  |  3 +
>  src/mesa/drivers/dri/i965/intel_tex_copy.c|  3 +
>  src/mesa/drivers/dri/i965/intel_tex_image.c   |  5 ++
>  12 files changed, 103 insertions(+), 1 deletion(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_clear.c 
> b/src/mesa/drivers/dri/i965/brw_clear.c
> index b097dfe346c..d3e360b3e23 100644
> --- a/src/mesa/drivers/dri/i965/brw_clear.c
> +++ b/src/mesa/drivers/dri/i965/brw_clear.c
> @@ -247,6 +247,9 @@ brw_clear(struct gl_context *ctx, GLbitfield mask)
> if (!_mesa_check_conditional_render(ctx))
>return;
>  
> +   if (ctx->IntelBlackholeRender)
> +  return;
> +
> if (mask & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_FRONT_RIGHT)) {
>brw->front_buffer_dirty = true;
> }
> diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
> b/src/mesa/drivers/dri/i965/brw_context.h
> index 0880d18b6f0..23602df2138 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.h
> +++ b/src/mesa/drivers/dri/i965/brw_context.h
> @@ -218,6 +218,7 @@ enum brw_state_id {
> BRW_STATE_CONSERVATIVE_RASTERIZATION,
> BRW_STATE_DRAW_CALL,
> BRW_STATE_AUX,
> +   BRW_STATE_CS_NOOP,
> BRW_NUM_STATE_BITS
>  };
>  
> @@ -309,6 +310,7 @@ enum brw_state_id {
>  #define BRW_NEW_CONSERVATIVE_RASTERIZATION (1ull << 
> BRW_STATE_CONSERVATIVE_RASTERIZATION)
>  #define BRW_NEW_DRAW_CALL   (1ull << BRW_STATE_DRAW_CALL)
>  #define BRW_NEW_AUX_STATE   (1ull << BRW_STATE_AUX)
> +#define BRW_NEW_CS_NOOP (1ull << BRW_STATE_CS_NOOP)
>  
>  struct brw_state_flags {
> /** State update flags signalled by mesa internals */
> diff --git a/src/mesa/drivers/dri/i965/brw_defines.h 
> b/src/mesa/drivers/dri/i965/brw_defines.h
> index 320426d6944..4e2d6acc706 100644
> --- a/src/mesa/drivers/dri/i965/brw_defines.h
> +++ b/src/mesa/drivers/dri/i965/brw_defines.h
> @@ -1651,11 +1651,17 @@ enum brw_pixel_shader_coverage_mask_mode {
>  #define GEN10_CACHE_MODE_SS0x0e420
>  #define GEN10_FLOAT_BLEND_OPTIMIZATION_ENABLE (1 << 4)
>  
> -#define INSTPM 0x20c0
> +#define INSTPM 0x20c0 /* Gen6-8 */
>  # define INSTPM_CONSTANT_BUFFER_ADDRESS_OFFSET_DISABLE (1 << 6)
> +# define INSTPM_GLOBAL_DEBUG_ENABLE(1 << 4)
> 

Re: [Mesa-dev] [RFC PATCH] mesa/st: don't prematurely optimize for render targets when on virgl

2018-07-10 Thread Erik Faye-Lund

On 10. juli 2018 15:42, Gert Wollny wrote:

For three component textures virgl faces the problem that the host driver
may report that these can not be used as a render target, and when the
client requests such a texture a four-componet texture will be choosen
even if only a sampler view was requested. One example where this happens
is with the Intel i965 driver that doesn't support RGB32* as render target.
The result is that when allocating a GL_RGB32F and a GL_RGB32I texture, and
then glCopyImageSubData is called for these two texture, gallium will fail
with an assertion, because it reports a different per pixel bit count.

Therefore, when using the virgl driver, don't try to enable BIND_RENDER_TARGET
for RGB textures that were requested with only BIND_SAMPLER_VIEW.

Signed-off-by: Gert Wollny 
---

I'm aware that instead of using the device ID, I should probably add a new caps
flag, but apart from that I was wondering whether there may be better approaches
to achieve the same goal: The a texture is allocated with the internal format
as closely as possible to the requested one. Especially it shouldn't change the
percieved pixel bit count.

In fact, I was a bit surprised to see that the assertions regarding the
different sizes was hit in st_copy_image:307 (swizzled_copy). It seems that
there is some check missing that should redirect the copy in such a case.

Many thanks for any comments,
Gert

  src/mesa/state_tracker/st_format.c | 22 +++---
  1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/src/mesa/state_tracker/st_format.c 
b/src/mesa/state_tracker/st_format.c
index 9ae796eca9..2d8ff756a9 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -2285,19 +2285,27 @@ st_ChooseTextureFormat(struct gl_context *ctx, GLenum 
target,
  
 /* GL textures may wind up being render targets, but we don't know

  * that in advance.  Specify potential render target flags now for formats
-* that we know should always be renderable.
+* that we know should always be renderable, except when we are on virgl,
+* we don't try this for three component textures, because the host might
+* not support rendering to them, and then Gallium chooses a four component
+* internal format and calls to e.g. glCopyImageSubData will fail for format
+* that should be compatible.
  */
 bindings = PIPE_BIND_SAMPLER_VIEW;
 if (_mesa_is_depth_or_stencil_format(internalFormat))
bindings |= PIPE_BIND_DEPTH_STENCIL;
-   else if (is_renderbuffer || internalFormat == 3 || internalFormat == 4 ||
-internalFormat == GL_RGB || internalFormat == GL_RGBA ||
-internalFormat == GL_RGB8 || internalFormat == GL_RGBA8 ||
+   else if (is_renderbuffer  ||
+internalFormat == GL_RGBA ||
+internalFormat == GL_RGBA8 ||
  internalFormat == GL_BGRA ||
-internalFormat == GL_RGB16F ||
  internalFormat == GL_RGBA16F ||
-internalFormat == GL_RGB32F ||
-internalFormat == GL_RGBA32F)
+internalFormat == GL_RGBA32F ||
+((st->pipe->screen->get_param(st->pipe->screen, PIPE_CAP_DEVICE_ID) != 
0x1010) &&
+ (internalFormat == 3 || internalFormat == 4 ||
+  internalFormat == GL_RGB ||
+  internalFormat == GL_RGB8 ||
+  internalFormat == GL_RGB16F ||
+  internalFormat == GL_RGB32F )))
bindings |= PIPE_BIND_RENDER_TARGET;


I don't think this is correct. The problem is that the spec defines 
GL_RGB et al as color-renderable, and in OpenGL any color-renderable 
texture can become a render-target at any point. So the driver *has* to 
be prepared for rendering to GL_RGB.


The OpenGL 4.6 spec, section 9.4 "Framebuffer completeness" has this to say:

"An internal format is color-renderable if it is RED, RG, RGB, RGBA, or 
one of the sized internal formats from table 8.12 whose “CR” 
(color-renderable) column is checked in that table"


So, all RGB formats must be color-renderable in OpenGL. For OpenGL ES, I 
think this is slightly different, where color-renderable guarantees for 
RGB-textures are extensions for at least ES 2.0 IIRC. So *perhaps* we 
could get away with something like this for that API.

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


[Mesa-dev] [RFC PATCH] mesa/st: don't prematurely optimize for render targets when on virgl

2018-07-10 Thread Gert Wollny
For three component textures virgl faces the problem that the host driver
may report that these can not be used as a render target, and when the
client requests such a texture a four-componet texture will be choosen
even if only a sampler view was requested. One example where this happens
is with the Intel i965 driver that doesn't support RGB32* as render target.
The result is that when allocating a GL_RGB32F and a GL_RGB32I texture, and
then glCopyImageSubData is called for these two texture, gallium will fail
with an assertion, because it reports a different per pixel bit count.

Therefore, when using the virgl driver, don't try to enable BIND_RENDER_TARGET
for RGB textures that were requested with only BIND_SAMPLER_VIEW.

Signed-off-by: Gert Wollny 
---

I'm aware that instead of using the device ID, I should probably add a new caps
flag, but apart from that I was wondering whether there may be better approaches
to achieve the same goal: The a texture is allocated with the internal format 
as closely as possible to the requested one. Especially it shouldn't change the
percieved pixel bit count. 

In fact, I was a bit surprised to see that the assertions regarding the 
different sizes was hit in st_copy_image:307 (swizzled_copy). It seems that 
there is some check missing that should redirect the copy in such a case.

Many thanks for any comments, 
Gert 

 src/mesa/state_tracker/st_format.c | 22 +++---
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/src/mesa/state_tracker/st_format.c 
b/src/mesa/state_tracker/st_format.c
index 9ae796eca9..2d8ff756a9 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -2285,19 +2285,27 @@ st_ChooseTextureFormat(struct gl_context *ctx, GLenum 
target,
 
/* GL textures may wind up being render targets, but we don't know
 * that in advance.  Specify potential render target flags now for formats
-* that we know should always be renderable.
+* that we know should always be renderable, except when we are on virgl,
+* we don't try this for three component textures, because the host might
+* not support rendering to them, and then Gallium chooses a four component
+* internal format and calls to e.g. glCopyImageSubData will fail for format
+* that should be compatible.
 */
bindings = PIPE_BIND_SAMPLER_VIEW;
if (_mesa_is_depth_or_stencil_format(internalFormat))
   bindings |= PIPE_BIND_DEPTH_STENCIL;
-   else if (is_renderbuffer || internalFormat == 3 || internalFormat == 4 ||
-internalFormat == GL_RGB || internalFormat == GL_RGBA ||
-internalFormat == GL_RGB8 || internalFormat == GL_RGBA8 ||
+   else if (is_renderbuffer  ||
+internalFormat == GL_RGBA ||
+internalFormat == GL_RGBA8 ||
 internalFormat == GL_BGRA ||
-internalFormat == GL_RGB16F ||
 internalFormat == GL_RGBA16F ||
-internalFormat == GL_RGB32F ||
-internalFormat == GL_RGBA32F)
+internalFormat == GL_RGBA32F ||
+((st->pipe->screen->get_param(st->pipe->screen, 
PIPE_CAP_DEVICE_ID) != 0x1010) &&
+ (internalFormat == 3 || internalFormat == 4 ||
+  internalFormat == GL_RGB ||
+  internalFormat == GL_RGB8 ||
+  internalFormat == GL_RGB16F ||
+  internalFormat == GL_RGB32F )))
   bindings |= PIPE_BIND_RENDER_TARGET;
 
/* GLES allows the driver to choose any format which matches
-- 
2.17.1

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


Re: [Mesa-dev] [PATCH] gallium/u_transfer_helper: Initialize the stride of MSAA maps.

2018-07-10 Thread Rob Clark
On Tue, Jul 10, 2018 at 2:07 AM, Eric Anholt  wrote:
> We just never set the value that was returned for MSAA mappings (directly
> reading back an MSAA framebuffer).  Since we're handing back ss_map, it
> should be ss_map's stride from our nested transfer.
>
> Fixes piglit /home/anholt/src/piglit/bin/fbo-depthstencil -samples=4
> casees.

nit: s/casees/cases/

Reviewed-by: Rob Clark 


> ---
>  src/gallium/auxiliary/util/u_transfer_helper.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/src/gallium/auxiliary/util/u_transfer_helper.c 
> b/src/gallium/auxiliary/util/u_transfer_helper.c
> index fd8a5c3a0895..df67f8288523 100644
> --- a/src/gallium/auxiliary/util/u_transfer_helper.c
> +++ b/src/gallium/auxiliary/util/u_transfer_helper.c
> @@ -218,6 +218,7 @@ transfer_map_msaa(struct pipe_context *pctx,
>return NULL;
> }
>
> +   ptrans->stride = trans->trans->stride;
> *pptrans = ptrans;
> return ss_map;
>  }
> --
> 2.18.0
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] i965/tex: ignore the diff between GL_TEXTURE_2D and GL_TEXTURE_RECTANGLE

2018-07-10 Thread Andrii Simiklit
the difference between GL_TEXTURE_2D and GL_TEXTURE_RECTANGLE
doesn't matter as far as the miptree is concerned;
genX(update_sampler_state) only looks at the
gl_texture_object and not the miptree when determining whether or
not to use normalized coordinates.

Signed-off-by: Andrii Simiklit 

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107117

---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 7d1fa96..dc45a06 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -58,6 +58,12 @@ static void *intel_miptree_map_raw(struct brw_context *brw,
 
 static void intel_miptree_unmap_raw(struct intel_mipmap_tree *mt);
 
+static GLenum
+tex_rect_to_tex2d(GLenum val)
+{
+return (GL_TEXTURE_RECTANGLE == val) ? GL_TEXTURE_2D : val;
+}
+
 static bool
 intel_miptree_supports_mcs(struct brw_context *brw,
const struct intel_mipmap_tree *mt)
@@ -1320,13 +1326,15 @@ intel_miptree_match_image(struct intel_mipmap_tree *mt,
 {
struct intel_texture_image *intelImage = intel_texture_image(image);
GLuint level = intelImage->base.Base.Level;
+   GLenum texObjTarget = tex_rect_to_tex2d(mt->target);
+   GLenum mipmapTreeTarget = tex_rect_to_tex2d(image->TexObject->Target);
int width, height, depth;
 
/* glTexImage* choose the texture object based on the target passed in, and
 * objects can't change targets over their lifetimes, so this should be
 * true.
 */
-   assert(image->TexObject->Target == mt->target);
+   assert(texObjTarget == mipmapTreeTarget);
 
mesa_format mt_format = mt->format;
if (mt->format == MESA_FORMAT_Z24_UNORM_X8_UINT && mt->stencil_mt)
-- 
2.7.4

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


Re: [Mesa-dev] [PATCH 1/2] glsl: slim the kill_entry struct used in const propagation

2018-07-10 Thread Thomas Helland
2018-07-09 20:59 GMT+02:00 Caio Marcelo de Oliveira Filho
:
> Since 4654439fdd7 "glsl: Use hash tables for
> opt_constant_propagation() kill sets." uses a hash_table for storing
> kill_entries, so the structs can be simplified.
>
> Remove the exec_node from kill_entry since it is not used in an
> exec_list anymore.
>
> Remove the 'var' from kill_entry since it is now redundant with the
> key of the hash table.
>
> Suggested by Eric Anholt.

These are both:

Reviewed-by: Thomas Helland

> ---
>  src/compiler/glsl/opt_constant_propagation.cpp | 13 +
>  1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/src/compiler/glsl/opt_constant_propagation.cpp 
> b/src/compiler/glsl/opt_constant_propagation.cpp
> index 05dc71efb72..f91498b45cd 100644
> --- a/src/compiler/glsl/opt_constant_propagation.cpp
> +++ b/src/compiler/glsl/opt_constant_propagation.cpp
> @@ -77,20 +77,17 @@ public:
>  };
>
>
> -class kill_entry : public exec_node
> +class kill_entry
>  {
>  public:
> /* override operator new from exec_node */
> DECLARE_LINEAR_ZALLOC_CXX_OPERATORS(kill_entry)
>
> -   kill_entry(ir_variable *var, unsigned write_mask)
> +   explicit kill_entry(unsigned write_mask)
> {
> -  assert(var);
> -  this->var = var;
>this->write_mask = write_mask;
> }
>
> -   ir_variable *var;
> unsigned write_mask;
>  };
>
> @@ -386,7 +383,7 @@ 
> ir_constant_propagation_visitor::handle_if_block(exec_list *instructions)
> hash_entry *htk;
> hash_table_foreach(new_kills, htk) {
>kill_entry *k = (kill_entry *) htk->data;
> -  kill(k->var, k->write_mask);
> +  kill((ir_variable *) htk->key, k->write_mask);
> }
>  }
>
> @@ -433,7 +430,7 @@ ir_constant_propagation_visitor::visit_enter(ir_loop *ir)
> hash_entry *htk;
> hash_table_foreach(new_kills, htk) {
>kill_entry *k = (kill_entry *) htk->data;
> -  kill(k->var, k->write_mask);
> +  kill((ir_variable *) htk->key, k->write_mask);
> }
>
> /* already descended into the children. */
> @@ -469,7 +466,7 @@ ir_constant_propagation_visitor::kill(ir_variable *var, 
> unsigned write_mask)
> }
> /* Not already in the hash table.  Make new entry. */
> _mesa_hash_table_insert(this->kills, var,
> -   new(this->lin_ctx) kill_entry(var, write_mask));
> +   new(this->lin_ctx) kill_entry(write_mask));
>  }
>
>  /**
> --
> 2.18.0
>
> ___
> 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 107176] Mesa Vulkan build fails on Ubuntu 16.04 for dependencies not caught by Mesa configure

2018-07-10 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=107176

Sergii Romantsov  changed:

   What|Removed |Added

 CC||sergii.romantsov@globallogi
   ||c.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 48/48] tests/vma: fix build with MSVC

2018-07-10 Thread Liviu Prodea
I tried the Meson Windows branch posted by Dylan Baker now available on 
Freedesktop Gitlab with default configuration but unfortunately it didn't work 
for me.

Build script


@set mesa=C:\Software\Development\projects\mesa
@SET 
PATH=C:\Software\Development\Git\cmd\;%mesa%\Python\;%mesa%\Py3\;%mesa%\Py3\Scripts\;%mesa%\flexbison\;%mesa%\ninja\;%mesa%\pkgconfig\;%PATH%
@call "%ProgramFiles% (x86)\Microsoft Visual 
Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
@cd %mesa%\mesa
@set buildcmd=%mesa%\Py3\python.exe %mesa%\Py3\Scripts\meson.py . 
.\build\windows-x86_64
@RD /S /Q %mesa%\mesa\build\windows-x86_64
@%buildcmd%
@cmd

Result
**

**
** Visual Studio 2017 Developer Command Prompt v15.7.4
** Copyright (c) 2017 Microsoft Corporation
**
[vcvarsall.bat] Environment initialized for: 'x64'
The Meson build system
Version: 0.46.1
Source dir: C:\Software\Development\projects\mesa\mesa
Build dir: C:\Software\Development\projects\mesa\mesa\build\windows-x86_64-sys
Build type: native build
Program python found: YES 
(C:\Software\Development\projects\mesa\Python\python.EXE)
Project name: mesa
Native C compiler: cl (msvc 19.14.26431)
Native C++ compiler: cl (msvc 19.14.26431)
Build machine cpu family: x86_64
Build machine cpu: x86_64
Program pkg-config found: YES 
(C:\Software\Development\projects\mesa\pkgconfig\pkg-config.EXE)
Program python2 found: NO
Program python found: YES 
(C:\Software\Development\projects\mesa\Python\python.EXE)
Checking for function "bswap32": NO
Checking for function "bswap64": NO
Checking for function "clz": NO
Checking for function "clzll": NO
Checking for function "ctz": NO
Checking for function "expect": NO
Checking for function "ffs": NO
Checking for function "ffsll": NO
Checking for function "popcount": NO
Checking for function "popcountll": NO
Checking for function "unreachable": NO
Checking if "__attribute__((const))" compiles: NO
Checking if "__attribute__((flatten))" compiles: NO
Checking if "__attribute__((malloc))" compiles: NO
Checking if "__attribute__((pure))" compiles: NO
Checking if "__attribute__((unused))" compiles: NO
Checking if "__attribute__((warn_unused_result))" compiles: NO
Checking if "__attribute__((weak))" compiles: NO
Checking if "__attribute__((format(...)))" compiles: NO
Checking if "__attribute__((packed))" compiles: NO
Checking if "__attribute__((returns_nonnull))" compiles: NO
Checking if "__attribute__((visibility(...)))" compiles: NO
Checking if "__attribute__((alias(...)))" compiles: NO
Checking if "__attribute__((__noreturn__))" compiles: NO
Compiler for C supports arguments /wd4018: YES
Traceback (most recent call last):
  File 
"C:\Software\Development\projects\mesa\Py3\lib\site-packages\mesonbuild\compilers\compilers.py",
 line 799, in compile
    raise StopIteration
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File 
"C:\Software\Development\projects\mesa\Py3\lib\site-packages\mesonbuild\mesonmain.py",
 line 364, in run
    app.generate()
  File 
"C:\Software\Development\projects\mesa\Py3\lib\site-packages\mesonbuild\mesonmain.py",
 line 135, in generate
    self._generate(env)
  File 
"C:\Software\Development\projects\mesa\Py3\lib\site-packages\mesonbuild\mesonmain.py",
 line 186, in _generate
    intr.run()
  File 
"C:\Software\Development\projects\mesa\Py3\lib\site-packages\mesonbuild\interpreter.py",
 line 3261, in run
    super().run()
  File 
"C:\Software\Development\projects\mesa\Py3\lib\site-packages\mesonbuild\interpreterbase.py",
 line 215, in run
    self.evaluate_codeblock(self.ast, start=1)
  File 
"C:\Software\Development\projects\mesa\Py3\lib\site-packages\mesonbuild\interpreterbase.py",
 line 239, in evaluate_codeblock
    raise e
  File 
"C:\Software\Development\projects\mesa\Py3\lib\site-packages\mesonbuild\interpreterbase.py",
 line 231, in evaluate_codeblock
    self.evaluate_statement(cur)
  File 
"C:\Software\Development\projects\mesa\Py3\lib\site-packages\mesonbuild\interpreterbase.py",
 line 254, in evaluate_statement
    return self.evaluate_if(cur)
  File 
"C:\Software\Development\projects\mesa\Py3\lib\site-packages\mesonbuild\interpreterbase.py",
 line 307, in evaluate_if
    self.evaluate_codeblock(i.block)
  File 
"C:\Software\Development\projects\mesa\Py3\lib\site-packages\mesonbuild\interpreterbase.py",
 line 239, in evaluate_codeblock
    raise e
  File 
"C:\Software\Development\projects\mesa\Py3\lib\site-packages\mesonbuild\interpreterbase.py",
 line 231, in evaluate_codeblock
    self.evaluate_statement(cur)
  File 
"C:\Software\Development\projects\mesa\Py3\lib\site-packages\mesonbuild\interpreterbase.py",
 line 274, in evaluate_statement
    return self.evaluate_foreach(cur)
  File 
"C:\Software\Development\projects\mesa\Py3\lib\site-packages\mesonbuild\interpreterbase.py",

  1   2   >