AgeCommit message (Collapse)AuthorFilesLines
2021-02-02Drop dri.h includesHEADmasterMichel Dänzer2-3/+0
Not needed anymore. Reviewed-by: Alex Deucher <>
2020-12-14Fix drmmode_crtc_scanout_create logicLikun Gao1-1/+2
If crtc scanout create successfully, the function of drmmode_crtc_scanout_create should return TURE. This will fix the regression caused by commit: "Make drmmode_crtc_scanout_create/destroy static" (442efe73), as it will result to some function (such as drmmode_set_scanout_pixmap) go to wrong code path and result to NULL pointer. Fixes: 442efe73 ("Make drmmode_crtc_scanout_create/destroy static") Signed-off-by: Likun Gao <> Reviewed-by: Michel Dänzer <>
2020-08-28Check for AMDGPU_CREATE_PIXMAP_SCANOUT in amdgpu_glamor_create_pixmapMichel Dänzer1-1/+2
We must not call glamor_create_pixmap or fbCreatePixmap when it's set. Closes:
2020-07-17Replace a few more instances of "master"Michel Dänzer2-3/+3
Reviewed-by: Alex Deucher <>
2020-07-10Fix build against ABI_VIDEODRV_VERSION 25.2Michel Dänzer6-46/+52
Use primary/secondary instead of master/slave where applicable. Reviewed-by: Alex Deucher <>
2020-05-27Make drmmode_crtc_scanout_create/destroy staticMichel Dänzer3-35/+28
And the latter inline.
2020-05-27Drop struct drmmode_scanout altogether in favour of PixmapPtrsMichel Dänzer3-66/+57
2020-05-27Drop bo/width/height members from struct drmmode_scanoutMichel Dänzer3-70/+14
The pixmap is all we really need.
2020-05-27Fix return value check of drmIoctl()Niclas Zeising1-1/+1
When the drmModeSetCursor2() call was replaced with bare drmIoctl() call in b344e155, a bug was introduced. With the use of drmModeSetCursor2(), the return value from drmIoctl() (which calls ioctl()) were mangled, if they were negative, they were replaced by -errno by a wrapper function in xf86drMode.c in libdrm. After replacing drmModeSetCursor2() with the call to drmIoctl(), this mangling no longer happens, and we need to explicitly check if the call to drmIoctl() fails, which is indicated by returning -1, and then why it failed, by checking errno. If the error indicated by errno is EINVAL, then we can't use the DRM_IOCTL_MODE_CURSOR2 ioctl(), and need to fall back to the DRM_IOCTL_MODE_CURSOR ioctl(). This bug can manifest itself by an invisible hw cursor on systems where the DRM_IOCTL_MODE_CURSOR2 is not implemented by the graphics driver. Signed-off-by: Niclas Zeising <>
2020-05-27gitlab CI: update to use the latest CI templatesPeter Hutterer1-19/+19
Repository was moved there from wayland/ci-templates, and let's update to the most recent version.. No real functional changes, we're just making use of the various CI template bits and bobs now, specifically the FDO_* variables and the .fdo.container-build and .fdo.distribution-image templates. Signed-off-by: Peter Hutterer <>
2020-04-21glamor: Make pixmap scanout compatible if its dimensions areMichel Dänzer4-13/+21
Namely, if its dimensions match those of the screen pixmap (enough that it could stand in for it). When that's the case, the pixmap may end up being scanned out directly due to page flipping via the Present extension, e.g. with xfwm4 --vblank=xpresent . v2: * Use AMDGPU_CREATE_PIXMAP_SCANOUT instead of second-guessing in amdgpu_alloc_pixmap_bo, fixes corruption when resizing from smaller to larger virtual size via RandR. Closes:
2020-03-18Handle NULL fb_ptr in pixmap_get_fbMichel Dänzer1-1/+1
This can happen when HW acceleration is disabled. Fixes (ported from radeon commit 4d84cf438e7f1bebf0053035ef0292e9fed257d1) Reviewed-by: Alex Deucher <>
2020-03-16Bail from amdgpu_pixmap_get_handle with ShadowFBMichel Dänzer1-3/+5
There's no pixmap private in that case. The callers handle this gracefully. Reviewed-by: Alex Deucher <>
2020-03-16Factor out common code to amdgpu_probe()Emil Velikov1-70/+9
Keep the distinct pci/platform screen management in the separate probe entry point and fold the rest into a single function. v2: Rebase Signed-off-by: Emil Velikov <> Reviewed-by: Michel Dänzer <> Acked-by: Alex Deucher <>
2020-03-16Introduce amdgpu_device_setup helperEmil Velikov1-28/+32
It folds the device specifics (open fd, device init) into a single place. v2: - Rebase - Pass pAMDGPUEnt to amdgpu_device_setup (Michel) Signed-off-by: Emil Velikov <> Reviewed-by: Michel Dänzer <> Acked-by: Alex Deucher <>
2020-03-16Kill off drmOpen/Close/drmSetInterfaceVersion in favour of drmDevicesEmil Velikov1-22/+48
The former has very subtle semantics (see the implementation in libdrm for details) which were required in the UMS days. With drmDevices around, we have enough information to build our heuristics and avoid drmOpen all together. In the odd case drmGetDevices2() can take a few extra cycles, so use a reasonably sized local array. v2: - Rebase - Rework now that amdgpu_kernel_mode_enabled() is staying - Keep amdgpu_bus_id() - Use local drmDevice array. v3: - Correct error handling (Michel) - Preserve the "am I master" check (Michel) - Always initialise the fd variable v4: - Don't print "-1" on drmGetDevices2 failure (Michel) - Use uppercase DRM (Michel) v5: - Rebase on top of amdgpu_bus_id() rework - Pass both pci and platform dev to amdgpu_kernel_open_fd() (Michel) - Indent local_drmIsMaster() with tabs (Michel) Signed-off-by: Emil Velikov <> Acked-by: Alex Deucher <>
2020-03-16Use the device_id straight from gpu_infoEmil Velikov2-11/+1
This way we can remove the PciInfo and Chipset from the AMDGPUInfoRec. Signed-off-by: Emil Velikov <> Reviewed-by: Michel Dänzer <> Acked-by: Alex Deucher <>
2020-03-16Reuse the existing busid stringEmil Velikov1-4/+2
Signed-off-by: Emil Velikov <> Reviewed-by: Michel Dänzer <> Acked-by: Alex Deucher <>
2020-03-16Store the busid string in AMDGPUEntEmil Velikov3-28/+20
This way we can reuse it, instead of redoing it later on. v2: Pass the AMDGPUEnt as argument. v3: free() the string at AMDGPUFreeRec (Michel) v4: Inline amdgpu_bus_id, move at top of mdgpu_kernel_open_fd (Michel) Signed-off-by: Emil Velikov <> Reviewed-by: Michel Dänzer <> (v3) Acked-by: Alex Deucher <>
2020-03-16Remove NULL check after a "cannot fail" functionEmil Velikov1-6/+0
XNFasprintf cannot fail - aka busid cannot be NULL. Signed-off-by: Emil Velikov <> Reviewed-by: Michel Dänzer <> Acked-by: Alex Deucher <>
2020-03-16Fixup the amdgpu_bus_id() string formatEmil Velikov1-1/+1
The func is a u, instead of a signed int. v2: Drop the precision - s/1u/u/ (Michel) Signed-off-by: Emil Velikov <> Reviewed-by: Michel Dänzer <> Acked-by: Alex Deucher <>
2020-03-16Remove drmCheckModesettingSupported and kernel module loading, on LinuxEmil Velikov1-2/+2
The former of these is a UMS artefact which gives incorrect and misleading promise whether KMS is supported. Not to mention that AMDGPU is a only KMS driver. In a similar fashion xf86LoadKernelModule() is a relic of the times, where platforms had no scheme of detecting and loading the appropriate kernel module. Notes: - Since there is no reply from Robert the code is still around, behind a FreeBSD guard. - If FreeBSD still needs this they should look and fix it ASAP, as: - wayland itself or compositors do _not_ load kernel modules - the kernel module should be loaded early to control the clocks/fan, hence temperature of the card v2: Keep the code as FreeBSD only, add 'Notes' in the commit message. Cc: Robert Millan <> Signed-off-by: Emil Velikov <> Reviewed-by: Michel Dänzer <> Acked-by: Alex Deucher <>
2020-03-16Use ODEV_ATTRIB_PATH where possible for the device node.Emil Velikov1-2/+14
Use the device node path, if the server knows it. Note: ODEV_ATTRIB_PATH was introduced with xserver 1.13 - the minimum version required to build amdgpu. Yet it's defined in xf86platformBus.h. With the header included only when XSERVER_PLATFORM_BUS is set. Keep things obvious and use a ODEV_ATTRIB_PATH guard. v2: Rebase, add commit message Signed-off-by: Emil Velikov <> Reviewed-by: Michel Dänzer <> Acked-by: Alex Deucher <>
2020-02-05Fix link failure with gcc 10Adam Jackson1-1/+1
Without the 'extern' this looks like a definition not just a declaration, in every file that includes the header. gcc 10 is stricter about this kind of multiple definition.
2019-11-22kms: Handle changes to SourceValidate call chain in xserver 19Adam Jackson1-1/+6
xserver 19 expects the SourceValidate hook to always be filled in with something valid. For earlier servers it's harmless to simply fill this in with a do-nothing function instead of NULL. Reviewed-by: Michel Dänzer <>
2019-10-11Bump version for the 19.1.0 releasexf86-video-amdgpu-19.1.0Michel Dänzer1-1/+1
2019-09-26Don't unreference FBs of pixmaps from different screens in LeaveVTMichel Dänzer1-10/+17
FindClientResourcesByType finds pixmaps from all screens, but trying to process ones from other screens here makes no sense and likely results in a crash or memory corruption. Fixes: c16ff42f927d ("Make all active CRTCs scan out an all-black framebuffer in LeaveVT") (Ported from radeon commit 2faaecc69b127248718e759c6c98c84d56dd1b6b)
2019-09-18Don't set up black scanout buffer if LeaveVT is called from CloseScreenMichel Dänzer1-1/+9
Avoids a crash described in Reviewed-by: Alex Deucher <>
2019-08-07present: Don't check pixmap pitch in check_flip with non-DC >= 3.34Michel Dänzer1-3/+10
The current non-DC kernel driver also handles flipping between different pitches correctly. Reviewed-by: Nicholas Kazlauskas <>
2019-08-07present: Don't check pixmap pitch in check_flip with current DCMichel Dänzer1-4/+4
Current DC handles flipping between different pitches correctly. Reviewed-by: Nicholas Kazlauskas <>
2019-08-07present: Also check pixmap pitch in check_flip with current xserverMichel Dänzer1-2/+0
The corresponding check in the xserver Present code was removed again, because flipping between different pitches can work in some cases. Reviewed-by: Nicholas Kazlauskas <>
2019-07-30gitlab-ci: Use templates from wayland/ci-templatesMichel Dänzer3-91/+78
These are already used by xserver, Mesa and some other projects. Current Debian testing brings e.g. GCC 8.3.0 and clang 7.0.1.
2019-07-05Don't disable page flipping completely with SW cursorMichel Dänzer1-7/+2
Even with SW cursor, page flipping can be used while no X cursor is visible. Occurred to me in the context of xorg/xserver#828.
2019-06-25present: Check that we can get a KMS FB for flippingMichel Dänzer2-0/+19
This can legitimately fail if the pixmap's storage is shared from another device, e.g. when using PRIME render offloading.
2019-06-14Remove dri2_drawable_crtc parameter consider_disabledMichel Dänzer1-5/+5
All callers were passing TRUE. Reviewed-and-tested-by: Flora Cui <>
2019-06-14dri2: Re-use previous CRTC when possible if pick_best_crtc returns NULLMichel Dänzer1-2/+4
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. Reviewed-and-tested-by: Flora Cui <>
2019-06-10dri2: reply to client for WaitMSC request in any caseFlora Cui1-0/+3
otherwise client would wait for reply forever and desktop appears hang. Signed-off-by: Flora Cui <> Acked-by: Feifei Xu <> Reviewed-by: Michel Dänzer <>
2019-04-30dri3: Always flush glamor before sharing pixmap storage with clientsMichel Dänzer1-21/+5
Even if glamor_gbm_bo_from_pixmap / glamor_fd_from_pixmap themselves don't trigger any drawing, there could already be unflushed drawing to the pixmap whose storage we share with a client.
2019-04-18Retry get_fb_ptr in get_fbMichel Dänzer1-12/+13
If get_fb_ptr returns NULL, try again after pixmap_get_handle, it should work then. Fixes spurious Present page flipping failures using "normal" pixmaps which aren't shared with direct rendering clients, e.g. with a compositor using the RENDER extension. Bugzilla: Reviewed-by: Alex Deucher <>
2019-03-19Bump version for the 19.0.1 releasexf86-video-amdgpu-19.0.1Michel Dänzer1-1/+1
2019-03-07modesetting: add tile property supportDave Airlie2-2/+55
This adds tiling support to the driver, it retrieves the tile info from the kernel and translates it into the server format and exposes the property. (Ported from xserver commits 8fb8bbb3062f1a06621ab7030a9e89d5e8367b35 and 6abdb54a11dac4e8854ff94ecdcb90a14321ab31) Reviewed-by: Alex Deucher <>
2019-03-06Bump version for the 19.0.0 releasexf86-video-amdgpu-19.0.0Michel Dänzer1-1/+1
2019-03-04present: Don't check tiling parameters with DC & DRM minor version >= 31Michel Dänzer1-5/+11
Current DC handles any changes of tiling parameters for flips. v2: * Just check all tiling bits if DRM minor < 31 or DC is disabled. Reviewed-by: Nicholas Kazlauskas <>
2019-03-04Make drmmode_cm_enabled an inline functionMichel Dänzer2-8/+9
So that it can be used outside of drmmode_display.c as well. Reviewed-by: Nicholas Kazlauskas <>
2019-03-04Revert "Remove set but unused amdgpu_dri2::pKernelDRMVersion"Michel Dänzer2-0/+7
This reverts commit 720a61000aeb139005bd8125908cec66a6e69554. We're going to make use of it now. Reviewed-by: Nicholas Kazlauskas <>
2019-03-01Revert "gitlab-ci: Only run docker-image stage if relevant source files change"Michel Dänzer1-4/+0
This reverts commit 9c23076b9e81c36ac2408c491f9b2d546829ee8e. Some scenarios have come to light where this failed to ensure the docker image exists: * If the master branch of a forked repository is used for an MR which doesn't modify .gitlab-ci.yml, the docker-image job may not run. * If the docker-image job of the first pipeline in a forked repository is cancelled or fails for any reason, and .gitlab-ci.yml isn't modified for the next pipeline run.
2019-03-01dri2: Call drm_queue_handle_deferred in dri2_deferred_eventMichel Dänzer1-4/+15
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: 739181c8d3334 "Add amdgpu_drm_handle_event wrapper for drmHandleEvent" Reviewed-by: Aaron Liu <> Tested-by: Aaron Liu <>
2019-02-27present: Check that flip and screen pixmap pitches matchMichel Dänzer1-1/+7
If they don't, flipping will result in corrupted display. Test case: * Run Xorg at 1920x1080 with no window manager * glxgears -geometry 2048x1080 The Present extension code in xserver 1.21 will check for this. Tested-by: Jax Lin <>
2019-02-22Call amdgpu_present_set_screen_vrr from amdgpu_vrr_property_updateMichel Dänzer3-1/+9
If the window is currently flipping. This might make a difference when the property gets disabled: Variable refresh will now be disabled immediately in that case, instead of only when the window can no longer use page flipping at all. Reviewed-by: Nicholas Kazlauskas <>
2019-02-22Make use of property request wrappers for VRR propertyMichel Dänzer1-60/+55
Instead of scanning for PropertyNotify events. Reasons: * Works even if no client listens to PropertyNotify events for the window. * No overhead on delivery of unrelated events, and no overhead at all if Option "VariableRefresh" is disabled. v2: * Use shorter variable name amdgpu_vrr_atom. * Call MakeAtom regardless of info->instance_id, for robustness vs VRR being enabled in some but not all AMDGPU screens. Reviewed-by: Nicholas Kazlauskas <>