summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2018-08-16Use correct FB handle in radeon_do_pageflipMichel Dänzer
We were always using the handle of the client provided FB, which prevented RandR transforms from working, and could result in a black screen. Bugzilla: https://bugs.freedesktop.org/107519 Fixes: 740f0850f1e4 "Store FB for each CRTC in drmmode_flipdata_rec" (Ported from amdgpu commit f6cd72e64e85896b6d155bee0930e59771dcb701) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2018-08-03Store FB for each CRTC in drmmode_flipdata_recMichel Dänzer
We were only storing the FB provided by the client, but on CRTCs with TearFree enabled, we use a separate FB. This could cause drmmode_flip_handler to fail to clear drmmode_crtc->flip_pending, which could result in a hang when waiting for the pending flip to complete. We were trying to avoid that by always clearing drmmode_crtc->flip_pending when TearFree is enabled, but that wasn't reliable, because drmmode_crtc->tear_free can already be FALSE at this point when disabling TearFree. Now that we're keeping track of each CRTC's flip FB separately, drmmode_flip_handler can reliably clear flip_pending, and we no longer need the TearFree hack. (Ported from amdgpu commit 9b6782c821e0bdc53336d98f87ddde752faf7902) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2018-08-02glamor: Set RADEON_CREATE_PIXMAP_DRI2 for DRI3 pixmapsMichel Dänzer
Not doing this resulted in falling back to software for DRI3 client presentation operations with ShadowPrimary. (Ported from amdgpu commit 2989d40ef74d9966e8e8df2ef7727b2cc48d4960) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-27glamor: Use glamor_egl_create_textured_pixmap_from_gbm_bo when possibleMichel Dänzer
Inspired by the modesetting driver. Fixes screen pixmap corruption with Xorg < 1.20, and as a bonus, simplifies the code slightly. Bugzilla: https://bugs.freedesktop.org/107385 Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-24Use strcpy for RandR output property namesMichel Dänzer
Instead of strncpy with the string length. Avoids new warnings with GCC 8: ../../src/drmmode_display.c: In function ‘drmmode_output_create_resources’: ../../src/drmmode_display.c:2240:2: warning: ‘strncpy’ output truncated before terminating nul copying 8 bytes from a string of the same length [-Wstringop-truncation] strncpy(tearfree_prop->name, "TearFree", 8); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../src/drmmode_display.c:2244:2: warning: ‘strncpy’ output truncated before terminating nul copying 3 bytes from a string of the same length [-Wstringop-truncation] strncpy(tearfree_prop->enums[0].name, "off", 3); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../src/drmmode_display.c:2245:2: warning: ‘strncpy’ output truncated before terminating nul copying 2 bytes from a string of the same length [-Wstringop-truncation] strncpy(tearfree_prop->enums[1].name, "on", 2); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../src/drmmode_display.c:2247:2: warning: ‘strncpy’ output truncated before terminating nul copying 4 bytes from a string of the same length [-Wstringop-truncation] strncpy(tearfree_prop->enums[2].name, "auto", 4); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (Ported from amdgpu commit f3b2ed37d683f8616a0a31ff63133ddb8fe1a4a3) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-23Remove drmmode_terminate_leasesMichel Dänzer
The RandR screen private is already freed when our CloseScreen runs, so this can't do anything useful. This cleanup has to be done by the X server itself. (Ported from amdgpu commit 5f06d6b8ba570b500956ad26fee711d5ac427818) Acked-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-23Hardcode "non-desktop" RandR property nameMichel Dänzer
It's a bit silly to require current randrproto just for this definition, which can't really change anyway. Suggested-by: Qiang Yu <qiang.yu@amd.com> (Ported from amdgpu commit ae8e02c6fc4ef5d5340b8cd4739e66b19b9e3386) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-19Don't allocate drmmode_output->props twiceMichel Dänzer
This was accidentally duplicated when porting RandR lease support from amdgpu. Trivial.
2018-07-17glamor: Invalidate cached GEM handle in radeon_set_pixmap_boMichel Dänzer
We continued using the stale cached handle, causing issues e.g. when resizing the screen via RandR. Reported-by: iive on IRC Acked-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-16glamor: Fix glamor_block_handler argument in radeon_glamor_finishMichel Dänzer
I missed this before because this code isn't compiled with current xserver. Trivial.
2018-07-12Add RandR leases supportKeith Packard
Signed-off-by: Keith Packard <keithp@keithp.com> (Ported from xserver commit e4e3447603b5fd3a38a92c3f972396d1f81168ad) Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> (Ported from amdgpu commit 61040bdfa360975614fb47aa7ea1b3a1abac3427) Acked-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-12modesetting: Create CONNECTOR_ID properties for outputs [v2]Keith Packard
This lets a DRM client map between X outputs and kernel connectors. v2: Change CONNECTOR_ID to enum -- Adam Jackson <ajax@nwnk.net> Signed-off-by: Keith Packard <keithp@keithp.com> (Ported from xserver commit 023d4aba8d45e9e3630b944ecfb650c081799b96) Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> (Ported from amdgpu commit ab7e39c5a03e24c3ce3ee2f22ada7572bc2d9aa7) Acked-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-12modesetting: Record non-desktop kernel property at PreInit timeKeith Packard
Save any value of the kernel non-desktop property in the xf86Output structure to avoid non-desktop outputs in the default configuration. [Also bump randrproto requirement to a version that defines RR_PROPERTY_NON_DESKTOP - ajax] Signed-off-by: Keith Packard <keithp@keithp.com> (Ported from xserver commit b91c787c4cd2d20685db69426c539938c556128a) Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> (Ported from amdgpu commit 14db71a606128c4a207f43298809af279b77e2a8) Acked-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-12Call drmmode_crtc_gamma_do_set from drmmode_setup_colormapMichel Dänzer
Instead of from drmmode_set_mode_major. There's no need to re-set the gamma LUT on every modeset, the kernel should preserve it. (Ported from amdgpu commit baea4fa492f635cdfe746a84be2e337d9aeae8a9) Acked-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-12Remove #if 0'd codeMichel Dänzer
This has always been disabled, no need to keep it. (Ported from amdgpu commit 19a40758be04e1d451a030f452efb49e8aaad541) Acked-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-12Check dimensions passed to drmmode_xf86crtc_resizeMichel Dänzer
When enabling a secondary GPU output, Xorg can try resizing the screen beyond the limit advertised by the driver, leading to drmModeAddFB failing and primary GPU outputs turning off. Check for this and bail instead. (Ported from amdgpu commit 940c8b39f79789d4d5ddb8ab8d25a8ae05932756) Acked-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-12Use drmmode_crtc_dpms in drmmode_set_desired_modesMichel Dänzer
Simplifies the latter slightly. (Ported from amdgpu commit 74124f2c17dbb4b752707bb7eee398ae099e8a2c) Acked-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-12Call drmmode_do_crtc_dpms from drmmode_crtc_dpms as wellMichel Dänzer
Leo pointed out that drmmode_do_crtc_dpms wasn't getting called when turning off an output with xrandr --output <output> --off This meant that the vblank sequence number and timestamp wouldn't be saved before turning off the CRTC in this case. Reported-by: Leo (Sunpeng) Li <sunpeng.li@amd.com> (Ported from amdgpu commit ceeacb455cd058492a493aac954deab8455804b5) 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-12Wait for pending flips in drmmode_output_set_tear_freeMichel Dänzer
This prevents a nested call to drmHandleEvent, which would hang. Fixes hangs when disabling TearFree on a CRTC while a DRI3 client is page flipping. (Ported from amdgpu commit 04947b83cce3a7782e59dece2c7797cc396c1e05) Acked-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-12Refactor drmmode_output_set_tear_free helperMichel Dänzer
Preparation for the following fix, no functional change intended. (Ported from amdgpu commit fa30f4601de7a44edfb4a95873bd648946fd4292) Acked-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-12Set drmmode_crtc->scanout_id = 0 when TearFree is disabledMichel Dänzer
When disabling TearFree, drmmode_crtc->scanout_id could remain as 1, but drmmode_set_mode_major would destroy drmmode_crtc->scanout[1], so scanout_do_update() would keep bailing, and the scanout buffer would stop being updated. Fixes freeze after disabling TearFree on a CRTC with active RandR rotation or other transform. (Ported from amdgpu commit 7db0c8e9d7586cff4312d4b93684d35de3e6376f) Acked-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-12Simplify drmmode_handle_transformMichel Dänzer
Set crtc->driverIsPerformingTransform for any case we can handle before calling xf86CrtcRotate. We already clear it afterwards when the latter clears crtc->transform_in_use. This should allow our separate scanout buffer mechanism to be used in more cases. (Cherry picked from amdgpu commit 8e544b4a0de6717feb4abf00052d57c5b726b5ce) Acked-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-12Don't call scanout_flip/update with a legacy RandR scanout bufferMichel Dänzer
It means we are not using our own scanout buffers. Fixes crash when TearFree is supposed to be enabled, but drmmode_handle_transform doesn't set crtc->driverIsPerformingTransform. Bugzilla: https://bugs.freedesktop.org/105736 (Ported from amdgpu commit 463477661c88cab3a87746499e5838c5b9f9a13b) Acked-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-12Simplify drmmode_crtc_scanout_updateMichel Dänzer
Use our own BoxRec for the extents, and RegionEmpty for clearing the scanout damage region. (Ported from amdgpu commit 72c3e9c7308fbcdf85708b72f9be14a5f2f8e7b5) Acked-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-12Update RandR CRTC state if set_mode_major fails in set_desired_modesMichel Dänzer
Without this, RandR would report the CRTC and its outputs as enabled, even though they were actually off due to the failure. (Cherry picked from amdgpu commit 4dcda0b48d62944c841cd9540f4ad4c7ac8dee47) Acked-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-12Abort scanout_update_pending event when possibleMichel Dänzer
We don't need to wait for a non-TearFree scanout update before scanning out from the screen pixmap or before flipping, as the scanout update won't be visible anyway. Instead, just abort it. (Ported from amdgpu commit 36d01989cd842588f12fdae5b2cba5fdcf9c91dd) Acked-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-12Track DRM event queue sequence number in scanout_update_pendingMichel Dänzer
Preparation for next change, no behaviour change intended. (Ported from amdgpu commit 04a5c5f7cfacad8d9ccffe81e388cc3da2036cb5) Acked-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-12Ignore RADEON_DRM_QUEUE_ERROR (0) in radeon_drm_abort_entryMichel Dänzer
This allows a following change to be slightly simpler. (Ported from amdgpu commit 8fcc3a9b43d3907052a83a96e5a2423afab5ad3f) Acked-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-12Do not export the DriverRec RADEONEmil Velikov
Unused externally and should not be exported. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> (Ported from amdgpu commit 7fb8b49895e225b3908c8bd186539de23afe91d1) Acked-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-11Wait for pending scanout update before calling drmmode_crtc_scanout_freeJim Qu
There is a case that when set screen from reverse to normal, the old scanout damage is freed in modesetting before scanout update handler, so it causes segment fault issue. Signed-off-by: Jim Qu <Jim.Qu@amd.com> [ Michel Dänzer: Only call drmmode_crtc_wait_pending_event before drmmode_crtc_scanout_free is actually called, slightly tweak commit message ] Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> (Ported from amdgpu commit 9f6a8905611b5b1d8fcd31bebbc9af7ca1355cc3) 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-09Refactor radeon_finish helperMichel Dänzer
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-07-09Move flush from radeon_scanout_do_update to its callersMichel Dänzer
No functional change intended. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-09Factor out radeon_surface_initialize helperMichel Dänzer
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-09glamor: Don't store radeon_surfaces in pixmapsMichel Dänzer
Only EXA needs them. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-09Only initialize libdrm_radeon surface manager for >= R600Michel Dänzer
Not used with older GPUs. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2018-07-09EXA: Remove old RADEONEXACreatePixmap hookMichel Dänzer
Not used by any supported version of xserver. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2018-05-23Drop unused drmmode_create_bo_pixmap surface parameterMichel Dänzer
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2018-05-22glamor: Bail CreatePixmap on unsupported pixmap depthMichel Dänzer
Fixes crash in that case. Bugzilla: https://bugs.freedesktop.org/106293 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-03-14Pass extents to radeon_scanout_do_update by valueMichel Dänzer
radeon_scanout_extents_intersect could leave the scanout damage region in an invalid state, triggering debugging checks in pixman: *** BUG *** In pixman_region_append_non_o: The expression r->x1 < r->x2 was false Set a breakpoint on '_pixman_log_error' to debug (Ported from amdgpu commit 8af989546907ad9fb491d940e1936d3bfc89276b)
2018-03-07Wrap the whole miPointerScreenFuncRec, instead of only Set/MoveCursorMichel Dänzer
We were clobbering entries in mi's global miSpritePointerFuncs struct, which cannot work correctly with multiple primary screens. Instead, assign a pointer to our own wrapper struct to PointPriv->spriteFuncs. Fixes crashes with multiple primary screens. Fixes: 1fe8ca75974c ("Keep track of how many SW cursors are visible on each screen") Reported-by: Mario Kleiner <mario.kleiner.de@gmail.com>
2018-03-05Only change Set/MoveCursor hooks from what we expectMichel Dänzer
Since xf86CursorCloseScreen runs after RADEONCloseScreen_KMS, PointPriv->spriteFuncs doesn't point to the same struct in the latter as in RADEONCursorInit_KMS. So we were restoring info->Set/MoveCursor to the wrong struct. Then in the next server generation, info->Set/MoveCursor would end up pointing to drmmode_sprite_set/move_cursor, resulting in an infinite loop if one of them was called. To avoid this, only change the Set/MoveCursor hooks if their values match our expectations, otherwise leave them as is. This is kind of a hack, but the alternative would be invasive and thus risky changes to the way we're wrapping CloseScreen, and it's not even clear that can work without changing xserver code. Fixes: 1fe8ca75974c ("Keep track of how many SW cursors are visible on each screen") Acked-by: Alex Deucher <alexander.deucher@amd.com>
2018-03-02modesetting: Update property values at detect and uevent timeKeith Packard
We were updating the link-status property when a uevent came in, but we also want to update the non-desktop property, and potentially others as well. We also want to check at detect time in case we don't get a hotplug event. This patch updates every property provided by the kernel, sending changes to DIX so it can track things as well. Signed-off-by: Keith Packard <keithp@keithp.com> (Ported from amdgpu commit 374cb8fef4fdbb648af089ee80803ec78321f1b2)
2018-03-02modesetting: Reset output_id if drmModeGetConnector failedDaniel Martin
If drmModeGetConnector() fails in drmmode_output_detect(), we have to reset the output_id to -1 too. Yet another spot leading to a potential NULL dereference when handling the mode_output member as output_id was != -1. Though, this case should be very hard to hit. Signed-off-by: Daniel Martin <consume.noise@gmail.com> (Ported from amdgpu commit 10054b6c3d9a755b30abb43020121b9631fa296d)
2018-03-02modesetting: Use helper to fetch drmModeProperty(Blob)sDaniel Martin
Replace the various loops to lookup drmModeProperty(Blob)s by introducing helper functions. Signed-off-by: Daniel Martin <consume.noise@gmail.com> (Ported from amdgpu commit fb58e06acd6c6bd59de2dbdadbca27eb1dd0025b)