Commit Graph

4778 Commits

Author SHA1 Message Date
Povilas Kanapickas 18d3131f9a meson: Implement developer documentation build
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2021-08-20 10:26:07 +00:00
Olivier Fourdan 7eba412072 xfree86: Move xf86CVTMode() function
The xf86CVTMode() was implemented in a standalone source file because it
was being used for both the xfree86 API and the standalone cvt utility.

Now that the cvt utility is removed (as part of libxcvt) we can move the
small xf86CVTMode() function with the rest of the xf86Modes sources.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1142
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2021-08-06 11:29:29 +00:00
Olivier Fourdan f2781e9536 xfree86/cvt: Drop cvt utility
The cvt utility is now replaced by the standalone version found in
libxcvt, no need to build the one in xfree86 anymore.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1142
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2021-08-06 11:29:29 +00:00
Olivier Fourdan f788289bdc xfree86: Use libxcvt
Replace the local implementation of the VESA CVT standard timing
modelines generator with the one from libxct to avoid code duplication.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1142
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2021-08-06 11:29:29 +00:00
Zoltán Böszörményi f08bc32f5a xf86: Assign GPUs to screens according to configuration
If there is an explicit configuration, assign the RandR provider
of the GPUDevice to the screen it was specified for.

If there is no configuration (default case) the screen number is
still 0 so it doesn't change behaviour.

The result is e.g:

  # DISPLAY=:0.2 xrandr --listproviders
  Providers: number : 2
  Provider 0: id: 0xd2 cap: 0x2, Sink Output crtcs: 1 outputs: 1 associated providers: 0 name:modesetting
  Provider 1: id: 0xfd cap: 0xb, Source Output, Sink Output, Sink Offload crtcs: 2 outputs: 2 associated providers: 0 name:Intel

Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
2021-07-30 00:27:39 +00:00
Zoltán Böszörményi cd567415cc xf86: Extract screen configuration matching into its own function
Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
2021-07-30 00:27:39 +00:00
Łukasz Spintzyk 8836b9d243 modesetting: unflip not possible when glamor is not set
This is fixing crashes of xfce when running under qemu
2021-07-22 13:24:21 +02:00
Łukasz Spintzyk d66b7ec129 xfree86: Fix out of array bound access to xf86Entities
Signed-off-by: Łukasz Spintzyk <lukasz.spintzyk@synaptics.com>
2021-06-24 09:05:57 +02:00
Povilas Kanapickas 0d93bbfa2c xfree86: Fix potentially NULL reference to platform device's PCI device
xf86_platform_devices[i].pdev may be NULL in cases we fail to parse the
busid in config_udev_odev_setup_attribs() (see also [1], [2]) such as
when udev does not give use ID_PATH. This in turn leads to
platform_find_pci_info() being not called and pdev being NULL.

[1]: https://gitlab.freedesktop.org/xorg/xserver/-/issues/993
[2]: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1076

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2021-06-23 14:29:10 +03:00
Povilas Kanapickas 303763941f xfree86: Consistently check for reference to primaryBus pci_device
This is the only place where we don't check whether
primaryBus.id.plat->pdev is not NULL before accessing its members.

It may be NULL in cases we fail to parse the busid in
config_udev_odev_setup_attribs() (see also [1], [2]) such as when udev
does not give use ID_PATH. This in turn leads to
platform_find_pci_info() being not called and pdev being NULL in one of
the items within the xf86_platform_devices array. For this to cause a
crash we only need it to become the primaryBus device.

[1]: https://gitlab.freedesktop.org/xorg/xserver/-/issues/993
[2]: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1076

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2021-06-23 14:29:10 +03:00
Zoltán Böszörményi ef89b6648e xfree86: Fix NULL pointer dereference crash
screenp->displays[count] (passed to configDisplay() in
configScreen()) is NULL if there is no Virtual setting
in the configuration.

