Commit Graph

51 Commits

Author SHA1 Message Date
Alan Coopersmith 23e83724df Fix spelling/wording issues
Most (but not all) of these were found by using
  codespell --builtin clear,rare,usage,informal,code,names
but not everything reported by that was fixed.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-07-05 13:07:33 -07:00
Zoltán Böszörményi 42aaf37241 Fix modesetting device matching through kmsdev device path
xf86platformProbeDev didn't check the device path, fix it.

This is a problem when trying to set up a non-PCI device via
explicit xorg.conf.d configuration.

An USB DisplayLink device, being non-PCI was always set up
as a GPU device assigned to screen 0 instead of a regular
framebuffer, potentially having its own dedicated screen,
despite such configuration as below. Only the relevant parts
of the configuration are quoted, it's part of a larger context
with an Intel chip that has 3 outputs:
* DP1 connected to an LCD panel,
* VGA1 connected to an external monitor,
* HDMI1 unconnected and having no user visible connector

Section "ServerFlags"
        Option          "AutoBindGPU" "false"
EndSection

...

Section "Device"
        Identifier      "Intel2"
        Driver          "intel"
        BusID           "PCI:0:2:0"
        Screen          2
        Option          "Monitor-HDMI1" "HDMI1"
        Option          "ZaphodHeads" "HDMI1"
EndSection

Section "Device"
        Identifier      "UDL"
        Driver          "modesetting"
        Option          "kmsdev" "/dev/dri/card0"
        #BusID          "usb:0:1.2:1.0"
        Option          "Monitor-DVI-I-1" "DVI-I-1"
        Option          "ShadowFB" "on"
        Option          "DoubleShadow" "on"
EndSection

...

Section "Screen"
        Identifier      "SCREEN2"
        Option          "AutoServerLayout" "on"
        Device          "UDL"
        GPUDevice       "Intel2"
        Monitor         "Monitor-DVI-I-1"
        SubSection      "Display"
                Modes   "1024x768"
                Depth   24
        EndSubSection
EndSection

Section "ServerLayout"
        Identifier      "LAYOUT"
        Option          "AutoServerLayout" "on"
        Screen          0 "SCREEN"
        Screen          1 "SCREEN1" RightOf "SCREEN"
        Screen          2 "SCREEN2" RightOf "SCREEN1"
EndSection

On the particular machine I was trying to set up an UDL device,
I found the following structure was being used to match
the device to a platform device while I was debugging the issue:

xf86_platform_devices[0] == Intel, /dev/dri/card1, primary platform device
xf86_platform_devices[1] == UDL, /dev/dri/card0

devList[0] == "Intel0", ZaphodHeads: DP1
devList[1] == "Intel1", ZaphodHeads: VGA1
devList[2] == "UDL"
devList[3] == "Intel2", ZaphodHeads: HDMI1 (intended GPU device to UDL)

When xf86platformProbeDev() matched the UDL device, the BusID
check failed in both cases of:
* BusID "usb:0:1.2:1.0" was specified
* Option "kmsdev" "/dev/dri/card0" was specified

As a result, xf86platformProbeDev() went on to call probeSingleDevice()
with xf86_platform_devices[0] and devList[2], resulting in the
UDL device being set up as a GPU device assigned to the first screen
instead of as a framebuffer on the third screen as the configuration
specified.

Checking Option "kmsdev" in code code may be a layering violation.
But the modesetting driver is actually part of the Xorg sources
instead of being an external driver, so he "kmsdev" path knowledge
may be used here.

Signed-off-by: Böszörményi Zoltán <zboszor@pr.hu>
2020-02-12 21:29:52 +00:00
Dave Airlie 078277e4d9 xf86: autobind GPUs to the screen
This is a modified version of a patch we've been carry-ing in Fedora and
RHEL for years now. This patch automatically adds secondary GPUs to the
master as output sink / offload source making e.g. the use of
slave-outputs just work, with requiring the user to manually run
"xrandr --setprovideroutputsource" before he can hookup an external
monitor to his hybrid graphics laptop.

There is one problem with this patch, which is why it was not upstreamed
before. What to do when a secondary GPU gets detected really is a policy
decission (e.g. one may want to autobind PCI GPUs but not USB ones) and
as such should be under control of the Desktop Environment.

