<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>521333</bug_id>
          
          <creation_ts>2026-06-11 12:14:09 +0000</creation_ts>
          <short_desc>KWin does not properly fallback to drmModeAddFB when drmModeAddFB2 fails</short_desc>
          <delta_ts>2026-06-19 02:55:23 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Plasma</classification>
          <product>kwin</product>
          <component>platform-drm</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Pavel Ondračka">pavel.ondracka</reporter>
          <assigned_to name="KWin default assignee">kwin-bugs-null</assigned_to>
          <cc>nate</cc>
    
    <cc>xaver.hugl</cc>
          
          <cf_commitlink>https://invent.kde.org/plasma/kwin/-/commit/ee01169f593151ae7743143227260973c3b1df8b</cf_commitlink>
          <cf_versionfixedin>6.6.6</cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2522341</commentid>
    <comment_count>0</comment_count>
    <who name="Pavel Ondračka">pavel.ondracka</who>
    <bug_when>2026-06-11 12:14:09 +0000</bug_when>
    <thetext>DESCRIPTION

When drmModeAddFB2 fails, KWin has a fallback path to drmModeAddFB, but that one is guarded by ret == EOPNOTSUPP https://github.com/KDE/kwin/blob/master/src/backends/drm/drm_gpu.cpp#L996, while the kernel returns -EONOTSUPP.

This is problematic for some drm drivers on big endian (like for radeon driver) since kernel returns -EOPNOTSUPP for everything unless quirk_addfb_prefer_host_byte_order is set (and radeon does not).
  #ifdef __BIG_ENDIAN
  if (!dev-&gt;mode_config.quirk_addfb_prefer_host_byte_order)
      return -EOPNOTSUPP;
  #endif

So the check should probably be more robust, possibly something like:
if (ret &lt; 0 &amp;&amp; (ret == -EOPNOTSUPP || errno == EOPNOTSUPP))

STEPS TO REPRODUCE
1. Start kwin on a big endian machine with some driver without modifiers that does not have modifiers and quirk_addfb_prefer_host_byte_order. Or hack the kernel to always return -EOPNOTSUPP from drmModeAddFB2

OBSERVED RESULT
kwin fails to start since it cannot ge t a framebuffer.


EXPECTED RESULT
kwin starts


SOFTWARE/OS VERSIONS
Operating System: linux
kwin-6.6.5</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2522406</commentid>
    <comment_count>1</comment_count>
    <who name="Bug Janitor Service">bug-janitor</who>
    <bug_when>2026-06-11 15:55:07 +0000</bug_when>
    <thetext>A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/9373</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2523446</commentid>
    <comment_count>2</comment_count>
    <who name="Zamundaaa">xaver.hugl</who>
    <bug_when>2026-06-16 11:39:02 +0000</bug_when>
    <thetext>Git commit 85fa4ee22b57e834505864a20ac13de0a97a1161 by Xaver Hugl.
Committed on 16/06/2026 at 11:18.
Pushed by zamundaaa into branch &apos;master&apos;.

backends/drm: fix addFB2 fallback

Returned error codes are negative, not the actual value of the define.

M  +1    -1    src/backends/drm/drm_gpu.cpp

https://invent.kde.org/plasma/kwin/-/commit/85fa4ee22b57e834505864a20ac13de0a97a1161</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2523454</commentid>
    <comment_count>3</comment_count>
    <who name="Zamundaaa">xaver.hugl</who>
    <bug_when>2026-06-16 12:32:23 +0000</bug_when>
    <thetext>Git commit 9f27237b14432624ee2798dc6866748e96a705dd by Xaver Hugl.
Committed on 16/06/2026 at 11:49.
Pushed by zamundaaa into branch &apos;Plasma/6.7&apos;.

backends/drm: fix addFB2 fallback

Returned error codes are negative, not the actual value of the define.


(cherry picked from commit 85fa4ee22b57e834505864a20ac13de0a97a1161)

Co-authored-by: Xaver Hugl &lt;xaver.hugl@kde.org&gt;

M  +1    -1    src/backends/drm/drm_gpu.cpp

https://invent.kde.org/plasma/kwin/-/commit/9f27237b14432624ee2798dc6866748e96a705dd</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2523697</commentid>
    <comment_count>4</comment_count>
    <who name="Vlad Zahorodnii">vlad.zahorodnii</who>
    <bug_when>2026-06-17 07:13:36 +0000</bug_when>
    <thetext>Git commit ee01169f593151ae7743143227260973c3b1df8b by Vlad Zahorodnii, on behalf of Xaver Hugl.
Committed on 17/06/2026 at 06:37.
Pushed by vladz into branch &apos;Plasma/6.6&apos;.

backends/drm: fix addFB2 fallback

Returned error codes are negative, not the actual value of the define.


(cherry picked from commit 85fa4ee22b57e834505864a20ac13de0a97a1161)

Co-authored-by: Xaver Hugl &lt;xaver.hugl@kde.org&gt;

M  +1    -1    src/backends/drm/drm_gpu.cpp

https://invent.kde.org/plasma/kwin/-/commit/ee01169f593151ae7743143227260973c3b1df8b</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>