Fixes: f8a6be04d0 ("xfree86: Change
displays array to pointers array to fix invalid pointer issues
after table reallocation")

Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
2021-06-21 14:11:37 +02:00
Daniel Strnad 05b3c681ea hw/xfree86: Propagate physical dimensions from DRM connector
Physical dimmension of display can be obtained not just by configuration or
DDC, but also directly from kernel via drmModeGetConnector(). Until now
xserver silently discarded these values even when no configuration nor EDID
were present and fallbacked to default DPI.
2021-06-15 13:21:11 +00:00
Łukasz Spintzyk f8a6be04d0 xfree86: Change displays array to pointers array to fix invalid pointer issues after table reallocation
There are rare cases when xf86SetDepthBpp is resizing displays array in confScreen.
As that array is shared between set of ScrnInfoRec's then realloc might invalidate chached DispPtr display values in
otheres ScrnInfoRec objects.

If we will change displays array as an array of pointers to DispRec then cached DispRec pointers in ScrnInfoRec
won't be invalid after reallocation of displays array.

Signed-off-by: Łukasz Spintzyk <lukasz.spintzyk@synaptics.com>
2021-06-15 10:01:14 +00:00
Povilas Kanapickas 1a1bd5cf7a modesetting: Add a limit on async page flip error log frequency
In certain circumstances we will have a lot of flip errors without a
reasonable way to prevent them. In such case we reduce the number of
logged messages to at least not fill the error logs.

The details are as follows:

At least on i915 hardware support for async page flip support depends on
the used modifiers which themselves can change dynamically for a screen.
This results in the following problems:

- We can't know about whether a particular CRTC will be able to do an
async flip without hardcoding the same logic as the kernel as there's no
interface to query this information.

- There is no way to give this information to an application, because
the protocol of the present extension does not specify anything about
changing of the capabilities on runtime or the need to re-query them.

Even if the above was solved, the only benefit would be avoiding a
roundtrip to the kernel and reduced amount of error logs. The former
does not seem to be a good enough benefit compared to the amount of work
that would need to be done. The latter is solved in this commit.

Reviewed-by: Eero Tamminen <eero.t.tamminen@intel.com>
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2021-06-15 12:53:33 +03:00
Povilas Kanapickas 9992245c5f modesetting: Extract flip failure logging to a single place
Reviewed-by: Eero Tamminen <eero.t.tamminen@intel.com>
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2021-06-15 12:53:33 +03:00
Lukasz Spintzyk 7e7c147105 modesetting: Disable reverse prime offload mode for displays running on evdi,udl
This mode for displays running on evdi/udl as side effect of failed glamor_egl_init
reverse_prime_offload_mode was initialized to FALSE

After Mesa upgrade to 21.0.0 GL_RENDERER is not llvmpipe that results in successful glamor_egl_init
and reverse_prime_offload_mode enabled.

This commit is explicitly disabling reverse_prime_offload_mode for evdi and udl drivers

Signed-off-by: Łukasz Spintzyk <lukasz.spintzyk@synaptics.com>
2021-06-08 16:20:36 +00:00
Povilas Kanapickas 0886254f96 xfree86: Bump input minor ABI due to addition touchpad gestures
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2021-05-30 13:26:46 +03:00
Povilas Kanapickas 1cdc3b5d14 xfree86: Implement gesture support for test input driver 2021-05-30 13:26:45 +03:00
Povilas Kanapickas d3c52df161 hw/xfree86: Implement public APIs to submit gesture events 2021-05-30 13:26:41 +03:00
Mazlan, Hazwan Arif 3ea46f9336 dri2: Sync i965_pci_ids.h from mesa iris_pci_ids.h
Copied TGL PCI ID from MESA iris_pci_ids.h
This update brings in a significant number of new platform ID's
Sync up until commit f02ae698

Signed-off-by: Mazlan, Hazwan Arif <hazwan.arif.mazlan@intel.com>
2021-04-24 19:21:41 +00:00
luporl 7e142cb2a8 xserver: fix RGB mask handling
On FreeBSD 13.0-CURRENT for PowerPC64 big-endian (BE), X was
crashing in some cases. For instance, when twm was started
and the background was clicked to open its menu, X crashed
with a segmentation fault, trying to dereference a null pointer
at CreatePicture().

There were 2 issues with xorg-server handling of RGB masks that
caused the pointer above to be null and thus the crash:
- wrong use of ffs() to get the RGB offsets from the masks
- overflow when shifting a 16-bit integer

This change fixes both issues. They happen when the system is BE
but has a video adapter using a little-endian (LE) ARGB32
framebuffer. In order to display the correct colors, this setup
requires a BE RGBA32 color format to be used by X, by setting
the RGB masks appropriately, that didn't work properly because of
the issues above.
2021-04-16 14:40:49 +00:00
Łukasz Spintzyk 5be3b80b8d modesetting: Remove few common functions from ms namespace
A lot of that code is the same as in xf86-amdgpu and xf86-nouveau drivers. By removing that functions from
ms namespace we can move that code to common implementation.

Signed-off-by: Łukasz Spintzyk <lukasz.spintzyk@synaptics.com>
2021-04-16 10:53:43 +00:00
Łukasz Spintzyk c282be503e modesetting: remove unnecessary ms_covering_xf86_crtc dup of ms_covering_randr_crtc
Signed-off-by: Łukasz Spintzyk <lukasz.spintzyk@synaptics.com>
2021-04-16 10:53:43 +00:00
Łukasz Spintzyk b923364c5e modesetting: Find crtc on secondary outputs as fallback instead of returning primary crtc
Signed-off-by: Łukasz Spintzyk <lukasz.spintzyk@synaptics.com>
2021-04-16 10:53:43 +00:00
Łukasz Spintzyk d03c0de77b modesetting: Initialize present extension despite glamor is disabled
Signed-off-by: Łukasz Spintzyk <lukasz.spintzyk@synaptics.com>
2021-04-16 10:53:43 +00:00
Pascal VITOUX 34e2a64ce0 xfree86: fix gtf support detection for EDID 1.4
According to the "VESA Enhanced EDID Standard", all GTF compliant
displays are continuous frequency.

The GTF support flags in 'Display Range Limits Descriptor' cannot be
used if the display is a non-continuous frequency multi-mode display.

Closes #1105
Signed-off-by: Pascal VITOUX <vitoux.pascal@gmail.com>
Fixes: 6a79a737 ("xfree86: add drm modes on non-GTF panels")
Reviewed-by: Aaron Ma aaron.ma@canonical.com
2021-04-06 11:25:42 +00:00
Aaron Plattner b75d0cca28 modesetting: Defer crtc gamma size upgrade to drmmode_setup_colormap
Rather than trying to create a gamma ramp array of the appropriate size in
drmmode_crtc_init when the GAMMA_LUT property should be used, just flag the crtc
as wanting to use the GAMMA_LUT property and then replace the gamma ramp later,
right before calling xf86HandleColormaps. This avoids a problem during initial
startup where xf86RandR12CreateObjects12 hard-codes a gamma ramp size of 256,
causing xf86RandR12CrtcSetGamma to read past the end of the DIX layer's RandR
gamma ramp array:

  PreInit
    drmmode_pre_init
      drmmode_crtc_init
        crtc->gamma_size = 1024

  ScreenInit
    xf86CrtcScreenInit
      xf86RandR12Init
        xf86RandR12Init12
          xf86RandR12CreateObjects12
            RRCrtcCreate
              randr_crtc->gammaSize = 0
          xf86RandR12InitGamma(pScrn, 256)
            RRCrtcGammaSetSize
              randr_crtc->gammaSize = 256
          xf86RandR12InitGamma
            xf86RandR12CrtcInitGamma
              RRCrtcGammaSet
                xf86RandR12CrtcSetGamma
                  // crtc->gamma_size is 1024 here, while randr_crtc->gammaRed
                  // is a 256-element array.
                  memcpy(crtc->gamma_red, randr_crtc->gammaRed, crtc->gamma_size * sizeof(crtc->gamma_red[0]));
    drmmode_setup_colormap
      xf86HandleColormaps
        xf86RandR12InitGamma
          RRCrtcGammaSetSize
            randr_crtc->gammaSize = 1024

Fixes: 245b9db0 - modesetting: Use GAMMA_LUT when available
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1126
Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Robert Morell <rmorell@nvidia.com>
2021-04-05 14:25:33 -07:00
Povilas Kanapickas a3931ec6f4 xfree86: Create a symlink X -> Xorg when installing using meson
This brings the behavior closer than what we currently have with
autotools-based build system.

Meson does not currently have native support for symlinks.
See https://github.com/mesonbuild/meson/issues/1602.

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2021-03-26 09:29:25 +00:00
Povilas Kanapickas 09cd65233e xfree86: Set appropriate install_mode for suid_wrapper 2021-03-26 09:18:55 +00:00
Povilas Kanapickas 82d2156ba7 xfree86: Fix meson overwriting suid wrapper with the wrapped executable
Meson gets confused when there are two targets of the same name within
the same directory, so we use a different intermediate name.

This is a problem with the Xorg SUID wrapper which has the same filename
as the real Xorg executable and is configured in the same meson.build
file. This commit works around this by using a different filename in
build stage and renaming only when installing.

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2021-03-26 09:08:02 +00:00
Jacob Cherry a5367face1 xfree86: Fix autoconfig secondary GPU devices
The code path added by commit 69e4b8e6 (xfree86: attempt to autoconfig
gpu slave devices (v3)) assumes that it will only be run if the primary
device on the screen is the first device in xf86configptr->conf_device_lst.
While this is true most of the time, there are two specific cases where
this assumption fails.

First, if the first device in conf_device_lst is assigned to a different
seat than the running X server, it will be skipped by the previous
FIND_SUITABLE macro usage. Second, if the primary device was explicitly
assigned to the screen but auto_gpu_device is still set and no secondary
devices were explicitly listed, that device may not be the first device
in conf_device_lst.

When the first device in conf_device_lst is not the primary device
assigned to the screen, two problems emerge. First, the first device in
conf_device_lst will never be assigned to the screen as a secondary
device. Second, the primary device is additionally assigned to the
screen as a secondary device. The combination of these problems causes
certain otherwise valid configurations to be invalid. For example, if a
primary device is assigned to a screen and a secondary device is listed
in the config but not explicitly assigned to the screen, then one order
of the device sections results in a usable PRIME or Reverse PRIME setup
and the other order does not.

This commit removes the assumption that the primary device is the first
device in conf_device_lst by starting the loop from the start of
conf_device_lst and skipping the primary device when it is encountered.

Signed-off-by: Jacob Cherry <jcherry@nvidia.com>
2021-03-03 17:50:31 +00:00
Olivier Fourdan b5e1f13681 dix: Add POINTER_RAWONLY flag
This add a new flag POINTER_RAWONLY for GetPointerEvents() which does
pretty much the opposite of POINTER_NORAW.

Basically, this tells GetPointerEvents() that we only want the
DeviceChanged events and any raw events for this motion but no actual
motion events.

This is preliminary work for Xwayland to be able to use relative motion
events for raw events. Xwayland would use absolute events for raw
events, but some X11 clients (wrongly) assume raw events to be always
relative.

To allow such clients to work with Xwayland, it needs to switch to
relative raw events (if those are available from the Wayland
compositor).

However, Xwayland cannot use relative motion events for actual pointer
location because that would cause a drift over time, the pointer being
actually controlled by the Wayland compositor.

So Xwayland needs to be able to send only relative raw events, hence
this API.

Bump the ABI_XINPUT_VERSION minor version to reflect that API addition.

v2: Actually avoid sending motion events (Peter)
v3: Keep sending raw emulated events with RAWONLY (Peter)

Suggested-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Related: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1130
2021-02-15 09:42:00 +01:00
Olivier Fourdan 3cdac5ba07 mi: List extensions in usage message
Not all extensions can be enabled or disabled at runtime, list the
extensions which can from the help message rather than on error only.

v2:
 * Print the header message in the ListStaticExtensions() (Peter
   Hutterer)
 * Do not export ListStaticExtensions() as Xserver API

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2021-01-29 12:52:09 +00:00
Julien Cristau 0148a15da1 compiler.h: don't define inb/outb and friends on mips
The definition relies on IOPortBase, which is only ever set in
hw/xfree86/os-support/bsd/arm_video.c

This caused build failures on linux/mips with GCC 10, due to this
change (from https://gcc.gnu.org/gcc-10/changes.html#c):

"GCC now defaults to -fno-common. As a result, global variable accesses
are more efficient on various targets. In C, global variables with
multiple tentative definitions now result in linker errors. With
-fcommon such definitions are silently merged during linking."

As a result anything including compiler.h would get its own definition
of IOPortBase and the linker would error out.
2021-01-27 19:29:35 +00:00
Povilas Kanapickas 5322457980 xfree86/inputtest: Drop extraneous linux-specific include
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2021-01-06 01:48:02 +00:00
Povilas Kanapickas 5e3900904d xfree86: Use different scroll increment than libinput in inputtest drv
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2020-12-18 04:39:07 +02:00
Povilas Kanapickas 58465a3dd9 xfree86: Add scroll axes to touch devices in inputtest driver
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2020-12-17 03:11:16 +02:00
Povilas Kanapickas 91a8013990 xfree86: Add support for pressure valuator axis in inputtest driver
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2020-12-17 03:11:08 +02:00
Povilas Kanapickas 742b87f7ee xfree86: Fix axis labels for PointerAbsolute input of inputtest driver
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2020-12-17 03:10:58 +02:00
Povilas Kanapickas 8c0afc9eb2 xfree86: Implement a test input driver
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2020-12-14 01:12:10 +00:00
Prabhu Sundararaj 36e353bcf4 Remove check for useSIGIO option
Commit 6a5a4e6037 removed the option to
configure useSIGIO option. Indeed, the xfree86 SIGIO support was
reworked to use internal versions of OsBlockSIGIO and OsReleaseSIGIO.

As a result, useSIGIO is no longer needed and can dropped

Fixes: 6a5a4e60 - Remove SIGIO support for input [v5]
Closes: xorg/xserver#1107
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Prabhu Sundararaj <prabhu.sundararaj@nxp.com>
Signed-off-by: Mylène Josserand <mylene.josserand@free-electrons.com>
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2020-12-08 11:23:31 -05:00
Olivier Fourdan 3ce05a44f3 modesetting: Fix build with DebugPresent() enabled
By default, the macro DebugPresent() is a no-op but it can be enabled
at build time for debugging purpose.

However, doing so prevents the code to build because one debug statement
tries to make use of a non-existent variable:

  present.c: In function ‘ms_present_queue_vblank’:
  present.c:147:18: error: ‘vbl’ undeclared (first use in this function)
    147 |                  vbl.request.sequence));
        |                  ^~~
  present.c:49:32: note: in definition of macro ‘DebugPresent’
    49 | #define DebugPresent(x) ErrorF x
       |                                ^

