Commit Graph

131923 Commits

Author SHA1 Message Date
Jesse Natalie 474baa04ed clover/api: Support MSVC
Three things:
1. MSVC dislikes mismatching declaration/definition of __declspec(dllexport).
   Since CL headers don't have the declspec, the implementations should't either.
2. An unnamed brace-initialization gets deduced as an initializer list, instead
   of a brace-constructed string. Just add the type name.
3. posix_memalign doesn't exist on Windows.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7680>
2020-12-02 10:13:34 -08:00
Jesse Natalie f88347cd22 clover/core: Support MSVC
Constructing a class where the class name is wrapped in parens
doesn't work with MSVC. I see no good reason to do that so drop
the parens. Also, use a generic page size helper instead of hardcoding
something OS-specific.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7680>
2020-12-02 10:13:34 -08:00
Jesse Natalie 4cfd57dd48 clover/llvm: Work around MSVC quirks
Two things:
1. While instantiating a template where clover::llvm and ::llvm are
   both resolvable for unscoped llvm, MSVC complains about ambiguity.
   Resolve by not using namespace clover, leaving only ::llvm as a
   valid namespace.
2. LLVM headers (specifically Allocator.h) use __declspec(restrict),
   but Mesa's util headers #define restrict to __restrict for C++.
   Since __declspec(__restrict) is invalid, make sure we always include
   Allocator.h first before the util header.
3. Change a uint/int to uint64_t to match the type returned from LLVM.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7680>
2020-12-02 10:13:34 -08:00
Jesse Natalie 149a036825 clover: Fix property_element::as for MSVC
MSVC doesn't like reinterpret_cast<T>(val) where neither T nor val
are pointers. It needs to be a static cast instead.

