Commit Graph

257 Commits

Author SHA1 Message Date
Rob Herring 112e988329 Android: move libdrm settings to top-level Android.common.mk
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-06-13 15:31:29 +01:00
Jonathan Gray 28e3ae344b loader: add a libdrm case for loader_get_device_name_for_fd
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-04-21 14:41:41 +01:00
Axel Davy d943ac432d dri: add backbuffer use flag
This will be used by the next commit.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2016-03-09 15:02:25 +01:00
Rob Herring 657dc4f533 virtio_gpu: Add PCI ID to driver map
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>
2016-01-23 12:35:24 +10:00
Emil Velikov b9b0a1f58e loader: unconditionally add AM_CPPFLAGS to libloader_la_CPPFLAGS
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: 5a79e0a8e3 "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-23 12:07:50 +00:00
Emil Velikov 7157085140 automake: loader: don't create an empty dri3 helper
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-20 10:40:35 +00:00
Emil Velikov 115f179852 automake: loader: honour the XCB_DRI3 cflags
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-20 10:40:29 +00:00
Emil Velikov 5a79e0a8e3 automake: loader: rework the CPPFLAGS
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-20 10:40:11 +00:00
Boyan Ding bd6131a8d1 loader/dri3: Expose function to create __DRIimage from pixmap
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-17 17:26:20 +02:00
Boyan Ding 6bd9ba7d07 loader: Add dri3 helper
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-11-17 17:26:20 +02:00
Emil Velikov 1c328b8aa7 loader: use HAVE_LIBDRM instead of ! __NOT_HAVE_DRM_H
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-22 16:35:25 +01:00
Guillaume Desmottes 8108de4774 loader: don't leak udev_enumerate
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-11 20:49:25 +01:00
Chris Wilson f241345793 loader: Look for any version of currently linked libudev.so
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-07-08 11:04:02 +01:00
Julien Isorce 30d67d3824 loader: move loader_open_device out of HAVE_LIBUDEV block
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-24 13:43:44 +01:00
Derek Foreman 9c92746349 loader: Rename drm_open_device() to loader_open_device() and share it
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-23 16:54:51 +01:00
Erik Faye-Lund 634f200256 mesa: build xmlconfig to a separate static library
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-12 15:32:18 +01:00
Chih-Wei Huang b8213bbe4c android: loader: export the path to be included
Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-06-09 11:38:44 -07:00
Alexander von Gluck IV 8362068c1b egl: Add needed extern "C" for C++ access
* Haiku's egl driver is C++ due to the interface natively being C++

Reviewed-⁠by: Brian Paul <brianp@vmware.com>
2015-05-14 14:08:37 -04:00
Zoë Blade 05e7f7f438 Fix a few typos
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
2015-04-27 17:28:29 +03:00
Emil Velikov 86919352e3 android: use LOCAL_SHARED_LIBRARIES over TARGET_OUT_HEADERS
... to manage the LIBDRM*_CFLAGS. The former is the recommended approach
by the Android build system developers while the latter has been
depreciated for quite some time.

Cc: "10.4 10.5" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-04-22 14:23:28 +01:00
Jose Fonseca 47870d658b scons: Don't build loader on Windows.
EGL was the last user.

Reviewed-by: Brian Paul <brianp@vmware.com>
2015-03-25 10:42:35 +00:00
Emil Velikov 771cd266b9 loader: include <sys/stat.h> for non-sysfs builds
Required by fstat(), otherwise we'll error out due to implicit function
declaration.

Cc: "10.4 10.5" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89530
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reported-by: Vadim Rutkovsky <vrutkovs@redhat.com>
Tested-by: Vadim Rutkovsky <vrutkovs@redhat.com>
2015-03-16 20:48:07 +00:00
Jose Fonseca 00faf9f000 scons: Use -Werror MSVC compatibility flags per-directory.
Matching what we already do with autotools builds.

Reviewed-by: Brian Paul <brianp@vmware.com>
2015-03-04 15:12:06 +00:00
Jose Fonseca 80c5bd7ef0 configure: Leverage gcc warn options to enable safe use of C99 features where possible.
The main objective of this change is to enable Linux developers to use
more of C99 throughout Mesa, with confidence that the portions that need
to be built with MSVC -- and only those portions --, stay portable.

