Commit Graph

3510 Commits

Author SHA1 Message Date
Michel Dänzer
16954fab59 Call RADEONFreeRec from RADEONFreeScreen_KMS even if info == NULL
It's safe now.

(Ported from amdgpu commit c9bd1399a13cea2e1331af2c826ca054b88db071)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2018-02-15 17:23:49 +01:00
Michel Dänzer
6b44b8c584 Don't call RADEONFreeRec from RADEONPreInit_KMS
If the latter fails, Xorg will call RADEONFreeScreen_KMS, which calls
the former.

(Ported from amdgpu commit 103b7285845b786929fb509083c57e074c48f9be)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2018-02-15 17:23:30 +01:00
Michel Dänzer
8a55e66bfd Don't use RADEONEntPriv in RADEONFreeRec
It crashes if info == NULL.

(Ported from amdgpu commits fb8444e731765588c0ff1e9053c1c7b73f5f0907 &
 cfccf4c4e7e5c73fe4040fabeb1b43283cf29b33)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2018-02-15 17:23:02 +01:00
Michel Dänzer
703cbb7177 glamor: Allow depth 30 with Xorg >= 1.19.99.1
Corresponding to amdgpu commit 6aee5770fb913713bb1b9a1af8f0d0892a66f21a.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2018-02-14 17:28:10 +01:00
Michel Dänzer
733f606dd6 Always use screen depth/bpp for KMS framebuffers
DRI clients can use depth 32 pixmaps while the screen is depth 24, in
which case page flipping would fail.

Reported-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-and-Tested-by: Mario Kleiner <mario.kleiner.de@gmail.com>
2018-01-25 16:59:30 +01:00
Mario Kleiner
8312442604 Make XvMC extension initialize at depth 30.
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2018-01-25 16:47:59 +01:00
Mario Kleiner
2d171c892d Add missing depth 30 -> cpp=4 handling for DRI2.
Missing this apparently didn't cause any ill side effects, only a bit of
confusion when looking at xtrace's of DRI2 clients.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2018-01-25 16:47:49 +01:00
Mario Kleiner
574bfab4bf Support exa screen color depth 30 on Linux 3.16 and later. (v2)
Linux 3.16's radeon-kms introduced 10 bpc fb support.
Currently, as of X-Server 1.19, this works with exa accel,
but not yet when using glamor acceleration.

v2: Style fixes, check for glamor first, as suggested
    by Michel.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2018-01-22 12:11:25 +01:00
Fredrik Höglund
ee7e6c2598 exa: Accelerate ARGB2101010 pictures
Tested by Mario on a Radeon HD 4000 series for the r600
exa path, and on Radeon HD 5770 for the evergreen exa
path.

Signed-off-by: Fredrik Höglund <fredrik@kde.org>
Reviewed-and-Tested-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2018-01-22 12:10:41 +01:00
Mario Kleiner
1f1d4b1fa7 Skip xf86HandleColormaps() at color depth 30. (v2)
The hardware gamma luts get bypassed at color
depth 30 anyway, so skip their setup.

v2: Also don't hook up drmmode_crtc_gamma_set()
    to .gamma_set for a screen with depth 30,
    so the server can spare itself the effort of
    updating and setting unused cluts.
    Suggested by Michel.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2018-01-22 12:08:42 +01:00
Mario Kleiner
21f6753462 Define per x-screen individual drmmode_crtc_funcs
This allows to en-/disable some functions depending on individual screen
settings.

Prep work for more efficient depth 30 support.

Suggested-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2018-01-22 12:05:51 +01:00
Michel Dänzer
1fe8ca7597 Keep track of how many SW cursors are visible on each screen
And use this to determine when we cannot use page flipping for DRI
clients. We previously did this based on whether the HW cursor cannot
be used on at least one CRTC, which had at least two issues:

* Even while the HW cursor cannot be used, no SW cursor may actually be
  visible (e.g. because all cursors are disabled), in which case we can
  use page flipping for DRI clients anyway
* Even while the HW cursor can be used, there may be SW cursors visible
  from non-core pointer devices, in which case we cannot use page
  flipping for DRI clients anyway