Unconditionally adding autobinding support to the xserver will result
in races between the DE dealing with the hotplug of a secondary GPU
and the server itself dealing with it.

However we've waited for years for any Desktop Environments to actually
start doing some sort of autoconfiguration of secondary GPUs and there
is still not a single DE dealing with this, so I believe that it is
time to upstream this now.

To avoid potential future problems if any DEs get support for doing
secondary GPU configuration themselves, the new autobind functionality
is made optional. Since no DEs currently support doing this themselves it
is enabled by default. When DEs grow support for doing this themselves
they can disable the servers autobinding through the servers cmdline or a
xorg.conf snippet.

Signed-off-by: Dave Airlie <airlied@gmail.com>
[hdegoede@redhat.com: Make configurable, fix with nvidia, submit upstream]
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
---
Changes in v2:
-Make the default enabled instead of installing a xorg.conf
 snippet which enables it unconditionally

Changes in v3:
-Handle GPUScreen autoconfig in randr/rrprovider.c, looking at
 rrScrPriv->provider, rather then in hw/xfree86/modes/xf86Crtc.c
 looking at xf86CrtcConfig->provider. This fixes the autoconfig not
 working with the nvidia binary driver
2019-08-07 12:26:59 +02:00
Eric Anholt e50c85f4eb Fix segfault on probing a non-PCI platform device on a system with PCI.
Some Broadcom set-top-box boards have PCI busses, but the GPU is still
probed through DT.  We would dereference a null busid here in that
case.

Signed-off-by: Eric Anholt <eric@anholt.net>
2018-10-29 15:51:44 +00:00
Jeff Smith 1a24a0ae7b xfree86: Do not use uninitialized pointer during probe
Commits b5dffbb and d75ffcd introduce code in xf86platformProbe() that
references a member of xf86configptr.  However, when using the
"-configure" option, xf86configptr may not be initialized when
xf86platformProbe() is called.

Avoid referencing a member of xf86configptr if uninitialized.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100405
Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-02-05 15:40:13 -05:00
Karol Kosik 5d3b6cc221 xfree86: Improved autoconfig drivers matching
Implementation of new drivers matching algorithm. New approach
doesn't add duplicate drivers and ease drivers matching phase.

v2: Re-commit the patch reverted in
    2388f5e583, with Aaron Plattner's
    fix squashed in (by anholt).

Signed-off-by: Karol Kosik <kkosik@nvidia.com>
Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com> (v1)
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> (v1)
Tested-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Eric Anholt <eric@anholt.net>
2017-05-09 17:36:05 -07:00
Eric Anholt 2388f5e583 Revert "xfree86: Improved autoconfig drivers matching"
This reverts commit 112d0d7d01.

It broke Xorg for Adam, Peter, and myself, by failing hard when a
module load failed.

Signed-off-by: Eric Anholt <eric@anholt.net>
2017-05-09 15:02:30 -07:00
Karol Kosik 112d0d7d01 xfree86: Improved autoconfig drivers matching
Implementation of new drivers matching algorithm. New approach
doesn't add duplicate drivers and ease drivers matching phase.

Signed-off-by: Karol Kosik <kkosik@nvidia.com>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2017-04-27 15:10:56 -04:00
Hans De Goede b5dffbbac1 xfree86: Add ModulePath support for OutputClass config Sections
Allow OutputClass config snippets to modify the module-path.

Note that any specified ModulePaths will be pre-pended to the normal
ModulePath. The idea behind this is that any output hardware specific
modules should have preference over the normal modules.

One use-case for this is the nvidia binary driver, this allows a
config snippet like this:

Section "OutputClass"
    MatchDriver "nvidia"
    Modulepath "/usr/lib64/nvidia/modules"
EndSection

To get the nvidia glx specific glx module loaded, but only when the
nvidia kernel driver is loaded.

Together with the glvnd work done recently, this allows the nouveau
+ mesa and nvidia-binary userspace stacks to co-exist on the same
system without any ldconfig / xorg.conf tweaking and the xserver will
automatically do the right thing depending on which kernel driver
(nouveau or nvidia) is loaded.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-12-14 14:12:19 -05:00
Hans De Goede d75ffcdbf8 xfree86: Allow overriding primary GPU detection from an OutputClass section
Allow using:

