[why]
On RHEL9+, xorg-server.pc shows that the Xorg no longer depends on dri,
and dri.pc provides "/opt/amdgpu/include" path for pkg-config, this
cause pkg-config no longer output "-I/opt/amdgpu/include", consequently
the configure can't find gbm.h and HAVE_GBM_BO_USE_LINEAR is not
declared, that cause the corruption.
[how]
Since the gbm.pc also provides the "/opt/amdgpu/include" path, in module
dependence checking, GBM_CFLAGS get this path, so just explicitly add
GBM_CFLAGS into CPPFLAGS can fix this issue.
Signed-off-by: tiancyin <tianci.yin@amd.com>
Some laptops have the external outputs routed to dGPU, when the external
output over dGPU is the only display in reverse prime mode, we need
present extension so fake CRTC won't be used.
This is commit is removing obsolete switch done in
xf86-video-ati at sha 61d0aec40e2521488c2fe43e7a6823e5c87d94d7: video: add option to include disabled CRTCs in best CRTC search
This is not required anymore as with commit done in
xorg-server at sha 5c5c1b77982a9af7279a90bc3c2be48adaa9c778: present: Add Present extension
That in case of lack of crtc is using fake_crtc with render 1Hz frequency
When consider_disabled is removed then amdgpu_pick_best_crtc is doing the same what rr_crtc_covering_box is doing
so it can be reimplemented to reuse that function.
Signed-off-by: Łukasz Spintzyk <lukasz.spintzyk@synaptics.com>
Signed-off-by: Shashank Sharma <contactshashanksharma@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
This is a straightforward port of a patch with the same name
"modesetting: Add option for non-vsynced flips for "secondary"
outputs." from X-Server master / X-Server 21.1. See server MR 742.
The description below is therefore identical to that X-Server commit:
Whenever an unredirected fullscreen window uses pageflipping for a
DRI3/Present PresentPixmap() operation and the X-Screen has more than
one active output, multiple crtc's need to execute pageflips. Only
after the last flip has completed can the PresentPixmap operation
as a whole complete.
If a sync_flip is requested for the present, then the current
implementation will synchronize each pageflip to the vblank of
its associated crtc. This provides tear-free image presentation
across all outputs, but introduces a different artifact, if not
all outputs run at the same refresh rate with perfect synchrony:
The slowest output throttles the presentation rate, and present
completion is delayed to flip completion of the "latest" output
to complete. This means degraded performance, e.g., a dual-display
setup with a 144 Hz monitor and a 60 Hz monitor will always be
throttled to at most 60 fps. It also means non-constant present
rate if refresh cycles drift against each other, creating complex
"beat patterns", tremors, stutters and periodic slowdowns - quite
irritating!
Such a scenario will be especially annoying if one uses multiple
outputs in "mirror mode" aka "clone mode". One output will usually
be the "production output" with the highest quality and fastest
display attached, whereas a secondary mirror output just has a
cheaper display for monitoring attached. Users care about perfect
and perfectly timed tear-free presentation on the "production output",
but cares less about quality on the secondary "mirror output". They
are willing to trade quality on secondary outputs away in exchange
for better presentation timing on the "production output".
One example use case for such production + monitoring displays are
neuroscience / medical science applications where one high quality
display device is used to present visual animations to test subjects
or patients in a fMRI scanner room (production display), whereas
an operator monitors the same visual animations from a control room
on a lower quality display. Presentation timing needs to be perfect,
and animations high-speed and tear-free for the production display,
whereas quality and timing don't matter for the monitoring display.
This commit gives users the option to choose such a trade-off as
opt-in:
It adds a new boolean option "AsyncFlipSecondaries" to the device section
of xorg.conf. If this option is specified as true, then DRI3 pageflip
behaviour changes as follows:
1. The "reference crtc" for a windows PresentPixmap operation does a
vblank synced flip, or a DRM_MODE_PAGE_FLIP_ASYNC non-synchronized
flip, as requested by the caller, just as in the past. Typically
flips will be requested to be vblank synchronized for tear-free
presentation. The "reference crtc" is the one chosen by the caller
to drive presentation timing (as specified by PresentPixmap()'s
"target_msc", "divisor", "remainder" parameters and implemented by
vblank events) and to deliver Present completion timestamps (msc
and ust) extracted from its pageflip completion event.
2. All other crtc's, which also page-flip in a multi-display configuration,
will try to flip with DRM_MODE_PAGE_FLIP_ASYNC, ie. immediately and
not synchronized to vblank. This allows the PresentPixmap operation
to complete with little delay compared to a single-display present,
especially if the different crtc's run at different video refresh
rates or their refresh cycles are not perfectly synchronized, but
drift against each other. The downside is potential tearing artifacts
on all outputs apart from the one of the "reference crtc".
Successfully tested on a AMD gpu with single-display and dual-display
setups, and with single-X-Screen as well as dual-X-Screen "ZaphodHeads"
configurations.
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
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 <Likun.Gao@amd.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
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 <zeising@daemonic.se>
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 <peter.hutterer@who-t.net>
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: https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgpu/-/issues/10
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 <emil.velikov@collabora.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
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 <emil.velikov@collabora.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
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 <emil.velikov@collabora.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
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 <emil.velikov@collabora.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> (v3)
Acked-by: Alex Deucher <alexander.deucher@amd.com>
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 <rmh@freebsd.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
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 <emil.velikov@collabora.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
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.
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 <mdaenzer@redhat.com>
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: c16ff42f92 ("Make all active CRTCs scan out an all-black
framebuffer in LeaveVT")
(Ported from radeon commit 2faaecc69b127248718e759c6c98c84d56dd1b6b)
The current non-DC kernel driver also handles flipping between different
pitches correctly.
Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
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 <nicholas.kazlauskas@amd.com>