This is achieved by using the appropriate -Werror= options only on the
places they need to be used.

Unfortunately we still need MSVC 2008 on a few portions of the code
(namely llvmpipe and its dependencies).  I hope to eventually eliminate
this so that we can use C99 everywhere, but there are technical/logistic
challenges (specifically, newer Windows SDKs no longer bundle MSVC,
instead require a full installation of Visual Studio, and that has
hindered adoption of newer MSVC versions on our build processes.)
Thankfully we have more directy control over our OpenGL driver, which is
why we're now able to migrate to MSVC 2013 for most of the tree.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2015-03-03 09:25:11 +00:00
Kenneth Graunke 982723dfa2 Revert "configure: Leverage gcc warn options to enable safe use of C99 features where possible."
This reverts commit 79daa510c7.

I apparently hadn't done a clean build when testing this; it broke the
build for Tom, Ben, and myself.  We like the idea; let's try a v2.
2015-02-27 16:13:10 -08:00
Jose Fonseca 79daa510c7 configure: Leverage gcc warn options to enable safe use of C99 features where possible.
The main objective of this change is to enable Linux developers to use
more of C99 throughout Mesa, with confidence that the portions that need
to be built with MSVC -- and only those portions --, stay portable.

This is achieved by using the appropriate -Werror= options only on the
places they need to be used.

Unfortunately we still need MSVC 2008 on a few portions of the code
(namely llvmpipe and its dependencies).  I hope to eventually eliminate
this so that we can use C99 everywhere, but there are technical/logistic
challenges (specifically, newer Windows SDKs no longer bundle MSVC,
instead require a full installation of Visual Studio, and that has
hindered adoption of newer MSVC versions on our build processes.)
Thankfully we have more directy control over our OpenGL driver, which is
why we're now able to migrate to MSVC 2013 for most of the tree.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2015-02-27 14:30:36 +00:00
Rob Clark 9153dd4b7e loader: not having a pci-id should not be a warn
If there is no pci-id, which is valid for vc4 and freedreno, just emit
an info msg.  Keep malformed but existing pci-id's as a warning.

Mostly just to clean up a warning that confuses users for the non-pci
devices.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-02-21 17:11:02 -05:00
Matt Turner 9b5efac461 loader: Remove NEED_OPENGL_COMMON check.
HAVE_DRICOMMON is sufficient since OpenGL must be enabled for DRI.
2015-01-23 14:28:44 -08:00
Matt Turner 952b324b23 mesa: Add scons files to distribution. 2014-12-12 12:11:50 -08:00
Matt Turner 9f565f5f8a loader: Add headers to distribution. 2014-12-12 12:11:47 -08:00
Michael Forney 5d64da401c loader: Add missing EXPAT_CFLAGS to libloader.la CPPFLAGS
Reviewed-by: Matt Turner <mattst88@gmail.com>
2014-12-08 08:50:27 -08:00
Juha-Pekka Heikkila 261120daef loader: Check dlsym() did not fail in libudev_get_device_name_for_fd()
Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
2014-09-23 10:25:02 +03:00
Dave Airlie 291ae622fd loader: fds can be 0
Possible resource leak reported by coverity.

Reported-by: Coverity scanner.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-09-06 10:24:25 +10:00
Emil Velikov 73121a34d4 android: loader: prefix static libraries with libmesa_*
Will make it easier on us as CleanSpec.mk comes along and improves
consistency across the Android build.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-08-13 00:46:57 +01:00
Emil Velikov 5f3022e97f android: loader: use the installed libdrm headers
One step closer to the way we handle automake builds.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-08-13 00:46:56 +01:00
Jason Ekstrand efa0aa8ffc util: Gather some common macros
This gathers macros that have been included across components into util so
that the include chain can be more vertical.  In particular, this makes
util stand on its own without any dependence whatsoever on the rest of
mesa.

