Commit Graph

269 Commits

Author SHA1 Message Date
Michel Dänzer
ba2aa0a8c1 Handle rotation in the driver also with Xorg 1.12-1.18
We cannot use the HW cursor in that case, but in turn we get more
efficient and less teary updates of rotated outputs.

(Ported from radeon commit f2bc882f1c1082bed9f496cfab6c8f07a76bc122)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-03-03 16:08:21 +09:00
Michel Dänzer
7f3abf35a2 Fold drmmode_crtc_scanout_allocate into drmmode_crtc_scanout_create
Not used anywhere else anymore.

(Ported from radeon commit ae921a3150f69c38b5b3c88a9e37d54fdf0d5093)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-03-03 16:07:49 +09:00
Michel Dänzer
03c2db3c67 Call drmmode_crtc_scanout_create in drmmode_crtc_shadow_allocate as well
Calling drmmode_crtc_scanout_allocate in drmmode_crtc_shadow_allocate
resulted in drmmode_crtc_scanout_create called from
drmmode_crtc_shadow_create passing an uninitialized pitch value to
drmmode_create_bo_pixmap.

Fixes issues such as failure to allocate the scanout pixmap or visual
corruption and GPUVM faults when attempting to use rotation with Xorg
<1.19.

Bugzilla: https://bugs.freedesktop.org/99916
Fixes: 5f71238088 ("Pass pitch from drmmode_crtc_scanout_allocate to
                      drmmode_create_bo_pixmap")
(Ported from radeon commit 987a34adb319923ad36e2b47a26837248f187c3e)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-03-02 16:42:04 +09:00
Emil Velikov
49b092563c autogen.sh: use quoted string variables
Place quotes around the $srcdir, $ORIGDIR and $0 variables to prevent
fall-outs, when they contain space.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-26 11:10:12 +09:00
Peter Hutterer
457fcc5935 autogen.sh: use exec instead of waiting for configure to finish
Syncs the invocation of configure with the one from the server.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2017-01-26 11:09:07 +09:00
Michel Dänzer
5f71238088 Pass pitch from drmmode_crtc_scanout_allocate to drmmode_create_bo_pixmap
Mostly to align with radeon commit
ea30d856ba5e7274c8ea499293b8b0e721b8e082, but also gets rid of a
gbm_bo_get_stride call.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-01-06 17:42:25 +09:00
Jammy Zhou
b5c189473d Use render node for DRI3 if available
Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
[ Second attempt, let's see if there's any fallout this time... ]
2016-12-19 17:20:25 +09:00
Michel Dänzer
edd276185d Simplify drmmode_handle_uevents
No functional change intended.

Reviewed-by: Jim Qu <Jim.Qu@amd.com>
2016-12-15 12:42:44 +09:00
jimqu
732cf4d3a2 udev_monitor_receive_device() will block when hotplug monitor
udev_monitor_receive_device() will block and wait for the event of udev
use select() to ensure that this will not block.

Signed-off-by: JimQu <Jim.Qu@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-12-14 11:33:50 +09:00
Michel Dänzer
d60ea478cf Call amdgpu_drm_abort_entry on failure to flip to a scanout pixmap
Fixes leaking the corresponding struct amdgpu_drm_queue list entry in
that case.

(Ported from radeon commit e2942449171fe628a7726e59bcaab65e27d88563)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-12-01 17:04:00 +09:00
Michel Dänzer
aea70298ef Call ValidateGC after ChangeClip in amdgpu_sync_scanout_pixmaps
The wrong order meant that the clipping region wasn't actually applied,
so it always copied the full contents from the other scanout pixmap.

(Ported from radeon commit 14c3f59f5157885ad8f941f0bad6c0c5e3db12f8)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-12-01 17:03:49 +09:00
Michel Dänzer
0f79c30619 Fix amdgpu_scanout_extents_intersect for GPU screens
Fixes incorrect screen updates with TearFree enabled on PRIME slave
outputs which are not located at (0, 0).

(Ported from radeon commit a995f5830916a0fee5126263d1bfe48632be3a15)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-12-01 17:03:33 +09:00
Michel Dänzer
082b6b8ca1 Take current scanout_id into account everywhere involved with TearFree
Fixes various potential issues with TearFree enabled, e.g. outputs
freezing after display configuration changes.

(Ported from radeon commit e543ef3a2fb304cbe3a965fb780632af2e4186f4)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-11-30 16:21:28 +09:00
Michel Dänzer
82729b1f3b Add amdgpu_is_gpu_screen helper
This will hopefully decrease the chance of accidentally breaking the
build against xserver < 1.13 in the future.

(Ported from radeon commit f130b10e63f7526360b41aa0918b4940f63f662a)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-11-28 17:47:17 +09:00
Michel Dänzer
7fe2a8ed67 Don't install Flush/EventCallback for GPU screens
Their purpose is to flush GPU rendering commands corresponding to damage
events, but there can be no damage events corresponding to GPU screen
rendering operations.

(Ported from radeon commits 13c6bc5e382765fe567091e1c616c0a26eec04ca and
487aa62a2a23b86e4ea4714fdfd465c9e513141f)

v2: Squash in radeon fix for build against xserver < 1.13

Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (v1)
2016-11-28 17:40:32 +09:00
Michel Dänzer
ff31320644 Make libdrm >= 2.4.72 requirement explicit
And drop compatibility code for older versions.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-11-28 17:39:18 +09:00
Michel Dänzer
f9ba1e8fd4 Use DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags when available
(Ported from radeon commits 1106b2f773ad0611c729b27f4c192a26b43ef1e7
and 5fea5ef2f07eee4a0f94baab427010b936f1d4b4)

v2:
* Squash in radeon fix for TearFree regression
* Remove preprocessor guards for compatibility with libdrm < 2.4.72
  (Emil Velikov)

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-11-22 16:30:59 +09:00
Michel Dänzer
e8aa4e7ea5 Remove generated header files
No longer used.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-11-21 17:58:23 +09:00
Michel Dänzer
d69fd22b6d Stop using AMDGPU(Unique)Chipsets
Use libdrm_amdgpu's amdgpu_get_marketing_name for the chipset name, or
"Unknown AMD Radeon GPU" as a fallback.

v2: Require libdrm_amdgpu >= 2.4.72 for amdgpu_get_marketing_name

Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (v1)
2016-11-21 17:55:57 +09:00
Michel Dänzer
8a5ff54af3 Stop using AMDGPUPciChipsets
Not actually used by Xorg.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-11-21 17:55:32 +09:00
Michel Dänzer
298eaf58a5 Remove amdpciids.h
Not useful anymore.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-11-21 17:55:00 +09:00
Michel Dänzer
a0881d55fe Stop using generated amdgpu_device_match
Just match on PCI device ID 0x1002.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-11-21 17:54:26 +09:00
Michel Dänzer
40ddc52b2a Use family information from libdrm_amdgpu / kernel
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-11-21 17:53:43 +09:00
Michel Dänzer
5c9d1c5097 Move struct amdgpu_gpu_info out of amdgpu_get_tile_config
Preparation for the following change, no functional change intended.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-11-21 17:51:02 +09:00
Michel Dänzer
adf7dabdf9 Post-release version bump 2016-11-21 17:50:22 +09:00
Michel Dänzer
a000320508 Bump version for 1.2.0 release xf86-video-amdgpu-1.2.0 2016-11-17 15:17:10 +09:00
Michel Dänzer
a446b3af9b manpage updates for the 1.2.0 release
Option "TearFree" is now effective for arbitrary transforms as well.

Point to the amd-gfx mailing list instead of xorg-driver-ati.
2016-11-17 15:13:59 +09:00
Michel Dänzer
24e36c7044 Use pAMDGPUEnt to find both screens of a GPU in amdgpu_mode_hotplug
Fixes misbehaviour when hotplugging DisplayPort connectors on secondary
GPUs.

Fixes: 14606e127f ("Handle Zaphod mode correctly in amdgpu_mode_hotplug")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98626
(Ported from radeon commit 9760ef33cba5795eddeda4d5c2fcbe2dcce21689)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-11-16 17:22:00 +09:00
Michel Dänzer
257be5b085 Refactor amdgpu_mode_hotplug
Preparation for the next change, no functional change intended.

(Cherry picked from radeon commit 35bec4937d89b48a79acfcb4f814b7370cb631b2)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-11-10 12:28:03 +09:00
Michel Dänzer
1352a1d2f7 Check Xorg version at runtime instead of build time in two places
This means that all possible paths can be handled as intended, no matter
which Xorg version the driver happened to be compiled against.

(Ported from radeon commit 350a2645a1b127227ff294c0b62d20000d0fd48a)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-11-02 12:35:55 +09:00
Michel Dänzer
5da43c5da8 Require xserver 1.10 or newer
1.10.0 was released in February 2011.

We've been accidentally requiring 1.10 or newer since c7d27c94cb ("Keep
track of damage event related flushes per-client").

(Ported from radeon commit 5df36de39952c3a26cb2fbc125f298139a9dd5bc)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-11-02 12:32:29 +09:00
Michel Dänzer
dd4a740714 present: Check tiling info for flips
The kernel driver doesn't handle flipping between buffers with
different tiling parameters correctly.

Fixes display corruption with fullscreen apps using different tiling
modes (e.g. due to R600_DEBUG=notiling or R600_DEBUG=no2d) via DRI3.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-10-27 11:22:36 +09:00
Michel Dänzer
3c1f4386ba Consume all available udev events at once
We get multiple udev events for actions like docking a laptop into its
station or plugging a monitor to the station. By consuming as many
events as we can, we reduce the number of output re-evalutions.

It depends on the timing how many events can be consumed at once.

(Inspired by xserver commit 363f4273dd4aec3e26cc57ecb6c20f27e6c813d8)
(Ported from radeon commit 22b5ce9548393ba2ff73ee234ecd82eeaf0ef6c4)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-10-27 11:02:34 +09:00
Hans de Goede
c87dff3257 PRIME: Fix swapping of provider sink / source capabilities
When a card has import capability it can be an offload _sink_, not a
source and vice versa for export capability.

This went unnoticed sofar because most gpus have both import and export
capability.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(Ported from xserver commit 94a1c77259ce39ba59ad87615df39b570ffab435)
(Ported from radeon commit 82d3c8f5500d2a6fb1495e217a0b79c396f1534c)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-10-27 11:02:18 +09:00
Michel Dänzer
9c4416422f Always call PixmapStopDirtyTracking in drmmode_set_scanout_pixmap
Otherwise, we may leak screen->pixmap_dirty_list entries if
drmmode_set_scanout_pixmap is called repatedly with ppix != NULL, which
can happen from RRReplaceScanoutPixmap.

(Inspired by xserver commit b773a9c8126222e5fed2904d012fbf917a9f22fd)
(Ported from radeon commit 6c940446ddadf418ee4959e46fa552b6c1cf6704)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-10-27 11:01:55 +09:00
Michel Dänzer
0a91f11c03 Don't rely on randr_crtc->scanout_pixmap in drmmode_set_scanout_pixmap
RRReplaceScanoutPixmap may set randr_crtc->scanout_pixmap = NULL before
we get here.

(Inspired by xserver commit f4c37eeee7953df1fe0e3196eda452acf0078e61)
v2: Always return TRUE in the if (!ppix) block.
(Cherry picked from radeon commit 61df12e2377cbb19a19ca9d5624df8959822da9f)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-10-26 16:14:45 +09:00
Michel Dänzer
b37f477488 Sayōnara, AM_MAINTAINER_MODE!
If --enable-maintainer-mode got lost from config.status for any reason,
builds would fail in mysterious ways after changing between different
Git commits.

There are more reasons for dropping it in the automake manual:

https://www.gnu.org/software/automake/manual/html_node/maintainer_002dmode.html

I'm not aware of any reason why --disable-maintainer-mode would ever be
useful with this project.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
(Cherry picked from radeon commit 49cf3b5032a7ce40afe514b7092440e3e19e05aa)
2016-10-25 16:30:46 +09:00
Michel Dänzer
c8d9ad0e18 Order unique chipsets according to first appearance in ati_pciids.csv
Instead of lexically. This makes it more likely for similar generations
to be close to each other in the list of unique chipsets.

(Ported from radeon commit 1ce1b1656acc6211deb2091ff7f28d51b6daf86b,
 plus change $numunique++ => ++$numunique to fix OLAND getting listed
 twice)

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-10-19 18:16:47 +09:00
Michel Dänzer
7cc04035c5 Enable HW cursor support with PRIME slave output & Xorg > 1.18.99.901
Supported since Xorg 1.18.99.2, but buggy until 1.18.99.901.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-10-06 18:34:40 +09:00
Michel Dänzer
d42773eb45 Rotate and reflect cursor hotspot position for drmModeSetCursor2
We were always passing the hotspot position in the X screen coordinate
space, but drmModeSetCursor2 needs it in the CRTC coordinate space. The
wrong hotspot position would cause the kernel driver to adjust the
HW cursor position incorrectly when the hotspot position changed.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-10-05 17:31:57 +09:00
Michel Dänzer
bdee9f4dd4 Add support for ScreenPtr::SyncSharedPixmap
This allows deferring shared pixmap updates between different drivers.

(Ported from radeon commit 53be26b00e83f871f0afd39caa5a7a1d6ec4aea1)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-21 15:47:57 +09:00
Michel Dänzer
97d7386caf Untangle HAS_XORG_CONF_DIR / --with-xorg-conf-dir lines in configure.ac
$sysconfigdir used to be part of the default --with-xorg-conf-dir value,
but it no longer is.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-20 17:19:25 +09:00
Michel Dänzer
aa8a3fa246 Fix handling of configure option --with-xorg-conf-dir
There were two problems:

I accidentally changed the variable name in the AC_ARG_WITH stanza from
configdir to xorgconfigdir, so specifying --with-xorg-conf-dir wouldn't
work correctly. Fix this back to configdir.

If neither --with-xorg-conf-dir nor --prefix is specified on the command
line, the $prefix variable doesn't contain "/usr/local" (the default
prefix) yet at this point but "NONE". So make install would attempt to
install 10-amdgpu.conf in ${DESTDIR}NONE/share/X11/xorg.conf.d/ . Fix
this by leaving ${prefix} verbatim in the default value, to be resolved
by make.

