Commit Graph

3659 Commits

Author SHA1 Message Date
Alan Coopersmith
008e3482de Strip trailing whitespace from source files
Performed with: `git ls-files | xargs perl -i -p -e 's{[ \t]+$}{}'`

`git diff -w` & `git diff -b` show no diffs from this change

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati/-/merge_requests/32>
2025-08-12 17:22:33 -07:00
Alan Coopersmith
7fb2787108 Revert "use dixDestroyPixmap() instead of direct driver call"
This reverts commit c610c03736

Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati/-/merge_requests/31>
2025-06-14 09:00:14 -07:00
Alan Coopersmith
d0ddf971d0 ati.man & radeon.man: Improve man page formatting
More closely follow common style as described on
https://man7.org/linux/man-pages/man7/man-pages.7.html
and fix warnings raised by `mandoc -T lint` and `groff -rCHECKSTYLE=10`

Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati/-/merge_requests/30>
xfree-xf86-video-ati-22.0.0.1
2025-06-01 16:56:59 -07:00
Enrico Weigelt, metux IT consult
c610c03736 use dixDestroyPixmap() instead of direct driver call
Direct calls to ScreenRec->DestroyPixmap() blocks cleaning up the wrapping
jungle, so use the proper dix function instead - except when calling down the
chain where we had wrapped ourselves - and protecting those against NULL, so
we can move subsys-provided functions out of that chain.

See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1754
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati/-/merge_requests/28>
2025-02-06 22:58:36 +00:00
Alan Coopersmith
888b33c679 configure: Update links to use gitlab instead of anongit & bugzilla
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati/-/merge_requests/27>
2024-09-29 11:09:55 -07:00
Alan Coopersmith
d799dba35a radeon.man: Update links to use gitlab & oftc instead of cgit & freenode
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati/-/merge_requests/27>
2024-09-29 11:07:23 -07:00
nia
b65036af74 Avoid namespace collision: rename bswap_XX to radeon_bswap_XX
xorg-server includes its own bswap_16, bswap_32 etc macros in
its misc.h. This is transcluded after radeon.h in some files.

If the operating system defines bswap_XX in a way that is
unsuitable for a function name (e.g. on NetBSD), this results
in build failures.

Signed-off-by: Nia Alarie <nia@NetBSD.org>
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati/-/merge_requests/23>
2024-06-02 18:41:52 +00:00
nia
1f81004bfc radeon_accel: Avoid unaligned access in RADEONCopySwap
from NetBSD (via Martin Husemann), this helps the radeon driver
work on sparc64 hardware.

Signed-off-by: Nia Alarie <nia@NetBSD.org>
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati/-/merge_requests/22>
2024-05-04 02:12:26 +02:00
Alan Coopersmith
8e5a43d248 radeon_dri2_create_buffer2: remove unused variable tiling
The code that used this was removed in commit 615033f2b5
Recent versions of clang flag this:
radeon_dri2.c:114:14: error: variable 'tiling' set but not used
 [-Werror,-Wunused-but-set-variable]
    uint32_t tiling = 0;
             ^

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati/-/merge_requests/19>
2024-03-08 22:04:51 +00:00
Alan Coopersmith
47a145bb4a RADEONInit3DEngineInternal: remove unused variable gb_tile_config
Prior to commit 18d5ae3bd9
gb_tile_config was used in OUTREG(R300_GB_TILE_CONFIG, gb_tile_config);
but since then it's unused, and is flagged by recent clang versions:

radeon_accel.c:209:14: error: variable 'gb_tile_config' set but not used
 [-Werror,-Wunused-but-set-variable]
    uint32_t gb_tile_config, vap_cntl;
             ^

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati/-/merge_requests/19>
2024-03-08 22:04:51 +00:00
Alan Coopersmith
adf7ca9fca Add xserver-21.1 branch to CI build matrix
Also updates build container from Debian buster (10) to bookworm (12),
which in turn requires working around glvnd shipping gl.pc with a much
lower version number than Mesa had.

v2: use Debian bookworm (12) instead of bullseye (11)

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati/-/merge_requests/19>
2024-03-08 22:04:51 +00:00
Alan Coopersmith
7ed3b8e582 README.md: updates to match the style of the xf86-video-amdgpu README
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2024-02-24 14:42:21 -08:00
Douglas R. Reno
c99d634132 Update README.md to use proper bug URL 2024-02-24 14:39:12 -08:00
Matt Turner
0c01893774 Bump version for 22.0.0 release
Signed-off-by: Matt Turner <mattst88@gmail.com>
xf86-video-ati-22.0.0
2023-04-25 14:40:08 -04:00
Matthieu Herrb
7a6a34af02 Don't set SourceValidate pointer to NULL
inspired from similar code in amdgpu, fixes a crash when xrandr(1)
is invoqued with X server 21.1.1