Signed-off-by: "Jason Ekstrand" <jason.ekstrand@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2014-08-04 11:07:10 -07:00
Axel Davy 4d6c9352f3 mesa: fix the condition in src/loader/Makefile.am
We want to have the dri common files compiled to define USE_DRICONF.
We need to check both NEED_OPENGL_COMMON and HAVE_DRICOMMON

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Tested-by: Brian Paul <brianp@vmware.com>
2014-07-01 09:42:44 -06:00
Axel Davy 3ecd9e1a93 loader: Use drirc device_id parameter in complement to DRI_PRIME
DRI_PRIME is not very handy, because you have to launch the executable
with it set, which is not always easy to do.
By using drirc, the user specifies the target executable
and the device to use. After that the program will be launched everytime
on the target device.

For example if .drirc contains:

<driconf>
    <device driver="loader">
        <application name="Glmark2" executable="glmark2">
            <option name="device_id" value="pci-0000_01_00_0" />
        </application>
    </device>
</driconf>

Then glmark2 will use if possible the render-node of
ID_PATH_TAG pci-0000_01_00_0.

v2: Fix compilation issue
v3: Add "-lm" and rebase.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-07-01 13:07:40 +10:00
Axel Davy 7ab925a6aa loader: add gpu selection code via DRI_PRIME.
v2: Fix the leak of device_name
v3: Rebased

It enables to use the DRI_PRIME env var to specify
which gpu to use.
Two syntax are supported:
If DRI_PRIME is 1 it means: take any other gpu than the default one.
If DRI_PRIME is the ID_PATH_TAG of a device: choose this device if
possible.

The ID_PATH_TAG is a tag filled by udev.
You can check it with 'udevadm info' on the device node.
For example it can be "pci-0000_01_00_0".

Render-nodes need to be enabled to choose another gpu,
and they need to have the ID_PATH_TAG advertised.
It is possible for not very recent udev that the tag
is not advertised for render-nodes, then
ones need to add a file containing:

SUBSYSTEM=="drm", IMPORT{builtin}="path_id"

in /etc/udev/rules.d/

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-07-01 13:07:30 +10:00
Gary Wong 85b6f36ca5 loader: add optional /sys filesystem method for PCI identification.
Introduce a simple PCI identification method of looking up the answer
the /sys filesystem (available on Linux).  Attempted after libudev, but
before DRM.

Disabled by default (available only when the --enable-sysfs configure
option is specified).

Signed-off-by: Gary Wong <gtw@gnu.org>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-05-29 20:25:37 -06:00
Gary Wong 090c772b8a loader: allow attempting more than one method of PCI identification.
loader_get_pci_id_for_fd() and loader_get_device_name_for_fd() now attempt
all available strategies to identify the hardware, instead of conditionally
compiling in a single test.  The existing libudev and DRM approaches have
been retained, attempting first libudev (if available) and then DRM (if
necessary).

Signed-off-by: Gary Wong <gtw@gnu.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-05-29 20:25:37 -06:00
Jonathan Gray 380f05ccc3 loader: don't limit the non-udev path to only android
Platforms that lack libudev (OpenBSD and possibly others) need
this change in order to load the correct dri driver.
Under linux we unconditionally require libudev, thus this code
will never get build.

v2: Add commit message (Emil Velikov)

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-04-05 12:17:28 +01:00
Jonathan Gray 727f54a76e loader: use 0 instead of FALSE which isn't defined
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-04-05 12:16:45 +01:00
Ilia Mirkin 51989817e6 loader: add special logic to distinguish nouveau from nouveau_vieux
There are a lot of different pci ids supported by nouveau, and more are
added all the time. The relevant distinguisher between drivers is the
chipset id.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: "10.1" <mesa-stable@lists.freedesktop.org>
2014-03-19 18:17:40 -04:00
Eric Anholt c849ecc19a dri: Add a useful error message if someone's packages missed libudev deps.
Reviewed-by: Matt Turner <mattst88@gmail.com>
2014-02-01 10:09:11 -08:00
Eric Anholt 63546b8e3d dri: Also support the loader with libudev.so.0.
As far as I know, this should be safe.  If not, we have to decide whether
to have variable lookup of the functions, or just drop support for .so.0
(which is a year and a half old it looks like)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74127
Reviewed-by: Matt Turner <mattst88@gmail.com>
2014-02-01 10:08:36 -08:00
Emil Velikov 7965908976 loader: do not print the pci id during normal operation
Spamming the pci id is not beneficial. Make sure it's printed
only when needed.

