Bug 510650 - Closing lid of a laptop with screen off, turns off enabled external screens
Summary: Closing lid of a laptop with screen off, turns off enabled external screens
Status: RESOLVED WORKSFORME
Alias: None
Product: plasmashell
Classification: Plasma
Component: Power management & brightness (other bugs)
Version First Reported In: 6.4.5
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-10-15 18:21 UTC by Méven
Modified: 2025-11-02 11:33 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
kwin screen config (25.66 KB, application/json)
2025-10-16 06:41 UTC, Méven
Details
kscreen-doctor json (29.14 KB, application/json)
2025-10-16 08:29 UTC, Méven
Details
drm_info json output (401.92 KB, application/json)
2025-10-16 16:45 UTC, Méven
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Méven 2025-10-15 18:21:37 UTC
SUMMARY

With a laptop, with two screens plugged in, and the internal laptop screen turned off in systemsettings.


STEPS TO REPRODUCE
1. Close the lid

OBSERVED RESULT
All the screens turn off

EXPECTED RESULT
The enabled screens don't change.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.4.5
KDE Frameworks Version: 6.19.0
Qt Version: 6.10.0
Kernel Version: 6.17.2-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 12 × 13th Gen Intel® Core™ i7-1365U
Memory: 32 Gio of RAM (31.0 Gio usable)
Graphics Processor: Intel® Iris® Xe Graphics

This used to work IIRC.
Comment 1 Méven 2025-10-15 18:50:35 UTC
I should add my screens are connected through a dock (KVM av access).
Comment 2 Zamundaaa 2025-10-15 19:51:36 UTC
Can't replicate that here with a direct display connection at least, on 6.4 and git master.
Comment 3 Méven 2025-10-16 06:41:28 UTC
Created attachment 185829 [details]
kwin screen config
Comment 4 Méven 2025-10-16 07:39:50 UTC
I would expect this setup to be used then:
{
                "lidClosed": true,
                "outputs": [
                    {
                        "enabled": false,
                        "outputIndex": 0,
                        "position": {
                            "x": 0,
                            "y": 0
                        },
                        "priority": -1,
                        "replicationSource": ""
                    },
                    {
                        "enabled": true,
                        "outputIndex": 1,
                        "position": {
                            "x": 0,
                            "y": 0
                        },
                        "priority": 0,
                        "replicationSource": ""
                    },
                    {
                        "enabled": true,
                        "outputIndex": 2,
                        "position": {
                            "x": 2195,
                            "y": 0
                        },
                        "priority": 1,
                        "replicationSource": ""
                    }
                ]
            },

But it is like:

            {
                "lidClosed": true,
                "outputs": [
                    {
                        "enabled": false,
                        "outputIndex": 0,
                        "position": {
                            "x": 0,
                            "y": 0
                        },
                        "priority": 0,
                        "replicationSource": ""
                    },
                    {
                        "enabled": true,
                        "outputIndex": 1,
                        "position": {
                            "x": 0,
                            "y": 0
                        },
                        "priority": 1,
                        "replicationSource": ""
                    }
                ]
            },

