https://bugs.kde.org/show_bug.cgi?id=523353

--- Comment #3 from Paulo Dias <[email protected]> ---
fix attached:

Patch report for KDE Bug 523353
================================

Summary
-------

KWin 6.7.3 no longer honors KWIN_DRM_NO_DIRECT_SCANOUT=1 for DRM virtual
outputs. This allows fullscreen clients to use direct scanout on a virtual
screen even when direct scanout was explicitly disabled. In the reported
case, fullscreen Chromium-based applications freeze on the virtual screen.

Physical DRM outputs are not affected by this specific regression because
EglGbmLayer::earlyScanoutChecks() still checks the environment variable.


Regression
----------

The regression was introduced by commit 768eb537025b:

    compositor: also set dmabuf feedback if buffer import fails

This is the Plasma/6.7 backport of upstream commit
a36eb2d492fb86ad2f51ce43f63a521a6bbcb72f.

That change split direct-scanout validation into two stages:

1. earlyScanoutChecks() checks policy and output configuration before dmabuf
   feedback is considered.
2. importScanoutBuffer() checks whether the candidate buffer can actually be
   imported.

Before this change, VirtualEglGbmLayer::importScanoutBuffer() rejected direct
scanout when KWIN_DRM_NO_DIRECT_SCANOUT=1. It also validated the source and
target rectangles, virtual-output mode size, candidate buffer size, and
offload transform.

During the refactor, those checks were removed from the virtual-output import
function, but they were not moved to the new validation stage. KWin 6.7.3 is
therefore left with:

    bool VirtualEglGbmLayer::earlyScanoutChecks()
    {
        return true;
    }

and an importScanoutBuffer() implementation that accepts every candidate.
Consequently, the environment variable has no effect in the virtual-output
direct-scanout path.


Fix
---

The attached patch restores the checks while preserving the intent of the
two-stage validation introduced in 6.7.3:

* earlyScanoutChecks() rejects direct scanout when
  KWIN_DRM_NO_DIRECT_SCANOUT=1.
* earlyScanoutChecks() restores the source/target rectangle, output mode size,
  output origin, and offload-transform restrictions.
* importScanoutBuffer() restores the candidate buffer-size check because that
  check depends on the buffer being imported.

Keeping the buffer-dependent check in importScanoutBuffer() also preserves the
new dmabuf-feedback behavior: output-policy failures are rejected early, while
an unsuitable client buffer can still cause updated allocation feedback.

Only the following file is changed:

    src/backends/drm/drm_virtual_egl_layer.cpp


Expected Result
---------------

With KWIN_DRM_NO_DIRECT_SCANOUT=1 in KWin's process environment, direct
scanout is rejected for both physical and DRM virtual outputs. The compositor
renders the virtual output normally, restoring the behavior seen in KWin
6.7.2.


Validation
----------

* Compared the v6.7.2 and v6.7.3 KWin source tags.
* Identified commit 768eb537025b as the first change that removes the virtual
  output checks.
* Verified that the patch syntax is valid and that its hunk applies to the
  KWin 6.7.3 source context.
* The patch has not yet been compile-tested or runtime-tested.


Suggested Runtime Test
----------------------

1. Start Plasma Wayland with KWIN_DRM_NO_DIRECT_SCANOUT=1 available to
   kwin_wayland.
2. Create and enable a DRM virtual output.
3. Move a Chromium-based browser to that output.
4. Play a video in fullscreen for several minutes.
5. Confirm that the video and browser UI remain responsive.
6. Optionally use KWin's "Show Compositing" debug effect to confirm that the
   virtual output remains composited instead of entering direct scanout.


Attachment
----------

    0001-backends-drm-restore-virtual-output-scanout-checks.patch

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to