Option "PrimaryGPU" "yes"

In an OutputClass section to override the default primary GPU device
selection which selects the GPU used as output by the firmware.

If multiple output devices match an OutputClass section with
the PrimaryGPU option set, the first one enumerated becomes the
primary GPU.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-12-14 14:12:12 -05:00
Hans De Goede ab1a65b775 xfree86: xf86platformProbe: split finding pci-info and setting primary GPU
This is a preparation patch for allowing an OutputClass section to
override the default primary GPU device selection.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-12-14 14:12:09 -05:00
Hans De Goede 9cd3cc7526 xfree86: Add options support for OutputClass Options
Add support for setting options in OutputClass Sections and having these
applied to any matching output devices.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-12-14 14:12:06 -05:00
Hans De Goede 08b84d7287 xfree86: Make OutputClassMatches take a xf86_platform_device
Make OutputClassMatches directly take a xf86_platform_device as argument,
rather then an index into xf86_platform_devices. This makes things
easier for callers which already have a xf86_platform_device pointer.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-12-14 14:12:04 -05:00
Hans De Goede c57c1e53ea xfree86: Free devlist returned by xf86MatchDevice
xf86MatchDevice returns a dynamically allocated list of GDevPtr-s,
free this when we're done with it.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-12-14 14:12:00 -05:00
Hans de Goede 75c4f6e412 xfree86: Try harder to find atleast 1 non GPU Screen
If we did not find any non GPU Screens, try again ignoring the notion
of any video devices being the primary device. This fixes Xorg exiting
with a "no screens found" error when using virtio-vga in a
virtual-machine and when using a device driven by simpledrm.

This is a somewhat ugly solution, but it is the best I can come up with
without major surgery to the bus and probe code.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-12-05 11:38:57 -05:00
Hans de Goede 7121b03d32 xfree86: Make adding unclaimed devices as GPU devices a separate step
This is primarily a preparation patch for fixing the xserver exiting with
a "no screens found" error even though there are supported video cards,
due to the server not recognizing any card as the primary card.

This also fixes the (mostly theoretical) case of a platformBus capable
driver adding a device as GPUscreen before a driver which only supports
the old PCI probe method gets a chance to claim it as a normal screen.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-12-05 11:38:54 -05:00
Qiang Yu ea91db4b83 config: fix GPUDevice fail when AutoAddGPU off + BusID
This fix is for the following xorg.conf can work:

Section "ServerFlags"
        Option  "AutoAddGPU" "off"
EndSection

Section "Device"
        Identifier "Amd"
        Driver "ati"
        BusID "PCI:1:0:0"
EndSection

Section "Device"
        Identifier "Intel"
        Driver "modesetting"
        BusID "pci:0:2:0"
EndSection

Section "Screen"
        Identifier "Screen0"
        Device "Intel"
        GPUDevice "Amd"
EndSection

Without AutoAddGPU off, modesetting DDX will also be loaded
for GPUDevice.

Signed-off-by: Qiang Yu <Qiang.Yu@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-09-28 14:53:39 -04:00
Laszlo Ersek ca8d88e503 xfree86: recognize primary BUS_PCI device in xf86IsPrimaryPlatform()
The new platform bus code and the old PCI bus code overlap. Platform bus
can handle any type of device, including PCI devices, whereas the PCI code
can only handle PCI devices. Some drivers only support the old style
PCI-probe methods, but the primary device detection code is server based,
not driver based; so we might end up with a primary device which only has
a PCI bus-capable driver, but was detected as primary by the platform
code, or the other way around.

(The above paragraph was shamelessly stolen from Hans de Goede, and
customized.)

The latter case applies to QEMU's virtio-gpu-pci device: it is detected as
a BUS_PCI primary device, but we actually probe it first (with the
modesetting driver) through xf86platformProbeDev(). The
xf86IsPrimaryPlatform() function doesn't recognize the device as primary
(it bails out as soon as it sees BUS_PCI); instead, we add the device as a
secondary graphics card under "autoAddGPU". In turn, the success of this
automatic probing-as-GPU prevents xf86CallDriverProbe() from proceeding to
the PCI probing.