Signed-off-by: Matthieu Herrb <matthieu.herrb@laas.fr>
2022-07-30 17:37:48 +00:00
Alan Coopersmith
983a779b7a radeon_glamor_wrappers.c: Convert from ISO-8859-1 to UTF-8
Allows Flawfinder to analyze source instead of erroring out on encoding

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-07-23 18:58:08 -07:00
Alan Coopersmith
a25ca015e6 gitlab CI: enable gitlab's builtin static analysis
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-07-23 18:58:08 -07:00
Alan Coopersmith
7b94009754 gitlab CI: enable commit & merge request checks
Uses ci-fairy from freedesktop/ci-templates

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-07-23 18:58:08 -07:00
Alan Coopersmith
8fc442d6a6 Fix spelling/wording issues
Found by using:
    codespell --builtin clear,rare,usage,informal,code,names

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-04-06 23:37:35 +00:00
Alan Coopersmith
11d549d591 Build xz tarballs instead of bzip2
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-01-22 09:24:46 -08:00
Michel Dänzer
5eba006e41 Only include dri.h with older versions of xserver
Not needed anymore with current versions.
2021-05-10 10:46:53 +02:00
Michel Dänzer
ecced3b3c6 Add GitLab CI pipeline
Based on xf86-video-amdgpu, but applying experience gained in the
meantime in other projects and taking advantage of new features
available with current versions of GitLab.
2021-03-26 17:55:04 +01:00
Michel Dänzer
77d9ab03ca Guard local variable info only used with glamor
Fixes compiler warning with glamor disabled:

radeon_dri2.c: In function 'radeon_dri2_exchange_buffers':
radeon_dri2.c:732:19: error: unused variable 'info' [-Werror=unused-variable]
     RADEONInfoPtr info = RADEONPTR(xf86ScreenToScrn(screen));
                   ^~~~
2021-03-26 17:42:50 +01:00
Michel Dänzer
3c7c84ed49 Guard local variable priv only used with glamor
Fixes compile errors with glamor disabled:

../../src/radeon_present.c: In function ‘radeon_present_check_flip’:
../../src/radeon_present.c:281:21: error: invalid use of undefined type ‘struct radeon_pixmap’
  281 |     if (priv && priv->fb_failed)
      |                     ^~