v2: Change severity to _LOADER_DEBUG, rather than removing
the message.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-29 19:55:02 +00:00
Emil Velikov 780dfc1fec loader: print WARNING and FATAL messages using the default logger
Lower values are used for more severe cases.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-29 19:53:53 +00:00
Emil Velikov 61c825e862 loader: include dlfcn.h when building with HAVE_LIBUDEV
The code depending on the definitions is already wrapped
in the same conditional so go ahead and wrap the include.

Otherwise we'll brake compilation on platforms that are
missing the header. Add assert.h in there as well, as it
is introduced and used in the same fashon.

Cc: Eric Anholt <eric@anholt.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74122
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-01-28 14:32:03 +00:00
Emil Velikov a6031a82f9 loader: Add missing \n on message printing
Cover both loader and glx/dri_glx
Drop \n from the default loader logger

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-01-27 09:37:29 -08:00
Eric Anholt 4556c73470 loader: Use dlsym to get our udev symbols instead of explicit linking.
Steam links against libudev.so.0, while we're linking against
libudev.so.1.  The result is that the symbol names (which are the same in
the two libraries) end up conflicting, and some of the usage of .so.1
calls the .so.0 bits, which have different internal structures, and
segfaults happen.

By using a dlopen() with RTLD_LOCAL, we can explicitly look for the
symbols we want, while they get the symbols they want.

Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Tested-by: Alexandre Demers <alexandre.f.demers@gmail.com>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
2014-01-27 09:36:24 -08:00
José Fonseca f0c2662b12 logger: Remove unused variable.
Silences gcc "unused variable ‘buf’" warning.

Trivial.
2014-01-20 13:58:11 +00:00
José Fonseca d43260b59e logger: s/\<log\>/log_/
Currently the MSVC build is broken because of conflicting definitions of
'log' function.  I didn't investigate thoroughly, but I suspect the
it is conflicting standard math.h's log.

log_ is admittedly not a great name, but it is better than a broken build.
A better one can be used in a follow-on build.
2014-01-20 13:57:12 +00:00
Emil Velikov 26d380da69 loader: ifdef libdrm specific code and include
Mesa provides the flexibility of building without the
need to have libdrm present on the system. The situation
has regressed with the recent commit

commit 8c2e7fd846
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date:   Fri Jan 10 23:36:16 2014 +0000

    loader: introduce the loader util lib

By isolating libdrm code by #ifndef __NOT_HAVE_DRM_H we
can have libdrm-less builds on across all build systems.

This patch converts Android's _EGL_NO_DRM to __NOT_HAVE_DRM_H
to provide consistency with the other cases within mesa, allows
compilation of libloader on libdrm-less scons and conditionally
links against libdrm if present under automake.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73776
BUgzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73777
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-01-19 15:17:00 +00:00
Rob Clark bf70c238a7 loader: fallback to drmGetVersion() for non-pci devices
Use the kernel driver name are returned by drmGetVersion() for
non-pci(platform) devices.

Signed-off-by: Rob Clark <robclark@freedesktop.org>

v2 (Emil): Rebased and weaked commit message.
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-01-18 18:52:07 +00:00
Emil Velikov 3d3ae75c86 pci_ids: no not include loader.h
As per original approach by Rob, each user of the loader lib should include
loader.h and the pci_id_driver_map.h header will be used exclusively by the
loader.

Add back the include guard __IS_LOADER and remove no longer needed include
folder in the scons build.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-01-18 18:51:54 +00:00
Emil Velikov 8c2e7fd846 loader: introduce the loader util lib
All the various window system integration layers duplicate roughly the
same code for figuring out device and driver name, pci-id's, etc.  Which
is sad.  So extract it out into a loader util lib.

v2 (Emil)
* Separate the introduction of libloader from the code de-duplication.
* Strip out non-pci devices support.
* Add scons + Android build system support.
* Add VISIBILITY_CFLAGS to avoid exporting the loader funcs.

v3 (Emil)
* PIPE_OS_ANDROID is undefined at this scope, use ANDROID
* Make sure we define _EGL_NO_DRM when building only swrast

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-01-18 18:47:27 +00:00