Is used instead.
Comment 5 Méven 2025-10-16 08:29:51 UTC
Created attachment 185832 [details]
kscreen-doctor json
Comment 6 Méven 2025-10-16 16:45:34 UTC
Created attachment 185842 [details]
drm_info json output
Comment 7 Zamundaaa 2025-10-16 19:12:54 UTC
KWin can't disable all outputs, there are guards in place to prevent that. This is almost certainly dpms; maybe check "kscreen-doctor --dpms show"?
Comment 8 Méven 2025-10-17 07:46:00 UTC
(In reply to Zamundaaa from comment #7)
> KWin can't disable all outputs, there are guards in place to prevent that.
> This is almost certainly dpms; maybe check "kscreen-doctor --dpms show"?

I have added some logs locally, After the lid is closed, my second external screen(2K) is disabled, the first one(4K) is still enabled, but it the first screen has dpms off.
It is loaded from a pre-existing setup.

I know the first screen(4K) has some dpms issue because it stays off when the lib is opened again, but kwin/plasma treats the screen as on.

I get when the lid is opened:
dpms mode for screen DP-5: on
dpms mode for screen DP-6: on

And when the lid is closed:
dpms mode for screen DP-5: on  (the first 4K screen that appears off,  dpms off)

Still the first screen dpms state seems changed. I can only guess my screen is peticular or the intermediate dock.
Comment 9 Méven 2025-10-17 13:38:50 UTC
I get those, from journalctl --user -t kwin_wayland --since -10m

oct. 17 15:35:38 meven-thinkpad kwin_wayland[90499]: 0x3: GL_INVALID_VALUE in glTexSubImage2D(xoffset 0 + width 735 > 420)
oct. 17 15:35:41 meven-thinkpad kwin_wayland[90499]: atomic commit failed: Permission non accordée
oct. 17 15:35:42 meven-thinkpad kwin_wayland[90499]: atomic commit failed: Permission non accordée
Comment 10 Méven 2025-10-17 15:10:59 UTC
Here is some debugging I added in queryConfig.

This shows the screens before and after the lid is opened, and the opt<bool> of the enabled property for each screens:

oct. 17 17:01:22 meven-thinkpad kwin_wayland[132145]: queryConfig isLidClosed: true relevantOutputs: QList(KWin::DrmOutput(0x55b3c4d471b0, name="eDP-1", internal="5>
oct. 17 17:01:22 meven-thinkpad kwin_wayland[132145]: Preexisting "5b30ba8807bda00ae82fb0abc5d715b2" std::optional(false) order: QList(KWin::DrmOutput(0x55b3c4d47f4>
oct. 17 17:01:22 meven-thinkpad kwin_wayland[132145]: Preexisting "6fa8612cf012e30cc46c75d1ce190271" std::optional(true) order: QList(KWin::DrmOutput(0x55b3c4d47f40>
oct. 17 17:01:22 meven-thinkpad kwin_wayland[132145]: Preexisting "f3cdc9793f255fe073669fe4679f2330" std::optional(false) order: QList(KWin::DrmOutput(0x55b3c4d47f4>
oct. 17 17:01:28 meven-thinkpad kwin_wayland[132145]: queryConfig isLidClosed: false relevantOutputs: QList(KWin::DrmOutput(0x55b3c4d471b0, name="eDP-1", internal=">
oct. 17 17:01:28 meven-thinkpad kwin_wayland[132145]: Preexisting "5b30ba8807bda00ae82fb0abc5d715b2" std::optional(false) order: QList(KWin::DrmOutput(0x55b3c4d47f4>
oct. 17 17:01:28 meven-thinkpad kwin_wayland[132145]: Preexisting "6fa8612cf012e30cc46c75d1ce190271" std::optional(true) order: QList(KWin::DrmOutput(0x55b3c4d47f40>
oct. 17 17:01:28 meven-thinkpad kwin_wayland[132145]: Preexisting "f3cdc9793f255fe073669fe4679f2330" std::optional(true) order: QList(KWin::DrmOutput(0x55b3c4d47f40>
oct. 17 17:01:49 meven-thinkpad kwin_wayland[132145]: queryConfig isLidClosed: false relevantOutputs: QList(KWin::DrmOutput(0x55b3c4d471b0, name="eDP-1", internal=">
oct. 17 17:01:49 meven-thinkpad kwin_wayland[132145]: Preexisting "5b30ba8807bda00ae82fb0abc5d715b2" std::optional(false) order: QList(KWin::DrmOutput(0x55b3c4d47f4>
oct. 17 17:01:49 meven-thinkpad kwin_wayland[132145]: Preexisting "6fa8612cf012e30cc46c75d1ce190271" std::optional(true) order: QList(KWin::DrmOutput(0x55b3c4d47f40>
oct. 17 17:01:49 meven-thinkpad kwin_wayland[132145]: Preexisting "f3cdc9793f255fe073669fe4679f2330" std::optional(true) order: QList(KWin::DrmOutput(0x55b3c4d47f40>
oct. 17 17:02:16 meven-thinkpad kwin_wayland[132145]: 0x3: GL_INVALID_VALUE in glTexSubImage2D(xoffset 0 + width 4252 > 1080)
oct. 17 17:02:16 meven-thinkpad kwin_wayland[132145]: 0x3: GL_INVALID_VALUE in glTexSubImage2D(xoffset 0 + width 2160 > 1080)
oct. 17 17:02:16 meven-thinkpad kwin_wayland[132145]: 0x3: GL_INVALID_VALUE in glTexSubImage2D(xoffset 0 + width 4252 > 1080)
oct. 17 17:02:16 meven-thinkpad kwin_wayland[132145]: 0x3: GL_INVALID_VALUE in glTexSubImage2D(xoffset 0 + width 2160 > 1080)
oct. 17 17:02:16 meven-thinkpad kwin_wayland[132145]: 0x3: GL_INVALID_VALUE in glTexSubImage2D(xoffset 0 + width 4252 > 1080)
oct. 17 17:02:16 meven-thinkpad kwin_wayland[132145]: 0x3: GL_INVALID_VALUE in glTexSubImage2D(xoffset 0 + width 2160 > 1080)
lines 25-103/103 (END)
Comment 11 Méven 2025-10-17 15:25:58 UTC
And adding:

std::optional<std::tuple<OutputConfiguration, QList<Output *>, OutputConfigurationStore::ConfigType>> OutputConfigurationStore::queryConfig(const QList<Output *> &outputs, bool isLidClosed, QOrientationReading *orientation, bool isTabletMode)
{
+    if (isLidClosed) {
+       return std::nullopt;
+   }

Solves my issue.

It seems the kwinoutputconfig.json does not match my two screens setup with isLidClosed.
I am guessing it is because of the generation step or kscreen.

The setup that seems to be used is:

            {
                "lidClosed": true,
                "outputs": [
                    {
                        "enabled": false,
                        "outputIndex": 0,
                        "position": {
                            "x": 0,
                            "y": 0
                        },
                        "priority": -1
                    },
                    {
                        "enabled": true,
                        "outputIndex": 5,
                        "position": {
                            "x": 1920,
                            "y": 0
                        },
                        "priority": 0
                    },
                    {
                        "enabled": false,
                        "outputIndex": 4,
                        "position": {
                            "x": 4115,
                            "y": 0
                        },
                        "priority": -1
                    }
                ]
            }

The positions are off for some reason.

Compared to the correct one:

            {
                "lidClosed": false,
                "outputs": [
                    {
                        "enabled": false,
                        "outputIndex": 0,
                        "position": {
                            "x": 0,
                            "y": 0
                        },
                        "priority": -1
                    },
                    {
                        "enabled": true,
                        "outputIndex": 5,
                        "position": {
                            "x": 0,
                            "y": 0
                        },
                        "priority": 0
                    },
                    {
                        "enabled": true,
                        "outputIndex": 4,
                        "position": {
                            "x": 2195,
                            "y": 0
                        },
                        "priority": 1
                    }
                ]
            },

This is  4 and 5 outputs:

            {
                "allowDdcCi": true,
                "allowSdrSoftwareBrightness": true,
                "autoRotation": "InTabletMode",
                "brightness": 0.42,
                "colorPowerTradeoff": "PreferEfficiency",
                "colorProfileSource": "sRGB",
                "connectorName": "DP-6",
                "detectedDdcCi": false,
                "edidHash": "f3cdc9793f255fe073669fe4679f2330",
                "edidIdentifier": "DEL 53362 809059148 35 2016 0",
                "edrPolicy": "always",
                "highDynamicRange": false,
                "iccProfilePath": "",
                "maxBitsPerColor": 0,
                "mode": {
                    "height": 1080,
                    "refreshRate": 60000,
                    "width": 1920
                },
                "mstPath": "-2\u0000",
                "overscan": 0,
                "rgbRange": "Automatic",
                "scale": 1,
                "sdrBrightness": 200,
                "sdrGamutWideness": 0,
                "transform": "Rotated270",
                "uuid": "7e59c927-2841-469d-82fa-24dbc89e4ef9",
                "vrrPolicy": "Never",
                "wideColorGamut": false
            },
            {
                "allowDdcCi": true,
                "allowSdrSoftwareBrightness": true,
                "autoRotation": "InTabletMode",
                "brightness": 0.44,
                "colorPowerTradeoff": "PreferEfficiency",
                "colorProfileSource": "EDID",
                "connectorName": "DP-5",
                "detectedDdcCi": false,
                "edidHash": "6fa8612cf012e30cc46c75d1ce190271",
                "edidIdentifier": "DEL 41430 811161420 49 2021 0",
                "edrPolicy": "always",
                "highDynamicRange": false,
                "iccProfilePath": "",
                "maxBitsPerColor": 10,
                "mode": {
                    "height": 2160,
                    "refreshRate": 60000,
                    "width": 3840
                },
                "mstPath": "-1\u0000",
                "overscan": 0,
                "rgbRange": "Automatic",
                "scale": 1.75,
                "sdrBrightness": 200,
                "sdrGamutWideness": 0,
                "uuid": "e82b174e-9dcc-4ab4-8db9-09ea74fee52a",
                "vrrPolicy": "Never",
                "wideColorGamut": false
            },
Comment 12 Bug Janitor Service 2025-11-01 03:48:02 UTC
🐛🧹 ⚠️ This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information, then set the bug status to REPORTED. If there is no change for at least 30 days, it will be automatically closed as RESOLVED WORKSFORME.

For more information about our bug triaging procedures, please read https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging.

Thank you for helping us make KDE software even better for everyone!
Comment 13 Méven 2025-11-02 11:33:25 UTC
I fixed my issue by nucking my kwinoutputconfig.json.
I got cleaner file with fewer screens.
This can only be done when kwin is of, as it will overwrite the file when it stops.

There is some issue somewhere relating to screen references getting broken somehow.