(Ported from amdgpu commit 69e20839bfeb3ee0b0a732d72de0a32d6c5435fc)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-12-28 15:17:56 +01:00
Michel Dänzer
b4ce8913ac Move cursor related ScreenInit calls into RADEONCursorInit_KMS
And bail if xf86_cursors_init fails.

(Ported from amdgpu commit dfccaa7043ccb157a1f8be7313123792bb7e7001)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-12-27 17:05:26 +01:00
Michel Dänzer
ee907e9b95 Add radeon_dirty_src_drawable helper
Allows tidying up radeon_dirty_src_equals and redisplay_dirty slightly.

(Cherry picked from amdgpu commit 1d65ac395971571094df21ca0408d5972c6b56ec)
Acked-by: Alex Deucher <alexander.deucher@amd.com>
2017-12-01 15:49:11 +01:00
Joakim Tjernlund
fccfd75ecf Fix non GLAMOR build
Non GLAMOR builds needs pRADEONEnt so move the USE_GLAMOR define
down to make pRADEONEnt defined in this case.

Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2017-11-27 11:13:10 +01:00
Michel Dänzer
15350bd553 Use correct ScrnInfoPtr in redisplay_dirty
We used the destination pixmap's screen for flushing drawing commands.
But when we are the master screen, the destination pixmap is from the
slave screen.

Fixes crash when the slave screen isn't using the same acceleration
architecture as us.