Fix the build with DebugPresent() by removing the vbl variable from the
debug message.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2020-11-26 22:06:56 +00:00
Böszörményi Zoltán 682167475c Introduce and use BUS_USB
With !155, the device bus ID received via udev is constructed
properly with the "usb:" prefix. But, it is not enough to
make the following line to work in Section "Device":

    BusID  "usb:0:1.2:1.0"

Introduce BUS_USB, so the prefix can be distinguished from BUS_PCI
and check the supplied BusID value against device->attribs->busid
in xf86PlatformDeviceCheckBusID().

Signed-off-by: Böszörményi Zoltán <zboszor@pr.hu>
2020-11-25 04:39:14 +00:00
Aaron Plattner af4622d3f9 modesetting: Add missing copyright notices
I forgot to add these in commits 4fefe73fe, b6985d6b3, 245b9db03, and 4e670f128.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
2020-11-25 04:28:42 +00:00
Alan Coopersmith e538601128 int10: wrap entire V_ADDR_R* macros in parens for safer expansion
Resolves warnings from Oracle Parfait static analyser:

Error: Misleading macro
   Misleading macro [misleading-macro]:
      misleading evaluation of ternary '?:' operator in expansion of macro V_ADDR_RB due to missing parentheses
        at line 392 of hw/xfree86/int10/generic.c.
        '|' operator has higher precedence than ternary '?:' operator inside macro body at line 431
        low precedence ternary '?:' operator is hidden by expansion of macro V_ADDR_RB at line 431
   Misleading macro [misleading-macro]:
      misleading evaluation of ternary '?:' operator in expansion of macro V_ADDR_RB due to missing parentheses
        at line 392 of hw/xfree86/int10/generic.c.
        '<<' operator has higher precedence than ternary '?:' operator inside macro body at line 431
        low precedence ternary '?:' operator is hidden by expansion of macro V_ADDR_RB at line 431
   Misleading macro [misleading-macro]:
      misleading evaluation of ternary '?:' operator in expansion of macro V_ADDR_RB due to missing parentheses
        at line 392 of hw/xfree86/int10/generic.c.
        '<<' operator has higher precedence than ternary '?:' operator inside macro body at line 442
        low precedence ternary '?:' operator is hidden by expansion of macro V_ADDR_RB at line 442
   Misleading macro [misleading-macro]:
      misleading evaluation of ternary '?:' operator in expansion of macro V_ADDR_RB due to missing parentheses
        at line 392 of hw/xfree86/int10/generic.c.
        '<<' operator has higher precedence than ternary '?:' operator inside macro body at line 443
        low precedence ternary '?:' operator is hidden by expansion of macro V_ADDR_RB at line 443
   Misleading macro [misleading-macro]:
      misleading evaluation of ternary '?:' operator in expansion of macro V_ADDR_RB due to missing parentheses
        at line 392 of hw/xfree86/int10/generic.c.
        '|' operator has higher precedence than ternary '?:' operator inside macro body at line 443
        low precedence ternary '?:' operator is hidden by expansion of macro V_ADDR_RB at line 441
   Misleading macro [misleading-macro]:
      misleading evaluation of ternary '?:' operator in expansion of macro V_ADDR_RB due to missing parentheses
        at line 392 of hw/xfree86/int10/generic.c.
        '<<' operator has higher precedence than ternary '?:' operator inside macro body at line 443
        low precedence ternary '?:' operator is hidden by expansion of macro V_ADDR_RB at line 443

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-11-17 18:43:39 -08:00
Aaron Plattner 4e670f1281 modesetting: Add CTM RandR property
When the "CTM" (color transform matrix) modesetting property is available,
create a corresponding RandR property.

