678 Commits

Author SHA1 Message Date
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
Michel Dänzer
6d31fb124d Handle RandR 1.4 slave dirty updates via amdgpu_drm_queue
This reduces PCIe bandwidth usage and tearing.

(Ported from radeon commit ad0a0656dd0e74683e6d7789decba827aa29c221)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-09 19:02:40 +09:00
Michel Dänzer
b10ecdbd89 Use drmmode_crtc_scanout_* helpers for RandR 1.4 scanout pixmaps
This should allow using multiple CRTCs via RandR 1.4 even with xserver
< 1.17. It also simplifies the code a little, and paves the way for
following changes.

(Ported from radeon commits 4cfa4615f79f64062e5e771cd45dd7048f48b4f6
 and a92c27484703abc7c410b6ae0e4b8d1efbbb8e6f)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-09 19:02:28 +09:00
Michel Dänzer
9565981f75 Wait for pending flips to complete before turning off an output or CRTC
At least with older kernels, the flip may never complete otherwise,
which can result in us hanging in drmmode_set_mode_major.

Fixes: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-ati/+bug/1577170

(Ported from radeon commits 9090309e057dc703d1a5bffd88e6cae14108cfc3,
 e520ce0ec0adf91ddce5c932d4b3f9477fd49304,
 a36fdaff40d5b4795a1400c348a80eee94892212 and
 4bd2d01552f18153afa03a8947b22eebf3d67c6b)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-09 19:02:19 +09:00
Michel Dänzer
c7d27c94cb Keep track of damage event related flushes per-client
This further reduces the compositing slowdown due to flushing overhead,
by only flushing when the X server actually sends XDamageNotify events
to a client, and there hasn't been a flush yet in the meantime.

(Ported from radeon commit 121a6de72da5fcf9a32408eff36b2235f3dfbcfe)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-09 19:02:11 +09:00
Michel Dänzer
58773d1945 Use EventCallback to avoid flushing every time in the FlushCallback
We only need to flush for XDamageNotify events.

Significantly reduces compositing slowdown due to flushing overhead, in
particular with glamor.

(Ported from radeon commit 9a1afbf61fbb2827c86bd86d295fa0848980d60b)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-09 19:02:02 +09:00
Michel Dänzer
d166d04f69 Add explicit AMDGPU_DRM_QUEUE_ERROR define
Should make the amdgpu_drm_queue_alloc error handling clearer, and gets
rid of a compile warning about it returning NULL.

(Ported from radeon commit a37af701768b12d86868a831a79f1e02ee4968cf)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-07 18:03:05 +09:00
Michel Dänzer
6a1ba044c2 Only list each unique chipset family once in the log file
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-08-30 16:54:16 +09:00
Michel Dänzer
7d050d15d4 Add missing Kaveri PCI ID (1318)
Found by comparing src/pcidb/ati_pciids.csv with xf86-video-ati.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-08-30 16:53:45 +09:00
Michel Dänzer
aa54926609 Add Mullins PCI IDs
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97472
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-08-29 15:52:48 +09:00
Qiang Yu
73c8dc000a DRI2: Fix amdgpu_dri2_exchange_buffers width/height copy'n'paste error
Signed-off-by: Qiang Yu <Qiang.Yu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-08-23 11:48:09 +09:00
Michel Dänzer
5a4d3267ac Remove unused lut_r/g/b arrays from drmmode_crtc_private_rec
Fixes: 1091f28e1f ("Remove drmmode_load_palette")
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-08-23 11:47:12 +09:00
Marek Olšák
c436452069 Fix cursor size for SI
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
2016-08-22 15:06:55 +02:00
Ronie Salgado
2eb5d77b84 Add SI PCI IDs
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-08-22 15:06:53 +02:00
Michel Dänzer
abd1a7901c DRI2: Add interpolated_vblanks in amdgpu_dri2_get_crtc_msc
We need that in amdgpu_dri2_drawable_crtc as well for priv->vblank_delta
to work as intended.

amdgpu_dri2_get_msc was already doing this.

Fixes hangs in some cases when using VDPAU via DRI2 and moving the
window between CRTCs.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-07-22 19:12:27 +09:00
Qiang Yu
978242977e Fix amdgpu_mode_hotplug crash on multi GPU platform.
On multi GPU platform, some screen is created by other GPU DDX.

Signed-off-by: Qiang Yu <Qiang.Yu@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-07-20 15:50:13 +09:00
Keith Packard
fdd1209e26 Use NotifyFd for drm fd
NotifyFd is available after API 22, and must be used after API 23.

Signed-off-by: Keith Packard <keithp@keithp.com>
2016-07-19 09:16:32 -07:00
Adam Jackson
17c0cf4974 Adapt Block/WakeupHandler signature for ABI 23
Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-07-19 10:23:26 -04:00
Michel Dänzer
b5e2b964b7 Only use RandR APIs if RandR is enabled
Fixes crash with Xinerama enabled, which disables RandR.

Fixes: https://bugs.debian.org/827984

(Ported from radeon commit 3be841d0ae7d505cef325993205b12d15e98dba9)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-07-12 16:04:43 +09:00
Michel Dänzer
84496ebc89 Add .editorconfig file
Basically a conversion from .dir-locals.el. EditorConfig supports many
more editors and IDEs.

(Ported from radeon commit aa07b365d7b0610411e118f105e49daff5f5a5cf)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-07-12 16:03:51 +09:00
Michel Dänzer
a576430526 Clear damage in amdgpu_scanout_update if it doesn't intersect the CRTC
There's no need to test that same damage again.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-06-28 15:38:21 +09:00
Michel Dänzer
ede7f2bcae Remove w/h parameters from amdgpu_scanout_extents_intersect
We can use the dimensions of the CRTC's mode instead.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-06-28 15:37:48 +09:00
Michel Dänzer
bf000ea7ef Make the dedicated scanout mechanism work with arbitrary transforms v2
This makes TearFree work with arbitrary transforms, and makes transforms
work better even without TearFree, with xserver >= 1.12.

