summaryrefslogtreecommitdiff
path: root/src/loader
AgeCommit message (Collapse)AuthorFilesLines
2017-03-15loader: use drmGetDevice[s]2 APIEmil Velikov1-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 <emil.velikov@collabora.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> Tested-by: Mike Lothian <mike@fireburn.co.uk>
2017-03-08loader: Move non-error message to debug levelFabio Estevam1-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 <festevam@gmail.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2017-02-28egl/dri3: implement query surface hookBrendan King2-0/+25
This is a DRI3 version of a change made for DRI2 (4d6d4f939e0af4252e0b, "egl/dri2: implement query surface hook"), that fixed failures in dEQP-EGL.functional.resize.surface_size.grow and dEQP-EGL.functional.resize.surface_size.shrink. Cc: Tapani Pälli <tapani.palli@intel.com> Cc: Mark Janes <mark.a.janes@intel.com> Cc: Chad Versace <chadversary@chromium.org> Signed-off-by: Brendan King <Brendan.King@imgtec.com> Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Cc: "17.0" <mesa-stable@lists.freedesktop.org>
2017-02-10loader: unconditionally include unistd.h and stdlib.hNicolai Hähnle1-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 <vlee@freedesktop.org> 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 <emil.velikov@collabora.com>
2017-02-06loader: Add an environment variable to override driver name choice.Eric Anholt1-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 <emil.velikov@collabora.com> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-01-27loader: automake: include builddir prior to srcdirEmil Velikov1-1/+1
Analogous to previous commit. Cc: "12.0 13.0" <mesa-dev@lists.freedesktop.org> Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2017-01-13loader/dri3: Unify the style of function pointer calls in structsBoyan Ding1-39/+39
Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>
2016-11-21loader: automake: whitespace cleanupEmil Velikov1-1/+1
Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
2016-11-15loader: fixup driver names if neededChristian Gmeiner1-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 <christian.gmeiner@gmail.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> (v1) Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2016-11-15loader: add loader_get_extensions_name(..) helperChristian Gmeiner2-0/+21
Changes since v1: - renamed function to loader_get_extensions_name - moved function into loader Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com> V2: [Emil Velikov] - Use local define. Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2016-10-18loader: cleanup copyright sectionEmil Velikov1-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 <emil.velikov@collabora.com> Reviewed-by: Axel Davy <axel.davy@ens.fr> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-10-18loader: remove loader_get_driver_for_fd() driver_typeEmil Velikov3-23/+13
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 <emil.velikov@collabora.com> Reviewed-by: Axel Davy <axel.davy@ens.fr> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-10-18loader: remove final sysfs codepath in loader_get_device_name_for_fd()Emil Velikov1-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 <gtw@gnu.org> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Axel Davy <axel.davy@ens.fr> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-10-18scons: remove all libudev referencesEmil Velikov1-4/+0
Analogous to previous automake/autoconf commit. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Axel Davy <axel.davy@ens.fr> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-10-18scons: loader: use libdrm when availableEmil Velikov1-0/+4
Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Axel Davy <axel.davy@ens.fr> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-10-18automake: remove all the libudev referencesEmil Velikov1-2/+1
As of last commit nothing in mesa depends on libudev. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Axel Davy <axel.davy@ens.fr> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-10-18loader: remove libudev_get_device_name_for_fd and related codeEmil Velikov1-126/+0
With this all the libudev related code is now gone. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Axel Davy <axel.davy@ens.fr> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-10-18loader: reimplement loader_get_user_preferred_fd via libdrmEmil Velikov1-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 <emil.velikov@collabora.com> Reviewed-by: Axel Davy <axel.davy@ens.fr>
2016-10-18loader: annotate __driConfigOptionsLoader as staticEmil Velikov1-1/+1
Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Axel Davy <axel.davy@ens.fr> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-10-18loader: separate USE_DRICONF code into separate functionEmil Velikov1-12/+18
Improves readability and allows us to do further cleanups a lot easier. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Axel Davy <axel.davy@ens.fr> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-10-18loader: slim down loader_get_pci_id_for_fd implementation(s)Emil Velikov1-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 <jsg@jsg.id.au> Cc: Jean-Sébastien Pédron <dumbbell@FreeBSD.org> Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Axel Davy <axel.davy@ens.fr>
2016-10-14loader/dri3: constify the loader_dri3_vtableEmil Velikov2-3/+3
Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eric Engestrom <eric@engestrom.ch>
2016-10-07loader/dri3: import prime buffers in the currently-bound screenMartin Peres1-1/+11
This tries to mirrors the codepath taken by DRI2 in IntelSetTexBuffer2() and fixes many applications when using DRI3: - Totem with libva on hw-accelerated decoding - obs-studio, using Window Capture (Xcomposite) as a Source - gstreamer with VAAPI v2: - introduce get_dri_screen() in the dri3 loader's vtable (krh) Tested-by: Timo Aaltonen <tjaalton@ubuntu.com> Tested-by: Ionut Biru <biru.ionut@gmail.com> Cc: mesa-stable@lists.freedesktop.org Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71759 Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
2016-10-07loader/dri3: add get_dri_screen() to the vtableMartin Peres1-0/+1
This allows querying the current active screen from the loader's common code. Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
2016-09-06loader/dri3: Always use at least two back buffersMichel Dänzer1-3/+1
This can make a significant difference for performance with some extreme test cases such as vblank_mode=0 glxgears. Fixes: 1e3218bc5ba2 ("loader/dri3: Overhaul dri3_update_num_back") Cc: "12.0 11.2" <mesa-stable@lists.freedesktop.org> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97549 Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
2016-09-01loader: fix sysfs uevent file parsingFrank Binns1-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 <frank.binns@imgtec.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2016-08-30nouveau: allow NV3x's to be used with nouveau_vieuxIlia Mirkin1-1/+3
NV34 and possibly other NV3x hardware has the capability of exposing the NV25 graph class. This allows forcing nouveau_vieux to be used instead of the gallium driver, primarily for testing purposes. (Among other things, NV2x only ever came as AGP or inside an Xbox, never PCI/PCIe). Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
2016-08-25loader/dri3: Overhaul dri3_update_num_backMichel Dänzer1-9/+6
Always use 3 buffers when flipping. With only 2 buffers, we have to wait for a flip to complete (which takes non-0 time even with asynchronous flips) before we can start working on the next frame. We were previously only using 2 buffers for flipping if the X server supports asynchronous flips, even when we're not using asynchronous flips. This could result in bad performance (the referenced bug report is an extreme case, where the inter-frame stalls were preventing the GPU from reaching its maximum clocks). I couldn't measure any performance boost using 4 buffers with flipping. Performance actually seemed to go down slightly, but that might have been just noise. Without flipping, a single back buffer is enough for swap interval 0, but we need to use 2 back buffers when the swap interval is non-0, otherwise we have to wait for the swap interval to pass before we can start working on the next frame. This condition was previously reversed. Cc: "12.0 11.2" <mesa-stable@lists.freedesktop.org> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97260 Reviewed-by: Frank Binns <frank.binns@imgtec.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2016-08-04loader/dri3: Destroy Present event context when destroying drawable v2Michel Dänzer1-1/+7
Without this, the X server may accumulate stale Present event contexts if a client ends up creating and destroying DRI drawables for the same window. v2: Based on Chris Wilson's review: * Use xcb_present_select_input_checked so that protocol errors generated by old X servers can be handled gracefully * Use xcb_discard_reply() instead of free(xcb_request_check())
2016-08-03loader: fix memory leak in loader_dri3_openJan Ziak1-0/+1
Found via "valgrind --leak-check=full glxgears". Signed-off-by: Jan Ziak (http://atom-symbol.net) <0xe2.0x9a.0x9b@gmail.com> Acked-by: Boyan Ding <boyan.j.ding@gmail.com> Cc: "12.0 11.2" <mesa-stable@lists.freedesktop.org> Reviewed-by: Eric Anholt <eric@anholt.net>
2016-07-26mesa: Use AC_HEADER_MAJOR to include correct header for major().Matt Turner1-2/+5
Gentoo has been smoke testing an upcoming change to glibc. Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=580392
2016-06-13Android: move libdrm settings to top-level Android.common.mkRob Herring1-5/+0
Fix warnings like these due to HAVE_LIBDRM being inconsistently defined: external/libdrm/include/drm/drm.h:839:30: warning: redefinition of typedef 'drm_clip_rect_t' is a C11 feature [-Wtypedef-redefinition] typedef struct drm_clip_rect drm_clip_rect_t; HAVE_LIBDRM needs to be set project wide to fix this. This change also harmlessly links libdrm with everything, but simplifies the makefiles a bit. Signed-off-by: Rob Herring <robh@kernel.org> Acked-by: Emil Velikov <emil.velikov@collabora.com>
2016-04-21loader: add a libdrm case for loader_get_device_name_for_fdJonathan Gray1-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 <jsg@jsg.id.au> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2016-03-09dri: add backbuffer use flagAxel Davy1-2/+4
This will be used by the next commit. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2016-01-23virtio_gpu: Add PCI ID to driver mapRob Herring1-0/+7
Add the virtio-gpu PCI ID so the driver probing works. Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-11-23loader: unconditionally add AM_CPPFLAGS to libloader_la_CPPFLAGSEmil Velikov1-2/+2
It seems that due to the conditional autotools is getting confused and forgetting to add AM_CPPFLAGS when building libloader (when HAVE_DRICOMMON is not set). Cc: mesa-stable@lists.freedesktop.org Fixes: 5a79e0a8e37 "automake: loader: rework the CPPFLAGS" Reported-by: Pali Rohár <pali.rohar@gmail.com> Tested-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-11-20automake: loader: don't create an empty dri3 helperEmil Velikov1-1/+3
Seems that creating an empty one does not fair too well with MacOSX's ar. Considering that all the users of the helper include it only when needed, let's reshuffle the makefile. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92985 Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Tested-by: Vinson Lee <vlee@freedesktop.org> Tested-by: Kai Wasserbäch <kai@dev.carbon-project.org> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-11-20automake: loader: honour the XCB_DRI3 cflagsEmil Velikov1-0/+1
Without this the compilation will fail, as the headers are installed in a non-default location. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Tested-by: Kai Wasserbäch <kai@dev.carbon-project.org> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-11-20automake: loader: rework the CPPFLAGSEmil Velikov1-11/+4
Rather than duplicating things, just use the generic AM_CPPFLAGS. This has the fortunate side-effect of adding VISIBILITY_CFLAGS for the dri3 helper. The latter of which was erroneously exposing some internal symbols. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reported-by: Kai Wasserbäch <kai@dev.carbon-project.org> Tested-by: Kai Wasserbäch <kai@dev.carbon-project.org> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-11-17loader/dri3: Expose function to create __DRIimage from pixmapBoyan Ding2-29/+58
Used to support EGL_KHR_image_pixmap. Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com> Reviewed-by: Martin Peres <martin.peres@linux.intel.com> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Emil Velikov <emil.velikov@collabora.co.uk>
2015-11-17loader: Add dri3 helperBoyan Ding3-1/+1622
v2: From Martin Peres - Try to fit in the 80-col limit as much as possible v3: From Martin Peres - introduce loader_dri3_helper.la to avoid dragging the xcb dep everywhere (Kristian & Emil) - get rid of the width, height, dri_screen and is_different_gpu vfuncs (Kristian) - replace the create/destroy functions with init/fini for dri3 drawables - prefix static functions with dri3_ and exported ones with loader_dri3 (Emil) - keep the function definition consistent (Emil) Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com> Signed-off-by: Martin Peres <martin.peres@linux.intel.com> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Emil Velikov <emil.velikov@collabora.co.uk>
2015-07-22loader: use HAVE_LIBDRM instead of ! __NOT_HAVE_DRM_HEmil Velikov5-15/+8
Double negatives in English language are normally avoided, plus the former seems cleaner and more consistent. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2015-07-11loader: don't leak udev_enumerateGuillaume Desmottes1-0/+4
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90073 Signed-off-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-07-08loader: Look for any version of currently linked libudev.soChris Wilson1-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 <chris@chris-wilson.co.uk> 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 <emil.l.velikov@gmail.com> Cc: mesa-stable@lists.freedesktop.org
2015-06-24loader: move loader_open_device out of HAVE_LIBUDEV blockJulien Isorce1-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 <j.isorce@samsung.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-06-23loader: Rename drm_open_device() to loader_open_device() and share itDerek Foreman2-3/+6
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 <derekf@osg.samsung.com> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-06-12mesa: build xmlconfig to a separate static libraryErik Faye-Lund1-7/+3
As we use the file from both the dri modules and loader, we end up with multiple definition of the symbols provided in our gallium dri modules. Additionally we compile the file twice. Resolve both issues, effectively enabling the build on toolchains which don't support -Wl,--allow-multiple-definition. v2: [Emil Velikov] - Fix the Scons/Android build. - Resolve libgbm build issues (bring back the missing -lm) Cc: Julien Isorce <j.isorce@samsung.com> Cc: "10.5 10.6" <mesa-stable@lists.freedesktop.org> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90310 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90905 Acked-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-06-09android: loader: export the path to be includedChih-Wei Huang1-0/+2
Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw> Reviewed-by: Eric Anholt <eric@anholt.net>
2015-05-14egl: Add needed extern "C" for C++ accessAlexander von Gluck IV1-0/+9
* Haiku's egl driver is C++ due to the interface natively being C++ Reviewed-⁠by: Brian Paul <brianp@vmware.com>
2015-04-27Fix a few typosZoë Blade1-1/+1
Reviewed-by: Francisco Jerez <currojerez@riseup.net>