Bugzilla: https://bugs.freedesktop.org/103613
Fixes: 01b040b4a8 ("Adapt to PixmapDirtyUpdateRec::src being a
                     DrawablePtr")
(Ported from amdgpu commit 3a4f7422913093ed9e26b73ecd7f9e773478cb1e)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-11-15 18:01:29 +01:00
Daniel Martin
6441210bc5 modesetting: Check crtc before searching link-status property
No need to lookup the link-status property if we don't have a crtc.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
(Ported from xserver commit 8d7f7e24261e68459e6f0a865e243473f65fe7ad)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-11-01 18:42:33 +01:00
Keith Packard
cafcb55768 modesetting: Skip no-longer-present connectors when resetting BAD links
Outputs may have NULL mode_output (connector) pointers if the
connector disappears while the server is running. Skip these when
resetting outputs with BAD link status.

(Ported from xserver commit 37f4e7651a2fd51efa613a08a1e705553be33e76)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-10-30 18:41:31 +01:00
Michel Dänzer
0cd14777b7 Always call drmModeFreeProperty after drmModeGetProperty
We were not doing so in all cases, leaking memory allocated by the
latter.

(Cherry picked from amdgpu commit f6b39bcd45cb06976ba8a3600df77fc471c63995)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-10-30 18:41:01 +01:00
Michel Dänzer
84c7d9c1c7 Call TimerFree for timer created in LeaveVT
We were leaking the memory allocated by TimerSet.

(Ported from amdgpu commit 84aad09f18fed6b52b0c073f0bbd675a6de07807)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-10-30 18:40:46 +01:00
Michel Dänzer
d588015f4f Free memory returned by xf86GetEntityInfo
We were leaking it.

(Ported from amdgpu commit cfccf4c4e7e5c73fe4040fabeb1b43283cf29b33)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-10-30 18:40:27 +01:00
Michel Dänzer
ec90c94881 Free pRADEONEnt memory in RADEONFreeRec
We were leaking it.

(Inspired by amdgpu commit 9d84934309e4ccd9a43c73d958b8ff10ef2fc990)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-10-20 16:51:16 +02:00
Michel Dänzer
b93ae9b159 Unreference pixmap's FB with EXA as well in radeon_set_pixmap_bo
Not doing so resulted in DRI2 page flips not actually changing the FB
being scanned out, showing intermittent flicker of the "back" buffer
rendering.

Bugzilla: https://bugs.freedesktop.org/102643
Fixes: 55e513b978 "Use reference counting for tracking KMS framebuffer
                     lifetimes"
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-10-20 10:28:37 +02:00
Darren Salt
61113768bd Clarify when TearFree is automatically enabled.
(Ported from amdgpu commit 2f72be038d22c54620e436af30121dd89f79a003)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-10-19 18:17:07 +02:00
Michel Dänzer
7d43535409 Bail if there's a problem with ShadowFB
If we hit a problem while setting up ShadowFB, just carrying on trying
to set up HW acceleration instead is unlikely to work.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-10-04 11:11:33 +02:00
Michel Dänzer
b71836c996 Post-release version bump 2017-10-04 11:05:49 +02:00
Michel Dänzer
34da04daec Fix VT switching with ShadowFB
We were trying to call acceleration specific functions from LeaveVT.
Instead, memset the scanout buffer to all 0 in LeaveVT and allocate a
new one in EnterVT.

Bugzilla: https://bugs.freedesktop.org/102948
Fixes: 06a4654841 ("Make all active CRTCs scan out an all-black
                      framebuffer in LeaveVT")
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-10-03 12:51:05 +02:00
Michel Dänzer
f9aca8c1a7 Bump version for 7.10.0 release xf86-video-ati-7.10.0 2017-09-08 17:02:59 +09:00
Michel Dänzer
5cdd334b34 Require xserver >= 1.13
xserver 1.13.0 was released on September 6th, 2012, almost 5 years ago.

This allows cleaning up a bunch of backwards compatibility code.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2017-08-30 18:48:19 +09:00
Michel Dänzer
9d9c565c84 Use a timer for unreferencing the all-black FB
The timer fires 1 second after LeaveVT. This gives the next DRM master
enough time to set up scanout of its own buffers.

Fixes prolonged intermittent black screen when switching from Xorg to
e.g. the GDM Wayland mode login VT.

Fixes: 06a4654841 ("Make all active CRTCs scan out an all-black
                      framebuffer in LeaveVT")
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-29 18:07:51 +09:00
Michel Dänzer
e4a3df19d5 Remove drmmode_scanout_free
Not used anymore.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-29 16:36:01 +09:00
Michel Dänzer
06a4654841 Make all active CRTCs scan out an all-black framebuffer in LeaveVT
And destroy all other FBs. This is so that other DRM masters can only
get access to this all-black FB, not to any other FB we created, while
we're switched away and not DRM master.

Fixes: 55e513b978 ("Use reference counting for tracking KMS
                      framebuffer lifetimes")
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-29 16:35:30 +09:00
Michel Dänzer
7f0cd68d1b Create radeon_master_screen helper
Preparatory, no functional change intended yet.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-29 16:35:16 +09:00
Michel Dänzer
20f6b56fdb Create radeon_pixmap_get_fb_ptr helper
Preparatory, no functional change intended yet.

Also inline radeon_pixmap_create_fb into radeon_pixmap_get_fb, since
there's only one call-site anymore.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-29 16:34:54 +09:00
Michel Dänzer
4bc992c310 Create drmmode_set_mode helper
Preparatory, no functional change intended yet.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-29 16:34:30 +09:00
Michel Dänzer
3f6210ca2c Create radeon_pixmap_clear helper
Preparatory, no functional change intended yet.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-23 16:27:25 +09:00
Martin Peres
0472a605e0 modesetting: re-set the crtc's mode when link-status goes BAD
Despite all the careful planning of the kernel, a link may become
insufficient to handle the currently-set mode. At this point, the
kernel should mark this particular configuration as being broken
and potentially prune the mode before setting the offending connector's
link-status to BAD and send the userspace a hotplug event. This may
happen right after a modeset or later on.

Upon receiving a hot-plug event, we iterate through the connectors to
re-apply the currently-set mode on all the connectors that have a
link-status property set to BAD. The kernel may be able to get the
link to work by dropping to using a lower link bpp (with the same
display bpp). However, the modeset may fail if the kernel has pruned
the mode, so to make users aware of this problem a warning is outputed
in the logs to warn about having a potentially-black display.

This patch does not modify the current behaviour of always propagating
the events to the randr clients. This allows desktop environments to
re-probe the connectors and select a new resolution based on the new
(currated) mode list if a mode disapeared. This behaviour is expected in
order to pass the Display Port compliance tests.

(Ported from xserver commit bcee1b76aa0db8525b491485e90b8740763d7de6)

[ Michel: Bump libdrm dependency to >= 2.4.78 for
  DRM_MODE_LINK_STATUS_BAD ]
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-18 14:40:19 +09:00
Michel Dänzer
d822a0f470 Make radeon_scanout_do_update take a PixmapPtr instead of a DrawablePtr
All callers were already passing in a pixmap.

This allows simplifying the rotated scanout case slightly.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-17 16:20:52 +09:00
Michel Dänzer
3e24770b1b Use xorg_list_append for the DRM event list
We were adding entries at the start of the list, i.e. the list was
ordered from most recently added to least recently added. However, the
corresponding DRM events are generally expected to arrive in the same
order as they are queued, which means that radeon_drm_queue_alloc would
generally have to traverse the whole list to find the entry
corresponding to an arrived event. Fix this by adding entries at the end
of the list.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-17 16:05:26 +09:00
Michel Dänzer
36ce792013 Consolidate radeon_scanout_flip_abort/handler helpers
While at it, make them use crtc->driver_private.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-17 16:04:21 +09:00
Michel Dänzer
d314cbfb22 Always allow DRI2 page flipping with TearFree
Even if TearFree is enabled for the CRTC we're synchronizing to.

v2:
* Move manpage hunk here from previous change.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com> # v1
2017-08-17 16:03:50 +09:00
Michel Dänzer
4445765af5 Always allow Present page flipping with TearFree
Even if TearFree is active for the the CRTC we're synchronizing to. In
that case, for Present flips synchronized to vertical blank, the other
scanout buffer is immediately synchronized and flipped to during the
target vertical blank period. For Present flips not synchronized to
vertical blank, we simply use the MSC and timestamp values of the last
vertical blank period for timing purposes, and let the normal TearFree
mechanism handle display updates.

v2:
* Move manpage hunk to next change, since TearFree can still prevent
  DRI2 page flipping with this change.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com> # v1
2017-08-17 15:52:24 +09:00
Michel Dänzer
65e0c5ea1b Pass extents to radeon_scanout_do_update
Preparation for following change, no functional change intended yet.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-17 15:51:43 +09:00
Michel Dänzer
1443270e52 Add source drawable parameter to radeon_scanout_do_update
Preparation for following changes, no functional change intended yet.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-17 15:49:01 +09:00
Michel Dänzer
7c10ee9c88 Handle multiple "pending" Present flips
The xserver Present code can submit a flip in response to notifying it
that a vblank event arrived. This can happen before the completion event
of the previous flip is processed. In that case, we were clearing the
drmmode_crtc->flip_pending field prematurely.

Prevent this by only clearing drmmode_crtc->flip_pending when it matches
the framebuffer being scanned out since the flip whose completion event
we're processing.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-17 15:45:37 +09:00
Michel Dänzer
e6d7dc2070 Wait for pending flips synchronously before turning off a CRTC
Allows removing drmmode_clear_pending_flip and the pending_dpms_mode
field and cleaning up the code considerably.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-17 15:42:45 +09:00
Michel Dänzer
f87acdbfb1 Create drmmode_crtc_wait_pending_event helper macro
Preparation for following change, no functional change intended yet.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-17 15:38:21 +09:00
Michel Dänzer
99f1d7a474 Create drmmode_wait_vblank helper
Allows cleaning up the code considerably.

v2:
* Fix "drmWaiVBlank" typo, add blank line for readability (Slava Abramov)
* Rename in/out sequence parameters to "target_seq" and "result_seq",
  hopefully that will be clearer.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com> # v1
2017-08-17 15:24:22 +09:00
Michel Dänzer
49cc61ab97 Pass reference CRTC to radeon_do_pageflip directly
Simplifies the code slightly.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-17 15:23:34 +09:00
Michel Dänzer
3f120fa1d5 Remove drmmode_crtc->scanout_destroy[] array
No longer necessary since we're reference counting framebuffers.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com
2017-08-15 17:31:31 +09:00