summaryrefslogtreecommitdiff
path: root/src/amdgpu_kms.c
AgeCommit message (Collapse)AuthorFilesLines
2017-05-24Simplify tracking of PRIME scanout pixmapMichel Dänzer1-5/+2
Remember the shared pixmap passed to drmmode_set_scanout_pixmap for each CRTC, and just compare against that. Fixes leaving stale entries in ScreenRec::pixmap_dirty_list under some circumstances, which would usually result in use-after-free and a crash down the line. (Ported from radeon commit 7dc68e26755466f9056f8c72195ab8690660693d) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-05-11Don't enable DRI3 without glamorMichel Dänzer1-1/+4
Can't work currently. Fixes crash when trying to run a DRI3 client when glamor isn't enabled. Bugzilla: https://bugs.freedesktop.org/100968 Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-04-17Don't set modes before AMDGPUWindowExposures_oneshot is calledMichel Dänzer1-3/+3
The root window contents may be undefined before that, so we don't want to show anything yet. Fixes a crash on startup with rotation and virtual resolution set in xorg.conf. Bugzilla: https://bugs.freedesktop.org/100276 Fixes: ad53635af150 ("Move DPMS check from amdgpu_scanout_do_update to amdgpu_scanout_flip") Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-03-28Fix a misspelling of 'acceleration' in amdgpu_kms.cNicholas Molloy1-1/+1
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2017-03-10Pass TRUE to drmmode_set_desired_modes the first time for GPU screensMichel Dänzer1-1/+2
This is the only place we call drmmode_set_desired_modes for GPU screens during server startup. Without this change, the display outputs of secondary GPUs may stay on even while Xorg isn't using them. (Ported from radeon commit 9a71445094b728f3d78db8f6808b4782ee19a453) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-03-09Skip some initialization steps for GPU screensMichel Dänzer1-41/+49
Xorg doesn't use the following functionality of GPU screens, so don't bother initializing it: * DRI page flipping * DRI3 / Present / SYNC fences * XVideo / XvMC * Root window with background None (Ported from radeon commit 67ae5e00a748ad52cf92738d401afff2947b1891) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-03-07Refactor amdgpu_kernel_close_fd helperMichel Dänzer1-6/+1
Preparation for the following change. Assign pAMDGPUEnt->fd = -1 instead of 0 when we're not using the file descriptor anymore. Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-03-07glamor: Don't flush in BlockHandler with Xorg >= 1.19Michel Dänzer1-0/+2
This was only necessary with older versions for driving the FBO cache expiry mechanism. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-03-07Only define transform_region for XF86_CRTC_VERSION >= 4Michel Dänzer1-0/+4
Not used with older versions of Xorg. Fixes warning in that case: ../../src/amdgpu_kms.c:328:1: warning: ‘transform_region’ defined but not used [-Wunused-function] transform_region(RegionPtr region, struct pict_f_transform *transform, ^~~~~~~~~~~~~~~~ Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-03-07Don't use pScrn->is_gpu in AMDGPUCreateScreenResources_KMSMichel Dänzer1-1/+1
Looks like this snuck in accidentally. Brings us back in line with the radeon driver, and fixes the build against older versions of xserver which didn't have the is_gpu field yet. Fixes: 6bab8fabb37e ("Remove info->dri2.drm_fd and info->drmmode->fd") Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-03-07Move DPMS check from amdgpu_scanout_do_update to amdgpu_scanout_flipMichel Dänzer1-2/+2
When amdgpu_scanout_do_update is called from drmmode_crtc_scanout_update, drmmode_crtc->pending_dpms_mode may still be != DPMSModeOn, e.g. during server startup. Fixes intermittently showing garbage with TearFree enabled. (Ported from radeon commit cc9d6b7db9c2078be1e530a64af6d517c6a42024) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-03-07Call drmmode_set_desired_modes from a WindowExposures hookMichel Dänzer1-12/+28
This is the earliest opportunity where the root window contents are guaranteed to be initialized, and prevents drmmode_set_mode_major from getting called before drmmode_set_desired_modes via AMDGPUUnblank -> drmmode_crtc_dpms. Also, in contrast to the BlockHandler hook, this is called when running Xorg with -pogo. Fixes intermittently showing garbage on server startup or after server reset. As a bonus, this avoids trouble due to higher layers (e.g. the tigervnc Xorg module) calling AMDGPUBlockHandler_oneshot repeatedly even after we set pScreen->BlockHandler = AMDGPUBlockHandler_KMS. Bugzilla: https://bugs.freedesktop.org/99457 (Ported from radeon commits 0a12bf1085505017068dfdfd31d23133e51b45b9 and f0e7948e1c0e984fc27f235f365639e9cf628291) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-03-03Allow toggling TearFree at runtime via output propertyMichel Dänzer1-24/+33
Option "TearFree" now sets the default value of the output property. See the manpage update for details. TearFree is now enabled by default for outputs using rotation or other RandR transforms, and for RandR 1.4 slave outputs. (Ported from radeon commit 58cd1600057e41aade0106d4acf78e23eac6e44f) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-03-03Factor out amdgpu_prime_dirty_to_crtc helperMichel Dänzer1-29/+33
Cleanup in preparation for the following change, no functional change intended. (Ported from radeon commit 649644a88347a6d03de68f8c41db03a82deeb23b) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-12-01Call amdgpu_drm_abort_entry on failure to flip to a scanout pixmapMichel Dänzer1-0/+2
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-01Call ValidateGC after ChangeClip in amdgpu_sync_scanout_pixmapsMichel Dänzer1-1/+1
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-01Fix amdgpu_scanout_extents_intersect for GPU screensMichel Dänzer1-5/+15
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-11-30Take current scanout_id into account everywhere involved with TearFreeMichel Dänzer1-3/+3
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-28Add amdgpu_is_gpu_screen helperMichel Dänzer1-11/+3
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-28Don't install Flush/EventCallback for GPU screensMichel Dänzer1-2/+6
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-22Use DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags when availableMichel Dänzer1-10/+8
(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-21Stop using AMDGPU(Unique)ChipsetsMichel Dänzer1-8/+4
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-21Remove amdpciids.hMichel Dänzer1-3/+1
Not useful anymore. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-11-21Use family information from libdrm_amdgpu / kernelMichel Dänzer1-13/+5
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-11-21Move struct amdgpu_gpu_info out of amdgpu_get_tile_configMichel Dänzer1-10/+8
Preparation for the following change, no functional change intended. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-11-16Use pAMDGPUEnt to find both screens of a GPU in amdgpu_mode_hotplugMichel Dänzer1-0/+5
Fixes misbehaviour when hotplugging DisplayPort connectors on secondary GPUs. Fixes: 14606e127f4b ("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-02Check Xorg version at runtime instead of build time in two placesMichel Dänzer1-5/+1
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-02Require xserver 1.10 or newerMichel Dänzer1-6/+0
1.10.0 was released in February 2011. We've been accidentally requiring 1.10 or newer since c7d27c94cb65 ("Keep track of damage event related flushes per-client"). (Ported from radeon commit 5df36de39952c3a26cb2fbc125f298139a9dd5bc) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-10-27PRIME: Fix swapping of provider sink / source capabilitiesHans de Goede1-2/+2
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-09-21Add support for ScreenPtr::SyncSharedPixmapMichel Dänzer1-1/+42
This allows deferring shared pixmap updates between different drivers. (Ported from radeon commit 53be26b00e83f871f0afd39caa5a7a1d6ec4aea1) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-09Make TearFree effective with PRIME slave scanoutMichel Dänzer1-8/+104
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-09Synchronize scanout pixmaps for TearFreeMichel Dänzer1-13/+67
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-09Move up amdgpu_scanout_extents_intersectMichel Dänzer1-17/+17
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-09Factor out transform_region helperMichel Dänzer1-31/+43
(Ported from radeon commit 5a57005178fc13b6f7e513458ca6dae72a3e5783) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-09Only copy from screen pixmap to shared pixmap on demand for slave scanoutMichel Dänzer1-13/+70
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-09Track damage accurately for RandR 1.4 slave scanoutMichel Dänzer1-11/+72
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-09Handle RandR 1.4 slave dirty updates via amdgpu_drm_queueMichel Dänzer1-3/+93
This reduces PCIe bandwidth usage and tearing. (Ported from radeon commit ad0a0656dd0e74683e6d7789decba827aa29c221) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-09Use drmmode_crtc_scanout_* helpers for RandR 1.4 scanout pixmapsMichel Dänzer1-7/+12
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-09Wait for pending flips to complete before turning off an output or CRTCMichel Dänzer1-3/+3
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-09Keep track of damage event related flushes per-clientMichel Dänzer1-8/+33
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-09Use EventCallback to avoid flushing every time in the FlushCallbackMichel Dänzer1-15/+62
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-07Add explicit AMDGPU_DRM_QUEUE_ERROR defineMichel Dänzer1-2/+2
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-08-22Fix cursor size for SIMarek Olšák1-2/+8
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
2016-07-12Only use RandR APIs if RandR is enabledMichel Dänzer1-9/+12
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-06-28Clear damage in amdgpu_scanout_update if it doesn't intersect the CRTCMichel Dänzer1-1/+3
There's no need to test that same damage again. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-06-28Remove w/h parameters from amdgpu_scanout_extents_intersectMichel Dänzer1-10/+5
We can use the dimensions of the CRTC's mode instead. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-06-24Make the dedicated scanout mechanism work with arbitrary transforms v2Michel Dänzer1-19/+10
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-16Propagate failure from amdgpu_set_pixmap_boMichel Dänzer1-1/+3
Preparation for the following fixes. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-05-12Enable DRI3 by default when building for Xorg >= 1.18.3Michel Dänzer1-0/+4
Seems to work well enough in general now. (Ported from radeon commit 1181b9c582f10b6c523e4b2988e2ce87ecf3d367) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-04-11Remove RR_Capability_SinkOutput for GPU without CRTC.Qiang Yu1-4/+7
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>