../../src/radeon_present.c:288:19: error: invalid use of undefined type ‘struct radeon_pixmap’
  288 |  if (priv && !priv->fb_failed) {
      |                   ^~
../../src/radeon_present.c:292:10: error: invalid use of undefined type ‘struct radeon_pixmap’
  292 |      priv->fb_failed = TRUE;
      |          ^~
2021-03-26 17:42:50 +01:00
Dave Airlie
8da3e4561e ati: cleanup terminology to use primary/secondary
The X server changed some API/ABIs here.

Based on amdgpu patch by Michel
2020-07-13 09:16:47 +10:00
Niclas Zeising
3845392426 Fix return value check of drmIoctl()
When the drmModeSetCursor2() call was replaced with bare drmIoctl() call in
92df7097, a bug was introduced.  With the use of drmModeSetCursor2(),
the return value from drmIoctl() (which calls ioctl()) were mangled, if
they were negative, they were replaced by -errno by a wrapper function
in xf86drMode.c in libdrm.  After replacing drmModeSetCursor2() with the
call to drmIoctl(), this mangling no longer happens, and we need to
explicitly check if the call to drmIoctl() fails, which is indicated by
returning -1, and then why it failed, by checking errno.
If the error indicated by errno is EINVAL, then we can't use the
DRM_IOCTL_MODE_CURSOR2 ioctl(), and need to fall back to the
DRM_IOCTL_MODE_CURSOR ioctl().

This bug can manifest itself by an invisible hw cursor on systems where the
DRM_IOCTL_MODE_CURSOR2 is not implemented by the graphics driver.

Credit also to Alexey Dokuchaev for help with developing the fix and
testing.

This fixes #190

Signed-off-by: Niclas Zeising <zeising@daemonic.se>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2020-04-14 18:53:26 +02:00
Alexey Sheplyakov
c0eb5dbd9c Don't crash X server if GPU acceleration is not available
Commit d1d8e3c8d0 causes X server
to fail on startup when GPU acceleration is not working (or is
disabled). The reason is that `radeon_get_pixmap_bo` function
gets called too early (before EXA has been initialized) and
fails with an assert:

 #0  __GI_raise (sig=<optimized out>) at ../sysdeps/unix/sysv/linux/raise.c:50
 #1  0x76ab1c6c in __GI_abort () at abort.c:79
 #2  0x76ac0b64 in __assert_fail_base (fmt=0x76bfbce4 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x7658c80c "key->initialized", file=<optimized out>, line=121,
     function=0x7658d040 <__PRETTY_FUNCTION__.10607> "dixGetPrivateAddr") at assert.c:92
 #3  0x76ac0c0c in __GI___assert_fail (assertion=0x7658c80c "key->initialized", file=0x7658c9d0 "../include/privates.h", line=121,
     function=0x7658d040 <__PRETTY_FUNCTION__.10607> "dixGetPrivateAddr") at assert.c:101
 #4  0x76579e6c in dixGetPrivateAddr (key=<optimized out>, key=<optimized out>, privates=<optimized out>) at ../include/privates.h:121
 #5  0x7657a954 in dixGetPrivateAddr (key=<optimized out>, key=<optimized out>, privates=<optimized out>) at exa.c:70
 #6  dixGetPrivate (key=<optimized out>, privates=<optimized out>) at ../include/privates.h:136
 #7  exaGetPixmapDriverPrivate (pPix=<optimized out>) at exa.c:68
 #8  0x7623d460 in radeon_get_pixmap_bo (pPix=0x71c1b8) at radeon.h:804
 #9  radeon_get_pixmap_handle (pixmap=0x71c1b8, handle=0x7fa22328) at radeon_bo_helper.c:357
 #10 0x76244458 in radeon_pixmap_get_fb (pix=0x71c1b8) at radeon.h:886
 #11 drmmode_set_mode_major (crtc=0x691860, mode=0x69191c, rotation=<optimized out>, x=<optimized out>, y=<optimized out>) at drmmode_display.c:918
 #12 0x762467e8 in drmmode_set_desired_modes (pScrn=0x67c678, drmmode=<optimized out>, set_hw=1) at drmmode_display.c:3128
 #13 0x0047bfa4 in MapWindow (client=0x669ec8, pWin=0x7206c0) at window.c:2722
 #14 MapWindow (pWin=0x7206c0, client=0x669ec8) at window.c:2665
 #15 0x00449650 in dix_main (argc=3, argv=0x7fa22604, envp=<optimized out>) at main.c:247
 #16 0x76ab2198 in __libc_start_main (main=0x42db10 <main>, argc=3, argv=0x7fa22604, init=<optimized out>, fini=0x606434 <__libc_csu_fini>, rtld_fini=0x77229930 <_dl_fini>,
     stack_end=0x7fa225e0) at libc-start.c:308
 #17 0x0042db80 in __start () at ../sysdeps/mips/start.S:110

Don't call `exaGetPixmapDriverPrivate` if the acceleration (EXA) is not
enabled [yet] to avoid the problem.

Closes: https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati/issues/188
Closes: https://bugzilla.altlinux.org/show_bug.cgi?id=37539
2020-02-10 15:55:37 +00:00
Michel Dänzer
4d84cf438e Handle NULL fb_ptr in pixmap_get_fb
This can happen when HW acceleration is disabled.

Fixes https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati/issues/188
2020-02-10 15:53:48 +00:00
Adam Jackson
f223035f4f Fix link failure with gcc 10
Without the 'extern' this looks like a definition not just a
declaration, in every file that includes the header. gcc 10 is stricter
about this kind of multiple definition.

Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2020-02-05 11:39:53 -05:00
Michel Dänzer
b9bd8097e1 Bump version for 19.1.0 release xf86-video-ati-19.1.0 2019-10-15 17:54:12 +02:00
Michel Dänzer
2faaecc69b Don't unreference FBs of pixmaps from different screens in LeaveVT
FindClientResourcesByType finds pixmaps from all screens, but trying to
process ones from other screens here makes no sense and likely results
in a crash or memory corruption.

