diff -Nru mesa-18.3~git1809200730.18be74~oibaf~c/debian/changelog mesa-18.3~git1809201930.2567ad~oibaf~c/debian/changelog --- mesa-18.3~git1809200730.18be74~oibaf~c/debian/changelog 2018-09-20 05:30:03.000000000 +0000 +++ mesa-18.3~git1809201930.2567ad~oibaf~c/debian/changelog 2018-09-20 17:30:02.000000000 +0000 @@ -1,13 +1,13 @@ -mesa (18.3~git1809200730.18be74~oibaf~c) cosmic; urgency=high +mesa (18.3~git1809201930.2567ad~oibaf~c) cosmic; urgency=high * Checkout from master git branch up to commit - 18be7403a11f53d58bbfe3905c0cacd6bc714492 + 2567ad28bbbec5750567af0cd9c8a2dd4732f91d * Gallium Nine installed by default * Custom OpenGL version string to make sure you are running drivers from this PPA * Disabled Mir (FTBFS) - -- Oibaf Thu, 20 Sep 2018 07:30:03 +0200 + -- Oibaf Thu, 20 Sep 2018 19:30:02 +0200 mesa (18.0.0~rc4-1ubuntu1) bionic; urgency=medium diff -Nru mesa-18.3~git1809200730.18be74~oibaf~c/meson.build mesa-18.3~git1809201930.2567ad~oibaf~c/meson.build --- mesa-18.3~git1809200730.18be74~oibaf~c/meson.build 2018-09-18 05:30:03.000000000 +0000 +++ mesa-18.3~git1809201930.2567ad~oibaf~c/meson.build 2018-09-20 17:30:02.000000000 +0000 @@ -1188,6 +1188,8 @@ _llvm_version = '>= 3.3.0' endif +_shared_llvm = get_option('shared-llvm') + _llvm = get_option('llvm') if _llvm == 'auto' dep_llvm = dependency( @@ -1196,6 +1198,7 @@ modules : llvm_modules, optional_modules : llvm_optional_modules, required : with_amd_vk or with_gallium_radeonsi or with_gallium_swr or with_gallium_opencl, + static : not _shared_llvm ) with_llvm = dep_llvm.found() elif _llvm == 'true' @@ -1204,6 +1207,7 @@ version : _llvm_version, modules : llvm_modules, optional_modules : llvm_optional_modules, + static : not _shared_llvm, ) with_llvm = true else diff -Nru mesa-18.3~git1809200730.18be74~oibaf~c/meson_options.txt mesa-18.3~git1809201930.2567ad~oibaf~c/meson_options.txt --- mesa-18.3~git1809200730.18be74~oibaf~c/meson_options.txt 2018-08-27 10:18:53.000000000 +0000 +++ mesa-18.3~git1809201930.2567ad~oibaf~c/meson_options.txt 2018-09-20 17:30:02.000000000 +0000 @@ -238,6 +238,12 @@ description : 'Build with LLVM support.' ) option( + 'shared-llvm', + type : 'boolean', + value : true, + description : 'Whether to link llvm shared or statically.' +) +option( 'valgrind', type : 'combo', value : 'auto', diff -Nru mesa-18.3~git1809200730.18be74~oibaf~c/src/egl/drivers/dri2/platform_android.c mesa-18.3~git1809201930.2567ad~oibaf~c/src/egl/drivers/dri2/platform_android.c --- mesa-18.3~git1809200730.18be74~oibaf~c/src/egl/drivers/dri2/platform_android.c 2018-09-14 05:30:03.000000000 +0000 +++ mesa-18.3~git1809201930.2567ad~oibaf~c/src/egl/drivers/dri2/platform_android.c 2018-09-20 17:30:02.000000000 +0000 @@ -1202,10 +1202,14 @@ return (config_count != 0); } +static EGLBoolean +droid_probe_device(_EGLDisplay *disp); + #ifdef HAVE_DRM_GRALLOC -static int -droid_open_device_drm_gralloc(struct dri2_egl_display *dri2_dpy) +static EGLBoolean +droid_open_device_drm_gralloc(_EGLDisplay *disp) { + struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); int fd = -1, err = -EINVAL; if (dri2_dpy->gralloc->perform) @@ -1214,10 +1218,14 @@ &fd); if (err || fd < 0) { _eglLog(_EGL_WARNING, "fail to get drm fd"); - fd = -1; + return EGL_FALSE; } - return (fd >= 0) ? fcntl(fd, F_DUPFD_CLOEXEC, 3) : -1; + dri2_dpy->fd = fcntl(fd, F_DUPFD_CLOEXEC, 3); + if (dri2_dpy->fd < 0) + return EGL_FALSE; + + return droid_probe_device(disp); } #endif /* HAVE_DRM_GRALLOC */ @@ -1404,6 +1412,17 @@ return false; } +static void +droid_unload_driver(_EGLDisplay *disp) +{ + struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); + + dlclose(dri2_dpy->driver); + dri2_dpy->driver = NULL; + free(dri2_dpy->driver_name); + dri2_dpy->driver_name = NULL; +} + static int droid_filter_device(_EGLDisplay *disp, int fd, const char *vendor) { @@ -1420,13 +1439,31 @@ return 0; } -static int +static EGLBoolean +droid_probe_device(_EGLDisplay *disp) +{ + /* Check that the device is supported, by attempting to: + * - load the dri module + * - and, create a screen + */ + if (!droid_load_driver(disp)) + return EGL_FALSE; + + if (!dri2_create_screen(disp)) { + _eglLog(_EGL_WARNING, "DRI2: failed to create screen"); + droid_unload_driver(disp); + return EGL_FALSE; + } + return EGL_TRUE; +} + +static EGLBoolean droid_open_device(_EGLDisplay *disp) { #define MAX_DRM_DEVICES 32 + struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); drmDevicePtr device, devices[MAX_DRM_DEVICES] = { NULL }; - int prop_set, num_devices; - int fd = -1, fallback_fd = -1; + int num_devices; char *vendor_name = NULL; char vendor_buf[PROPERTY_VALUE_MAX]; @@ -1436,7 +1473,7 @@ num_devices = drmGetDevices2(0, devices, ARRAY_SIZE(devices)); if (num_devices < 0) - return num_devices; + return EGL_FALSE; for (int i = 0; i < num_devices; i++) { device = devices[i]; @@ -1444,41 +1481,49 @@ if (!(device->available_nodes & (1 << DRM_NODE_RENDER))) continue; - fd = loader_open_device(device->nodes[DRM_NODE_RENDER]); - if (fd < 0) { + dri2_dpy->fd = loader_open_device(device->nodes[DRM_NODE_RENDER]); + if (dri2_dpy->fd < 0) { _eglLog(_EGL_WARNING, "%s() Failed to open DRM device %s", __func__, device->nodes[DRM_NODE_RENDER]); continue; } - if (vendor_name && droid_filter_device(disp, fd, vendor_name)) { - /* Match requested, but not found - set as fallback */ - if (fallback_fd == -1) { - fallback_fd = fd; - } else { - close(fd); - fd = -1; + /* If a vendor is explicitly provided, we use only that. + * Otherwise we fall-back the first device that is supported. + */ + if (vendor_name) { + if (droid_filter_device(disp, dri2_dpy->fd, vendor_name)) { + /* Device does not match - try next device */ + close(dri2_dpy->fd); + dri2_dpy->fd = -1; + continue; + } + /* If the requested device matches - use it. Regardless if + * init fails, do not fall-back to any other device. + */ + if (!droid_probe_device(disp)) { + close(dri2_dpy->fd); + dri2_dpy->fd = -1; } - continue; + break; } - /* Found a device */ - break; - } - drmFreeDevices(devices, num_devices); + if (droid_probe_device(disp)) + break; - if (fallback_fd < 0 && fd < 0) { - _eglLog(_EGL_WARNING, "Failed to open any DRM device"); - return -1; + /* No explicit request - attempt the next device */ + close(dri2_dpy->fd); + dri2_dpy->fd = -1; } + drmFreeDevices(devices, num_devices); - if (fd < 0) { - _eglLog(_EGL_WARNING, "Failed to open desired DRM device, using fallback"); - return fallback_fd; + if (dri2_dpy->fd < 0) { + _eglLog(_EGL_WARNING, "Failed to open %s DRM device", + vendor_name ? "desired": "any"); + return EGL_FALSE; } - close(fallback_fd); - return fd; + return EGL_TRUE; #undef MAX_DRM_DEVICES } @@ -1510,25 +1555,14 @@ disp->DriverData = (void *) dri2_dpy; #ifdef HAVE_DRM_GRALLOC - dri2_dpy->fd = droid_open_device_drm_gralloc(dri2_dpy); + if (!droid_open_device_drm_gralloc(disp)) { #else - dri2_dpy->fd = droid_open_device(disp); + if (!droid_open_device(disp)) { #endif - if (dri2_dpy->fd < 0) { err = "DRI2: failed to open device"; goto cleanup; } - if (!droid_load_driver(disp)) { - err = "DRI2: failed to load driver"; - goto cleanup; - } - - if (!dri2_create_screen(disp)) { - err = "DRI2: failed to create screen"; - goto cleanup; - } - if (!dri2_setup_extensions(disp)) { err = "DRI2: failed to setup extensions"; goto cleanup; diff -Nru mesa-18.3~git1809200730.18be74~oibaf~c/src/git_sha1.h.in mesa-18.3~git1809201930.2567ad~oibaf~c/src/git_sha1.h.in --- mesa-18.3~git1809200730.18be74~oibaf~c/src/git_sha1.h.in 2018-09-20 05:30:03.000000000 +0000 +++ mesa-18.3~git1809201930.2567ad~oibaf~c/src/git_sha1.h.in 2018-09-20 17:30:02.000000000 +0000 @@ -1 +1 @@ -#define MESA_GIT_SHA1 "git-18be7403a1 2018-09-20 cosmic-oibaf-ppa" +#define MESA_GIT_SHA1 "git-2567ad28bb 2018-09-20 cosmic-oibaf-ppa" diff -Nru mesa-18.3~git1809200730.18be74~oibaf~c/src/mesa/drivers/dri/i965/brw_tcs.c mesa-18.3~git1809201930.2567ad~oibaf~c/src/mesa/drivers/dri/i965/brw_tcs.c --- mesa-18.3~git1809200730.18be74~oibaf~c/src/mesa/drivers/dri/i965/brw_tcs.c 2018-07-24 05:30:03.000000000 +0000 +++ mesa-18.3~git1809201930.2567ad~oibaf~c/src/mesa/drivers/dri/i965/brw_tcs.c 2018-09-20 17:30:02.000000000 +0000 @@ -167,10 +167,6 @@ if (tcp) { nir = tcp->program.nir; } else { - /* Create a dummy nir_shader. We won't actually use NIR code to - * generate assembly (it's easier to generate assembly directly), - * but the whole compiler assumes one of these exists. - */ const nir_shader_compiler_options *options = ctx->Const.ShaderCompilerOptions[MESA_SHADER_TESS_CTRL].NirOptions; nir = create_passthrough_tcs(mem_ctx, compiler, options, key); diff -Nru mesa-18.3~git1809200730.18be74~oibaf~c/src/util/u_math.c mesa-18.3~git1809201930.2567ad~oibaf~c/src/util/u_math.c --- mesa-18.3~git1809200730.18be74~oibaf~c/src/util/u_math.c 2018-09-07 17:30:08.000000000 +0000 +++ mesa-18.3~git1809201930.2567ad~oibaf~c/src/util/u_math.c 2018-09-20 17:30:02.000000000 +0000 @@ -29,7 +29,7 @@ #include "pipe/p_config.h" #include "util/u_math.h" -#include "util/u_cpu_detect.h" +#include "x86/common_x86_features.h" #if defined(PIPE_ARCH_SSE) #include @@ -90,7 +90,7 @@ unsigned mxcsr = 0; #if defined(PIPE_ARCH_SSE) - if (util_cpu_caps.has_sse) { + if (cpu_has_xmm) { mxcsr = _mm_getcsr(); } #endif @@ -98,6 +98,31 @@ return mxcsr; } +/* TODO: this was copied from u_cpu_detection. It's another case of duplication + * between gallium and core mesa, and it would be nice to get rid of that + * duplication as well. + */ +#if defined(PIPE_ARCH_X86) +PIPE_ALIGN_STACK static inline bool sse2_has_daz(void) +{ + struct { + uint32_t pad1[7]; + uint32_t mxcsr_mask; + uint32_t pad2[128-8]; + } PIPE_ALIGN_VAR(16) fxarea; + + fxarea.mxcsr_mask = 0; +#if defined(PIPE_CC_GCC) + __asm __volatile ("fxsave %0" : "+m" (fxarea)); +#elif defined(PIPE_CC_MSVC) || defined(PIPE_CC_ICL) + _fxsave(&fxarea); +#else + fxarea.mxcsr_mask = 0; +#endif + return !!(fxarea.mxcsr_mask & (1 << 6)); +} +#endif + /** * Make sure that the fp treats the denormalized floating * point numbers as zero. @@ -108,13 +133,21 @@ util_fpstate_set_denorms_to_zero(unsigned current_mxcsr) { #if defined(PIPE_ARCH_SSE) - if (util_cpu_caps.has_sse) { + if (cpu_has_xmm) { /* Enable flush to zero mode */ current_mxcsr |= _MM_FLUSH_ZERO_MASK; - if (util_cpu_caps.has_daz) { + /* x86_64 cpus always have daz, as do cpus with sse3 in fact, there's + * basically only a handful of very early pentium 4's that have sse2 but + * not daz. + */ +# if !defined(PIPE_ARCH_x86_64) && !defined(PIPE_ARCH_SSSE3) + if (sse2_has_daz()) { +# endif /* Enable denormals are zero mode */ current_mxcsr |= _MM_DENORMALS_ZERO_MASK; +# if !defined(PIPE_ARCH_x86_64) && !defined(PIPE_ARCH_SSSE3) } +#endif util_fpstate_set(current_mxcsr); } #endif @@ -130,7 +163,7 @@ util_fpstate_set(unsigned mxcsr) { #if defined(PIPE_ARCH_SSE) - if (util_cpu_caps.has_sse) { + if (cpu_has_xmm) { _mm_setcsr(mxcsr); } #endif