To match the format of the property available in the amdgpu driver, expose it as
an array of 18 32-bit XA_INTEGERs representing a 3x3 matrix in row-major order,
where each entry is a S31.32 sign-magnitude fixed-point number with the
fractional part listed first.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
Reviewed-by: James Jones <jajones@nvidia.com>
2020-10-29 15:25:00 -07:00
Aaron Plattner 245b9db03a modesetting: Use GAMMA_LUT when available
If the kernel exposes GAMMA_LUT and GAMMA_LUT_SIZE properties and the size is
not what the server has pre-configured for the crtc, free the old gamma ramp
memory allocated by the server and replace it with new allocations of the
appropriate size.

In addition, when GAMMA_LUT is available, use drmModeCreatePropertyBlob() and
drmModeObjectSetProperty() to set the gamma ramp rather than using the legacy
drmModeCrtcSetGamma() function.

Add a new option "UseGammaLUT" to allow disabling this new behavior and falling
back to drmModeCrtcSetGamma() unconditionally.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
2020-10-29 15:13:17 -07:00
Aaron Plattner b6985d6b3f modesetting: Query properties even in non-atomic mode
Modeset properties can be set even when ms->atomic_modeset is disabled by using
the drmModeObjectSetProperty() function.

This will be necessary in a later change in order to set the GAMMA_LUT and CTM
properties.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
2020-10-29 15:10:16 -07:00
Aaron Plattner 4fefe73fea modesetting: Store property values in drmmode_prop_info_rec
A later change will need to read the value of the GAMMA_LUT_SIZE property.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
2020-10-29 15:10:16 -07:00
Kishore Kadiyala efb3abddd4 modesetting: keep going if a modeset fails on EnterVT
There was a time when setting a mode on a CRTC would not depend on the
associated connector's state. If a mode had been set successfully once,
it would mean it would work later on.

This changed with the introduction of new connectors type that now
require a link training sequence (DP, HDMI 2.0), and that means that
some events may have happened while the X server was not master that
would then prevent the mode from successfully be restored to its
previous state.

This patch relaxes the requirement that all modes should be restored on
EnterVT, or the entire X-Server would go down by allowing modesets to
fail (with some warnings). If a modeset fails, the CRTC will be
disabled, and a RandR event will be sent for the desktop environment to
fix the situation as well as possible.

Additional patches might be needed to make sure that the user would
never be left with all screens black in some scenarios.

v2 (Martin Peres):
 - whitespace fixes
 - remove the uevent handling (it is done in a previous patch)
 - improve the commit message
 - reduce the size of the patch by not changing lines needlessly
 - return FALSE if one modeset fails in ignore mode
 - add comments/todos to explain why we do things
 - disable the CRTCs that failed the modeset

Signed-off-by: Kishore Kadiyala <kishore.kadiyala@intel.com>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Tested-by: Kishore Kadiyala <kishore.kadiyala@intel.com>
Closes: #1010
2020-09-25 16:13:56 +03:00