aboutsummaryrefslogtreecommitdiffstats
path: root/src/loader/loader.c
Commit message (Collapse)AuthorAgeFilesLines
* loader: Fix leak of kernel driver nameKenneth Graunke2020-01-301-1/+4
| | | | | | | | | | | This is strdup'd, it needs to be freed. CID: 1458032 Fixes: f93bb2fb102 ("loader: Check if the kernel driver is i915 before loading iris") Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Sagar Ghuge <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3630> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3630>
* loader: Check if the kernel driver is i915 before loading irisKenneth Graunke2020-01-281-0/+7
| | | | | | | | To prevent it from trying to load on say gma500 hardware. Reviewed-by: Eric Engestrom <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3595> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3595>
* loader: #define PATH_MAX when undefined (eg. Hurd)Samuel Thibault2020-01-221-0/+5
| | | | | | | Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Samuel Thibault <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3228> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3228>
* loader: Simplify handling of the radeonsi driverMichel Dänzer2019-10-081-9/+0
| | | | | | | The list of AMD/ATI devices supported by radeon/r200/r300/r600 is complete, so anything else must use radeonsi. Reviewed-by: Marek Olšák <[email protected]>
* loader: use ARRAY_SIZE instead of NULL sentinelEric Engestrom2019-10-071-1/+3
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Acked-by: Lionel Landwerlin <[email protected]>
* loader: replace int/1/0 with bool/true/falseEric Engestrom2019-10-071-9/+8
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Acked-by: Lionel Landwerlin <[email protected]>
* loader: Avoid use-after-free / use of uninitialized local variablesMichel Dänzer2019-09-261-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Per the valgrind output below, we were returning the pointer to freed memory if none of the later conditional pointer assignments were executed. This caused dEQP CI jobs to crash on certain runners, presumably due to a double-free down the line. Also, we were skipping to the out: label before the vendor_id & chip_id variables used by it were initialized, resulting in broken LIBGL_DEBUG=verbose output such as libGL: pci id for fd 4: 51108f00:51108f00, driver radeonsi Fixes: 5a545e355b23 "loader: always map the "amdgpu" kernel driver name to radeonsi (v2)" ==403== Invalid read of size 1 ==403== at 0x4AFD576: surfaceless_probe_device (platform_surfaceless.c:316) ==403== by 0x4AFD915: dri2_initialize_surfaceless (platform_surfaceless.c:391) ==403== by 0x4AF5EEA: dri2_initialize (egl_dri2.c:984) ==403== by 0x4AF5EEA: dri2_initialize (egl_dri2.c:958) ==403== by 0x4AF1EEC: _eglMatchAndInitialize (egldriver.c:75) ==403== by 0x4AF1F3B: _eglMatchDriver (egldriver.c:96) ==403== by 0x4AE9367: eglInitialize (eglapi.c:617) ==403== by 0x1D99C9: tcu::surfaceless::EglRenderContext::EglRenderContext(glu::RenderConfig const&, tcu::CommandLine const&) [clone .constprop.57] (in /deqp/modules/gles2/deqp-gles2) ==403== by 0x1DABB0: tcu::surfaceless::ContextFactory::createContext(glu::RenderConfig const&, tcu::CommandLine const&, glu::RenderContext const*) const (in /deqp/modules/gles2/deqp-gles2) ==403== by 0x53EBD1: glu::createRenderContext(tcu::Platform&, tcu::CommandLine const&, glu::RenderConfig const&, glu::RenderContext const*) (in /deqp/modules/gles2/deqp-gles2) ==403== by 0x53EFE9: glu::createDefaultRenderContext(tcu::Platform&, tcu::CommandLine const&, glu::ApiType) (in /deqp/modules/gles2/deqp-gles2) ==403== by 0x1DE07A: deqp::gles2::Context::Context(tcu::TestContext&) (in /deqp/modules/gles2/deqp-gles2) ==403== by 0x1DB5EF: deqp::gles2::TestPackage::init() (in /deqp/modules/gles2/deqp-gles2) ==403== Address 0x56bd340 is 0 bytes inside a block of size 4 free'd ==403== at 0x48369AB: free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) ==403== by 0x4B01767: loader_get_driver_for_fd (loader.c:464) ==403== by 0x4AFD553: surfaceless_probe_device (platform_surfaceless.c:308) ==403== by 0x4AFD915: dri2_initialize_surfaceless (platform_surfaceless.c:391) ==403== by 0x4AF5EEA: dri2_initialize (egl_dri2.c:984) ==403== by 0x4AF5EEA: dri2_initialize (egl_dri2.c:958) ==403== by 0x4AF1EEC: _eglMatchAndInitialize (egldriver.c:75) ==403== by 0x4AF1F3B: _eglMatchDriver (egldriver.c:96) ==403== by 0x4AE9367: eglInitialize (eglapi.c:617) ==403== by 0x1D99C9: tcu::surfaceless::EglRenderContext::EglRenderContext(glu::RenderConfig const&, tcu::CommandLine const&) [clone .constprop.57] (in /deqp/modules/gles2/deqp-gles2) ==403== by 0x1DABB0: tcu::surfaceless::ContextFactory::createContext(glu::RenderConfig const&, tcu::CommandLine const&, glu::RenderContext const*) const (in /deqp/modules/gles2/deqp-gles2) ==403== by 0x53EBD1: glu::createRenderContext(tcu::Platform&, tcu::CommandLine const&, glu::RenderConfig const&, glu::RenderContext const*) (in /deqp/modules/gles2/deqp-gles2) ==403== by 0x53EFE9: glu::createDefaultRenderContext(tcu::Platform&, tcu::CommandLine const&, glu::ApiType) (in /deqp/modules/gles2/deqp-gles2) ==403== Block was alloc'd at ==403== at 0x483577F: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) ==403== by 0x4EE5E09: strndup (strndup.c:43) ==403== by 0x4B010B1: loader_get_kernel_driver_name (loader.c:101) ==403== by 0x4B016AF: loader_get_driver_for_fd (loader.c:462) ==403== by 0x4AFD553: surfaceless_probe_device (platform_surfaceless.c:308) ==403== by 0x4AFD915: dri2_initialize_surfaceless (platform_surfaceless.c:391) ==403== by 0x4AF5EEA: dri2_initialize (egl_dri2.c:984) ==403== by 0x4AF5EEA: dri2_initialize (egl_dri2.c:958) ==403== by 0x4AF1EEC: _eglMatchAndInitialize (egldriver.c:75) ==403== by 0x4AF1F3B: _eglMatchDriver (egldriver.c:96) ==403== by 0x4AE9367: eglInitialize (eglapi.c:617) ==403== by 0x1D99C9: tcu::surfaceless::EglRenderContext::EglRenderContext(glu::RenderConfig const&, tcu::CommandLine const&) [clone .constprop.57] (in /deqp/modules/gles2/deqp-gles2) ==403== by 0x1DABB0: tcu::surfaceless::ContextFactory::createContext(glu::RenderConfig const&, tcu::CommandLine const&, glu::RenderContext const*) const (in /deqp/modules/gles2/deqp-gles2) Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]>
* loader: always map the "amdgpu" kernel driver name to radeonsi (v2)Jiang, Sonny2019-09-231-0/+9
| | | | | | | | v2: cleanup Signed-off-by: Sonny Jiang <[email protected]> Signed-off-by: Marek Olšák <[email protected]> Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]>
* driconfig: add a new engine name/version parameterLionel Landwerlin2019-09-151-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Vulkan applications can register with the following structure : typedef struct VkApplicationInfo { VkStructureType sType; const void* pNext; const char* pApplicationName; uint32_t applicationVersion; const char* pEngineName; uint32_t engineVersion; uint32_t apiVersion; } VkApplicationInfo; This enables the Vulkan implementations to apply workarounds based off matching this description. Here we add a new parameter for matching the driconfig options with the following : <device driver="anv"> <application engine_name_match="MyOwnEngine.*" engine_versions="10:12,40:42"> <option name="blaaah" value="true" /> </application> </device> v2: switch engine name match to use regexps v3: Verify that the regexec returns REG_NOMATCH for match failure (Eric) v4: Add missing bit that went to the following commit (Eric) Signed-off-by: Lionel Landwerlin <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]> Cc: 19.2 <[email protected]>
* loader: include limits.h for PATH_MAXnia2019-09-021-0/+1
| | | | | | | | | This is needed to build on illumos. The location of the PATH_MAX definition in limits.h seems to be fairly standard: https://pubs.opengroup.org/onlinepubs/009695399/basedefs/limits.h.html Reviewed-by: Eric Engestrom <[email protected]>
* mesa: Rename GLX_USE_TLS to USE_ELF_TLS.Bas Nieuwenhuizen2019-08-031-1/+1
| | | | | | | These days it is not GLX only and it does not work with all TLS implementations. Reviewed-by: Eric Engestrom <[email protected]>
* loader: use loader_open_device() to handle O_CLOEXECEmil Velikov2019-02-261-1/+1
| | | | | | | | Some platforms lack O_CLOEXEC. The loader_open_device() handles those appropriately, so use the helper. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* loader: deduplicate logger function declarationEric Engestrom2018-12-041-2/+2
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* loader: Factor out the common driver opening logic from each loader.Eric Anholt2018-11-161-0/+90
| | | | | | | | | | | | | I copied the code from egl_dri2.c, but the functionality was equivalent between all the loaders other than their particular environment variables. v2: Drop the logging function equivalent to loader_default_logger() (requested by Eric, Emil). Move the SCons workaround across. Drop the now-unused driGetDriverExtensions() declaration that was lost in a rebase. Reviewed-by: Eric Engestrom <[email protected]> (v1) Reviewed-by: Emil Velikov <[email protected]> (v1)
* loader: Stop using a local definition for an in-tree headerEric Anholt2018-11-161-8/+2
| | | | | | | | I need other types from the header now, and "gl.h is big" is not a good reason to duplicate definitions. Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* loader: add loader_open_render_node(..)Christian Gmeiner2018-08-311-0/+65
| | | | | | | This helper is almost a 1:1 copy of tegra_open_render_node(). Signed-off-by: Christian Gmeiner <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* loader: add dri_driver option to override dri driver to loadQiang Yu2018-08-171-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | drirc implementation of MESA_LOADER_DRIVER_OVERRIDE which can be used to override dri driver to load. Usage: override dri driver for device with spec kernel driver name: <device kernel_driver="kernel_driver_name"> <option name="dri_driver" value="new_dri_driver" /> </device> or <device driver="loader" kernel_driver="kernel_driver_name"> <option name="dri_driver" value="new_dri_driver" /> </device> v2: add kernel_driver device attribute to specify kernel driver name instead of reuse driver attribute v3: seperate loader_get_kernel_driver_name into another patch seperate add kernel_driver attribute into another patch Suggested-by: Michel Dänzer <[email protected]> Signed-off-by: Qiang Yu <[email protected]> Acked-by: Michel Dänzer <[email protected]> Reviewed-by: Emil Velikov <[email protected]> [v4 Emil: add HAVE_LIBDRM guard around __driConfigOptionsLoader and loader_get_dri_config_driver] Signed-off-by: Emil Velikov <[email protected]>
* xmlconfig: add kernel_driver device attributeQiang Yu2018-08-171-1/+1
| | | | | | | | | This attribute can be used by loader to apply different option to device use specific kernel driver. Signed-off-by: Qiang Yu <[email protected]> Acked-by: Michel Dänzer <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* loader: abstract loader_get_kernel_driver_name for reuseQiang Yu2018-08-171-16/+23
| | | | | | | | | This function can be shared by the following kernel_driver drirc patch. Signed-off-by: Qiang Yu <[email protected]> Acked-by: Michel Dänzer <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* loader: fix indentationEric Engestrom2018-08-021-2/+2
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Frank Binns <[email protected]>
* loader: Add support for platform and host1x bussesThierry Reding2018-03-021-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ARM SoCs usually have their DRM/KMS devices on the platform bus, so add support for this bus in order to allow use of the DRI_PRIME environment variable with those devices. While at it, also support the host1x bus, which is effectively the same but uses an additional layer in the bus hierarchy. Note that it isn't enough to support the bus that has the rendering GPU because the loader code will also try to construct an ID path tag for a scanout-only device if it is the default that is being opened. The ID path tag for a device can be obtained by running udevadm info on the device node, as shown in this example on NVIDIA Tegra: $ udevadm info /dev/dri/card0 | grep ID_PATH_TAG E: ID_PATH_TAG=platform-50000000_host1x The corresponding OF_FULLNAME property, from which the ID_PATH_TAG is constructed, can be found in the sysfs "uevent" attribute for the card0 device's parent: $ grep OF_FULLNAME /sys/devices/platform/50000000.host1x/drm/uevent OF_FULLNAME=/host1x@50000000 Similarily, /dev/dri/card1 corresponds to the GPU: $ udevadm info /dev/dri/card1 | grep ID_PATH_TAG E: ID_PATH_TAG=platform-57000000_gpu and: $ grep OF_FULLNAME /sys/devices/platform/57000000.gpu/uevent OF_FULLNAME=/gpu@57000000 Changes in v2: - avoid confusing pre-increment in strdup() - add examples of tags to commit message Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
* loader: Fix compiler warnings about truncating the PCI ID path.Eric Anholt2018-02-201-8/+7
| | | | | | | | | | | | | My build was producing: ../src/loader/loader.c:121:67: warning: ‘%1u’ directive output may be truncated writing between 1 and 3 bytes into a region of size 2 [-Wformat-truncation=] and we can avoid this careful calculation by just using asprintf (as we do elsewhere in the file). Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* loader: let compiler figure out the length of the stringEric Engestrom2018-01-251-2/+1
| | | | | | | Basically, turn comment into code Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* loader: drop empty function aliasEric Engestrom2017-10-261-11/+2
| | | | | | | While at it, drop the duplicate return. Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* loader: use drmGetDeviceNameFromFd2 from libdrmGreg V2017-10-261-35/+1
| | | | | | | | | | | Reduce code duplication and automatically benefit from OS-specific fixes to libdrm (e.g. in FreeBSD ports). API was introduced with 2.4.74 and we already require 2.4.75 globally. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103283 Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* xmlconfig: move into src/utilNicolai Hähnle2017-07-311-2/+2
| | | | | | | | v2: attempt to fix Android build (Emil) v3: add missing include path Reviewed-by: Marek Olšák <[email protected]> (v1)
* egl: turn one more boolean `int` into a `bool`Eric Engestrom2017-06-211-5/+5
| | | | | | | | | | Same as the previous commit, but this one was split out because it's a bit more complicated: this field is given as a pointer to a function, so the function had to be changed as well, and the function was use in a bunch of places, which needed updating as well. Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* loader: use drmGetDevice[s]2 APIEmil Velikov2017-03-151-3/+3
| | | | | | | | | | | | By this allows us to fetch the device list/info w/o the revision field. At the moment retrieving the latter wakes up the device. Note: kernel patch to resolve that should be in 4.10. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Michel Dänzer <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Tested-by: Mike Lothian <[email protected]>
* loader: Move non-error message to debug levelFabio Estevam2017-03-081-1/+1
| | | | | | | | | | | | | | | | | Currently when running mesa on imx6 the following loader warnings are seen: # kmscube -D /dev/dri/card1 MESA-LOADER: device is not located on the PCI bus MESA-LOADER: device is not located on the PCI bus MESA-LOADER: device is not located on the PCI bus Using display 0x1920948 with EGL version 1.4 As this is not an error message, change it to debug level in order to have a cleaner log output. Signed-off-by: Fabio Estevam <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* loader: unconditionally include unistd.h and stdlib.hNicolai Hähnle2017-02-101-2/+2
| | | | | | | | | | | | | | | | | Otherwise we would fail with "implicit declaration of function" geteuid and getenv respectively. To trigger (re)move the libdrm.pc file and use the following: $ ./autogen.sh --disable-egl --disable-gbm --disable-dri \ --with-dri-drivers=swrast --with-gallium-drivers=swrast $ make Cc: Vinson Lee <[email protected]> Fixes: 3f462050c ("loader: Add an environment variable to override driver name choice. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99701 v2: [Emil: handle stdlib.h add commit message] Signed-off-by: Emil Velikov <[email protected]>
* loader: Add an environment variable to override driver name choice.Eric Anholt2017-02-061-0/+11
| | | | | | | | | | My vc4 simulator has been implemented so far by having an entrypoint claiming to be i965, which was a bit gross. The simulator would be a lot less special if we entered through the vc4 entrypoint like normal, so add a loader environment variable to allow the i965 fd to probe as vc4. Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* loader: fixup driver names if neededChristian Gmeiner2016-11-151-0/+6
| | | | | | | | | | | | This makes it possible to 'use' the imx-drm driver. Remeber that it is not possible to have sysmbol names in C/C++ with a '-' in it. Changes since v1: - move the fix to loader.c Signed-off-by: Christian Gmeiner <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> (v1) Reviewed-by: Emil Velikov <[email protected]>
* loader: add loader_get_extensions_name(..) helperChristian Gmeiner2016-11-151-0/+19
| | | | | | | | | | | | | Changes since v1: - renamed function to loader_get_extensions_name - moved function into loader Signed-off-by: Christian Gmeiner <[email protected]> V2: [Emil Velikov] - Use local define. Signed-off-by: Emil Velikov <[email protected]>
* loader: cleanup copyright sectionEmil Velikov2016-10-181-40/+2
| | | | | | | | | | | With previous patches nearly all the original code (as seen in the various loaders) is gone. Update the copyright/license section to reflect that. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Axel Davy <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* loader: remove loader_get_driver_for_fd() driver_typeEmil Velikov2016-10-181-7/+1
| | | | | | | | | | | | | | Reminiscent from the pre-loader days, were we had multiple instances of the loader logic in separate places and one could build a "GALLIUM_ONLY" version. Since that is no longer the case and the loaders (glx/egl/gbm) do not (and should not) require to know any classic/gallium specific we can drop the argument and the related code. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Axel Davy <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* loader: remove final sysfs codepath in loader_get_device_name_for_fd()Emil Velikov2016-10-181-46/+1
| | | | | | | | | | | | | | Effectively everyone with actual hardware and/or requesting the "device_name" requires a working libdrm. Thus they could/should already be using the (now only) codepath. Apart from the code simplification, we can slim down our configure.ac even further. But that will be done in separate patch(es). Cc: Gary Wong <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Axel Davy <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* loader: remove libudev_get_device_name_for_fd and related codeEmil Velikov2016-10-181-126/+0
| | | | | | | | With this all the libudev related code is now gone. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Axel Davy <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* loader: reimplement loader_get_user_preferred_fd via libdrmEmil Velikov2016-10-181-141/+106
| | | | | | | | | | | | | | | | Currently not everyone has libudev and with follow-up patches we'll completely remove the divergent codepaths. Use the libdrm drm device API to construct the required ID_PATH_TAG-like string, to preserve the current functionality for libudev users and allow others to benefit from it as well. v2: Drop ranty comments, pick the correct device v3: \n -> \0 in PCI_ID_PATH_TAG_LENGTH comment (Axel). v4: Use snprintf (Nicolai) Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Axel Davy <[email protected]>
* loader: annotate __driConfigOptionsLoader as staticEmil Velikov2016-10-181-1/+1
| | | | | | Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Axel Davy <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* loader: separate USE_DRICONF code into separate functionEmil Velikov2016-10-181-12/+18
| | | | | | | | Improves readability and allows us to do further cleanups a lot easier. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Axel Davy <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* loader: slim down loader_get_pci_id_for_fd implementation(s)Emil Velikov2016-10-181-156/+16
| | | | | | | | | | | | | | | | Currently mesa has three code paths in the loader - libudev, manual sysfs and drm ioctl one. Considering the issues we had with libudev - strip those down in favour of the libdrm drm device API. The latter can be implemented in any way depending on the platform and can be reused by others. v2: Use correct message on drmGetDevice failure. (Nicolai) Cc: Jonathan Gray <[email protected]> Cc: Jean-Sébastien Pédron <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Axel Davy <[email protected]>
* loader: fix sysfs uevent file parsingFrank Binns2016-09-011-2/+4
| | | | | | | | | | When trying to get a device name for an fd using sysfs, it would always fail as it was expecting key/value pairs to be delimited by '\0', which is not the case. Signed-off-by: Frank Binns <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* mesa: Use AC_HEADER_MAJOR to include correct header for major().Matt Turner2016-07-261-2/+5
| | | | | | Gentoo has been smoke testing an upcoming change to glibc. Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=580392
* loader: add a libdrm case for loader_get_device_name_for_fdJonathan Gray2016-04-211-1/+25
| | | | | | | | | Use dev_node_from_fd() with HAVE_LIBDRM to provide an implmentation of loader_get_device_name_for_fd() for non-linux systems that use libdrm but don't have udev or sysfs. Signed-off-by: Jonathan Gray <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* loader: use HAVE_LIBDRM instead of ! __NOT_HAVE_DRM_HEmil Velikov2015-07-221-4/+4
| | | | | | | | Double negatives in English language are normally avoided, plus the former seems cleaner and more consistent. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* loader: don't leak udev_enumerateGuillaume Desmottes2015-07-111-0/+4
| | | | | | Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90073 Signed-off-by: Guillaume Desmottes <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* loader: Look for any version of currently linked libudev.soChris Wilson2015-07-081-18/+28
| | | | | | | | | | | | | | | | | | | | | | Since there was an ABI break and linking twice against libudev.so.0 and libudev.so.1 causes the application to quickly crash, we first check if the application is currently linked against libudev before dlopening a local handle. However for backwards/forwards compatability, we need to inspect the application for current linkage against all known versions first. Not doing so causes a crash when both libraries are present and so mesa chooses libudev.so.1 but the application was linked against libudev.so.0. Signed-off-by: Chris Wilson <[email protected]> Emil Velikov: I'm ever so slightly conserned that RTLD_NOLOAD is not part of the POSIX standard, thus it's missing on some platforms (*BSD seems ok, while Solaris, MacOS are not). Reviewed-by: Emil Velikov <[email protected]> Cc: [email protected]
* loader: move loader_open_device out of HAVE_LIBUDEV blockJulien Isorce2015-06-241-18/+18
| | | | | | | | | | | | | | | | | | Fixes the following build issue, when building without libudev. CCLD libGL.la ./.libs/libglx.a(dri2_glx.o): In function `dri2CreateScreen': src/glx/dri2_glx.c:1186: undefined reference to `loader_open_device' collect2: ld returned 1 exit status CCLD libEGL.la Undefined symbols for architecture x86_64: "_loader_open_device", referenced from: _dri2_initialize_x11_dri2 in libegl_dri2.a(platform_x11.o) Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91077 Signed-off-by: Julien Isorce <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* loader: Rename drm_open_device() to loader_open_device() and share itDerek Foreman2015-06-231-3/+3
| | | | | | | | | This is already our common idiom for opening files with CLOEXEC and it's a little ugly, so let's share this one implementation. Signed-off-by: Derek Foreman <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* loader: include <sys/stat.h> for non-sysfs buildsEmil Velikov2015-03-161-1/+1
| | | | | | | | | | | Required by fstat(), otherwise we'll error out due to implicit function declaration. Cc: "10.4 10.5" <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89530 Signed-off-by: Emil Velikov <[email protected]> Reported-by: Vadim Rutkovsky <[email protected]> Tested-by: Vadim Rutkovsky <[email protected]>