summaryrefslogtreecommitdiff
path: root/src/radeon_kms.c
AgeCommit message (Collapse)Author
2016-11-10Use pRADEONEnt to find both screens of a GPU in radeon_mode_hotplugMichel Dänzer
Fixes misbehaviour when hotplugging DisplayPort connectors on secondary GPUs. Fixes: c801f9f10a5d ("Handle Zaphod mode correctly in radeon_mode_hotplug") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98626 Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-11-01Check Xorg version at runtime instead of build time in two placesMichel Dänzer
This means that all possible paths can be handled as intended, no matter which Xorg version the driver happened to be compiled against. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-10-27Require xserver 1.10 or newerMichel Dänzer
1.10.0 was released in February 2011. We've been accidentally requiring 1.10 or newer since 121a6de72da5 ("Keep track of damage event related flushes per-client v2"). Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-10-26PRIME: Fix swapping of provider sink / source capabilitiesHans de Goede
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) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-21Clear damage in radeon_scanout_update if it doesn't intersect the CRTCMichel Dänzer
There's no need to test that same damage again. (Ported from amdgpu commit a576430526cbc404de64b30e1377a356644e8024)
2016-09-21Remove w/h parameters from radeon_scanout_extents_intersectMichel Dänzer
We can use the dimensions of the CRTC's mode instead. (Ported from amdgpu commit ede7f2bcae63be65e05e3029bfe7c742e5978932)
2016-09-21Make the dedicated scanout mechanism work with arbitrary transformsMichel Dänzer
This makes TearFree work with arbitrary transforms, and makes transforms work better even without TearFree, with xserver >= 1.12. (Ported from amdgpu commit bf000ea7ef91f5ecb59fc3c1ab8ed9eddcc0841d)
2016-09-21Propagate failure from radeon_set_pixmap_boMichel Dänzer
(Ported from amdgpu commits c315c00e44afc91a7c8e2eab5af836d9643ebb88 and 0d42082108c264568e2aadd15ace70e72388bc65)
2016-09-21Add support for ScreenPtr::SyncSharedPixmapMichel Dänzer
This allows deferring shared pixmap updates between different drivers. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-21Only define transform_region function for XF86_CRTC_VERSION >= 4Michel Dänzer
We're not using it with older xserver. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-06Make TearFree effective with PRIME slave scanoutMichel Dänzer
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. v2: * Also test dirty->slave_dst in radeon_prime_scanout_do_update Reviewed-by: Alex Deucher <alexander.deucher@amd.com> [v1]
2016-09-06Synchronize scanout pixmaps for TearFreeMichel Dänzer
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. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-06Move up radeon_scanout_extents_intersectMichel Dänzer
Will be needed higher up by the following changes. No functional change. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-02Factor out transform_region helperMichel Dänzer
While we're at it, fix leaking the memory allocated for xRectangles. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-08-30Only copy from screen pixmap to shared pixmap on demand for slave scanoutMichel Dänzer
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. v2: * Reduce churn in radeon_prime_scanout_update_handler * Clear the correct damage in radeon_dirty_update Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-08-26Fix build against xserver < 1.13Michel Dänzer
pScreen->isGPU was only introduced in 1.13. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97490 Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-08-25Also call drmmode_clear_pending_flip from radeon_scanout_flip_abortMichel Dänzer
Not doing so could break DPMS with TearFree. Reported-and-Tested-by: furkan on IRC Fixes: 9090309e057d ("Wait for pending flips to complete before turning off an output or CRTC") Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-08-23Track damage accurately for RandR 1.4 slave scanoutMichel Dänzer
This further reduces the PCIe bandwidth usage. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-08-23Handle RandR 1.4 slave dirty updates via radeon_drm_queueMichel Dänzer
This reduces PCIe bandwidth usage and tearing. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-08-17Use drmmode_crtc_scanout_* helpers for RandR 1.4 scanout pixmapsMichel Dänzer
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. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-08-17Keep track of damage event related flushes per-client v2Michel Dänzer
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. v2: Use ScreenPrivateKey, fixes invalid memory access with GPU screens Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-08-03Wait for pending flips to complete before turning off an output or CRTCMichel Dänzer
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 Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-08-01Use EventCallback to avoid flushing every time in the FlushCallbackMichel Dänzer
We only need to flush for XDamageNotify events. Significantly reduces compositing slowdown due to flushing overhead, in particular with glamor. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-07-22Don't enable DRI3 by default with EXAMichel Dänzer
It doesn't work correctly in all cases, see e.g. https://bugs.freedesktop.org/show_bug.cgi?id=95475 . I'm not sure this is fixable, given EXA's architecture. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-07-22Add explicit RADEON_DRM_QUEUE_ERROR defineMichel Dänzer
Should make the radeon_drm_queue_alloc error handling clearer, and gets rid of a compile warning about it returning NULL. Reviewed-by: Alexandre Demers <alexandre.f.demers@gmail.com>
2016-06-24Only use RandR APIs if RandR is enabledMichel Dänzer
Fixes crash with Xinerama enabled, which disables RandR. Fixes: https://bugs.debian.org/827984 Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-05-11Enable DRI3 by default when building for Xorg >= 1.18.3Michel Dänzer
Seems to work well enough in general now. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-04-11Remove RR_Capability_SinkOutput for GPU without CRTCQiang Yu
Signed-off-by: Qiang Yu <Qiang.Yu@amd.com> (Ported from amdgpu commit a0bbb373f902e0ffc14570c85faec7e44134f62e) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-04-01Identify DRM event queue entries by sequence number instead of by pointerMichel Dänzer
If the memory for an entry was allocated at the same address as that for a previously cancelled entry, the handler could theoretically be called prematurely, triggered by the DRM event which was submitted for the cancelled entry. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-03-24Call RADEONBlockHandler_KMS before setting initial modesMichel Dänzer
Doing it the other way around meant that there was still a possibility for the front buffer contents to be uninitialized when they start being scanned out. (Ported from amdgpu commit 4a60b4b1851a3cbc2d8ad9048d68eeb6947cf132) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-03-24Fix build against older versions of xserverMichel Dänzer
Also slightly clean up the error handling in radeon_scanout_do_update. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94614 Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-03-24DRI3 only works with accelerationMichel Dänzer
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94214 Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-03-23TearFree can only work with accelerationMichel Dänzer
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-03-23Don't try DRI2/Present flipping while the HW cursor can't be usedMichel Dänzer
Flipping doesn't interact correctly with SW cursor: A flip makes the SW cursor disappear. It will only appear again when the cursor is moved, but it will be surrounded by corruption, because the SW cursor code will restore stale screen contents at the old cursor location before drawing the cursor at the new location. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-03-09Make Option "TearFree" effective for rotated/reflected outputs as well (v2)Michel Dänzer
Support varies by xserver version: < 1.12: No support for the driver handling rotation/reflection 1.12-1.15: Support for driver handling rotation/reflection, but there's a bug preventing the HW cursor from being visible everywhere it should be on rotated outputs, so we can only support TearFree for reflection. >= 1.16: While the bug above is still there (fixes pending review), the driver can force SW cursor for rotated outputs, so we can support TearFree for rotation as well. v2: Don't set crtc->driverIsPerformingTransform after xf86CrtcRotate if it wasn't set before. Fixes breaking rotation with TearFree disabled. Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (v1)
2016-03-01Deal with modesets and page flips crossing on a CRTCMichel Dänzer
If we set a mode while a flip is pending, the kernel driver may program the flip to the hardware after the modeset. If that happens, the hardware will display the BO from the flip, whereas we will assume it displays the BO from the modeset. In other words, the display will most likely freeze, at least until another modeset. Prevent this condition by waiting for a pending flip to finish before setting a mode. Fixes display freezing when setting rotation or a transform with TearFree enabled. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-02-27Make DRM event queue xf86CrtcPtr based instead of ScrnInfoPtr basedMichel Dänzer
This allows for a minor simplification of the code. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-02-27Remove radeon_scanout_flip_handlerMichel Dänzer
No longer necessary now that radeon_drm_queue_handler can handle e->handler == NULL. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-01-20Set RADEON_GEM_NO_CPU_ACCESS flag for BOs which don't need CPU accessMichel Dänzer
Failing to do this was resulting in the kernel driver unnecessarily leaving open the possibility of CPU access to those BOs. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-01-14Set the RandR primary output on startup if Xorg hasn'tMichel Dänzer
Fixes xrandr (XRRGetOutputPrimary) not reporting any output as primary after startup. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-12-01Load fb module before glamoregl/shadow modulesMichel Dänzer
Fixes unresolved symbols on some systems. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93105 Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-11-20Don't advertise any PRIME offloading capabilities without accelerationMichel Dänzer
Acceleration is required even for display offloading. Trying to enable display offloading without acceleration resulted in a crash. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-11-17glamor: Restore all ScreenRec hooks during CloseScreenMichel Dänzer
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-08-11Make selection between DRI2 and DRI3 consistent with other drivers. (v2)Mario Kleiner
Add Option "DRI" to allow selection of maximum DRI level. This allows the user to select the maximum level of DRI implementation to use, DRI2 or DRI3. It replaces the old option "DRI3" which had exactly the same purpose, but differs from the method used in both intel ddx and nouveau ddx. Make this consistent before a new stable driver is released. v2: Retain handling of old Option "DRI3" for backwards compatibility, but Option "DRI" will take precedence over "DRI3" if both are provided. Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2015-08-06Only call drmmode_copy_fb (at most) once on server startupMichel Dänzer
It doesn't make sense to copy the screen contents from console when VT switching back to Xorg or when Xorg resets. Fixes intermittent artifacts when VT switching back from console to the gdm login screen. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-07-28radeon: cleanup the entity recDave Airlie
Some of these were set, some of them were always opposites, so clean things up. Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-07-10radeon: adopt for new X server dirty tracking APIs.Dave Airlie
Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-06-25Skip disabled CRTCs in radeon_scanout_(do_)updateMichel Dänzer
The vblank / page flip ioctls don't work as expected for a disabled CRTC. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-06-22Don't set TILE_SPLIT flags if surface.tile_split == 0.Mario Kleiner
On pre-Evergreen hw, libdrm's r6_surface_best() helper for the surface managers radeon_surface_best() routine is a no-op and therefore doesn't assign any tile_split settings to created surfaces, so it leaves surface.tile_split on its "undefined" value of 0. Mesa's DRI3/Present backend creates DRI3 Pixmaps via the DRIImage extension and the radeon gallium driver implementation of that extension uses the libdrm surface manager for backing bo creation and treats an undefined surface.tile_split==0, as returned by the surface manager for pre-evergreen, as a signal to not assign any tile_split flags to the DRI3 Pixmaps bo. The ddx also uses libdrm surface manager to create the x-screen pixmap, but so far treated the returned undefined surface.tile_split==0 by mapping it to eg_tile_split()'s default tile_split flags, which are different from Mesa's tiling flags for DRI3 pixmaps. Under DRI3/Present this causes a mismatch of src pixmap and destination root pixmaps tiling flags and thereby prevents page flipping for pixmap presents. Change the ddx code to treat surface.tile_split==0 the same way as the radeon gallium driver to avoid mismatched tiling flags and thereby allow DRI3/Present page-flip to work on pre-Evergreen hw. Tested on RV730 and Evergreen "Juniper". Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
2015-06-11Allow/Fix use of multiple ZaphodHead outputs per x-screen. (v2)Mario Kleiner
Defining multiple ZaphodHead outputs per x-screen in a multiple x-screen's per gpu configuration caused all outputs except one per x-screen to go dark, because there was a fixed mapping x-screen number -> crtc number, limiting the number of crtc's per x-screen to one. On a ZaphodHead's setup, be more clever and assign as many crtc's to a given x-screen as there are ZaphodHeads defined for that screen, assuming there are enough unused crtc's available. Tested on a triple display setup with different combos of one, two or three ZaphodHeads per one, two or three x-screens. This is a port of similar code from xf86-video-nouveau. v2: Implement suggestions by Michel Dänzer: Less verbose debug output, more clear warning message on crtc allocation failure. Move clearing of per gpu assigned_crtc mask to CloseScreen, indeed testing shows no need for the more complex new server generation check from v1. Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> (v1) Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>