The result is that the server exits with no primary devices detected.

Commit cf66471353 ("xfree86: use udev to provide device enumeration for
kms devices (v10)") added "cross-bus" matching to xf86IsPrimaryPci(). Port
that now to xf86IsPrimaryPlatform(), so that we can probe virtio-gpu-pci
as a primary card in platform bus code.

Cc: Adam Jackson <ajax@redhat.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Keith Packard <keithp@keithp.com>
Cc: Marcin Juszkiewicz <mjuszkiewicz@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Tested-By: Marcin Juszkiewicz <mjuszkiewicz@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-09-28 14:53:39 -04:00
Dave Airlie c99fb550e0 xf86: don't add gpus from udev if autoAddGPU is set
At startup the server wasn't adding devices, but nothing
was blocking hotplug devices by the look of it.

bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91388
Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-10-21 15:13:41 -04:00
Alan Coopersmith 4cb1034906 Convert hw/xfree86 to new *allocarray functions
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-04-21 16:58:08 -07:00
Aaron Plattner e36236eade xfree86: Add GPU screens even if there are no active GDevs
xf86platformProbeDev creates GPU screens for any platform devices that were not
matched by a GDev in the loop above, but only if there was at least one device.
This means that it's impossible to configure a device as a GPU screen if there
is only one platform device that matches that driver.

Instead, create a GPU screen (if possible) for any platform device that was not
claimed by the GDev loop.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
2015-03-31 14:36:11 -07:00
Aaron Plattner 4ecda36259 xfree86: Fix xf86_check_platform_slot's handling of PCI
If a PCI entity is found, xf86_check_platform_slot performs a device ID check
against the xf86_platform_device passed in.  However, it just returns
immediately without checking the rest of the entities first.  This leads to this
situation happening:

1. The nvidia driver creates an entity 0 with bus.type == BUS_PCI
2. The intel driver creates entity 1 for its platform device, opening
   /dev/dri/card0
3. xf86platformProbeDev calls probeSingleDevice on the Intel platform device,
   which calls doPlatformProbe, which calls xf86_check_platform_slot.
4. xf86_check_platform_slot compares the Intel platform device against the
   NVIDIA PCI entity.  Since they don't have the same device ID, it returns
   TRUE.
5. doPlatformProbe calls xf86ClaimPlatformSlot, which creates a duplicate entity
   for the Intel one.

Fix this by only returning FALSE if the PCI ID matches, and continuing the loop
otherwise.  In the scenario above, this allows it to continue on to find the
Intel platform device that matches the second entity.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
2015-03-31 14:36:00 -07:00
Peter Hutterer 732fd7e571 Drop trailing whitespaces
sed -i "s/[ ]\+$//g" **/*.(c|h)

happy reviewing...
git diff -w is an empty diff.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-12 10:25:00 +10:00
Thierry Reding 5d133276de xfree86: Allow non-PCI devices as primary
On platforms that don't support PCI or have no GPU attached to the PCI
bus, there can still be a primary device on a non-PCI bus.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Tested-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-08-21 20:04:08 -05:00
Thierry Reding 2f0183222b xfree86: Fallback to first platform device as primary
When neither of the various bus implementations was able to find a
primary bus and device, fallback to using the platform bus as primary
bus and the first platform device as primary device.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Tested-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-08-21 20:03:48 -05:00
Keith Packard bd4198b01f xfree86: Avoid compiler warning for unused vars without systemd
When systemd isn't being used, systemd_logind_release_fd is defined
as an empty macro, leaving the arguments unused. Fix the compiler
warnings by simply removing the local variables and referencing the
structure within the macro call.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-07-31 00:03:39 -07:00
Keith Packard 60c05ce1ab config: Replace OdevAttributes linked list with struct
OdevAttributes are a fixed set of values with known types; instead of
storing them in a linked list and requiring accessor/settor functions,
replace the list header, struct OdevAttributes, with a struct that
directly contains the values. This provides for compile-time
typechecking of the values, eliminates a significant amount of code
and generally simplifies using this datatype.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-07-17 17:10:48 -07:00
Thierry Reding eeefecd9df xfree86: Support driver loading via OutputClass
Use the OutputClass configuration to determine what drivers to autoload
for a given device.

Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Tested-By: Aaron Plattner <aplattner@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Tested-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-07-07 16:12:41 -07:00
Thierry Reding 5a4e15c3f6 xfree86: Make driver matching consistent
Most of the driver enumeration functions take an array and a maximum
number of entries that they are allowed to fill in. Upon success, they
return the number of entries filled in. This allows them to be easily
used to consecutively.

One exception is the xf86MatchDriverFromFiles() function, which doesn't
return a value, so callers have to manually search the array for the
first empty entry.

This commit modifies the xf86MatchDriverFromFiles() to behave the same
way as others, which makes it easier to deal with.

Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Tested-By: Aaron Plattner <aplattner@nvidia.com>
Tested-by: Rob Clark <robdclark@gmail.com>  (on arm / platform device)
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-07-07 16:11:00 -07:00
Peter Hutterer 15460eaed2 systemd-logind: let the logind code decided whether to close an fd
We can only request one fd per device from systemd-logind. If a fd is re-used
by the same device, releasing the fd from one device doesn't mean we can close
it. The systemd code knows when it's really released, so let it close the fd.

Test case: xorg.conf section for an input device with hotplugging enabled.
evdev detects the duplicate and closes the hotplugged device, which closes the
fd. The other instance of evdev thinks the fd is still valid so now you're
playing a double lottery. First, which client(s) will get the evdev fd?
Second, which requests will be picked up by evdev and which ones will be
picked up by the client? You'll never know, but the fun is in finding out.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-05-05 07:26:33 +10:00
Hans de Goede 7f15e5aed7 Require video drivers to report that they support server managed fds
This makes how we handle video drivers identical to what we do for input
drivers, and this should make live easier for old non kms drivers.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2014-03-10 09:08:46 +01:00
Hans de Goede 76af81bdf8 xf86platformBus: Make doPlatformProbe accept a NULL gdev argument
And use it from xf86platformAddDevice too, instead of directly calling
drvp->platformProbe.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2014-03-10 09:08:06 +01:00
Hans de Goede 82863656ec systemd-logind: Add systemd-logind "core"
This commits add the bulk of the systemd-logind integration code, but does
not hook it up yet other then calling its init and fini functions, which
don't do that much.

Note the configure bits check for udev since systemd-logind use will only be
supported in combination with udev. Besides that it only checks for dbus
since all communication with systemd-logind is happening over dbus, so
no further libs are needed.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-03 08:13:55 +01:00
Hans de Goede 5fb641a29b hotplug: Extend OdevAttributes for server-managed fd support
With systemd-logind support, the xserver, rather than the drivers will be
responsible for opening/closing the fd for drm nodes.

This commit adds a fd member to OdevAttributes to store the fd to pass it
along to the driver.

systemd-logind tracks devices by their chardev major + minor numbers, so
also add OdevAttributes to store the major and minor.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2014-03-03 08:13:55 +01:00
Hans de Goede a8d802cb01 OdevAttribute: Remove unowned flag from OdevAttributes head
The OdevAttributes struct should just be a head of the attributes list, and
not contain various unrelated flags. Instead add a flags field to
struct xf86_platform_device and use that.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2014-03-03 08:13:55 +01:00
Hans de Goede bc9d17fb56 OdevAttribute: Add support for integer attributes
Add a couple of new functions for dealing with storing integer values into
OdevAttributes.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-03 08:13:55 +01:00
Hans de Goede 10c64e8056 OdevAttribute: Add config_odev_get_attribute helper
Add a config_odev_get_attribute helper, and replace the diy looping over all
the attributes done in various places with calls to this helper.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-03 08:13:55 +01:00
Keith Packard e1e01d2e33 xfree86/common: Warning fixes. Mostly const string handling.
Also removes DPMS functiosn from Xext/dpmsproc.h

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2014-01-12 10:14:48 -08:00
Michal Srb a9ca93dcf9 randr: send RRResourceChangeNotify event
Send RRResourceChangeNotify event when provider, output or crtc was created or
destroyed. I.e. when the list of resources returned by RRGetScreenResources and
RRGetProviders changes.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Michal Srb <msrb@suse.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2013-10-30 08:09:27 -07:00
Dave Airlie f2fd8ec372 gpu: call CreateScreenResources for GPU screens
I didn't think we needed this before, but after doing some more
work with reverse optimus it seems like it should be called.

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-04-30 10:10:51 +10:00
Dave Airlie 9d26e8eaf5 randr: report changes when we disconnect a GPU slave
When we disconnect an output/offload slave set the changed bits,
so a later TellChanged can do something.

Then when we remove a GPU slave device, sent change notification
to the protocol screen.

This allows hot unplugged USB devices to disappear in clients.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-04-30 10:08:43 +10:00
Dave Airlie 22cab8a28a xf86: don't hotplug output devices while VT switched.
We don't want to hotplug output devices while we are VT switched,
as we get races between multiple X servers on the device open, and
drm device master status. This just queues device opens until we return
from VT switch.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-04-12 10:01:23 +10:00
Dave Airlie da8ee26023 xfree86/hotplug: cleanup properly if the screen fails to initialise
Due to another bug, the modesetting/udl driver would fail to init properly
on hotplug, when it did the code didn't clean up properly, and on removing
the device the server could crash.

Found in F18 testing.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
2013-03-01 18:14:27 +10:00
Dave Airlie 6b4aa8a359 Revert "xf86: Fix non-PCI configuration-less setups"
This reverts commit 76d9c62eb2.

This breaks multi-GPU setups here, so lets drop it for now.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-12-12 12:56:46 +10:00
Thierry Reding 76d9c62eb2 xf86: Fix non-PCI configuration-less setups
For non-PCI video devices, such as those found on many ARM embedded
systems, the X server currently requires the BusID option to specify the
full path to the DRM device's sysfs node in order to properly match it
against the probed platform devices.

In order to allow X to start up properly if either the BusID option was
omitted or no configuration is present at all, the first video device is
used by default.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2012-11-27 16:23:36 -08:00
Dave Airlie 70e5766874 xf86: fix multi-seat video device support. (v2)
If we are not seat 0 the following apply:

don't probe any bus other than platform
don't probe any drivers other than platform
assume the first platform device we match on the bus is the primary GPU.

This just adds checks in the correct places to ensure this, and
with this X can now start on a secondary seat for an output device.

v2: fix Seat0 macros
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-09-19 15:48:50 +10:00
Dave Airlie 10672a5abe xf86/platform: scan pci after probing devices
This solves a race if we are trying to dynamically power off
secondary GPUs. Its not the greatest fix ever but it probably
as good as we can do for now.

The GPU probing causes the devices to be powered up, then when
we scan the PCI bus we get the correct information from the kernel,
rather than a bunch of 0xff due to the device being powered off.

drop gratuitous '&'.

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-09-19 10:46:32 +10:00
Dave Airlie 66d92afeae randr: add provider object and provider property support (v6)
This adds the initial provider object and provider property
support to the randr dix code.

v2: destroy provider in screen close
v2.1: fix whitespace

v3: update for latest rev of protocol + renumber after 1.4 tearout.

v4: fix logic issue, thanks Samsagax on irc

v5: keithp's review: fix current_role, fix copyrights, fix master
reporting crtc/outputs.

v6: port to new randr interface, drop all set role bits for now

v7: drop devPrivate in provider, not needed, add BadMatch returns
for NULL SetProviderOffloadSink and SetProviderOutputSource, drop
the old typedef.

Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-06 22:16:02 +01:00
Dave Airlie 74b786f7ce xfree86: add autoAddGPU option (v2)
This option is to stop the X server adding non-primary devices as
gpu screens.

v2: fix per Keith's suggestion.

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-06 10:35:20 +01:00
Dave Airlie ef6686480a xfree86: add platform bus hotplug support (v3)
This provides add/remove support for platform devices at xfree86 ddx level.

v2: cleanup properly if no driver found.

v3: load the modesetting driver before checking driver list.

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-07-06 10:35:20 +01:00