Also print the configdir value along with the values of other similar
configuration variables.

Reported-by: Timo Aaltonen <tjaalton@debian.org>
Reviewed-by: Julien Cristau <jcristau@debian.org>
2016-09-16 15:59:16 +09:00
Michel Dänzer
cd3acb7571 Use --with-xorg-conf-dir=$prefix/share/X11/xorg.conf.d by default
We were using the result of `pkg-config --variable=sysconfigdir
xorg-server` before, which may not be inside $prefix, so make install
might fail for 10-amdgpu.conf .

Fixes make distcheck in that case, and possibly also 10-amdgpu.conf
seemingly missing from some distribution packages.

This matches what some (though not all) input drivers are doing for their
xorg.conf.d snippets.
2016-09-14 18:33:42 +09:00
Michel Dänzer
0f8df8584a Make TearFree effective with PRIME slave scanout
TearFree can now prevent tearing with any possible display
configuration.

Note that there may still be inter-GPU tearing if the primary GPU uses
a different driver.

(Ported from radeon commit 38797a33117222dadbc89e5f21ed8cd5deef9bea)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-09 19:03:31 +09:00
Michel Dänzer
d6feed2cd7 Synchronize scanout pixmaps for TearFree
Copy the damaged areas which are still valid in the other scanout pixmap
from there, then only copy the remaining damaged area from the screen
pixmap.

