* [PATCH] vga-switcheroo: Allow VGA_SWITCHEROO to be enabled on LoongArch
@ 2026-10-29 1:36 Tianrui Zhao
2026-10-29 8:16 ` Thomas Zimmermann
0 siblings, 1 reply; 6+ messages in thread
From: Tianrui Zhao @ 2026-10-29 1:36 UTC (permalink / raw)
To: David Airlie, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Simona Vetter, chenhuacai
Cc: dri-devel, linux-kernel, wuqianhai, zhaotianrui
LoongArch systems with hybrid graphics (integrated +
discrete GPU) can benefit from the same GPU switching
mechanism that x86 laptops use. Relax the dependency
to allow VGA_SWITCHEROO to be built on LoongArch,
consistent with the existing dependencies on ACPI,
PCI, and FB=y.
Change-Id: I84d38fdfe5e1591495fb3681474a7f1f64281fa8
Signed-off-by: Tianrui Zhao <zhaotianrui@loongson.cn>
---
drivers/gpu/vga/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/vga/Kconfig b/drivers/gpu/vga/Kconfig
index bad4bcee313..89edd1211aa 100644
--- a/drivers/gpu/vga/Kconfig
+++ b/drivers/gpu/vga/Kconfig
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
config VGA_SWITCHEROO
bool "Laptop Hybrid Graphics - GPU switching support"
- depends on X86
+ depends on X86 || LOONGARCH
depends on ACPI
depends on PCI
depends on FB=y
--
2.39.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] vga-switcheroo: Allow VGA_SWITCHEROO to be enabled on LoongArch
2026-10-29 1:36 [PATCH] vga-switcheroo: Allow VGA_SWITCHEROO to be enabled on LoongArch Tianrui Zhao
@ 2026-10-29 8:16 ` Thomas Zimmermann
2026-10-30 7:04 ` zhaotianrui
0 siblings, 1 reply; 6+ messages in thread
From: Thomas Zimmermann @ 2026-10-29 8:16 UTC (permalink / raw)
To: Tianrui Zhao, David Airlie, Maarten Lankhorst, Maxime Ripard,
Simona Vetter, chenhuacai
Cc: dri-devel, linux-kernel, wuqianhai
Hi
Am 29.10.26 um 02:36 schrieb Tianrui Zhao:
> LoongArch systems with hybrid graphics (integrated +
> discrete GPU) can benefit from the same GPU switching
> mechanism that x86 laptops use. Relax the dependency
> to allow VGA_SWITCHEROO to be built on LoongArch,
> consistent with the existing dependencies on ACPI,
> PCI, and FB=y.
>
> Change-Id: I84d38fdfe5e1591495fb3681474a7f1f64281fa8
Internal change ids should be remove before submitting patches.
> Signed-off-by: Tianrui Zhao <zhaotianrui@loongson.cn>
> ---
> drivers/gpu/vga/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/vga/Kconfig b/drivers/gpu/vga/Kconfig
> index bad4bcee313..89edd1211aa 100644
> --- a/drivers/gpu/vga/Kconfig
> +++ b/drivers/gpu/vga/Kconfig
> @@ -1,7 +1,7 @@
> # SPDX-License-Identifier: GPL-2.0-only
> config VGA_SWITCHEROO
> bool "Laptop Hybrid Graphics - GPU switching support"
> - depends on X86
> + depends on X86 || LOONGARCH
I'm a bit skeptical if that's all there is to do. Does loongarch really
work with the existing handlers in the graphics drivers as-is? See [1]
for the interface that implements the actual switching.
[1]
https://elixir.bootlin.com/linux/v7.3/source/include/linux/vga_switcheroo.h#L93
Best regards
Thomas
> depends on ACPI
> depends on PCI
> depends on FB=y
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] vga-switcheroo: Allow VGA_SWITCHEROO to be enabled on LoongArch
2026-10-29 8:16 ` Thomas Zimmermann
@ 2026-10-30 7:04 ` zhaotianrui
2026-10-30 8:17 ` Thomas Zimmermann
0 siblings, 1 reply; 6+ messages in thread
From: zhaotianrui @ 2026-10-30 7:04 UTC (permalink / raw)
To: Thomas Zimmermann, David Airlie, Maarten Lankhorst,
Maxime Ripard, Simona Vetter, chenhuacai
Cc: dri-devel, linux-kernel, wuqianhai
在 2026/10/29 下午4:16, Thomas Zimmermann 写道:
> Hi
>
> Am 29.10.26 um 02:36 schrieb Tianrui Zhao:
>> LoongArch systems with hybrid graphics (integrated +
>> discrete GPU) can benefit from the same GPU switching
>> mechanism that x86 laptops use. Relax the dependency
>> to allow VGA_SWITCHEROO to be built on LoongArch,
>> consistent with the existing dependencies on ACPI,
>> PCI, and FB=y.
>>
>> Change-Id: I84d38fdfe5e1591495fb3681474a7f1f64281fa8
>
> Internal change ids should be remove before submitting patches.
>
Thanks for your review, I will fix this.
Best regards
Tianrui Zhao
>> Signed-off-by: Tianrui Zhao <zhaotianrui@loongson.cn>
>> ---
>> drivers/gpu/vga/Kconfig | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/vga/Kconfig b/drivers/gpu/vga/Kconfig
>> index bad4bcee313..89edd1211aa 100644
>> --- a/drivers/gpu/vga/Kconfig
>> +++ b/drivers/gpu/vga/Kconfig
>> @@ -1,7 +1,7 @@
>> # SPDX-License-Identifier: GPL-2.0-only
>> config VGA_SWITCHEROO
>> bool "Laptop Hybrid Graphics - GPU switching support"
>> - depends on X86
>> + depends on X86 || LOONGARCH
>
> I'm a bit skeptical if that's all there is to do. Does loongarch
> really work with the existing handlers in the graphics drivers as-is?
> See [1] for the interface that implements the actual switching.
>
> [1]
> https://elixir.bootlin.com/linux/v7.3/source/include/linux/vga_switcheroo.h#L93
>
> Best regards
> Thomas
>
Thanks, I will carefully check whether all these vga_switcheroo_handler
callbacks are supported on the LoongArch platform.
Best regards
Tianrui Zhao
>> depends on ACPI
>> depends on PCI
>> depends on FB=y
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] vga-switcheroo: Allow VGA_SWITCHEROO to be enabled on LoongArch
2026-10-30 7:04 ` zhaotianrui
@ 2026-10-30 8:17 ` Thomas Zimmermann
2026-10-30 8:39 ` zhaotianrui
0 siblings, 1 reply; 6+ messages in thread
From: Thomas Zimmermann @ 2026-10-30 8:17 UTC (permalink / raw)
To: zhaotianrui, David Airlie, Maarten Lankhorst, Maxime Ripard,
Simona Vetter, chenhuacai
Cc: dri-devel, linux-kernel, wuqianhai
Hi
Am 30.10.26 um 08:04 schrieb zhaotianrui:
>
> 在 2026/10/29 下午4:16, Thomas Zimmermann 写道:
>> Hi
>>
>> Am 29.10.26 um 02:36 schrieb Tianrui Zhao:
>>> LoongArch systems with hybrid graphics (integrated +
>>> discrete GPU) can benefit from the same GPU switching
>>> mechanism that x86 laptops use. Relax the dependency
>>> to allow VGA_SWITCHEROO to be built on LoongArch,
>>> consistent with the existing dependencies on ACPI,
>>> PCI, and FB=y.
>>>
>>> Change-Id: I84d38fdfe5e1591495fb3681474a7f1f64281fa8
>>
>> Internal change ids should be remove before submitting patches.
>>
> Thanks for your review, I will fix this.
>
>
> Best regards
>
> Tianrui Zhao
>
>>> Signed-off-by: Tianrui Zhao <zhaotianrui@loongson.cn>
>>> ---
>>> drivers/gpu/vga/Kconfig | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/vga/Kconfig b/drivers/gpu/vga/Kconfig
>>> index bad4bcee313..89edd1211aa 100644
>>> --- a/drivers/gpu/vga/Kconfig
>>> +++ b/drivers/gpu/vga/Kconfig
>>> @@ -1,7 +1,7 @@
>>> # SPDX-License-Identifier: GPL-2.0-only
>>> config VGA_SWITCHEROO
>>> bool "Laptop Hybrid Graphics - GPU switching support"
>>> - depends on X86
>>> + depends on X86 || LOONGARCH
>>
>> I'm a bit skeptical if that's all there is to do. Does loongarch
>> really work with the existing handlers in the graphics drivers
>> as-is? See [1] for the interface that implements the actual switching.
>>
>> [1]
>> https://elixir.bootlin.com/linux/v7.3/source/include/linux/vga_switcheroo.h#L93
>>
>> Best regards
>> Thomas
>>
> Thanks, I will carefully check whether all these
> vga_switcheroo_handler callbacks are supported on the LoongArch platform.
Switcheroo used to be required for x86 notebooks from ~2010. Those
systems had two graphics cards, but only one set of output connectors.
That design is become rare, I think.
So I'm a bit surprised to see it come back. Which loongarch systems are
there?
Best regards
Thomas
>
>
> Best regards
>
> Tianrui Zhao
>
>>> depends on ACPI
>>> depends on PCI
>>> depends on FB=y
>>
>
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] vga-switcheroo: Allow VGA_SWITCHEROO to be enabled on LoongArch
2026-10-30 8:17 ` Thomas Zimmermann
@ 2026-10-30 8:39 ` zhaotianrui
2026-10-30 10:10 ` Thomas Zimmermann
0 siblings, 1 reply; 6+ messages in thread
From: zhaotianrui @ 2026-10-30 8:39 UTC (permalink / raw)
To: Thomas Zimmermann, David Airlie, Maarten Lankhorst,
Maxime Ripard, Simona Vetter, chenhuacai
Cc: dri-devel, linux-kernel, wuqianhai
在 2026/10/30 下午4:17, Thomas Zimmermann 写道:
> Hi
>
> Am 30.10.26 um 08:04 schrieb zhaotianrui:
>>
>> 在 2026/10/29 下午4:16, Thomas Zimmermann 写道:
>>> Hi
>>>
>>> Am 29.10.26 um 02:36 schrieb Tianrui Zhao:
>>>> LoongArch systems with hybrid graphics (integrated +
>>>> discrete GPU) can benefit from the same GPU switching
>>>> mechanism that x86 laptops use. Relax the dependency
>>>> to allow VGA_SWITCHEROO to be built on LoongArch,
>>>> consistent with the existing dependencies on ACPI,
>>>> PCI, and FB=y.
>>>>
>>>> Change-Id: I84d38fdfe5e1591495fb3681474a7f1f64281fa8
>>>
>>> Internal change ids should be remove before submitting patches.
>>>
>> Thanks for your review, I will fix this.
>>
>>
>> Best regards
>>
>> Tianrui Zhao
>>
>>>> Signed-off-by: Tianrui Zhao <zhaotianrui@loongson.cn>
>>>> ---
>>>> drivers/gpu/vga/Kconfig | 2 +-
>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/gpu/vga/Kconfig b/drivers/gpu/vga/Kconfig
>>>> index bad4bcee313..89edd1211aa 100644
>>>> --- a/drivers/gpu/vga/Kconfig
>>>> +++ b/drivers/gpu/vga/Kconfig
>>>> @@ -1,7 +1,7 @@
>>>> # SPDX-License-Identifier: GPL-2.0-only
>>>> config VGA_SWITCHEROO
>>>> bool "Laptop Hybrid Graphics - GPU switching support"
>>>> - depends on X86
>>>> + depends on X86 || LOONGARCH
>>>
>>> I'm a bit skeptical if that's all there is to do. Does loongarch
>>> really work with the existing handlers in the graphics drivers
>>> as-is? See [1] for the interface that implements the actual switching.
>>>
>>> [1]
>>> https://elixir.bootlin.com/linux/v7.3/source/include/linux/vga_switcheroo.h#L93
>>>
>>> Best regards
>>> Thomas
>>>
>> Thanks, I will carefully check whether all these
>> vga_switcheroo_handler callbacks are supported on the LoongArch
>> platform.
>
> Switcheroo used to be required for x86 notebooks from ~2010. Those
> systems had two graphics cards, but only one set of output connectors.
> That design is become rare, I think.
>
> So I'm a bit surprised to see it come back. Which loongarch systems
> are there?
>
> Best regards
> Thomas
>
>
Hi Thomas,
Thanks for your reply.
On the Loongson platform, we don't have the "two GPUs but only one set
of display outputs" scenario you described. However, we do have systems
where an integrated GPU and a discrete GPU coexist.
We would like to use the vga_switcheroo interface to switch between the
discrete GPU (DIS) and the integrated GPU (IGD), and to configure the
default VGA device.
Would this approach be feasible? Do you have any suggestions or
recommendations?
Best regards
Tianrui Zhao
>>
>>
>> Best regards
>>
>> Tianrui Zhao
>>
>>>> depends on ACPI
>>>> depends on PCI
>>>> depends on FB=y
>>>
>>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] vga-switcheroo: Allow VGA_SWITCHEROO to be enabled on LoongArch
2026-10-30 8:39 ` zhaotianrui
@ 2026-10-30 10:10 ` Thomas Zimmermann
0 siblings, 0 replies; 6+ messages in thread
From: Thomas Zimmermann @ 2026-10-30 10:10 UTC (permalink / raw)
To: zhaotianrui, David Airlie, Maarten Lankhorst, Maxime Ripard,
Simona Vetter, chenhuacai
Cc: dri-devel, linux-kernel, wuqianhai
Hi
Am 30.10.26 um 09:39 schrieb zhaotianrui:
>
> 在 2026/10/30 下午4:17, Thomas Zimmermann 写道:
>> Hi
>>
>> Am 30.10.26 um 08:04 schrieb zhaotianrui:
>>>
>>> 在 2026/10/29 下午4:16, Thomas Zimmermann 写道:
>>>> Hi
>>>>
>>>> Am 29.10.26 um 02:36 schrieb Tianrui Zhao:
>>>>> LoongArch systems with hybrid graphics (integrated +
>>>>> discrete GPU) can benefit from the same GPU switching
>>>>> mechanism that x86 laptops use. Relax the dependency
>>>>> to allow VGA_SWITCHEROO to be built on LoongArch,
>>>>> consistent with the existing dependencies on ACPI,
>>>>> PCI, and FB=y.
>>>>>
>>>>> Change-Id: I84d38fdfe5e1591495fb3681474a7f1f64281fa8
>>>>
>>>> Internal change ids should be remove before submitting patches.
>>>>
>>> Thanks for your review, I will fix this.
>>>
>>>
>>> Best regards
>>>
>>> Tianrui Zhao
>>>
>>>>> Signed-off-by: Tianrui Zhao <zhaotianrui@loongson.cn>
>>>>> ---
>>>>> drivers/gpu/vga/Kconfig | 2 +-
>>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/drivers/gpu/vga/Kconfig b/drivers/gpu/vga/Kconfig
>>>>> index bad4bcee313..89edd1211aa 100644
>>>>> --- a/drivers/gpu/vga/Kconfig
>>>>> +++ b/drivers/gpu/vga/Kconfig
>>>>> @@ -1,7 +1,7 @@
>>>>> # SPDX-License-Identifier: GPL-2.0-only
>>>>> config VGA_SWITCHEROO
>>>>> bool "Laptop Hybrid Graphics - GPU switching support"
>>>>> - depends on X86
>>>>> + depends on X86 || LOONGARCH
>>>>
>>>> I'm a bit skeptical if that's all there is to do. Does loongarch
>>>> really work with the existing handlers in the graphics drivers
>>>> as-is? See [1] for the interface that implements the actual
>>>> switching.
>>>>
>>>> [1]
>>>> https://elixir.bootlin.com/linux/v7.3/source/include/linux/vga_switcheroo.h#L93
>>>>
>>>> Best regards
>>>> Thomas
>>>>
>>> Thanks, I will carefully check whether all these
>>> vga_switcheroo_handler callbacks are supported on the LoongArch
>>> platform.
>>
>> Switcheroo used to be required for x86 notebooks from ~2010. Those
>> systems had two graphics cards, but only one set of output
>> connectors. That design is become rare, I think.
>>
>> So I'm a bit surprised to see it come back. Which loongarch systems
>> are there?
>>
>> Best regards
>> Thomas
>>
>>
> Hi Thomas,
>
> Thanks for your reply.
>
> On the Loongson platform, we don't have the "two GPUs but only one set
> of display outputs" scenario you described. However, we do have
> systems where an integrated GPU and a discrete GPU coexist.
> We would like to use the vga_switcheroo interface to switch between
> the discrete GPU (DIS) and the integrated GPU (IGD), and to configure
> the default VGA device.
> Would this approach be feasible? Do you have any suggestions or
> recommendations?
Oh, that's not what vga_switcheroo is for. For your scenario, simply
provide a DRM driver for each GPU. Selection of the boot-up display
happens in the UEFI/BIOS. Picking the correct display hardware at
runtime is left to clients in user space (or fbcon). DRM itself has not
preference.
Best regards
Thomas
>
> Best regards
> Tianrui Zhao
>>>
>>>
>>> Best regards
>>>
>>> Tianrui Zhao
>>>
>>>>> depends on ACPI
>>>>> depends on PCI
>>>>> depends on FB=y
>>>>
>>>
>>
>
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-10-30 10:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-29 1:36 [PATCH] vga-switcheroo: Allow VGA_SWITCHEROO to be enabled on LoongArch Tianrui Zhao
2026-10-29 8:16 ` Thomas Zimmermann
2026-10-30 7:04 ` zhaotianrui
2026-10-30 8:17 ` Thomas Zimmermann
2026-10-30 8:39 ` zhaotianrui
2026-10-30 10:10 ` Thomas Zimmermann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®