v2: Preserve clamping of transformed damage extents to CRTC boundaries.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-06-24 15:55:51 +09:00
Michel Dänzer
d96dabc71b Destroy all dedicated scanout buffers during CloseScreen
Fixes leaking active scanout buffers across a server reset, which also
fixes server reset with glamor and active scanout buffers.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-06-24 15:54:14 +09:00
Michel Dänzer
1091f28e1f Remove drmmode_load_palette
Not used by any supported version of xserver.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-06-23 16:25:41 +09:00
Michel Dänzer
4d506c23c9 present: Separate checks for flips vs unflips v2
All unflip checks apply to flips as well, but not vice versa.

v2: Add comment above amdgpu_present_check_unflip (Alex)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-06-23 16:13:23 +09:00
Michel Dänzer
decabd574f dri2: Don't allow flipping when using a dedicated scanout buffer
Fixes issues when mixing rotation and page flipping with current xserver
Git master.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-06-23 16:12:20 +09:00
Michel Dänzer
3ed28ce7cd present: Don't allow flipping when using a dedicated scanout buffer
Fixes issues when mixing rotation and page flipping with current xserver
Git master.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-06-23 16:11:36 +09:00
Michel Dänzer
9c3324715f Make sure drmmode_crtc->scanout[] are destroyed when not needed
We failed to do this when going back to scanning out directly from the
screen pixmap.

As a bonus, since we now destroy drmmode_crtc->scanout[] after setting
the new scanout buffer, we may avoid the CRTC turning off intermittently
in this case.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-06-23 16:10:33 +09:00
Michel Dänzer
3bce0519a4 Simplify drmmode_set_mode_major error handling
Initialize ret = FALSE and only set it to TRUE when we've succeeded.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-06-23 16:09:54 +09:00
Hans de Goede
a3ca150070 Only add main fb if necessary
If we're doing reverse-prime; or doing rotation the main fb is not used,
and there is no reason to add it in this case.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(Ported from xserver commit 4313122dea0df9affc280ee698e929489061ccc6)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-06-23 16:08:51 +09:00
Hans de Goede
9ca1c24235 Remove unnecessary fb addition from drmmode_xf86crtc_resize
drmmode_set_mode_major() is the only user of drmmode->fb_id and will
create it if necessary.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(Ported from xserver commit 877453212166fdc912e0d687cdecee11aba563b5)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-06-23 10:58:11 +09:00
Michel Dänzer
0d42082108 Call amdgpu_glamor_create_screen_resources after ModifyPixmapHeader
Otherwise, glamor doesn't pick up the new screen pixmap size and
continues using the old size, leaving garbage in some areas after
enlarging the screen.

Fixes regression from commit c315c00e44
("Propagate failure from amdgpu_set_pixmap_bo").

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-06-23 10:54:28 +09:00
Michel Dänzer
e7e71eabbb Adapt to XF86_CRTC_VERSION 7
Now the HW cursor can be used with TearFree rotation.

This also allows always using the separate scanout pixmap mechanism for
rotation, so that should be much smoother even without TearFree enabled.

(Ported from radeon commit 7835558acdce318130ba4a09ef936fd675e3197d)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-06-21 10:43:29 +09:00
Michel Dänzer
7f7f9825ca Free priv in amdgpu_set_pixmap_bo also if priv->bo == NULL
Fixes memory leak when destroying pixmaps with priv->bo == NULL.

Reported-by: Qiang Yu <qiang.yu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-06-16 15:21:26 +09:00
Michel Dänzer
397aedafee glamor: Fix leak of pixmap private when replacing BO
Reported-by: Qiang Yu <qiang.yu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-06-16 15:20:56 +09:00
Michel Dänzer
5b4a8a7a6e Use amdgpu_set_pixmap_bo in amdgpu_set_shared_pixmap_backing
Fixes leaking any existing pixmap private.

While we're at it, also fix leaking the GBM BO if
amdgpu_glamor_create_textured_pixmap fails.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-06-16 15:20:13 +09:00
Michel Dänzer
c315c00e44 Propagate failure from amdgpu_set_pixmap_bo
Preparation for the following fixes.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-06-16 15:20:04 +09:00
Michel Dänzer
74602c4221 glamor: Make amdgpu_glamor_create_textured_pixmap take amdgpu_buffer*
Preparation for the following fixes.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-06-15 18:09:57 +09:00
Michel Dänzer
0007c2f018 glamor: Reallocate linear pixmap BO if necessary for DRI2 PRIME
Fixes corruption when using DRI2 PRIME render offloading with the master
screen using this driver.

Reported-by: Qiang Yu <qiang.yu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Tested-by: Qiang Yu <qiang.yu@amd.com>
2016-06-14 18:26:09 +09:00
Michel Dänzer
5518bf5d79 Move DRI2's local fixup_glamor helper to amdgpu_glamor_set_pixmap_bo v2
So it can be used outside of the DRI2 code.

v2: Keep pixmap refcnt increment in amdgpu_dri2_create_buffer2 (Qiang Yu)

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Tested-by: Qiang Yu <qiang.yu@amd.com> (v1)
2016-06-14 18:25:16 +09:00
Michel Dänzer
641f4647b7 Consolidate get_drawable_pixmap helper
There were two static helpers for the same purpose. Consolidate them
into a single inline helper which can be used anywhere.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Tested-by: Qiang Yu <qiang.yu@amd.com>
2016-06-14 18:24:49 +09:00