This is slightly more efficient (only needs one Damage record instead of
two, and only needs to copy each screen update across PCIe once with
ShadowPrimary and a discrete GPU), and will be significantly more
efficient for PRIME with the following change.

(Ported from radeon commit eda1f3df6aaed683036369fe8820da4dac3c2ae2)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-09 19:03:24 +09:00
Michel Dänzer
4927b84ec8 Move up amdgpu_scanout_extents_intersect
Will be needed higher up by the following changes. No functional change.

(Ported from radeon commit 2f6e5fb15f1a9ce523c85550e493f8bda9d0c00f)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-09 19:03:14 +09:00
Michel Dänzer
1c725f6396 Factor out transform_region helper
(Ported from radeon commit 5a57005178fc13b6f7e513458ca6dae72a3e5783)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-09 19:03:06 +09:00
Michel Dänzer
c92842764f Only copy from screen pixmap to shared pixmap on demand for slave scanout
Only copy once for each time we update the corresponding scanout pixmap.
This can significantly reduce the bandwidth usage when there are
frequent updates to the screen pixmap.

This initial implementation only works when both the master and slave
screens use this driver.

(Ported from radeon commit 99232f64db52812a843cd616d263d3a6b90eef3d)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-09 19:02:56 +09:00
Michel Dänzer
61ceefe17f Track damage accurately for RandR 1.4 slave scanout
This further reduces the PCIe bandwidth usage.

(Ported from radeon commit b0867063abb197b9134166706d99fcbe5f204bb5,
 plus leak fix from 5a57005178fc13b6f7e513458ca6dae72a3e5783)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-09 19:02:47 +09:00