summaryrefslogtreecommitdiff
path: root/src/radeon_dri2.c
AgeCommit message (Collapse)Author
2021-03-26Guard local variable info only used with glamorMichel Dänzer
Fixes compiler warning with glamor disabled: radeon_dri2.c: In function 'radeon_dri2_exchange_buffers': radeon_dri2.c:732:19: error: unused variable 'info' [-Werror=unused-variable] RADEONInfoPtr info = RADEONPTR(xf86ScreenToScrn(screen)); ^~~~
2019-06-14Remove dri2_drawable_crtc parameter consider_disabledMichel Dänzer
All callers were passing TRUE. (Ported from amdgpu commit ea19a5207054bb159fc7fb6d88e0ceb10c3da010) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2019-06-14dri2: Re-use previous CRTC when possible if pick_best_crtc returns NULLMichel Dänzer
This way, the MSC will continue ticking at the rate of (the last mode which was enabled for) that CRTC, instead of the client running unthrottled. (Ported from amdgpu commit 3109f088fdbd89c2ee8078625d4f073852492656) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2019-06-14dri2: reply to client for WaitMSC request in any caseFlora Cui
otherwise client would wait for reply forever and desktop appears hang. Signed-off-by: Flora Cui <flora.cui@amd.com> (Ported from amdgpu commit fb06fb814700a47464abd756e1111dcc76d0d776) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2019-03-04dri2: Call drm_queue_handle_deferred in dri2_deferred_eventMichel Dänzer
drm_queue_handler just puts the event on the signalled list; without calling drm_queue_handle_deferred, actual processing of the event may be delayed indefinitely, e.g. until another event arrives from the kernel. This could result in DRI2 clients hanging during DPMS off. Fixes: ba83a866af5a "Add radeon_drm_handle_event wrapper for drmHandleEvent" (Ported from amdgpu commit 09be74a3d1dd9604336d9a27f98d132b262dcbaf) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2019-01-28dri2: Flush in dri2_create_buffer2 after calling glamor_set_pixmap_boMichel Dänzer
To make sure the client can't use the shared pixmap storage for direct rendering first, which could produce garbage. Bugzilla: https://bugs.freedesktop.org/109235 (Ported from amdgpu commit ebd32b1c07208f8dbe853e089f5e4b7c6a7a658a)
2018-12-28Explicitly keep track of whether a DRM event is for a flip or notMichel Dänzer
When an async flip is performed, and TearFree is enabled on the CRTC used for timing, we schedule a vblank event for completing the page flip. The DRM event queuing code treated this event like a vblank event, but it needs to be treated like a page flip event. (Ported from amdgpu commit e2c7369cae65069aa93eed1c0b678f975ce5c274)
2018-08-17Move DRM event queue related initialization to radeon_drm_queue_initMichel Dänzer
And make radeon_drm_queue_handler not directly accessible outside of radeon_drm_queue.c. (Ported from amdgpu commit 0148283984c77f7a6e97026edc3093497547e0a4) Acked-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-12Replace 'foo == NULL' with '!foo'Michel Dänzer
Shorter and sweeter. :) (Ported from amdgpu commit e8e688f3852fb06b0c34ed5bce47c9493bcd1613) Acked-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-10Swap pixmap privates in radeon_dri2_exchange_buffersMichel Dänzer
Instead of only the BOs. This matches what amdgpu does, and fixes issues with DRI2 page flipping. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-09glamor: Use GBM for BO allocation when possibleMichel Dänzer
Inspired by amdgpu. This avoids various issues due to a GEM handle lifetime conflict between us and Mesa with current glamor. Bugzilla: https://bugs.freedesktop.org/105381 Tested-by: Konstantin Kharlamov <hi-angel@yandex.ru> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-09Add struct radeon_bufferMichel Dänzer
Inspired by amdgpu, preparation for the following change. For now, this is mostly a wrapper around struct radeon_bo, no functional change intended. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-09Remove throttling from radeon_dri2_copy_region2Jammy Zhou
Throttling should be handled by the client-side drivers. Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com> (Ported from amdgpu commit 8a34a8149860ac15e83ccdbd8d9a527d8d3e5997) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2018-05-17Bail from dri2_create_buffer2 if we can't get a pixmapMichel Dänzer
We would store the NULL pointer and continue, which would lead to a crash down the road. Bugzilla: https://bugs.freedesktop.org/106293 Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2018-01-25Add missing depth 30 -> cpp=4 handling for DRI2.Mario Kleiner
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>
2017-12-28Keep track of how many SW cursors are visible on each screenMichel Dänzer
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-08-30Require xserver >= 1.13Michel Dänzer
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-17Always allow DRI2 page flipping with TearFreeMichel Dänzer
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-17Create drmmode_wait_vblank helperMichel Dänzer
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-17Pass reference CRTC to radeon_do_pageflip directlyMichel Dänzer
Simplifies the code slightly. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-02Allow DRI page flipping when some CRTCs use separate scanout buffersMichel Dänzer
As long as the CRTC we're synchronizing to doesn't. v2: * Remove redundant checks from can_exchange which still prevented DRI2 page flipping Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-02Add drmmode_crtc_can_flip helperMichel Dänzer
To reduce code duplication between DRI2 and Present. No functional change intended yet. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-07-11Use drmmode_crtc->scanout_id instead of 0 to check for scanout bufferMichel Dänzer
Preparation for following change, no functional change intended. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-06-30Use pRADEONEnt->fd exclusively for the DRM file descriptorMichel Dänzer
This brings us closer to amdgpu. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-05-11Pass pixmap instead of handle to radeon_do_pageflipMichel Dänzer
This brings us in line with amdgpu and prepares for the following change, no functional change intended. (Ported from amdgpu commit e463b849f3e9d7b69e64a65619a22e00e78d297b) v2: * Be more consistent with the amdgpu code, which should make porting the following change to amdgpu easier Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-02-22Allow toggling TearFree at runtime via output propertyMichel Dänzer
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. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-02-08Fix flip event data leak if calloc or drmModeAddFB failsMichel Dänzer
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-11-18Use DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE/RELATIVE flags when availableMichel Dänzer
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-11-09Reindent code in radeon_dri2_create_buffer2Michel Dänzer
Fixes warning about misleading indentation from recent versions of gcc: ../../src/radeon_dri2.c: In function ‘radeon_dri2_create_buffer2’: ../../src/radeon_dri2.c:224:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] if (flags & RADEON_CREATE_PIXMAP_TILING_MACRO) ^~ ../../src/radeon_dri2.c:227:6: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’ if (aligned_width == front_width) ^~ No functional change intended. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-21dri2: Don't allow flipping when using a dedicated scanout bufferMichel Dänzer
Fixes issues when mixing rotation and page flipping with current xserver Git master. (Ported from amdgpu commit decabd574f90d3df397c80ec931b3fde8a4afb49)
2016-09-15DRI2: Fix radeon_dri2_exchange_buffers width/height copy'n'paste errorQiang Yu
Signed-off-by: Qiang Yu <Qiang.Yu@amd.com> (Ported from amdgpu commit 73c8dc000ad6b2b53ba3aa7155f5e8f6b55623b7) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-15DRI2: Add interpolated_vblanks in radeon_dri2_get_crtc_mscMichel Dänzer
We need that in radeon_dri2_drawable_crtc as well for priv->vblank_delta to work as intended. radeon_dri2_get_msc was already doing this. Fixes hangs in some cases when using VDPAU via DRI2 and moving the window between CRTCs. (Ported from amdgpu commit abd1a7901c95e4bc78415cf1b7923623b9177152) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-14Move DRI2's local fixup_glamor helper to radeon_glamor_set_pixmap_boMichel Dänzer
So it can be used outside of the DRI2 code. (Ported from amdgpu commit 5518bf5d793439b5bab369e5fc18de9a4a3b9dd6) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-14Consolidate get_drawable_pixmap helperMichel Dänzer
There were two static helpers for the same purpose. Consolidate them into a single inline helper which can be used anywhere. (Ported from amdgpu commit 641f4647b7f51dfd2da330376cd10fa9702b6423) 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-04-12Add support for async flips to radeon_do_pageflipMichel Dänzer
Will be used by the next change. No functional change here. 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-24Require xserver 1.9 or newerMichel Dänzer
1.9.0 was released in August 2010. We were already unintentionally relying on things not available in 1.8 for at least a year, and nobody has complained. 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-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-27DRI2: Also clear dri2_flipping when client disconnects before eventMichel Dänzer
Fixes the following problem: With DRI3 enabled, run glxgears with LIBGL_DRI3_DISABLE=1, make it fullscreen and press Escape while it's still fullscreen. This could result in dri2_flipping not getting cleared, spuriously preventing apps using DRI3 from flipping. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-11-12Clean up radeon_dri2_create_buffer2()Tom St Denis
Remove the depth_pixmap variable from the function and clear out any dead/odd behaviour that results. Signed-off-by: Tom St Denis <tom.stdenis@amd.com> (ported from amdgpu commit 6000aef4e2f0a121b94023484406fb6f04688f74) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-11-11dri2: Avoid calculation with undefined msc valueTom St Denis
If the get_msc() call fails for any reason we should avoid updating the vblank counter delta with undefined data. Signed-off-by: Tom St Denis <tom.stdenis@amd.com> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> (minor fixups) (ported from amdgpu commit 8823c3d4c6db70cff7699b31088f2d92db8faaf4) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-08-20DRI2: Keep MSC monotonic when moving window between CRTCsMichel Dänzer
This mirrors the DRI3 implementation in xserver. Fixes VDPAU video playback hanging when moving the window between CRTCs. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66384 (Ported from amdgpu commit 63948ea091a9b324327ade7ec4fc5d67ca7e6f6f) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-08-19DRI2: Don't ignore rotated CRTCs in amdgpu_dri2_drawable_crtcMichel Dänzer
Waiting for vblank interrupts works fine with rotated CRTCs. The only case we can't handle with rotation is page flipping, which is handled in can_exchange(). This fixes gnome-shell hanging on rotation, probably because amdgpu_dri2_get_msc returned MSC/UST 0 for rotated CRTCs. (Ported from amdgpu commit 7b3212e33cd36fb6f122774df27b56ec4e1a22b8) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-06-11Don't attempt a DRI2/Present page flip while the other one is flippingMichel Dänzer
Fixes corrupted display and hangs when switching between DRI2 and DRI3 fullscreen apps, e.g. a compositor using DRI3 and a fullscreen app using DRI2 or vice versa. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-06-01DRI2: Fix handling of drmmode_crtc_get_ust_msc return codeMichel Dänzer
Fixes regression introduced in commit 76c2923ac5c7230a8b2f9f8329c308d28b44d9c0 ("DRI2: Split out helper for getting UST and MSC of a specific CRTC"). Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-04-22DRI2: Clear old->devPrivate.ptr in fixup_glamorMichel Dänzer
It doesn't point to the memory of the newly allocated BO. Fixes crash running piglit with Option "ShadowPrimary" enabled. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-04-03glamor: Remove the stride member of struct radeon_pixmapMichel Dänzer
Its value was always the same as that of the PixmapRec devKind member. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-03-30DRI2: Use radeon_get_pixmap_handleMichel Dänzer
Now we can share pixmaps with no struct radeon_bo via DRI2. Fixes VDPAU video playback freezing when using an OpenGL compositor with DRI3 enabled. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89755 Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Tested-by: Nick Sarnie <commendsarnex@gmail.com>