summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
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-29Use a timer for unreferencing the all-black FBMichel Dänzer
The timer fires 1 second after LeaveVT. This gives the next DRM master enough time to set up scanout of its own buffers. Fixes prolonged intermittent black screen when switching from Xorg to e.g. the GDM Wayland mode login VT. Fixes: 06a465484101 ("Make all active CRTCs scan out an all-black framebuffer in LeaveVT") Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-29Remove drmmode_scanout_freeMichel Dänzer
Not used anymore. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-29Make all active CRTCs scan out an all-black framebuffer in LeaveVTMichel Dänzer
And destroy all other FBs. This is so that other DRM masters can only get access to this all-black FB, not to any other FB we created, while we're switched away and not DRM master. Fixes: 55e513b978b2 ("Use reference counting for tracking KMS framebuffer lifetimes") Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-29Create radeon_master_screen helperMichel Dänzer
Preparatory, no functional change intended yet. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-29Create radeon_pixmap_get_fb_ptr helperMichel Dänzer
Preparatory, no functional change intended yet. Also inline radeon_pixmap_create_fb into radeon_pixmap_get_fb, since there's only one call-site anymore. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-29Create drmmode_set_mode helperMichel Dänzer
Preparatory, no functional change intended yet. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-23Create radeon_pixmap_clear helperMichel Dänzer
Preparatory, no functional change intended yet. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-18modesetting: re-set the crtc's mode when link-status goes BADMartin Peres
Despite all the careful planning of the kernel, a link may become insufficient to handle the currently-set mode. At this point, the kernel should mark this particular configuration as being broken and potentially prune the mode before setting the offending connector's link-status to BAD and send the userspace a hotplug event. This may happen right after a modeset or later on. Upon receiving a hot-plug event, we iterate through the connectors to re-apply the currently-set mode on all the connectors that have a link-status property set to BAD. The kernel may be able to get the link to work by dropping to using a lower link bpp (with the same display bpp). However, the modeset may fail if the kernel has pruned the mode, so to make users aware of this problem a warning is outputed in the logs to warn about having a potentially-black display. This patch does not modify the current behaviour of always propagating the events to the randr clients. This allows desktop environments to re-probe the connectors and select a new resolution based on the new (currated) mode list if a mode disapeared. This behaviour is expected in order to pass the Display Port compliance tests. (Ported from xserver commit bcee1b76aa0db8525b491485e90b8740763d7de6) [ Michel: Bump libdrm dependency to >= 2.4.78 for DRM_MODE_LINK_STATUS_BAD ] Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-17Make radeon_scanout_do_update take a PixmapPtr instead of a DrawablePtrMichel Dänzer
All callers were already passing in a pixmap. This allows simplifying the rotated scanout case slightly. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-17Use xorg_list_append for the DRM event listMichel Dänzer
We were adding entries at the start of the list, i.e. the list was ordered from most recently added to least recently added. However, the corresponding DRM events are generally expected to arrive in the same order as they are queued, which means that radeon_drm_queue_alloc would generally have to traverse the whole list to find the entry corresponding to an arrived event. Fix this by adding entries at the end of the list. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-17Consolidate radeon_scanout_flip_abort/handler helpersMichel Dänzer
While at it, make them use crtc->driver_private. Reviewed-by: Alex Deucher <alexander.deucher@amd.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-17Always allow Present page flipping with TearFreeMichel Dänzer
Even if TearFree is active for the the CRTC we're synchronizing to. In that case, for Present flips synchronized to vertical blank, the other scanout buffer is immediately synchronized and flipped to during the target vertical blank period. For Present flips not synchronized to vertical blank, we simply use the MSC and timestamp values of the last vertical blank period for timing purposes, and let the normal TearFree mechanism handle display updates. v2: * Move manpage hunk to next change, since TearFree can still prevent DRI2 page flipping with this change. Reviewed-by: Alex Deucher <alexander.deucher@amd.com> # v1
2017-08-17Pass extents to radeon_scanout_do_updateMichel Dänzer
Preparation for following change, no functional change intended yet. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-17Add source drawable parameter to radeon_scanout_do_updateMichel Dänzer
Preparation for following changes, no functional change intended yet. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-17Handle multiple "pending" Present flipsMichel Dänzer
The xserver Present code can submit a flip in response to notifying it that a vblank event arrived. This can happen before the completion event of the previous flip is processed. In that case, we were clearing the drmmode_crtc->flip_pending field prematurely. Prevent this by only clearing drmmode_crtc->flip_pending when it matches the framebuffer being scanned out since the flip whose completion event we're processing. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-17Wait for pending flips synchronously before turning off a CRTCMichel Dänzer
Allows removing drmmode_clear_pending_flip and the pending_dpms_mode field and cleaning up the code considerably. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-08-17Create drmmode_crtc_wait_pending_event helper macroMichel Dänzer
Preparation for following change, no functional change intended yet. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
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-15Remove drmmode_crtc->scanout_destroy[] arrayMichel Dänzer
No longer necessary since we're reference counting framebuffers. Reviewed-by: Alex Deucher <alexander.deucher@amd.com
2017-08-15Adapt to PixmapDirtyUpdateRec::src being a DrawablePtrMichel Dänzer
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-28Use root window (pixmap) instead of screen pixmap for scanout updatesMichel Dänzer
Preparation for following changes, no functional change intended yet. v2: * Add drmmode_screen_damage_destroy callback to prevent use-after-free on server shutdown Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-07-26Only handle reflection in the driver with Xorg < 1.16Michel Dänzer
Xorg doesn't handle the hardware cursor correctly in that case for rotation and general transforms, and we can't force the SW cursor. Fixes: f2bc882f1c10 ("Handle rotation in the driver also with Xorg 1.12-1.18") Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-07-13If a TearFree flip fails, fall back to non-TearFree operationMichel Dänzer
In order to avoid possible freeze / log file spam in that case. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99769 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-06-30Improve drmmode_fb_reference debugging codeMichel Dänzer
If a reference count is <= 0, call FatalError with the call location (in case it doesn't get resolved in the backtrace printed by FatalError). (Ported from amdgpu commit 1b6ff5fd9933c00ec1ec90dfc62e0b531927749b) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-06-27Increase reference count of FB assigned to drmmode_crtc->flip_pendingMichel Dänzer
Otherwise, it could happen that we destroy the FB before the flip completes, resulting in use-after-free and most likely a crash. (Ported from amdgpu commit af7221e1c4d2dbdfd488eb0976a835584ea8441c) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-06-27Only call drmmode_scanout_free for non-GPU screens in LeaveVTMichel Dänzer
Destroying the scanout buffers of GPU screens resulted in a crash when switching back to the Xorg VT. Fixes: 4cfa4615f79f ("Use drmmode_crtc_scanout_* helpers for RandR 1.4 scanout pixmaps") Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-06-26Include xf86Pci.h for DRICreatePCIBusID with xserver Git masterMichel Dänzer
The declaration has been moved there from dri.h. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-06-15modesetting: Validate the atom for enum propertiesAdam Jackson
The client could have said anything here, and if what they said doesn't actually name an atom NameForAtom() will return NULL, and strcmp() will be unhappy about that. [copied from xserver d4995a3936ae283b9080fdaa0905daa669ebacfc] Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
2017-05-17Use plain glamor_egl_create_textured_screen().Eric Anholt
Since 5064ffab631 (2014), glamor's implementation of _ext just drops the back_pixmap arg, which we were passing NULL (the default) to anyway. Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2017-05-11Remove unused struct members from drmmode_display.hMichel Dänzer
(Ported from amdgpu commit 462ac3341e5bfbded9086d3d9043821d19352b3e) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-05-11Simplify tracking of PRIME scanout pixmapMichel Dänzer
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. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-05-11Use reference counting for tracking KMS framebuffer lifetimesMichel Dänzer
References are held by the pixmaps corresponding to the FBs (so the same KMS FB can be reused as long as the pixmap exists) and by the CRTCs scanning out from them (so a KMS FB is only destroyed once it's not being scanned out anymore, preventing intermittent black screens and worse issues due to a CRTC turning off when it should be on). v2: * Only increase reference count in drmmode_fb_reference if it was sane before * Make drmmode_fb_reference's indentation match the rest of drmmode_display.h 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-05-09Apply gamma correction to HW cursorMichel Dänzer
The display hardware CLUT we're currently using for gamma correction doesn't affect the HW cursor, so we have to apply it manually when uploading the HW cursor data. This currently only works in depth 24/32. (Ported from amdgpu commit 82fa615f38137add75f9cd4bb49c48dd88de916f) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-04-17Don't set modes before RADEONWindowExposures_oneshot is calledMichel Dänzer
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: cc9d6b7db9c2 ("Move DPMS check from radeon_scanout_do_update to radeon_scanout_flip") (Ported from amdgpu commit 981bac185cfd74ae50dffc28f57cf34623a9595f) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-04-10Set correct DRM event context versionDaniel Stone
DRM_EVENT_CONTEXT_VERSION is the latest context version supported by whatever version of libdrm is present. We were blindly asserting we supported whatever version that may be, even if we actually didn't. Set the version as 2, which should be bumped only with the appropriate version checks. Signed-off-by: Daniel Stone <daniels@collabora.com> (Ported from xserver commit 0c8e6ed85810e96d84173a52d628863802a78d82) v2: Remove second paragraph of commit log, we always initialize page_flip_handler2 = NULL (Emil Velikov) Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> # v1
2017-03-09Pass TRUE to drmmode_set_desired_modes the first time for GPU screensMichel Dänzer
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. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-03-08Skip some initialization steps for GPU screensMichel Dänzer
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 Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-03-06Fix build for XServer 1.13Jochen Rollwagen
Latest git build stops with the error message radeon_kms.c: In function 'RADEONWindowExposures_oneshot': radeon_kms.c:1644:45: error: expected expression before 'RegionPtr' pScreen->WindowExposures(pWin, pRegion, RegionPtr pBSRegion); This patch fixes the build. Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2017-03-02Don't call radeon_cs_flush_indirect & radeon_bo_wait in drmmode_copy_fbMichel Dänzer
RADEONWindowExposures_oneshot takes care of it. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2017-03-02Move DPMS check from radeon_scanout_do_update to radeon_scanout_flipMichel Dänzer
When radeon_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.
2017-03-02Call drmmode_set_desired_modes from a WindowExposures hookMichel Dänzer
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 RADEONUnblank -> 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 RADEONBlockHandler_oneshot repeatedly even after we set pScreen->BlockHandler = RADEONBlockHandler_KMS. v2: * Drop spaces between XORG_VERSION_NUMERIC arguments * Call radeon_bo_wait after radeon_cs_flush_indirect Bugzilla: https://bugs.freedesktop.org/99457 Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (v1)
2017-03-02Fix bogus indentationMichel Dänzer
Trivial. Fixes: 58cd1600057e ("Allow toggling TearFree at runtime via output property")