Commit Graph

4876 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult 27b5530107 xfree86: drop remains of old USL compiler
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1286>
2024-02-19 09:21:36 +00:00
Enrico Weigelt, metux IT consult 6dafe3dbe6 drop remains of support for old Sun compilers
With transition from autoconf to meson, these aren't actually supported
anymore, and re-adding it isn't planned. Thus the now dead code pathes
can be completely removed.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1286>
2024-02-19 09:21:36 +00:00
Yusuf Khan db3aa4e03b hw/xfree86: fix NULL pointer refrence to mode name
Potentially, the pointer to the mode name could be unset, this can
occur with the xf86-video-nv DDX, in that case there isnt much we can do
except check if the next mode is any better.

Signed-off-by: Yusuf Khan <yusisamerican@gmail.com>
2024-02-19 03:51:25 +00:00
Enrico Weigelt, metux IT consult a2e7904b1d fix: unused readIntVec()
[585/699] Compiling C object hw/xfree86/int10/libint10.so.p/generic.c.o
../hw/xfree86/int10/generic.c:103:1: warning: ‘readIntVec’ defined but not used [-Wunused-function]
  103 | readIntVec(struct pci_device *dev, unsigned char *buf, int len)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-02-19 01:02:32 +00:00
Enrico Weigelt, metux IT consult 374ee7acd7 xkb: drop defining XKBSRV_NEED_FILE_FUNCS
No need to define XKBSRV_NEED_FILE_FUNCS, for about 15 years now
(since XKBsrv.h isn't used anymore), so drop it.

Fixes: e5f002edde
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2024-02-19 00:44:15 +00:00
Matthieu Herrb 0d4a7ed684 bsd_init.c: fix build on OpenBSD
isolate NetBSD specific VGAPCVTID ioctl(2) call.

Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
2024-02-19 00:40:04 +00:00
Matthieu Herrb 238f8edcaf xfree86/bsd: fix build on NetBSD/amd64.
The IOPL function for 64 bit systems is x86_64_iopl() there
2024-02-18 00:03:45 +00:00
Matthieu Herrb 59dac6af45 Add full prototypes in hw/xfree86/os-support/bsd/bsd-video.c
Trivial functions without parameters -> (void)
2024-02-17 23:50:59 +00:00
Alan Coopersmith a8bb924af1 os: Assume all supported non-WIN32 platforms have seteuid & saved_ids
Removes fallback code to fork and exec a "cat" command to read files.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2024-02-10 00:05:54 +00:00
Olivier Fourdan 7fdef970c4 build: Switch to meson 0.56
And replace the deprecated meson API accordingly.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2024-01-08 10:38:05 +00:00
Dongwon Kim 995e60a919 modesetting: Correct coordinate info of dirty clips for front-buffer flushing
A clip should represent the area that is covering the current FB associated
with the CRTC. So making sure each input rect covers any area in the FB is
the first thing to do. If that is the case, the size and coordinates should
be adjusted based on the partial area in the FB the each rect covers. The size
elements need to be truncated if the rect's size exceeds FB's for the CRTC.
Then offsets should be applied to coordinates if the CRTC's offsets aren't 0.
And coordinate transposing and inversion are needed in case the rotated image
is assigned to the FB.

Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
2024-01-04 17:51:30 +00:00
Izumi Tsutsui 15624bb5bc Revert "xfree86: Remove -flippixels"
This reverts commit d1c00c859c except
hw/xfree86/common/xf86str.h that was not used by -flipPixels option.
2024-01-03 19:43:16 +00:00
Chia-Lin Kao (AceLan) f59871587e hw/xfree86: re-calculate the clock and refresh rate
xserver fails to generate useable resolutions with 90Hz framerate
panels(encounter the same issue with 3 different 2.5k resolution
panels). All the resolutions shown by xrandr lead to blank screen except
the one written in EDID.
Ville Syrjälä from Intel provides a method to calculate the preferred
clock and refresh rate from the existing resolution table and this
works for the issue.

v2. xf86ModeVRefresh might return 0, need to check it before use it.
v3. reported by Markus on launchpad that the issue is not devided by 0,
it's the "preferred" being accessed unconditionally.
BugLink: https://launchpad.net/bugs/1999852

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1388
Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>
2023-12-22 05:02:05 +00:00
Thomas Zimmermann cd617f2d0f xf86: Accept devices with the kernel's ofdrm driver
Add a workaround to accept devices of the kernel's ofdrm driver.
Makes Xorg work on Open Firmware's pre-configured display with the
DRM graphics stack.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
2023-12-17 17:27:41 +00:00
Moritz Bruder a8e41a8190 fbdevhw: Support symbolic links in fbdev_open
Resolve symbolic links before the PCI device check in fbdev_open.
Otherwise, opening device files that are symbolic links will fail.

Fixes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1419

Signed-off-by: Moritz Bruder <muesli4@gmail.com>
2023-12-17 17:21:56 +00:00
Sultan Alsawaf 0dacee6c51 modesetting: Enable TearFree by default
TearFree support has been available in the modesetting driver for a year
with no issues reported. The code is mature and robust, with error handling
that's been vetted across many hardware configurations.

Notably, TearFree is also the only way to achieve a tear-free desktop with
mismatched displays and transformed CRTCs.

Enable TearFree by default for a smooth desktop experience out of the box.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
2023-12-17 16:59:57 +00:00
xurui 6c60571528 modesetting: Check the return value of the drmGetVersion
Signed-off-by: xurui <xurui@kylinos.cn>
2023-12-17 16:54:15 +00:00
Ville Syrjälä 893e9a3238 modesetting: Don't feed stack garbage to the kernel in LUT reserved fields
Stop putting stack garbage into the gamma LUT blob reserved
fields.

Fixes: 245b9db03a ("modesetting: Use GAMMA_LUT when available")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2023-12-16 11:30:06 +00:00
Ville Syrjälä 1f41320e1c modesetting: Use a more optimal hw cursor size
Try to minimize the used hw cursor size in order to
minimize power consumption. There is no kernel query
for the minimum so we'll just probe around with
setcursor2 (using an invisible cursor image so
there will be no visual artifacts).

To avoid having to deal with absolutely every size stick
to power-of-two numbers. And with a bit of extra effort
we can determine whether non-square dimesions will also
work, which they do to some degree on current Intel GPUs.

On my Alderlake laptop I'm seeing a massive (up to .5W)
difference in power consumption between 64x64 vs. 256x256
cursors. While some of that is undoubtedly something that
needs to be fixed in i915's display data buffer allocation
code, it still makes sense to use as small as possible
cursor to minimize the wastege.

In case the crtc is rotated just punt to the max cursor size
for now since midlayer has already done the coordinate
transformations based on that. To make smaller cursors work
with rotation we'd either need to make the midlayer(s) aware
of the final cursor size, or just handle the whole roation
business in modesetting. I suspect the latter option would
be easier.

v2: Only allow square cursors in most cases for now as eg.
    on modern Intel hardware non-square only works with
    wide+short but not with narrow+tall cursors. Non-square
    size may still be used when maximum limits aren't
    square and the squared+POT'd dimensions would exceed
    one of the max limits.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2023-12-16 08:03:26 +02:00
Ville Syrjälä 899c87af1f modesetting: unflip before any setcrtc() calls
Make sure we're not scanning out any fbs with fancy modifiers when
we try to light up new displays. This is already the case in cases
where the screen gets resized, but in cases where that doesn't happen
it might be possible for the modeset(s) to fail due to watermark/etc.
constraints imposed by the fancy modifiers. We can avoid that by
making sure everything gets unflipped before the modeset.

v2: make poll timeout infinite
    s/in_modeset/pending_modeset/
    deal with tearfree fallout (goto no_flip)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2023-12-16 04:36:39 +00:00
Alan Coopersmith eb6125f20c Revert "Compile lnx_platform.c on FreeBSD too."
This reverts commit 947d1c7ecf.

lnx_platform.c doesn't exist in this branch since commit 54681238
renamed it to shared/drm_platform.c and added it to the BSD build.

Fixes build failures in CI of:
../hw/xfree86/os-support/meson.build:163:18: ERROR: File linux/lnx_platform.c does not exist.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2023-12-02 11:39:24 -08:00
Konstantin Pugin a987fc7c36 xorg: initialize glamor provider
This allows Xorg to use Glamor GLX when Glamor is requested,
and eliminates usage of DRI2 in case of Glamor.

Signed-off-by: Konstantin Pugin <ria.freelander@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Emma Anholt <emma@anholt.net>
2023-11-07 17:59:43 +03:00
Konstantin 4fc1500f74 xorg.conf.man: document new RenderingAPI option
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Konstantin <ria.freelander@gmail.com>
2023-11-02 08:18:00 +00:00
Pedro Montes Alcalde 1bb6991bda AutoRepeat: Fix wrong repeat rate being applied
When you set the auto repeat rate trough xset to something like 250 40:
`xset r rate 250 40`
Is setting the first delay to 250ms and set the rate to 40hz (25ms)

However, if you were to apply this configuration from a xorg config file,
the result would be the first delay being applied correctly,
but the repeat rate would be set to 25Hz instead. This is because the config
option is using a rate of repeats per second but XKB stores it as interval.
Make sure this is converted correctly.

Fixes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1558

Signed-off-by: EXtremeExploit <pedro.montes.alcalde@gmail.com>
2023-11-02 01:20:41 +00:00
John Kennedy cf44a4dda3 Extented 'arm' case to 'aarch64' on BSD. 2023-10-22 16:08:21 +00:00
Austin Shafer 947d1c7ecf Compile lnx_platform.c on FreeBSD too. 2023-10-22 16:08:21 +00:00
Peter Grehan 84ff599d0b Fix build on FreeBSD/PowerPC architecture. 2023-10-22 16:08:21 +00:00
Gleb Popov b1abb2efcb The framebuffer driver on FreeBSD is called scfb, use it. 2023-10-22 16:08:21 +00:00
Niclas Zeising 5528b0606e Extend Linux #ifdef to FreeBSD OS. 2023-10-22 16:08:21 +00:00
Gleb Popov f3e347241e Implement -novtswitch option handling for FreeBSD. 2023-10-22 15:39:44 +00:00
Aaron Dill 2260dea7d8 logind: call SetType on the logind session
This allows manual handling of IdleAction and IdleHint rather than automatically
calling the IdleAction every IdleSecs, due to inactivity on the underlying tty.
Fixes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1194

Signed-off-by: aarondill <aaronsacks2006@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2023-06-12 22:48:03 +00:00
Sultan Alsawaf 53b02054f3 modesetting: Support accurate DRI presentation timing with TearFree
When using TearFree, DRI clients have no way of accurately knowing when
their copied pixmaps appear on the display without utilizing the kernel
driver's notification indicating that the TearFree flip containing their
pixmap is complete. This is because the target CRTC's MSC can change while
the predicted completion MSC is calculated and even while the page flip
IOCTL is sent to the kernel due to scheduling delays and/or unfortunate
timing. Even worse, a page flip isn't actually guaranteed to be finished
after one vblank; it may be several MSCs until a flip actually finishes
depending on delays and load in hardware.

As a result, DRI clients may be off by one or more MSCs when they naively
expect their pixmaps to be visible at MSC+1 with TearFree enabled. This,
for example, makes it impossible for DRI clients to achieve precise A/V
synchronization when TearFree is enabled.

This change therefore adds a way for DRI clients to receive a notification
straight from the TearFree flip-done handler to know exactly when their
pixmaps appear on the display. This is done by checking for a NULL pixmap
pointer to modesetting's DRI flip routine, which indicates that the DRI
client has copied its pixmap and wants TearFree to send a notification when
the copied pixmap appears on the display as part of a TearFree flip. The
existing PageFlip scaffolding is reused to achieve this with minimal churn.

The Present extension will be updated in an upcoming change to utilize this
new mechanism for DRI clients' presentations.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Acked-by: Martin Roukala <martin.roukala@mupuf.org>
2023-02-28 22:43:37 -08:00
Sultan Alsawaf 9d1997f72a modesetting: Ensure vblank events always run in sequential order
It is possible for vblank events to run out of order with respect to one
another because the event which was queued to the kernel has the privilege
of running before all other events are handled. This allows kernel-queued
events to run before other, older events which should've run first.

Although this isn't a huge problem now, it will become more problematic
after the next change which ties DRI client notifications to TearFree page
flips. This increases the likelihood of DRI clients erroneously receiving
presentation-completion notifications out of order; i.e., a client could
receive a notification for a newer pixmap it submitted *before* receiving a
notification for an older pixmap.

Ensure vblank events always run in sequential order by removing the bias
towards kernel-queued events, and therefore forcing them to run at their
sequential position in the queue like other events.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Reviewed-by: Martin Roukala <martin.roukala@mupuf.org>
2023-02-28 22:43:37 -08:00
Sultan Alsawaf 18b14ea1f6 modesetting: Introduce ms_tearfree_is_active_on_crtc helper
There is more than one place with the confusing TearFree state check for a
CRTC. Instead of open-coding the TearFree check everywhere, introduce a
helper, ms_tearfree_is_active_on_crtc, to cover the TearFree state checks.

Suggested-by: Martin Roukala <martin.roukala@mupuf.org>
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Reviewed-by: Martin Roukala <martin.roukala@mupuf.org>
2023-02-28 22:43:37 -08:00
Sultan Alsawaf 8b5fd55658 modesetting: Improve TearFree state check in ms_present_check_flip
Check that the VT is owned and that the CRTC is on before exporting info to
Present stating that TearFree is available. Also, since `trf->buf[0].px` is
checked, the `ms->drmmode.tearfree_enable` check is redundant and can
therefore be removed.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Reviewed-by: Martin Roukala <martin.roukala@mupuf.org>
2023-02-28 22:43:37 -08:00
Sultan Alsawaf 35975d9054 modesetting: Fix memory leak on ms_do_pageflip error
The event allocation for ms_do_pageflip is leaked on error because callers
of ms_do_pageflip have no way of knowing whether or not a page flip
succeeded for any CRTCs. If a page flip succeeded for at least one CRTC,
then it's not safe for the caller to free the event allocation, and the
allocation won't be leaked. The event allocation is only leaked when not a
single CRTC's page flip succeeded.

Since all callers of ms_do_pageflip allocate the event pointer, and all of
them intentionally leak the event allocation when ms_do_pageflip returns an
error, just free the event pointer inside ms_do_pageflip when a page flip
doesn't succeed for any CRTC.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Reviewed-by: Martin Roukala <martin.roukala@mupuf.org>
2023-02-28 22:43:37 -08:00
Sultan Alsawaf be864d8e18 modesetting: Pass CRTC pointer to TearFree flip handlers
The CRTC pointer will soon be needed in the TearFree flip handlers, so pass
it in instead of passing in drmmode_tearfree_ptr.

No functional change.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Reviewed-by: Martin Roukala <martin.roukala@mupuf.org>
2023-02-28 22:43:37 -08:00
Sultan Alsawaf 1fd9d79ae0 modesetting: Pass reference CRTC pointer to ms_do_pageflip
Rather than passing the reference CRTC's vblank pipe to ms_do_pageflip,
just pass the pointer to the reference CRTC directly instead. This is
clearer and more useful than the vblank pipe, since the vblank pipe is only
used to identify whether or not a given CRTC is the reference CRTC.

No functional change.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Reviewed-by: Martin Roukala <martin.roukala@mupuf.org>
2023-02-28 22:43:37 -08:00
Sultan Alsawaf 7288b4d105 modesetting: Remove redundant GLAMOR_HAS_GBM #ifdef from ms_do_pageflip
This #ifdef is redundant since ms_do_pageflip is already enclosed within a
larger GLAMOR_HAS_GBM #ifdef.

No functional change.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Reviewed-by: Martin Roukala <martin.roukala@mupuf.org>
2023-02-28 22:43:37 -08:00
Alan Coopersmith d6b20f5e36 Remove "All rights reserved" from Oracle copyright notices
Oracle no longer includes this term in our copyright & license notices.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2023-02-25 09:40:41 -08:00
Austin Shafer 5468123822 Add DRM platform for BSD
This moves lnx_platform.c to the shared directory and adds it to
the BSD build. This is needed for PRIME render offload.

Acked-by: Olivier Fourdan <ofourdan@redhat.com>
2023-02-23 15:47:19 +00:00
Jocelyn Falempe 6969782b69 x86/logind fix suspend/resume when there are no input devices
Make sure info->active and info->vt_active are false after
dropping drm master.
Normally, this is done when pausing the first input device, so it
breaks when there are no input device at all.

Fixes: da9d012a9 ("xf86/logind: Fix drm_drop_master before vt_reldisp")
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1387
Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
2023-01-09 13:38:25 +00:00
Peter Hutterer 412777664a Disallow byte-swapped clients by default
The X server swapping code is a huge attack surface, much of this code
is untested and prone to security issues. The use-case of byte-swapped
clients is very niche, so let's disable this by default and allow it
only when the respective config option or commandline flag is given.

For Xorg, this adds the ServerFlag "AllowByteSwappedClients" "on".
For all DDX, this adds the commandline options +byteswappedclients and
-byteswappedclients to enable or disable, respectively.

Fixes #1201

https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1029

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-01-06 11:59:37 +10:00
Olivier Fourdan 24c5d8f17e xfree86: Fix videodrv ABI version
Commit 5145742fb6 accidentally bumped the videodrv ABI version from 26.0
to 26.6 in one go.

Change it back to 26.1 as per the documented process for minor additions.

Fixes: 5145742fb6 - randr: introduce rrCrtcGetInfo DDX function
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2023-01-04 11:56:38 +01:00
Minh Phan 5145742fb6 randr: introduce rrCrtcGetInfo DDX function
This allows rrCrtcGetInfo to override the values in the XRRCrtcGetInfo
reply. One use case is to allow Xwayland to return the current emulated
mode for the specific client instead of the global mode.

Signed-off-by: Minh Phan <phanquangminh217@gmail.com>
Acked-by: Olivier Fourdan <ofourdan@redhat.com>
2023-01-03 23:27:29 +07:00
Jeremy Huddleston Sequoia 3cb3024fea dix: Remove pScratchPixmap and other associated ABI changes
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2022-12-30 01:32:25 +00:00
Olivier Fourdan 6ac3178c33 modesetting: Log whether atomic modesetting is enabled
If atomic modesetting is to be enabled in the configuration file, log
whether this is supported and eventually enabled or disabled.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Martin Roukala <martin.roukala@mupuf.org>
2022-12-20 10:10:59 +01:00
Olivier Fourdan c066a46aac modesetting: Document the "Atomic" option
The modesetting driver has atomic modesetting disabled by default but
can be enabled (if supported) using a configuration option.

Add this option in the man page.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Martin Roukala <martin.roukala@mupuf.org>
2022-12-20 10:10:59 +01:00
Sultan Alsawaf a94dd95369 modesetting: add support for TearFree page flips
This adds support for TearFree page flips to eliminate tearing without the
use of a compositor. It allocates two shadow buffers for each CRTC, a back
buffer and a front buffer, and uses damage tracking to minimize excessive
copying between buffers and skip unnecessary flips when the screen's
contents remain unchanged. It works on transformed screens too, such as
rotated and scaled CRTCs.

When PageFlip is enabled, TearFree won't force fullscreen DRI clients to
synchronize their page flips to the vblank interval.

TearFree is disabled by default.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
2022-12-19 23:56:27 -08:00
Sultan Alsawaf 2d272b705c modesetting: coalesce vblank events to avoid DRM event queue exhaustion
The DRM event queue in the kernel is quite small and can be easily
exhausted by DRI clients. When the event queue is full, that means nothing
can be queued onto it anymore, which can lead to incorrect presentation
times for DRI clients and failure when attempting to queue a page flip.

To make matters worse, once an event is placed onto the kernel's event
queue, there's no straightforward way to prematurely remove it from the
kernel's event queue in userspace, which means that aborting a sequence
number doesn't free up space in the event queue.

Since vblank events from DRI clients are the largest consumers of the
event queue, and since it's often easy to know the desired target MSC of
their vblank events without querying the kernel for a CRTC's current MSC,
we can coalesce vblank events occurring at the same MSC such that only one
of them is placed onto the kernel's event queue, instead of allowing
duplicate vblank events to pollute the event queue.

This is achieved by tracking the next kernel-queued event's MSC on a
per-CRTC basis and then running all of that CRTC's vblank event handlers
which have reached their target MSC when the queued MSC is signaled.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
2022-12-19 23:56:27 -08:00