v2: Update assert to static_assert

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7680>
2020-12-02 10:13:33 -08:00
Jesse Natalie 80817b6e34 meson: Adjust Clover's required LLVM modules
When coming from CMake, all-targets doesn't exist, and Clover's
mechanism for finding Clang apparently requires the OpenMP frontend
lib but doesn't automatically pull it in.

Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7680>
2020-12-02 10:12:28 -08:00
Jesse Natalie 959e017799 clover: Add version.lib dependency for Clang on Windows
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7680>
2020-12-02 10:12:28 -08:00
Jesse Natalie 72566fd92c clover: Support LLVM coming from CMake instead of config-tool
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7680>
2020-12-02 10:12:27 -08:00
Jesse Natalie 425cfcafb2 clover: Add opencl-native build flag
This flag controls whether to include native codegen functionality
for the AMD backend

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7680>
2020-12-02 10:12:27 -08:00
Jesse Natalie 60454a4e99 gallium: Remove unnecessary forward declaration of swrast_driver_descriptor
MSVC complains that the definition has __declspec(dllexport) but the
forward declaration doesn't. I can't find any users of this decl in
the header.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7680>
2020-12-02 10:12:27 -08:00
Jesse Natalie bb7eee8b40 gallium: Include winsock lib as a dependency for Windows
The gallium aux lib includes code that calls socket APIs. On Windows,
these APIs come from ws2_32.lib/dll (winsock2), so make sure consumers
link against that lib.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7680>
2020-12-02 10:12:27 -08:00
Jesse Natalie a5de2bc229 driconf: Avoid empty macro resulting in empty initializer braces
MSVC is unhappy with empty initializer braces while compiling C

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7680>
2020-12-02 10:12:27 -08:00
Jesse Natalie cdf3a6a83b util: Add os_get_page_size query
No Apple/BSD implementation yet, I have no idea how to do that

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7680>
2020-12-02 10:12:27 -08:00
Jesse Natalie 852d91edcd windows: Always set NOMINMAX to remove min/max macros
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7680>
2020-12-02 10:12:25 -08:00
Caio Marcelo de Oliveira Filho 0a7abee60b anv: Avoid a couple of warnings related to vk_error macros
When DEBUG is not defined, no error reporting is done, the error is
just returned back.  The current definition a couple of warnings in
anv_formats.c.  First when the return value is intentionally ignored

  ../src/intel/vulkan/anv_formats.c:989:48: warning: statement with no effect [-Wunused-value]
    989 |          vk_errorfi(instance, physical_device, VK_ERROR_FORMAT_NOT_SUPPORTED,
        |                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ../src/intel/vulkan/anv_private.h:486:55: note: in definition of macro ‘vk_errorfi’
    486 | #define vk_errorfi(instance, obj, error, format, ...) error
        |                                                       ^~~~~

and also when an argument is used only

  ../src/intel/vulkan/anv_formats.c:908:25: warning: unused variable ‘instance’ [-Wunused-variable]
    908 |    struct anv_instance *instance = physical_device->instance;
        |                         ^~~~~~~~
  ../src/intel/vulkan/anv_formats.c: In function ‘anv_GetPhysicalDeviceImageFormatProperties2’:
  ../src/intel/vulkan/anv_formats.c:1231:25: warning: unused variable ‘instance’ [-Wunused-variable]
   1231 |    struct anv_instance *instance = physical_device->instance;
        |                         ^~~~~~~~

to avoid both issues, use a static inline function that just returns
it's argument but can consume other input. Ignoring the return value
of a function is OK, and the extra input can be tagged as UNUSED
getting rid of both warnings.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7860>
2020-12-02 08:30:46 -09:00
Daniel Schürmann e60fcf0a87 nir/opt_sink: return early when trying to sink unused instructions
Fixes: 5f6c5e5b86 ('nir: don't sink instructions into loops')

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7874>
2020-12-02 17:12:44 +00:00
Iago Toral Quiroga 5603bb13e3 v3dv: fix early return from failed drmGetMagic
v2: Log more detail to stderr upon failure (Chema)

Fixes: b14679ab22 ('v3dv: check return value of drmGetMagic')
Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7865>
2020-12-02 17:00:28 +00:00
Daniel Stone 9eee405484 freedreno: Add missing dependency to build
computerator depends on ir3_parser.h, which is a generated file, but
this dependency is not expressed in the build.

Fixes: 1e8808a4a0 ("freedreno/ir3: refactor out helper to compile shader from asm")
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7870>
2020-12-02 16:26:29 +00:00
Adam Jackson 770230aab1 glx: Fix the generated error when indirect contexts are not supported
When the server doesn't support indirect contexts it will generate a
BadValue error, since the CreateContext request's isDirect field will
have specified an unsupported value of False. We attempt to verify that
context creation succeeded by asking whether the context's XID is direct
or not after we create it. Due to the details of XCB error handling, if
the context wasn't successfully created, the GLXBadContext error from
the GLXIsDirect request will get raised first, hiding the BadValue from
the application.

To fix this, we change the behavior of __glXIsDirect based on the
`error` outparameter. If it is NULL we still raise the error generated
from the GLXIsDirect request, but if it is non-NULL we now just inform
the caller that the request failed and silently eat the error. By doing
this the BadValue (or whatever else) from the CreateContext request will
bubble up to the application as expected.

This is admittedly a bit subtle but it's the simplest way to get to the
fix here. A better solution would be to convert all of CreateContext to
XCB, but XCB doesn't have protocol for GLX_SGIX_fbconfig yet so we'd
lose glXCreateContextWithConfigSGIX.

Fixes: mesa/mesa#3907
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7859>
2020-12-02 16:07:27 +00:00
Adam Jackson 97858f3c9c glx: Simplify error handling in glXImportContextEXT
The GLXIsDirect request will throw GLXBadContext for us if it needs to,
so we can avoid synthesizing an error on the client side.

Acked-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7859>
2020-12-02 16:07:27 +00:00
Erik Faye-Lund 2c9e7f73ad microsoft/clc: increase test-timeout
The test "clc_compiler_test" is kinda nasty in packing too many things
into a single test, making it awkwardly long. We should really consider
splitting it up into multiple tests instead.

But right now, it's sometimes timing out on CI, which is bad, so here's
a quick band-aid to prevent this from happening.

The previous timeout of two minutes seems to not always be sufficient
under various loads, so let's add another minute just to be sure.

Here's an example of a failure with the current timeout:

https://gitlab.freedesktop.org/mesa/mesa/-/jobs/5918980#L1589

Fixes: ff05da7f8d ("microsoft: Add CLC frontend and kernel/compute support to DXIL converter")
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7872>
2020-12-02 14:19:19 +00:00
Simon Ser a7fb25bfe4 egl: fix typo in wl_drm error message
Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7854>
2020-12-02 14:02:37 +00:00
Christian Gmeiner 3f4325e44b etnaviv: update fallthrough comments
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7849>
2020-12-02 13:52:12 +00:00
Erik Faye-Lund 3517b6fd53 microsoft/clc: add missing dependency
We include git_sha1.h in clc_compiler.c, so we should also make sure we
depend on the header being generated in time. This fixes a spurious
build error when compiling with many cores, like we do on CI.

Fixes: ff05da7f8d ("microsoft: Add CLC frontend and kernel/compute support to DXIL converter")
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7869>
2020-12-02 13:41:24 +00:00
Erik Faye-Lund 84dd4ac1c7 microsoft/clc: use files-function for source-list
This makes things a bit more explicit, and is generally what we seem to
do around in the source-tree.

Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7869>
2020-12-02 13:41:24 +00:00
Duncan Hopkins 19a9f22501 zink: moved vkEnumerateInstanceVersion to create_instance
Moved the call to vkEnumerateInstanceVersion() into the create_instance() function,
so the result can be passed into the application apiVersion.
Will stop drivers from limiting a devices supported api version.

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7533>
2020-12-02 13:27:29 +00:00
Erik Faye-Lund 195a001d73 gitlab-ci: do not clone git-repo for test-job
The only thing we really need from the git-repo is the piglit_run.ps1
script, so let's upload that into our artifacts instead.

Fixes: d560addc30 ("gitlab-ci: run piglit on windows")
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7867>
2020-12-02 12:02:21 +00:00
Yevhenii Kharchenko 361d143f94 meson: Add build option to specify default shader disk cache max-size
Added an optional 'shader-cache-max-size' build option to meson,
which sets default value of max disk cache size for compiled
GLSL programs. Can be overriden by 'MESA_GLSL_CACHE_MAX_SIZE'
environment variable.
Syntax is the same as environment variable has: a number optionally
followed by K, M, G to specify a size in kilobytes, megabytes, or
gigabytes. By default, gigabytes will be assumed.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3572

Signed-off-by: Yevhenii Kharchenko <yevhenii.kharchenko@globallogic.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: John Bates <jbates@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7217>
2020-12-02 11:44:34 +00:00
James Park 0546ceba16 radv: Use portable ffs and util_bitcount macros
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7866>
2020-12-02 11:27:01 +00:00
James Park 3ff1eccce6 radv: Replace pthread thread with thrd_t
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7866>
2020-12-02 11:27:01 +00:00
James Park 63dc2a53af radv: Replace pthread mutex with mtx_t
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7866>
2020-12-02 11:27:01 +00:00
James Park aefaceab09 radv: Use unsigned with u_bit_scan for MSVC
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7866>
2020-12-02 11:27:01 +00:00
James Park 60c362c490 radv: Create shader cache if ENABLE_SHADER_CACHE
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7866>
2020-12-02 11:27:01 +00:00
James Park bed6e462e1 radv: Use standard __VA_ARGS__ macro
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7866>
2020-12-02 11:27:01 +00:00
James Park 09fb370068 radv: Fix function parameter types
Avoids unnecessary type aliasing.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7866>
2020-12-02 11:27:01 +00:00
James Park 6ec0953e22 radv: Fix leak in radv_amdgpu_winsys_destroy()
Fixes: fa97061a82 ("radv/winsys: Add binary syncobj ABI changes for timeline semaphores.")

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7866>
2020-12-02 11:27:01 +00:00
James Park 314bcb3937 radv: Fix callback signatures
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7866>
2020-12-02 11:27:01 +00:00
James Park be42e9a6d1 radv: Update radv_assert for MSVC
MSVC hates parentheses in radv_assert, so replace with do/while(0).

Also switch nonstandard DEBUG with standard NDEBUG, which Aco uses.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7866>
2020-12-02 11:27:01 +00:00
James Park 02481e1203 radv: Ignore radv_printflike on Windows
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7866>
2020-12-02 11:27:01 +00:00
James Park 7f7586704c radv: Don't return value in void function
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7866>
2020-12-02 11:27:01 +00:00
James Park 3fe62252e4 radv: Use os_localtime instead of localtime_r
Cross-platform abstraction that works with MSVC.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7866>
2020-12-02 11:27:01 +00:00
James Park fe67fe688a radv: Wrap pragmas with __GNUC__ to fix MSVC
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7866>
2020-12-02 11:27:01 +00:00
James Park c4a516ca70 radv: Replace VLAs with alloca
MSVC does not support VLAs.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7866>
2020-12-02 11:27:01 +00:00
James Park 2749258368 radv: Update build defines for Windows
Add VK_USE_PLATFORM_WIN32_KHR.

Use VK_NO_PROTOTYPES to deal with __declspec(dllexport) mismatch.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7866>
2020-12-02 11:27:01 +00:00
James Park 0c70842232 radv: Exclude amdgpu driver files for Windows
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7866>
2020-12-02 11:27:01 +00:00
Erik Faye-Lund b79eac6b07 gitlab-ci: ignore nv_copy_depth_to_color
This seems to be spuriously changing between crash and fail, so let's
skip it for now.

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7857>
2020-12-02 10:04:58 +01:00
Erik Faye-Lund d560addc30 gitlab-ci: run piglit on windows
This tests the D3D12 driver on Windows during CI, to prevent accidental
breakage.

Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7857>
2020-12-02 10:04:53 +01:00
Erik Faye-Lund 76b51fdf0c gitlab-ci: build piglit in mesa_deps.ps1
This will allow us to run Piglit on Windows during CI.

Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7857>
2020-12-02 10:04:48 +01:00
Erik Faye-Lund 04e3693e6d gitlab-ci: build zlib statically on windows
This avoids having to copy the DLL around when testing.

Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7857>
2020-12-02 10:04:43 +01:00
Erik Faye-Lund eaab92cc61 gitlab-ci: store build-artifacts from building mesa
GitLab CI doesn't allow us to store artifacts from outside the
build-directory, so let's create an install-directory and install there
instead.

To do this properly, we need to expand a variable inside the
command-line, so we need to change to a double-quoted string.

Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7857>
2020-12-02 10:04:39 +01:00
Samuel Pitoiset e88c61eb41 ci: build the Vulkan device select layer
To avoid breaking the build.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Tony Wasserka <tony.wasserka@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7843>
2020-12-02 07:44:13 +01:00