Fixes: 06a4654841 ("Make all active CRTCs scan out an all-black
                      framebuffer in LeaveVT")
2019-09-25 09:23:25 +02:00
Michel Dänzer
2cbbd8648c Don't set up black scanout buffer if LeaveVT is called from CloseScreen
Avoids a crash described in
https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgpu/merge_requests/43#note_223718

(Ported from amdgpu commit 5b8bc9fc505c551dcd9b0ed5ab835a49fa4f9fda)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2019-09-20 18:47:02 +02:00
Michel Dänzer
c7ed12cb2e Don't disable page flipping completely with SW cursor
Even with SW cursor, page flipping can be used while no X cursor is
visible.

Occurred to me in the context of xorg/xserver#828.
(Ported from amdgpu commit 87f41ace4920fd2069794211683659eb25b025a6)
2019-07-18 18:14:48 +02:00
Michel Dänzer
33803c85f7 present: Check that we can get a KMS FB for flipping
This can legitimately fail if the pixmap's storage is shared from
another device, e.g. when using PRIME render offloading.

(Ported from amdgpu commit 7d3fef72e0c871e1677e9e544f4cae5e238b5c52)
2019-06-25 17:46:23 +02:00
Michel Dänzer
fee737e828 Remove dri2_drawable_crtc parameter consider_disabled
All callers were passing TRUE.

(Ported from amdgpu commit ea19a5207054bb159fc7fb6d88e0ceb10c3da010)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2019-06-14 16:03:45 +02:00
Michel Dänzer
2a3f2d2089 dri2: Re-use previous CRTC when possible if pick_best_crtc returns NULL
This way, the MSC will continue ticking at the rate of (the last mode
which was enabled for) that CRTC, instead of the client running
unthrottled.

(Ported from amdgpu commit 3109f088fdbd89c2ee8078625d4f073852492656)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2019-06-14 16:03:38 +02:00
Flora Cui
d5f5bc5846 dri2: reply to client for WaitMSC request in any case
otherwise client would wait for reply forever and desktop appears hang.

Signed-off-by: Flora Cui <flora.cui@amd.com>
(Ported from amdgpu commit fb06fb814700a47464abd756e1111dcc76d0d776)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2019-06-14 11:20:12 +02:00
Michel Dänzer
f758908db4 dri3: Always flush glamor before sharing pixmap storage with clients
Even if glamor_gbm_bo_from_pixmap / glamor_fd_from_pixmap themselves
don't trigger any drawing, there could already be unflushed drawing to
the pixmap whose storage we share with a client.

(Ported from amdgpu commit 4b17533fcb30842caf0035ba593b7d986520cc85)
Acked-by: Alex Deucher <alexander.deucher@amd.com>
2019-05-09 12:35:37 +02:00
Michel Dänzer
d1d8e3c8d0 Retry get_fb_ptr in get_fb
If get_fb_ptr returns NULL, try again after pixmap_get_handle, it should
work then.

Fixes spurious Present page flipping failures using "normal" pixmaps
which aren't shared with direct rendering clients, e.g. with a
compositor using the RENDER extension.

Bugzilla: https://bugs.freedesktop.org/110417
(Ported from amdgpu commit bf61e6d7ac1a5754b1026d7f80acf25ef622c491)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2019-04-24 12:25:39 +02:00
Michel Dänzer
36703f66c3 Bump version for 19.0.1 release xf86-video-ati-19.0.1 2019-03-19 18:01:02 +01:00
Dave Airlie
4407c78bd8 modesetting: add tile property support
This adds tiling support to the driver, it retrieves the tile info from
the kernel and translates it into the server format and exposes the
property.

(Ported from xserver commits 8fb8bbb3062f1a06621ab7030a9e89d5e8367b35
 and 6abdb54a11dac4e8854ff94ecdcb90a14321ab31)
(Ported from amdgpu commit 6ee857726166f495abcd68e4ff60e3a09593d079)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2019-03-15 12:42:04 +01:00
Michel Dänzer
79bc0e054f Use radeon_finish in drmmode_crtc_scanout_update
radeon_glamor_finish only works if we're using glamor, otherwise it'll
crash.

Fixes: ce7db51020 "Cancel pending scanout update in drmmode_crtc_scanout_update"
Bug: https://bugs.debian.org/924540
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2019-03-14 11:10:51 +01:00
Michel Dänzer
f6cd4a67d7 Revert "glamor: Avoid glamor_create_pixmap for pixmaps backing windows"
This reverts commit 274703087f.

Reports of visual corruption were bisected to this, e.g.
https://bugs.archlinux.org/task/61941 . I can reproduce this with Turks,
but not with Bonaire. I assume it's a Mesa/glamor bug, but let's revert
for now.

Acked-by: Alex Deucher <alexander.deucher@amd.com>
2019-03-08 11:48:10 +01:00
Michel Dänzer
0d132d99e0 Bump version for 19.0.0 release xf86-video-ati-19.0.0 2019-03-06 17:48:42 +01:00
Michel Dänzer
c301b8af25 dri2: Call drm_queue_handle_deferred in dri2_deferred_event
drm_queue_handler just puts the event on the signalled list; without
calling drm_queue_handle_deferred, actual processing of the event may be
delayed indefinitely, e.g. until another event arrives from the kernel.

This could result in DRI2 clients hanging during DPMS off.

Fixes: ba83a866af "Add radeon_drm_handle_event wrapper for
                     drmHandleEvent"
(Ported from amdgpu commit 09be74a3d1dd9604336d9a27f98d132b262dcbaf)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2019-03-04 17:07:14 +01:00
Michel Dänzer
705020b624 present: Check that flip and screen pixmap pitches match
If they don't, flipping will result in corrupted display.

Test case:

* Run Xorg at 1920x1080 with no window manager
* glxgears -geometry 2048x1080

The Present extension code in xserver 1.21 will check for this.

(Ported from amdgpu commit a636f42b496b0604ca00a144690ece61d1a88a27)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2019-03-01 18:23:30 +01:00
Michel Dänzer
15697ee242 Keep waiting for a pending flip if drm_handle_event returns 0
drm_wait_pending_flip stopped waiting if drm_handle_event returned 0,
but that might have processed only some unrelated DRM events. As long as
the flip is pending, we have to keep waiting for its completion event.

Noticed while working on the previous fix.

(Ported from amdgpu commit 9045fb310f88780e250e60b80431ca153330e61b)
2019-02-11 12:12:34 +01:00
Michel Dänzer
227123de3d Call drmHandleEvent again if it was interrupted by a signal
drmHandleEvent can be interrupted by a signal in read(), in which case
it doesn't process any events but returns -1, which
drm_handle_event propagated to its callers. This could cause the
following failure cascade:

1. drm_wait_pending_flip stopped waiting for a pending flip.
2. Its caller cleared drmmode_crtc->flip_pending before the flip
   completed.
3. Another flip was attempted but got an unexpected EBUSY error because
   the previous flip was still pending.
4. TearFree was disabled due to the error.

The solution is to call drmHandleEvent if it was interrupted by a
signal. We can do that in drm_handle_event, because when that is called,
either it is known that there are events ready to be processed, or the
caller has to wait for events to arrive anyway.

Bugzilla: https://bugs.freedesktop.org/109364
(Ported from amdgpu commit 3ff2cc225f6bc08364ee007fa54e9d0150adaf11)
2019-01-28 18:24:41 +01:00
Michel Dänzer
1bfdccf763 Only update drmmode_crtc->flip_pending after actually submitting a flip
And only clear it if it matches the framebuffer of the completed flip
being processed.

Fixes

 (WW) RADEON(0): flip queue failed: Device or resource busy
 (WW) RADEON(0): Page flip failed: Device or resource busy
 (EE) RADEON(0): present flip failed

due to clobbering drmmode_crtc->flip_pending.

Reproducer: Enable TearFree, run warzone2100 fullscreen, toggle
Vertical sync on/off under Video Options. Discovered while investigating
https://bugs.freedesktop.org/109364 .

(Ported from amdgpu commit e72a02ba1d35743fefd939458b9d8cddce86e7f5)
2019-01-28 18:11:10 +01:00
Michel Dänzer
dcd3527299 Don't allow TearFree scanout flips to complete in the same vblank period
We were using a relative target of 0, meaning "complete the flip ASAP".
This could result in the flip sometimes, but not always completing in
the same vertical blank period where the corresponding drawing occurred,
potentially causing judder artifacts with applications updating their
window contents synchronized to the display refresh. A good way to test
this is the vsynctester.com site in a windowed browser, where the judder
results in the large "VSYNC" text intermittently appearing red or cyan
instead of the expected gray.

To avoid this, use a relative target MSC of 1, meaning that if a
vertical blank period is in progress, the flip will only complete in the
next one.

Reported by Julian Tempel and Brandon Wright in
https://bugs.freedesktop.org/106175 .

(Ported from amdgpu commit a1b479c7d0066c481af920f297d6af9009dda11e)
2019-01-28 18:08:35 +01:00