[PATCH v2] gpio-button-hotplug: skip disabled buttons

2024-09-24 Thread Thomas Richard via openwrt-devel
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.--- Begin Message ---
Ignore buttons which are disabled in the devicetree.

Reviewed-by: Rosen Penev 
Signed-off-by: Thomas Richard 
---
Changes in v2:
- take Reviewed-by: Rosen Penev 
--
 package/kernel/gpio-button-hotplug/Makefile  | 2 +-
 package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/kernel/gpio-button-hotplug/Makefile 
b/package/kernel/gpio-button-hotplug/Makefile
index 04cbb69ada..5b4085887d 100644
--- a/package/kernel/gpio-button-hotplug/Makefile
+++ b/package/kernel/gpio-button-hotplug/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=gpio-button-hotplug
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 PKG_LICENSE:=GPL-2.0
 
 include $(INCLUDE_DIR)/package.mk
diff --git a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c 
b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
index 17748219e8..a73e5c4e5a 100644
--- a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
+++ b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c
@@ -373,7 +373,7 @@ gpio_keys_get_devtree_pdata(struct device *dev)
if (!node)
return NULL;
 
-   nbuttons = of_get_child_count(node);
+   nbuttons = of_get_available_child_count(node);
if (nbuttons == 0)
return ERR_PTR(-EINVAL);
 
@@ -388,7 +388,7 @@ gpio_keys_get_devtree_pdata(struct device *dev)
pdata->rep = !!of_get_property(node, "autorepeat", NULL);
of_property_read_u32(node, "poll-interval", &pdata->poll_interval);
 
-   for_each_child_of_node(node, pp) {
+   for_each_available_child_of_node(node, pp) {
button = (struct gpio_keys_button *)(&pdata->buttons[i++]);
 
if (of_property_read_u32(pp, "linux,code", &button->code)) {
-- 
2.39.5


--- End Message ---
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: Raise nvptx code generation to default PTX ISA 7.3, sm_52, therefore CUDA 11.3 (released 2021-04)

2024-09-24 Thread Thomas Schwinge
Hi!

On 2024-09-23T09:22:55+0200, Richard Biener  wrote:
> On Fri, Sep 20, 2024 at 6:50 PM Thomas Schwinge  
> wrote:
>> (This is orthogonal to yesterday's
>> "GCC 15: nvptx '-mptx=3.1' multilib variants are deprecated".)
>>
>> We'd like to raise nvptx code generation from PTX ISA 6.0, sm_30 "Kepler"
>> to default PTX ISA 7.3, sm_52 "Maxwell", therefore CUDA 11.3 (2021-04).
>> This is, primarily, so that we're able to use 'alloca' and related stack
>> manipulation instructions, and improve upon the current:
>>
>> sorry ("target cannot support alloca");
>>
>> I see, for example:
>>
>>   - Ubuntu 22.04 "jammy" LTS has 11.5.1-1ubuntu1 packaged
>>   - Debian 12 "stable" ("bookworm", 2023-06) has 11.8.89~11.8.0-5~deb12u1 
>> packaged
>>
>> ..., and sm_52 "Maxwell" has been supported as of CUDA 6.5 (2014-08), and
>> thus supported by most Nvidia GPUs of the last decade, approximately.
>>
>> The question is, whether we continue to build by default also the current
>> sm_30 "Kepler" multilib variants (to be available for use via
>> building/linking with '-march=sm_30'), or if that's truly obsolete by
>> now, and need no longer be available by default?  (It has been deprecated
>> for a long time, and sm_3x "Kepler architecture support is removed from
>> CUDA 12.0", 2022-12.)  There's always the 'configure'-time
>> '--with-arch=sm_30' if you (additionally to sm_52) still need your target
>> libraries built for sm_30 multilib variants; I would argue that's
>> sufficient?
>
> I seem to have Turing so the change works for me

ACK.

> How would the user
> experience be with using the sm_30 multilib?

Let's consider the cases searately, under the assumption that the user's
Nvidia GPU doesn't support sm_52 or higher:

(1) GCC/nvptx 'configure'd without '--with-arch=[...]' (that is, default
'--with-arch=sm_52'), and there are no sm_30 multilib variants:
offloading codes build fine (for sm_52), but at run time libgomp either
(to be decided) emits an error message or silently ignores the device as
incapable.  (That's effectively the same scenario as if you build with
the wrong '-march=[...]' for GCC/GCN offloading.  Probably we should
mirror for nvptx how GCN behaves.)  <https://gcc.gnu.org/PR71646>
"incompability between ptx code and GPU hardware" should get resolved
here.

(2) GCC/nvptx 'configure'd '--with-arch=sm_30': generally, offloading
codes continue to build and execute as they do now, just for specific
upcoming OpenACC functionality (array/struct reductions), you may run
into compile-time 'sorry ("target cannot support alloca");'.  (..., which
we may evolve into a more helpful error message.)

(3) GCC/nvptx 'configure'd without '--with-arch=[...]' (that is, default
'--with-arch=sm_52'), but we do build sm_30 multilib variants (either
(3a) by default or (3b) upon 'configure'-time request via an additional
option: '--with-multilib-list=default,sm_30' or similar), and the user
builds with '-foffload-options=nvptx-none=-march=sm_30': behaves as (2).

Now, (1) and (2) behave as expected (other than maybe emit more helpful
error messages).  My concern with (3a) is that the sm_30 multilib
variants built by default will largely be unused (as they're obsolete
with moderatly recent Nvidia GPU hardware), but I'll be happy to
implement (3b) if people think that's still helpful.

In fact, (3b) can then generally support 'configure'-time selection of
further multilib variants to be built (for example,
'--with-multilib-list=default,sm_30,sm_89') -- but not use them as
default '-march=[...]', in contrast to what '--with-arch=sm_30' or
'--with-arch=sm_89' does, for example.  I'll look into that.


Grüße
 Thomas


[clang] [Clang] Add explicit visibility symbol macros (PR #108276)

2024-09-24 Thread Thomas Fransham via cfe-commits


@@ -8,6 +8,7 @@
 
 set(LLVM_LINK_COMPONENTS Support)
 
-add_clang_tool(amdgpu-arch AMDGPUArch.cpp AMDGPUArchByHSA.cpp 
AMDGPUArchByHIP.cpp)
+add_clang_tool(amdgpu-arch DISABLE_CLANG_LINK_DYLIB

fsfod wrote:

There using target_link_libraries instead of clang_target_link_libraries so 
there not linked to clang-cpp so we have to disable import macros.

https://github.com/llvm/llvm-project/pull/108276
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [VOTE] Release candidate fulcrum-yaafi v2.0.1 based on staged repository

2024-09-24 Thread Thomas Vandahl


> Am 11.09.2024 um 16:43 schrieb Kallidis, Georg :
> 
> Hi Turbine devs,
> 
> a new Turbine Yaafi release candidate has been prepared.
> 
> Tag: fulcrum-yaafi-2.0.1-candidate
> 
[...]
> [X] +1 release it
> [ ] +0 go ahead I don't care
> [ ] -1 no, do not release it because

Signatures ok, build and tests ok. Tested with

Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
Java version: 17.0.6, vendor: Oracle Corporation, runtime: 
/Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home
Default locale: de_DE, platform encoding: UTF-8
OS name: "mac os x", version: "14.6.1", arch: "x86_64", family: „mac"

Bye, Thomas 
-
To unsubscribe, e-mail: dev-unsubscr...@turbine.apache.org
For additional commands, e-mail: dev-h...@turbine.apache.org



[SR-Users] Re: [EXTERNAL] Re: SDP parsing fails when media stream is removed, there is no session-wide "c=" line and offending media stream omits all attributes

2024-09-24 Thread Thomas Baumgartner via sr-users
Hi Richard,

thanks for your input.
And i guess you are correct, when reading the sentence with the wording of the 
SDP RFC in mind attributes should only be "a=" lines. We will talk to the 
device vendor again with this new finding!

Anyways, maybe it still makes sense to adjust the SDP parser for such 
scenarios, as it really doesn't make sense to require a "c=" line if the stream 
is being removed as you said. I will open an git issue aswell.

Mit kommunikativen Grüßen I Best regards

Thomas
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


Re: [INDOLOGY] Sources on religion in India 600 CE – 1300 CE

2024-09-24 Thread Paul Thomas via INDOLOGY
Hello Colleagues,
I am looking for books covering the religious history of India in general
during the period 600 CE – 1300 CE.
Thank you,
Paul

-- 
Paul Thomas
Ph D Candidate, Department of South and Southeast Asian Studies
University of California, Berkeley, USA

___
INDOLOGY mailing list
INDOLOGY@list.indology.info
https://list.indology.info/mailman/listinfo/indology


Bug#1054291: fixed in wget2 2.1.0-3

2024-09-24 Thread Thomas Uhle

Hi Andreas,

at the moment there are only a few unit tests checked while building 
the binary packages because libmicrohttpd-dev is still missing as a 
build-dependency.  Just in case you have not done this on purpose (out 
of a certain reason not to do so), I add the remaining change from my 
previous patch to this e-mail.


Best regards,

Thomas Uhle

wget2-enable-testsuite.diff.gz
Description: GNU Zip compressed data


[PATCH] docs: Mark "gluster" support in QEMU as deprecated

2024-09-24 Thread Thomas Huth
According to https://marc.info/?l=fedora-devel-list&m=171934833215726
the GlusterFS development effectively ended. Thus mark it as deprecated
in QEMU, so we can remove it in a future release if the project does
not gain momentum again.

Signed-off-by: Thomas Huth 
---
 docs/about/deprecated.rst | 9 +
 1 file changed, 9 insertions(+)

diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index ed31d4b0b2..b231aa3948 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -395,6 +395,15 @@ Specifying the iSCSI password in plain text on the command 
line using the
 used instead, to refer to a ``--object secret...`` instance that provides
 a password via a file, or encrypted.
 
+``gluster`` backend (since 9.2)
+^^^
+
+According to https://marc.info/?l=fedora-devel-list&m=171934833215726
+the GlusterFS development effectively ended. Unless the development
+gains momentum again, the QEMU project might remove the gluster backend
+in a future release.
+
+
 Character device options
 ''''''''''''''''''''''''
 
-- 
2.46.0




[PATCH] docs: Mark "gluster" support in QEMU as deprecated

2024-09-24 Thread Thomas Huth
According to https://marc.info/?l=fedora-devel-list&m=171934833215726
the GlusterFS development effectively ended. Thus mark it as deprecated
in QEMU, so we can remove it in a future release if the project does
not gain momentum again.

Signed-off-by: Thomas Huth 
---
 docs/about/deprecated.rst | 9 +
 1 file changed, 9 insertions(+)

diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index ed31d4b0b2..b231aa3948 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -395,6 +395,15 @@ Specifying the iSCSI password in plain text on the command 
line using the
 used instead, to refer to a ``--object secret...`` instance that provides
 a password via a file, or encrypted.
 
+``gluster`` backend (since 9.2)
+^^^
+
+According to https://marc.info/?l=fedora-devel-list&m=171934833215726
+the GlusterFS development effectively ended. Unless the development
+gains momentum again, the QEMU project might remove the gluster backend
+in a future release.
+
+
 Character device options
 ''''''''''''''''''''''''
 
-- 
2.46.0


[PATCH] docs: Mark "gluster" support in QEMU as deprecated

2024-09-24 Thread Thomas Huth
According to https://marc.info/?l=fedora-devel-list&m=171934833215726
the GlusterFS development effectively ended. Thus mark it as deprecated
in QEMU, so we can remove it in a future release if the project does
not gain momentum again.

Signed-off-by: Thomas Huth 
---
 docs/about/deprecated.rst | 9 +
 1 file changed, 9 insertions(+)

diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index ed31d4b0b2..b231aa3948 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -395,6 +395,15 @@ Specifying the iSCSI password in plain text on the command 
line using the
 used instead, to refer to a ``--object secret...`` instance that provides
 a password via a file, or encrypted.
 
+``gluster`` backend (since 9.2)
+^^^
+
+According to https://marc.info/?l=fedora-devel-list&m=171934833215726
+the GlusterFS development effectively ended. Unless the development
+gains momentum again, the QEMU project might remove the gluster backend
+in a future release.
+
+
 Character device options
 ''''''''''''''''''''''''
 
-- 
2.46.0




Re: radeon ARUBA NULL pointer dereference

2024-09-24 Thread Thomas Zimmermann




Am 24.09.24 um 14:20 schrieb Thomas Zimmermann:

(cc: DMA and x86 folks)

Hi

Am 24.09.24 um 04:08 schrieb Arthur Marsh:
Using current Linus git head kernel, I was able to save the dmesg 
output:


[   17.218724] [drm] radeon kernel modesetting enabled.
[   17.218778] radeon :00:01.0: vgaarb: deactivate vga console
[   17.219509] Console: switching to colour dummy device 80x25
[   17.219700] [drm] initializing kernel modesetting (ARUBA 
0x1002:0x990C 0x1002:0x0123 0x00).

[   17.219773] ATOM BIOS: 113
[   17.219838] radeon :00:01.0: VRAM: 768M 0x - 
0x2FFF (768M used)
[   17.219841] radeon :00:01.0: GTT: 1024M 0x3000 - 
0x6FFF

[   17.219844] [drm] Detected VRAM RAM=768M, BAR=256M
[   17.219845] [drm] RAM width 64bits DDR
[   17.219851] BUG: kernel NULL pointer dereference, address: 
00a0


This is 160 bytes behind NULL, which indicates a field within a struct.


[   17.219852] #PF: supervisor read access in kernel mode
[   17.219853] #PF: error_code(0x) - not-present page
[   17.219854] PGD 0 P4D 0
[   17.219856] Oops: Oops:  [#1] PREEMPT_RT SMP NOPTI
[   17.219858] CPU: 0 UID: 0 PID: 451 Comm: udevd Not tainted 6.11.0+ 
#6121
[   17.219860] Hardware name: Gigabyte Technology Co., Ltd. To be 
filled by O.E.M./F2A78M-HD2, BIOS F2 05/28/2014

[   17.219862] RIP: 0010:dma_get_required_mask+0x11/0x50
[   17.219868] Code: 0f 1f 84 00 00 00 00 00 90 90 90 90 90 90 90 90 
90 90 90 90 90 90 90 90 90 0f 1f 44 00 00 48 8b 87 68 02 00 00 48 85 
c0 74 11 <48> 8b 80 a0 00 00 00 48 85 c0 74 1f e9 ee ed 94 00 f6 87 
2c 03 00

[   17.219870] RSP: 0018:a54bc13a7b00 EFLAGS: 00010202
[   17.219871] RAX:  RBX: 00ff RCX: 

[   17.219872] RDX:  RSI: 0027 RDI: 
976f44e720c8
[   17.219873] RBP: 976f44e720c8 R08: efff R09: 
ab2aab08
[   17.219874] R10: f000 R11: 0002 R12: 

[   17.219875] R13: 976f48a4aa30 R14:  R15: 
0028
[   17.219876] FS:  7f59a070d840() GS:97726f80() 
knlGS:

[   17.219878] CS:  0010 DS:  ES:  CR0: 80050033
[   17.219879] CR2: 00a0 CR3: 0001053b4000 CR4: 
000406f0

[   17.219880] Call Trace:
[   17.219881]  
[   17.219882]  ? __die_body.cold+0x19/0x1e
[   17.219885]  ? page_fault_oops+0xa8/0x230
[   17.219889]  ? search_module_extables+0x4f/0x90
[   17.219891]  ? fixup_exception+0x36/0x2f0
[   17.219894]  ? exc_page_fault+0x88/0x1b0
[   17.219897]  ? asm_exc_page_fault+0x22/0x30
[   17.219900]  ? dma_get_required_mask+0x11/0x50


This is not in the radeon driver but the DMA code. I'd say it's at 
[1], as get_required_mask is 160 bytes within struct drm_map_ops. The 
call to get_arch_dma_ops() probably returns NULL.


And indeed, when I added

    pr_warn("dev dma ops: 0x%p\n", pdev->dev.dma_ops);
    pr_warn("arch dma ops: 0x%p\n", get_arch_dma_ops());

to radeon_pci_probe(), I got

[   22.325657] dev dma ops: 0x
[   22.342921] arch dma ops: 0x0000

as a result.

Best regards
Thomas



Best regards
Thomas

[1] 
https://elixir.bootlin.com/linux/v6.11/source/kernel/dma/mapping.c#L523
[2] 
https://elixir.bootlin.com/linux/v6.11/source/include/linux/dma-map-ops.h#L98



[   17.219902] dma_addressing_limited+0x6c/0xb0
[   17.219905]  radeon_ttm_init+0x3f/0x210 [radeon]
[   17.219977]  cayman_init+0x97/0x290 [radeon]
[   17.220057]  radeon_device_init+0x5e9/0xb40 [radeon]
[   17.220115]  radeon_driver_load_kms+0xb0/0x260 [radeon]
[   17.220174]  radeon_pci_probe+0xff/0x170 [radeon]
[   17.220231]  pci_device_probe+0xbe/0x1a0
[   17.220234]  really_probe+0xde/0x350
[   17.220237]  ? pm_runtime_barrier+0x61/0xb0
[   17.220240]  ? __pfx___driver_attach+0x10/0x10
[   17.220242]  __driver_probe_device+0x78/0x110
[   17.220245]  driver_probe_device+0x2d/0xc0
[   17.220247]  __driver_attach+0xc9/0x1c0
[   17.220249]  bus_for_each_dev+0x6a/0xb0
[   17.220251]  ? migrate_enable+0xbf/0xf0
[   17.220254]  bus_add_driver+0x139/0x220
[   17.220256]  driver_register+0x6e/0xc0
[   17.220258]  ? __pfx_radeon_module_init+0x10/0x10 [radeon]
[   17.220315]  do_one_initcall+0x42/0x210
[   17.220318]  ? __kmalloc_cache_noprof+0x89/0x230
[   17.220321]  do_init_module+0x60/0x210
[   17.220324]  init_module_from_file+0x89/0xc0
[   17.220326]  __x64_sys_finit_module+0x142/0x390
[   17.220329]  do_syscall_64+0x47/0x110
[   17.220331]  entry_SYSCALL_64_after_hwframe+0x76/0x7e
[   17.220334] RIP: 0033:0x7f59a0625279
[   17.220336] Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 
00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 
08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 77 6b 0d 00 f7 d8 64 
89 01 48
[   17.220337] RSP: 002b:7ffd15ee7df8 EFLAGS: 0246 ORIG_RAX: 
0139
[   17.220339] RA

Re: radeon ARUBA NULL pointer dereference

2024-09-24 Thread Thomas Zimmermann




Am 24.09.24 um 14:20 schrieb Thomas Zimmermann:

(cc: DMA and x86 folks)

Hi

Am 24.09.24 um 04:08 schrieb Arthur Marsh:
Using current Linus git head kernel, I was able to save the dmesg 
output:


[   17.218724] [drm] radeon kernel modesetting enabled.
[   17.218778] radeon :00:01.0: vgaarb: deactivate vga console
[   17.219509] Console: switching to colour dummy device 80x25
[   17.219700] [drm] initializing kernel modesetting (ARUBA 
0x1002:0x990C 0x1002:0x0123 0x00).

[   17.219773] ATOM BIOS: 113
[   17.219838] radeon :00:01.0: VRAM: 768M 0x - 
0x2FFF (768M used)
[   17.219841] radeon :00:01.0: GTT: 1024M 0x3000 - 
0x6FFF

[   17.219844] [drm] Detected VRAM RAM=768M, BAR=256M
[   17.219845] [drm] RAM width 64bits DDR
[   17.219851] BUG: kernel NULL pointer dereference, address: 
00a0


This is 160 bytes behind NULL, which indicates a field within a struct.


[   17.219852] #PF: supervisor read access in kernel mode
[   17.219853] #PF: error_code(0x) - not-present page
[   17.219854] PGD 0 P4D 0
[   17.219856] Oops: Oops:  [#1] PREEMPT_RT SMP NOPTI
[   17.219858] CPU: 0 UID: 0 PID: 451 Comm: udevd Not tainted 6.11.0+ 
#6121
[   17.219860] Hardware name: Gigabyte Technology Co., Ltd. To be 
filled by O.E.M./F2A78M-HD2, BIOS F2 05/28/2014

[   17.219862] RIP: 0010:dma_get_required_mask+0x11/0x50
[   17.219868] Code: 0f 1f 84 00 00 00 00 00 90 90 90 90 90 90 90 90 
90 90 90 90 90 90 90 90 90 0f 1f 44 00 00 48 8b 87 68 02 00 00 48 85 
c0 74 11 <48> 8b 80 a0 00 00 00 48 85 c0 74 1f e9 ee ed 94 00 f6 87 
2c 03 00

[   17.219870] RSP: 0018:a54bc13a7b00 EFLAGS: 00010202
[   17.219871] RAX:  RBX: 00ff RCX: 

[   17.219872] RDX:  RSI: 0027 RDI: 
976f44e720c8
[   17.219873] RBP: 976f44e720c8 R08: efff R09: 
ab2aab08
[   17.219874] R10: f000 R11: 0002 R12: 

[   17.219875] R13: 976f48a4aa30 R14:  R15: 
0028
[   17.219876] FS:  7f59a070d840() GS:97726f80() 
knlGS:

[   17.219878] CS:  0010 DS:  ES:  CR0: 80050033
[   17.219879] CR2: 00a0 CR3: 0001053b4000 CR4: 
000406f0

[   17.219880] Call Trace:
[   17.219881]  
[   17.219882]  ? __die_body.cold+0x19/0x1e
[   17.219885]  ? page_fault_oops+0xa8/0x230
[   17.219889]  ? search_module_extables+0x4f/0x90
[   17.219891]  ? fixup_exception+0x36/0x2f0
[   17.219894]  ? exc_page_fault+0x88/0x1b0
[   17.219897]  ? asm_exc_page_fault+0x22/0x30
[   17.219900]  ? dma_get_required_mask+0x11/0x50


This is not in the radeon driver but the DMA code. I'd say it's at 
[1], as get_required_mask is 160 bytes within struct drm_map_ops. The 
call to get_arch_dma_ops() probably returns NULL.


And indeed, when I added

    pr_warn("dev dma ops: 0x%p\n", pdev->dev.dma_ops);
    pr_warn("arch dma ops: 0x%p\n", get_arch_dma_ops());

to radeon_pci_probe(), I got

[   22.325657] dev dma ops: 0x
[   22.342921] arch dma ops: 0x0000

as a result.

Best regards
Thomas



Best regards
Thomas

[1] 
https://elixir.bootlin.com/linux/v6.11/source/kernel/dma/mapping.c#L523
[2] 
https://elixir.bootlin.com/linux/v6.11/source/include/linux/dma-map-ops.h#L98



[   17.219902] dma_addressing_limited+0x6c/0xb0
[   17.219905]  radeon_ttm_init+0x3f/0x210 [radeon]
[   17.219977]  cayman_init+0x97/0x290 [radeon]
[   17.220057]  radeon_device_init+0x5e9/0xb40 [radeon]
[   17.220115]  radeon_driver_load_kms+0xb0/0x260 [radeon]
[   17.220174]  radeon_pci_probe+0xff/0x170 [radeon]
[   17.220231]  pci_device_probe+0xbe/0x1a0
[   17.220234]  really_probe+0xde/0x350
[   17.220237]  ? pm_runtime_barrier+0x61/0xb0
[   17.220240]  ? __pfx___driver_attach+0x10/0x10
[   17.220242]  __driver_probe_device+0x78/0x110
[   17.220245]  driver_probe_device+0x2d/0xc0
[   17.220247]  __driver_attach+0xc9/0x1c0
[   17.220249]  bus_for_each_dev+0x6a/0xb0
[   17.220251]  ? migrate_enable+0xbf/0xf0
[   17.220254]  bus_add_driver+0x139/0x220
[   17.220256]  driver_register+0x6e/0xc0
[   17.220258]  ? __pfx_radeon_module_init+0x10/0x10 [radeon]
[   17.220315]  do_one_initcall+0x42/0x210
[   17.220318]  ? __kmalloc_cache_noprof+0x89/0x230
[   17.220321]  do_init_module+0x60/0x210
[   17.220324]  init_module_from_file+0x89/0xc0
[   17.220326]  __x64_sys_finit_module+0x142/0x390
[   17.220329]  do_syscall_64+0x47/0x110
[   17.220331]  entry_SYSCALL_64_after_hwframe+0x76/0x7e
[   17.220334] RIP: 0033:0x7f59a0625279
[   17.220336] Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 
00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 
08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 77 6b 0d 00 f7 d8 64 
89 01 48
[   17.220337] RSP: 002b:7ffd15ee7df8 EFLAGS: 0246 ORIG_RAX: 
0139
[   17.220339] RA

[jira] [Comment Edited] (CAMEL-21238) camel-jbang - k8s run - Reloading project does not change route behaviour

2024-09-24 Thread Thomas Diesler (Jira)


[ 
https://issues.apache.org/jira/browse/CAMEL-21238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17884255#comment-17884255
 ] 

Thomas Diesler edited comment on CAMEL-21238 at 9/24/24 12:30 PM:
--

PR: https://github.com/apache/camel/pull/15672

The suggested change takes a fresh look at k8s run --dev, it detail ...
- export directory is different for each reload
- avoid duplicate labels (due to reexport)
- pod logging is more lenient and patiently waits for the reloaded pod (as for 
the original)
- file watching a setup anew for the reloaded project




was (Author: tdiesler):
PR: https://github.com/apache/camel/pull/15672

The suggested change takes a fresh look at k8s run --dev, it detail ...
- the export directory is different for each reload
- avoid duplicate labels (due to reexport)
- pod logging is more lenient and patiently waits for the reloaded pod (as for 
the original)
- file watching a setup anew for the reloaded project



> camel-jbang - k8s run - Reloading project does not change route behaviour
> -
>
> Key: CAMEL-21238
> URL: https://issues.apache.org/jira/browse/CAMEL-21238
> Project: Camel
>  Issue Type: Bug
>  Components: camel-jbang
>Reporter: Thomas Diesler
>Assignee: Thomas Diesler
>Priority: Major
> Fix For: 4.9.0
>
>
> When running a project with `--dev` like this ...
> {code}
> jbang camel kubernetes run timer-log-route.yaml --logs --dev \
>  --gav=examples:timer-log:1.0.0 \
>  --trait container.imagePullPolicy=IfNotPresent \
>  --trait service.type=NodePort \
>  --runtime=quarkus
> {code}
> I see ...
> {code}
> Reloading project due to file change: timer-log-route.yaml
> {code}
> without image re-build/deploy



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Comment Edited] (CAMEL-21238) camel-jbang - k8s run - Reloading project does not change route behaviour

2024-09-24 Thread Thomas Diesler (Jira)


[ 
https://issues.apache.org/jira/browse/CAMEL-21238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17884255#comment-17884255
 ] 

Thomas Diesler edited comment on CAMEL-21238 at 9/24/24 12:30 PM:
--

PR: https://github.com/apache/camel/pull/15672

The suggested change takes a fresh look at k8s run --dev, it detail ...
- the export directory is different for each reload
- avoid duplicate labels (due to reexport)
- pod logging is more lenient and patiently waits for the reloaded pod (as for 
the original)
- file watching a setup anew for the reloaded project




was (Author: tdiesler):
PR: https://github.com/apache/camel/pull/15672

The suggested change takes a fresh look at k8s run --dev, it detail ...
- the export directory is different for each reload
- duplicate labels (due to reexport) are avoided
- pod logging is more lenient and patiently waits for the reloaded pod (as for 
the original)
- file watching a setup anew for the reloaded project

I tested with 
https://github.com/tdiesler/camel-cloud-examples/tree/main/quarkus/timer-log

> camel-jbang - k8s run - Reloading project does not change route behaviour
> -
>
> Key: CAMEL-21238
> URL: https://issues.apache.org/jira/browse/CAMEL-21238
> Project: Camel
>  Issue Type: Bug
>  Components: camel-jbang
>Reporter: Thomas Diesler
>Assignee: Thomas Diesler
>Priority: Major
> Fix For: 4.9.0
>
>
> When running a project with `--dev` like this ...
> {code}
> jbang camel kubernetes run timer-log-route.yaml --logs --dev \
>  --gav=examples:timer-log:1.0.0 \
>  --trait container.imagePullPolicy=IfNotPresent \
>  --trait service.type=NodePort \
>  --runtime=quarkus
> {code}
> I see ...
> {code}
> Reloading project due to file change: timer-log-route.yaml
> {code}
> without image re-build/deploy



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Comment Edited] (CAMEL-21238) camel-jbang - k8s run - Reloading project does not change route behaviour

2024-09-24 Thread Thomas Diesler (Jira)


[ 
https://issues.apache.org/jira/browse/CAMEL-21238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17884255#comment-17884255
 ] 

Thomas Diesler edited comment on CAMEL-21238 at 9/24/24 12:30 PM:
--

PR: https://github.com/apache/camel/pull/15672

The suggested change takes a fresh look at k8s run --dev, it detail ...
- export directory is different for each reload
- avoid duplicate labels (due to reexport)
- pod logging is more lenient and patiently waits for the reloaded pod (as for 
the original)
- file watching a setup anew for each reload




was (Author: tdiesler):
PR: https://github.com/apache/camel/pull/15672

The suggested change takes a fresh look at k8s run --dev, it detail ...
- export directory is different for each reload
- avoid duplicate labels (due to reexport)
- pod logging is more lenient and patiently waits for the reloaded pod (as for 
the original)
- file watching a setup anew for the reloaded project



> camel-jbang - k8s run - Reloading project does not change route behaviour
> -
>
> Key: CAMEL-21238
> URL: https://issues.apache.org/jira/browse/CAMEL-21238
> Project: Camel
>  Issue Type: Bug
>  Components: camel-jbang
>Reporter: Thomas Diesler
>Assignee: Thomas Diesler
>Priority: Major
> Fix For: 4.9.0
>
>
> When running a project with `--dev` like this ...
> {code}
> jbang camel kubernetes run timer-log-route.yaml --logs --dev \
>  --gav=examples:timer-log:1.0.0 \
>  --trait container.imagePullPolicy=IfNotPresent \
>  --trait service.type=NodePort \
>  --runtime=quarkus
> {code}
> I see ...
> {code}
> Reloading project due to file change: timer-log-route.yaml
> {code}
> without image re-build/deploy



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Comment Edited] (CAMEL-21238) camel-jbang - k8s run - Reloading project does not change route behaviour

2024-09-24 Thread Thomas Diesler (Jira)


[ 
https://issues.apache.org/jira/browse/CAMEL-21238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17884255#comment-17884255
 ] 

Thomas Diesler edited comment on CAMEL-21238 at 9/24/24 12:21 PM:
--

PR: https://github.com/apache/camel/pull/15672

The suggested change takes a fresh look at k8s run --dev, it detail ...
- the export directory is different for each reload
- duplicate labels (due to reexport) are avoided
- pod logging is more lenient and patiently waits for the reloaded pod (as for 
the original)
- file watching a setup anew for the reloaded project

I tested with 
https://github.com/tdiesler/camel-cloud-examples/tree/main/quarkus/timer-log


was (Author: tdiesler):
PR: https://github.com/apache/camel/pull/15672

The suggested change takes a fresh look at k8s run --dev, it detail ...
- the export directory is different for each reload
- duplicate labels (due to reexport) are avoided
- pod logging is more lenient and patiently waits for the reloaded pod (as for 
the original)
- file watching a setup anew for wach project reload

I tested with 
https://github.com/tdiesler/camel-cloud-examples/tree/main/quarkus/timer-log

> camel-jbang - k8s run - Reloading project does not change route behaviour
> -
>
> Key: CAMEL-21238
> URL: https://issues.apache.org/jira/browse/CAMEL-21238
> Project: Camel
>  Issue Type: Bug
>  Components: camel-jbang
>Reporter: Thomas Diesler
>Assignee: Thomas Diesler
>Priority: Major
> Fix For: 4.9.0
>
>
> When running a project with `--dev` like this ...
> {code}
> jbang camel kubernetes run timer-log-route.yaml --logs --dev \
>  --gav=examples:timer-log:1.0.0 \
>  --trait container.imagePullPolicy=IfNotPresent \
>  --trait service.type=NodePort \
>  --runtime=quarkus
> {code}
> I see ...
> {code}
> Reloading project due to file change: timer-log-route.yaml
> {code}
> without image re-build/deploy



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (CAMEL-21238) camel-jbang - k8s run - Reloading project does not change route behaviour

2024-09-24 Thread Thomas Diesler (Jira)


[ 
https://issues.apache.org/jira/browse/CAMEL-21238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17884255#comment-17884255
 ] 

Thomas Diesler commented on CAMEL-21238:


PR: https://github.com/apache/camel/pull/15672

The suggested change takes a fresh look at k8s run --dev, it detail ...
- the export directory is different for each reload
- duplicate labels (due to reexport) are avoided
- pod logging is more lenient and patiently waits for the reloaded pod (as for 
the original)
- file watching a setup anew for wach project reload

I tested with 
https://github.com/tdiesler/camel-cloud-examples/tree/main/quarkus/timer-log

> camel-jbang - k8s run - Reloading project does not change route behaviour
> -
>
> Key: CAMEL-21238
> URL: https://issues.apache.org/jira/browse/CAMEL-21238
> Project: Camel
>  Issue Type: Bug
>  Components: camel-jbang
>Reporter: Thomas Diesler
>Assignee: Thomas Diesler
>Priority: Major
> Fix For: 4.9.0
>
>
> When running a project with `--dev` like this ...
> {code}
> jbang camel kubernetes run timer-log-route.yaml --logs --dev \
>  --gav=examples:timer-log:1.0.0 \
>  --trait container.imagePullPolicy=IfNotPresent \
>  --trait service.type=NodePort \
>  --runtime=quarkus
> {code}
> I see ...
> {code}
> Reloading project due to file change: timer-log-route.yaml
> {code}
> without image re-build/deploy



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


Re: radeon ARUBA NULL pointer dereference

2024-09-24 Thread Thomas Zimmermann

(cc: DMA and x86 folks)

Hi

Am 24.09.24 um 04:08 schrieb Arthur Marsh:

Using current Linus git head kernel, I was able to save the dmesg output:

[   17.218724] [drm] radeon kernel modesetting enabled.
[   17.218778] radeon :00:01.0: vgaarb: deactivate vga console
[   17.219509] Console: switching to colour dummy device 80x25
[   17.219700] [drm] initializing kernel modesetting (ARUBA 0x1002:0x990C 
0x1002:0x0123 0x00).
[   17.219773] ATOM BIOS: 113
[   17.219838] radeon :00:01.0: VRAM: 768M 0x - 
0x2FFF (768M used)
[   17.219841] radeon :00:01.0: GTT: 1024M 0x3000 - 
0x6FFF
[   17.219844] [drm] Detected VRAM RAM=768M, BAR=256M
[   17.219845] [drm] RAM width 64bits DDR
[   17.219851] BUG: kernel NULL pointer dereference, address: 00a0


This is 160 bytes behind NULL, which indicates a field within a struct.


[   17.219852] #PF: supervisor read access in kernel mode
[   17.219853] #PF: error_code(0x) - not-present page
[   17.219854] PGD 0 P4D 0
[   17.219856] Oops: Oops:  [#1] PREEMPT_RT SMP NOPTI
[   17.219858] CPU: 0 UID: 0 PID: 451 Comm: udevd Not tainted 6.11.0+ #6121
[   17.219860] Hardware name: Gigabyte Technology Co., Ltd. To be filled by 
O.E.M./F2A78M-HD2, BIOS F2 05/28/2014
[   17.219862] RIP: 0010:dma_get_required_mask+0x11/0x50
[   17.219868] Code: 0f 1f 84 00 00 00 00 00 90 90 90 90 90 90 90 90 90 90 90 90 90 
90 90 90 90 0f 1f 44 00 00 48 8b 87 68 02 00 00 48 85 c0 74 11 <48> 8b 80 a0 00 
00 00 48 85 c0 74 1f e9 ee ed 94 00 f6 87 2c 03 00
[   17.219870] RSP: 0018:a54bc13a7b00 EFLAGS: 00010202
[   17.219871] RAX:  RBX: 00ff RCX: 
[   17.219872] RDX:  RSI: 0027 RDI: 976f44e720c8
[   17.219873] RBP: 976f44e720c8 R08: efff R09: ab2aab08
[   17.219874] R10: f000 R11: 0002 R12: 
[   17.219875] R13: 976f48a4aa30 R14:  R15: 0028
[   17.219876] FS:  7f59a070d840() GS:97726f80() 
knlGS:
[   17.219878] CS:  0010 DS:  ES:  CR0: 80050033
[   17.219879] CR2: 00a0 CR3: 0001053b4000 CR4: 000406f0
[   17.219880] Call Trace:
[   17.219881]  
[   17.219882]  ? __die_body.cold+0x19/0x1e
[   17.219885]  ? page_fault_oops+0xa8/0x230
[   17.219889]  ? search_module_extables+0x4f/0x90
[   17.219891]  ? fixup_exception+0x36/0x2f0
[   17.219894]  ? exc_page_fault+0x88/0x1b0
[   17.219897]  ? asm_exc_page_fault+0x22/0x30
[   17.219900]  ? dma_get_required_mask+0x11/0x50


This is not in the radeon driver but the DMA code. I'd say it's at [1], 
as get_required_mask is 160 bytes within struct drm_map_ops. The call to 
get_arch_dma_ops() probably returns NULL.


Best regards
Thomas

[1] https://elixir.bootlin.com/linux/v6.11/source/kernel/dma/mapping.c#L523
[2] 
https://elixir.bootlin.com/linux/v6.11/source/include/linux/dma-map-ops.h#L98



[   17.219902]  dma_addressing_limited+0x6c/0xb0
[   17.219905]  radeon_ttm_init+0x3f/0x210 [radeon]
[   17.219977]  cayman_init+0x97/0x290 [radeon]
[   17.220057]  radeon_device_init+0x5e9/0xb40 [radeon]
[   17.220115]  radeon_driver_load_kms+0xb0/0x260 [radeon]
[   17.220174]  radeon_pci_probe+0xff/0x170 [radeon]
[   17.220231]  pci_device_probe+0xbe/0x1a0
[   17.220234]  really_probe+0xde/0x350
[   17.220237]  ? pm_runtime_barrier+0x61/0xb0
[   17.220240]  ? __pfx___driver_attach+0x10/0x10
[   17.220242]  __driver_probe_device+0x78/0x110
[   17.220245]  driver_probe_device+0x2d/0xc0
[   17.220247]  __driver_attach+0xc9/0x1c0
[   17.220249]  bus_for_each_dev+0x6a/0xb0
[   17.220251]  ? migrate_enable+0xbf/0xf0
[   17.220254]  bus_add_driver+0x139/0x220
[   17.220256]  driver_register+0x6e/0xc0
[   17.220258]  ? __pfx_radeon_module_init+0x10/0x10 [radeon]
[   17.220315]  do_one_initcall+0x42/0x210
[   17.220318]  ? __kmalloc_cache_noprof+0x89/0x230
[   17.220321]  do_init_module+0x60/0x210
[   17.220324]  init_module_from_file+0x89/0xc0
[   17.220326]  __x64_sys_finit_module+0x142/0x390
[   17.220329]  do_syscall_64+0x47/0x110
[   17.220331]  entry_SYSCALL_64_after_hwframe+0x76/0x7e
[   17.220334] RIP: 0033:0x7f59a0625279
[   17.220336] Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 
89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff 
ff 73 01 c3 48 8b 0d 77 6b 0d 00 f7 d8 64 89 01 48
[   17.220337] RSP: 002b:7ffd15ee7df8 EFLAGS: 0246 ORIG_RAX: 
0139
[   17.220339] RAX: ffda RBX: 5578ae660840 RCX: 7f59a0625279
[   17.220340] RDX:  RSI: 5578ae677fc0 RDI: 0011
[   17.220341] RBP:  R08: 7f59a06fcb20 R09: 5578ae640550
[   17.220342] R10: 0040 R11: 0246 R12: 5578ae677fc0
[   17.220342] R13: 0002 R14: 5578ae651750 R15: 
[   17.2

Re: radeon ARUBA NULL pointer dereference

2024-09-24 Thread Thomas Zimmermann

(cc: DMA and x86 folks)

Hi

Am 24.09.24 um 04:08 schrieb Arthur Marsh:

Using current Linus git head kernel, I was able to save the dmesg output:

[   17.218724] [drm] radeon kernel modesetting enabled.
[   17.218778] radeon :00:01.0: vgaarb: deactivate vga console
[   17.219509] Console: switching to colour dummy device 80x25
[   17.219700] [drm] initializing kernel modesetting (ARUBA 0x1002:0x990C 
0x1002:0x0123 0x00).
[   17.219773] ATOM BIOS: 113
[   17.219838] radeon :00:01.0: VRAM: 768M 0x - 
0x2FFF (768M used)
[   17.219841] radeon :00:01.0: GTT: 1024M 0x3000 - 
0x6FFF
[   17.219844] [drm] Detected VRAM RAM=768M, BAR=256M
[   17.219845] [drm] RAM width 64bits DDR
[   17.219851] BUG: kernel NULL pointer dereference, address: 00a0


This is 160 bytes behind NULL, which indicates a field within a struct.


[   17.219852] #PF: supervisor read access in kernel mode
[   17.219853] #PF: error_code(0x) - not-present page
[   17.219854] PGD 0 P4D 0
[   17.219856] Oops: Oops:  [#1] PREEMPT_RT SMP NOPTI
[   17.219858] CPU: 0 UID: 0 PID: 451 Comm: udevd Not tainted 6.11.0+ #6121
[   17.219860] Hardware name: Gigabyte Technology Co., Ltd. To be filled by 
O.E.M./F2A78M-HD2, BIOS F2 05/28/2014
[   17.219862] RIP: 0010:dma_get_required_mask+0x11/0x50
[   17.219868] Code: 0f 1f 84 00 00 00 00 00 90 90 90 90 90 90 90 90 90 90 90 90 90 
90 90 90 90 0f 1f 44 00 00 48 8b 87 68 02 00 00 48 85 c0 74 11 <48> 8b 80 a0 00 
00 00 48 85 c0 74 1f e9 ee ed 94 00 f6 87 2c 03 00
[   17.219870] RSP: 0018:a54bc13a7b00 EFLAGS: 00010202
[   17.219871] RAX:  RBX: 00ff RCX: 
[   17.219872] RDX:  RSI: 0027 RDI: 976f44e720c8
[   17.219873] RBP: 976f44e720c8 R08: efff R09: ab2aab08
[   17.219874] R10: f000 R11: 0002 R12: 
[   17.219875] R13: 976f48a4aa30 R14:  R15: 0028
[   17.219876] FS:  7f59a070d840() GS:97726f80() 
knlGS:
[   17.219878] CS:  0010 DS:  ES:  CR0: 80050033
[   17.219879] CR2: 00a0 CR3: 0001053b4000 CR4: 000406f0
[   17.219880] Call Trace:
[   17.219881]  
[   17.219882]  ? __die_body.cold+0x19/0x1e
[   17.219885]  ? page_fault_oops+0xa8/0x230
[   17.219889]  ? search_module_extables+0x4f/0x90
[   17.219891]  ? fixup_exception+0x36/0x2f0
[   17.219894]  ? exc_page_fault+0x88/0x1b0
[   17.219897]  ? asm_exc_page_fault+0x22/0x30
[   17.219900]  ? dma_get_required_mask+0x11/0x50


This is not in the radeon driver but the DMA code. I'd say it's at [1], 
as get_required_mask is 160 bytes within struct drm_map_ops. The call to 
get_arch_dma_ops() probably returns NULL.


Best regards
Thomas

[1] https://elixir.bootlin.com/linux/v6.11/source/kernel/dma/mapping.c#L523
[2] 
https://elixir.bootlin.com/linux/v6.11/source/include/linux/dma-map-ops.h#L98



[   17.219902]  dma_addressing_limited+0x6c/0xb0
[   17.219905]  radeon_ttm_init+0x3f/0x210 [radeon]
[   17.219977]  cayman_init+0x97/0x290 [radeon]
[   17.220057]  radeon_device_init+0x5e9/0xb40 [radeon]
[   17.220115]  radeon_driver_load_kms+0xb0/0x260 [radeon]
[   17.220174]  radeon_pci_probe+0xff/0x170 [radeon]
[   17.220231]  pci_device_probe+0xbe/0x1a0
[   17.220234]  really_probe+0xde/0x350
[   17.220237]  ? pm_runtime_barrier+0x61/0xb0
[   17.220240]  ? __pfx___driver_attach+0x10/0x10
[   17.220242]  __driver_probe_device+0x78/0x110
[   17.220245]  driver_probe_device+0x2d/0xc0
[   17.220247]  __driver_attach+0xc9/0x1c0
[   17.220249]  bus_for_each_dev+0x6a/0xb0
[   17.220251]  ? migrate_enable+0xbf/0xf0
[   17.220254]  bus_add_driver+0x139/0x220
[   17.220256]  driver_register+0x6e/0xc0
[   17.220258]  ? __pfx_radeon_module_init+0x10/0x10 [radeon]
[   17.220315]  do_one_initcall+0x42/0x210
[   17.220318]  ? __kmalloc_cache_noprof+0x89/0x230
[   17.220321]  do_init_module+0x60/0x210
[   17.220324]  init_module_from_file+0x89/0xc0
[   17.220326]  __x64_sys_finit_module+0x142/0x390
[   17.220329]  do_syscall_64+0x47/0x110
[   17.220331]  entry_SYSCALL_64_after_hwframe+0x76/0x7e
[   17.220334] RIP: 0033:0x7f59a0625279
[   17.220336] Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 
89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff 
ff 73 01 c3 48 8b 0d 77 6b 0d 00 f7 d8 64 89 01 48
[   17.220337] RSP: 002b:7ffd15ee7df8 EFLAGS: 0246 ORIG_RAX: 
0139
[   17.220339] RAX: ffda RBX: 5578ae660840 RCX: 7f59a0625279
[   17.220340] RDX:  RSI: 5578ae677fc0 RDI: 0011
[   17.220341] RBP:  R08: 7f59a06fcb20 R09: 5578ae640550
[   17.220342] R10: 0040 R11: 0246 R12: 5578ae677fc0
[   17.220342] R13: 0002 R14: 5578ae651750 R15: 
[   17.2

[SR-Users] Re: SDP parsing fails when media stream is removed, there is no session-wide "c=" line and offending media stream omits all attributes

2024-09-24 Thread Thomas Baumgartner via sr-users
Hi,

thanks for the follow up!
I don’t think though that this has anything to do with rtpengine since the SDP 
parser is part of the kamailio project and the error specifically occurs in 
„core/parser/sdp/sdp.c:523“. Also the example is unfortunately not the same 
since the „c=“ line is on session level and not on media level.

I read through the RFCs and found two points in different RFCs, and i am not 
sure which takes precedence in this case, that’s mainly why i posted to the 
mailing list rather than opening an issue on the kamailio github:

In RFC8866 5.7:
A session description MUST contain either at least one "c=" line in each media 
description or a single "c=" line at the session level. It MAY contain a single 
session-level "c=" line and additional media-level "c=" line(s) 
per-media-description, in which case the media-level values override the 
session-level settings for the respective media.

Technically the SDP i posted does not conform to this, but then there is 
RFC3264 8.2:
Existing media streams are removed by creating a new SDP with the port number 
for that stream set to zero.  The stream description MAY omit all attributes 
present previously, and MAY list just a single media format.

So which RFC takes precendence? If it’s RFC8866 5.7 then the device is doing 
something wrong, but if it’s RFC3264 8.2 and i understand it correctly so that 
the device can omit even the „c=“ line (… The stream description MAY omit all 
attributes present previously…) then i would argue that kamailio is doing 
something wrong.

Any ideas? Should i open an issue on github?

Mit kommunikativen Grüßen I Best regards

Thomas Baumgartner
VoIP Engineering

[Ein Bild, das Grafiken, Symbol, Logo, Schrift enthält.  Automatisch generierte 
Beschreibung]

Diese Nachricht kann Betriebs- bzw. Geschäftsgeheimnisse oder vertrauliche 
Informationen enthalten und ist ausschließlich für den beabsichtigten Empfänger 
bestimmt. Sollten Sie diese E-Mail irrtümlich erhalten, benachrichtigen Sie uns 
bitte, und löschen Sie diese Mail einschließlich aller angefertigten Kopien.

This message may contain trade secrets or confidential information and is 
intended exclusively for the intended recipient. If you receive this e-mail in 
error, please notify us and delete this e-mail including all copies made.

Von: Sergei Safarov 
Gesendet: Dienstag, 24. September 2024 13:14
An: Kamailio (SER) - Users Mailing List 
Cc: Thomas Baumgartner 
Betreff: Re: [SR-Users] SDP parsing fails when media stream is removed, there 
is no session-wide "c=" line and offending media stream omits all attributes

Please check

https://datatracker.ietf.org/doc/html/rfc7345
You will find example



   v=0

   o=- 4423478999 542492 IN IP4 ua2.example.com

   s=-

   c=IN IP4 ua2.example.com

   t=0 0

   m=audio 0 UDP/TLS/RTP/SAVP 0

   m=image 32000 UDP/TLS/UDPTL t38

   a=setup:active

   a=fingerprint: SHA-1 \

 FF:FF:FF:B1:3F:82:18:3B:54:02:12:DF:3E:5D:49:6B:19:E5:7C:AB

   a=T38FaxRateManagement:transferredTCF



In my opinion, this example equal to your case.

Probable this need to be reported on RTPengine bug tracker.



Sergey Safarov


On Mon, 2024-09-23 at 08:27 +, Thomas Baumgartner via sr-users wrote:
Hi,

we have a problem with a device trying to send T.38 fax. During the T.38 
ReInvite Kamailio fails to parse the SDP (via rtpengine_manage), and 
subsequently rtpengine is failing to do it’s job.
The problem seems to be that Kamailio is trying to find a media address, since 
there is no session-wide c= line present it goes to the media c= lines, but 
since the first media stream which was an audio stream is being removed (port 
0) and can therefore omit all attributes (as per RFC 3264 8.2, or am i 
understanding this wrong?), the Kamailio SDP parser is failing, even if there 
is another c= line in the T.38 media stream.

Here is the offending SDP from the ReInvite (IP changed):

v=0
o=xmserver 1726638425 1726638427 IN IP4 169.254.1.1
s=xmserver
t=0 0
m=audio 0 RTP/AVP 8
m=image 56002 udptl t38
c=IN IP4 169.254.1.1
a=sendrecv
a=T38FaxVersion:0
a=T38MaxBitRate:14400
a=T38FaxFillBitRemoval:0
a=T38FaxTranscodingMMR:0
a=T38FaxTranscodingJBIG:0
a=T38FaxRateManagement:transferredTCF
a=T38FaxMaxBuffer:200
a=T38FaxMaxDatagram:72
a=T38FaxUdpEC:t38UDPRedundancy

And here is the corresponding log entry:
 [core/parser/sdp/sdp.c:523]: parse_sdp_session(): can't find media IP in 
the message

Can anyone confirm my findings? Is it possible to adjust the SDP parser for 
these kind of scenarios?

Mit kommunikativen Grüßen I Best regards

Thomas
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to 
sr-users-le...@lists.kamailio.org<mailto:sr-users-le...@lists.kamailio.org>
Important: keep the mailing list in the recipients, do not reply 

Re: [PATCH v3 30/34] migration: remove return after g_assert_not_reached()

2024-09-24 Thread Thomas Huth

On 19/09/2024 06.46, Pierrick Bouvier wrote:

This patch is part of a series that moves towards a consistent use of
g_assert_not_reached() rather than an ad hoc mix of different
assertion mechanisms.

Signed-off-by: Pierrick Bouvier 
---
  migration/dirtyrate.c| 1 -
  migration/postcopy-ram.c | 7 ---
  migration/ram.c  | 2 --
  3 files changed, 10 deletions(-)


Reviewed-by: Thomas Huth 




Re: [PATCH v3 30/34] migration: remove return after g_assert_not_reached()

2024-09-24 Thread Thomas Huth

On 19/09/2024 06.46, Pierrick Bouvier wrote:

This patch is part of a series that moves towards a consistent use of
g_assert_not_reached() rather than an ad hoc mix of different
assertion mechanisms.

Signed-off-by: Pierrick Bouvier 
---
  migration/dirtyrate.c| 1 -
  migration/postcopy-ram.c | 7 ---
  migration/ram.c  | 2 --
  3 files changed, 10 deletions(-)


Reviewed-by: Thomas Huth 




Re: Elapsed Time incorrect for HTTP/2.0?

2024-09-24 Thread Thomas Meyer


Am 24. September 2024 10:44:46 MESZ schrieb Mark Thomas :
>On 24/09/2024 08:59, Thomas Meyer wrote:
>> Hi,
>> 
>> We see sometimes elapsed time values with over 100 million milliseconds and 
>> status code 500 in the Tomcat logs for HTTP/2.0 connections.
>> 
>> Is that expected or a bug?
>
>Is it just the large elapsed times that are unexpected or are the 500 status 
>codes unexpected as well?

Mhh, now that you mention it, I think I would have expected a 200 return code 
for this request, which actually took 113 seconds what I can see from the logs, 
but the frontend has a timeout of 60 seconds, so the request was probably 
aborted by the frontend.

>
>If the 500s are expected (or at least explainable) it is possible the elapsed 
>time calculation isn't right for some error conditions.
>
>Mark
>
>
>> 
>> I assume this is because of http2 multiplexing maybe?
>> 
>> Tomcat version is 10.1.30
>> 
>> Mfg
>> Thomas
>
>
>-
>To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>For additional commands, e-mail: users-h...@tomcat.apache.org
>

-- 
Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.

[gentoo-commits] repo/gentoo:master commit in: x11-wm/treewm/

2024-09-24 Thread Thomas Raschbacher
commit: 72ed6e3644226a90a7ead5ba123d8169b698132c
Author: Thomas Raschbacher  gentoo  org>
AuthorDate: Tue Sep 24 11:36:45 2024 +
Commit:     Thomas Raschbacher  gentoo  org>
CommitDate: Tue Sep 24 11:38:37 2024 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=72ed6e36

x11-wm/treewm: removed Variable in wrong scope (no revbump since it was not 
even used anyway)

Closes: https://bugs.gentoo.org/836123
Signed-off-by: Thomas Raschbacher  gentoo.org>

 x11-wm/treewm/treewm-0.4.5-r2.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/x11-wm/treewm/treewm-0.4.5-r2.ebuild 
b/x11-wm/treewm/treewm-0.4.5-r2.ebuild
index d6e75741168c..375ab4e49479 100644
--- a/x11-wm/treewm/treewm-0.4.5-r2.ebuild
+++ b/x11-wm/treewm/treewm-0.4.5-r2.ebuild
@@ -38,7 +38,7 @@ src_compile() {
CXX="$(tc-getCXX)" \
CCOPTIONS="${CFLAGS}" \
EXTRA_LDOPTIONS="${LDFLAGS}" \
-   PREFIX="/usr" ROOT="${D}"
+   PREFIX="/usr"
 }
 
 src_install() {



Bug#1082664: RM: python-proboscis -- ROM; became a leaf package, no use

2024-09-24 Thread Thomas Goirand
Package: ftp.debian.org
Severity: normal
User: ftp.debian@packages.debian.org
Usertags: remove
X-Debbugs-Cc: python-probos...@packages.debian.org
Control: affects -1 + src:python-proboscis

Hi,

This package used to be a (build?) depends of openstack-trove. That's not
the case anymore, so we don't need it. Let's remove it.

Cheers,

Thomas Goirand (zigo)



Re: [RFC PATCH 05/28] drm/gpusvm: Add support for GPU Shared Virtual Memory

2024-09-24 Thread Thomas Hellström
Hi, Matt,

Some random review comments on this patch I came across while looking
at multi-device.

Thanks,
Thomas


On Tue, 2024-08-27 at 19:48 -0700, Matthew Brost wrote:
> This patch introduces support for GPU Shared Virtual Memory (SVM) in
> the
> Direct Rendering Manager (DRM) subsystem. SVM allows for seamless
> sharing of memory between the CPU and GPU, enhancing performance and
> flexibility in GPU computing tasks.
> 
> The patch adds the necessary infrastructure for SVM, including data
> structures and functions for managing SVM ranges and notifiers. It
> also
> provides mechanisms for allocating, deallocating, and migrating
> memory
> regions between system RAM and GPU VRAM.
> 
> This mid-layer is largely inspired by GPUVM.

NIT: Naming, Should it be drm_svm rather than drm_gpusvm? For the
drm_gpuvm component, gpuvm clearly distinguished a gpu_vm from a
mm_struct but here we don't have the same need.

> 
> Cc: Dave Airlie 
> Cc: Thomas Hellström 
> Cc: Christian König 
> Cc: 
> Signed-off-by: Matthew Brost 
> ---
>  drivers/gpu/drm/xe/Makefile |    3 +-
>  drivers/gpu/drm/xe/drm_gpusvm.c | 2174
> +++
>  drivers/gpu/drm/xe/drm_gpusvm.h |  415 ++
>  3 files changed, 2591 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/gpu/drm/xe/drm_gpusvm.c
>  create mode 100644 drivers/gpu/drm/xe/drm_gpusvm.h
> 
> diff --git a/drivers/gpu/drm/xe/Makefile
> b/drivers/gpu/drm/xe/Makefile
> index b9670ae09a9e..b8fc2ee58f1a 100644
> --- a/drivers/gpu/drm/xe/Makefile
> +++ b/drivers/gpu/drm/xe/Makefile
> @@ -25,7 +25,8 @@ $(obj)/generated/%_wa_oob.c
> $(obj)/generated/%_wa_oob.h: $(obj)/xe_gen_wa_oob \
>  
>  # core driver code
>  
> -xe-y += xe_bb.o \
> +xe-y += drm_gpusvm.o \
> + xe_bb.o \
>   xe_bo.o \
>   xe_bo_evict.o \
>   xe_devcoredump.o \
> diff --git a/drivers/gpu/drm/xe/drm_gpusvm.c
> b/drivers/gpu/drm/xe/drm_gpusvm.c
> new file mode 100644
> index ..fc1e44e6ae72
> --- /dev/null
> +++ b/drivers/gpu/drm/xe/drm_gpusvm.c
> @@ -0,0 +1,2174 @@
> +// SPDX-License-Identifier: MIT
> +/*
> + * Copyright © 2024 Intel Corporation
> + *
> + * Authors:
> + * Matthew Brost 
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include "drm_gpusvm.h"
> +
> +/**
> + * DOC: Overview
> + *
> + * GPU Shared Virtual Memory (GPU SVM) layer for the Direct
> Rendering Manager (DRM)
> + *
> + * The GPU SVM layer is a component of the DRM framework designed to
> manage shared
> + * virtual memory between the CPU and GPU. It enables efficient data
> exchange and
> + * processing for GPU-accelerated applications by allowing memory
> sharing and
> + * synchronization between the CPU's and GPU's virtual address
> spaces.
> + *
> + * Key GPU SVM Components:
> + * - Notifiers: Notifiers: Used for tracking memory intervals and
> notifying the
> + *   GPU of changes, notifiers are sized based on a GPU
> SVM
> + *   initialization parameter, with a recommendation of
> 512M or
> + *   larger. They maintain a Red-BlacK tree and a list of
> ranges that
> + *   fall within the notifier interval. Notifiers are
> tracked within
> + *   a GPU SVM Red-BlacK tree and list and are
> dynamically inserted
> + *   or removed as ranges within the interval are created
> or
> + *   destroyed.
> + * - Ranges: Represent memory ranges mapped in a DRM device and
> managed
> + *    by GPU SVM. They are sized based on an array of chunk
> sizes, which
> + *    is a GPU SVM initialization parameter, and the CPU
> address space.
> + *    Upon GPU fault, the largest aligned chunk that fits
> within the
> + *    faulting CPU address space is chosen for the range
> size. Ranges are
> + *    expected to be dynamically allocated on GPU fault and
> removed on an
> + *    MMU notifier UNMAP event. As mentioned above, ranges
> are tracked in
> + *    a notifier's Red-Black tree.
> + * - Operations: Define the interface for driver-specific SVM
> operations such as
> + *allocation, page collection, migration,
> invalidations, and VRAM
> + *release.
> + *
> + * This layer provides interfaces for allocating, mapping,
> migrating, and
> + * releasing memory ranges between the CPU and GPU. It handles all
> core memory
> + * management interactions (DMA mapping, HMM, and migration) and
> provides
> + * driver-specific virtual functions (vfuncs). This infrastructure
> is sufficient
> + * to bu

Bug#1082661: Cannot import under Python 3.13

2024-09-24 Thread Thomas Goirand
Source: python-greenlet
Version: 2.0.2-1
Severity: important

Very simple test shows what I wrote in $subject:

root@Infomaniak-sid-test>_ ~ # python3.12
Python 3.12.6 (main, Sep  7 2024, 14:20:15) [GCC 14.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import greenlet
>>> 
root@Infomaniak-sid-test>_ ~ # python3.13
Python 3.13.0rc2 (main, Sep  7 2024, 08:52:38) [GCC 14.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import greenlet
Traceback (most recent call last):
  File "", line 1, in 
import greenlet
  File "/usr/lib/python3/dist-packages/greenlet/__init__.py", line 29, in 

from ._greenlet import _C_API # pylint:disable=no-name-in-module
^^^^^
ModuleNotFoundError: No module named 'greenlet._greenlet'

I have no clue (yet) how to fix though...

Cheers,

Thomas Goirand (zigo)



Re: tomcat startup error, IBM DB2 related (database)

2024-09-24 Thread Mark Thomas

On 24/09/2024 08:58, Michael Lau wrote:


here's a clip of the error from the cmd window of my friend:

0-Sep-2024 13:51:51.584 INFO [Timer-0]
org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading
Illegal access: this web application instance has been stopped already.
Could not load [com/ibm/db2/jcc/DB2JccConfiguration.properties]. The
following stack trace is thrown for debugging purposes as well as to
attempt to terminate the thread which caused the illegal access.

 java.lang.IllegalStateException: Illegal access: this web
application instance has been stopped already. Could not load
[com/ibm/db2/jcc/DB2JccConfiguration.properties]. The following stack trace
is thrown for debugging purposes as well as to attempt to terminate the
thread which caused the illegal access.


That is an error triggered when stopping the web application.

I suggest the following.

Stop the Tomcat instance.
Clear the logs directory (move the files somewhere else so you have a 
copy if you need them).

Start the Tomcat instance.
Look for errors in the logs. Start at the beginning. Fix the first error 
that occurs and then repeat this process.


The first error usually triggers multiple further errors. If you don't 
fix the first error first you will waste a huge amount of time fixing 
symptoms rather than the root cause.


Mark

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Elapsed Time incorrect for HTTP/2.0?

2024-09-24 Thread Mark Thomas

On 24/09/2024 08:59, Thomas Meyer wrote:

Hi,

We see sometimes elapsed time values with over 100 million milliseconds and 
status code 500 in the Tomcat logs for HTTP/2.0 connections.

Is that expected or a bug?


Is it just the large elapsed times that are unexpected or are the 500 
status codes unexpected as well?


If the 500s are expected (or at least explainable) it is possible the 
elapsed time calculation isn't right for some error conditions.


Mark




I assume this is because of http2 multiplexing maybe?

Tomcat version is 10.1.30

Mfg
Thomas



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



[PATCH] firmware/sysfb: Disable sysfb for firmware buffers with unknown parent

2024-09-24 Thread Thomas Zimmermann
The sysfb framebuffer handling only operates on graphics devices
that provide the system's firmware framebuffer. If that device is
not known, assume that any graphics device has been initialized by
firmware.

Fixes a problem on i915 where sysfb does not release the firmware
framebuffer after the native graphics driver loaded.

Reported-by: Borah, Chaitanya Kumar 
Closes: 
https://lore.kernel.org/dri-devel/sj1pr11mb6129efb8ce63d1ef6d932f94b9...@sj1pr11mb6129.namprd11.prod.outlook.com/
Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12160
Signed-off-by: Thomas Zimmermann 
Fixes: b49420d6a1ae ("video/aperture: optionally match the device in 
sysfb_disable()")
Cc: Javier Martinez Canillas 
Cc: Thomas Zimmermann 
Cc: Helge Deller 
Cc: Sam Ravnborg 
Cc: Daniel Vetter 
Cc: Alex Deucher 
Cc: dri-devel@lists.freedesktop.org
Cc: Linux regression tracking (Thorsten Leemhuis) 
Cc:  # v6.11+
---
 drivers/firmware/sysfb.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/sysfb.c b/drivers/firmware/sysfb.c
index 02a07d3d0d40..a3df782fa687 100644
--- a/drivers/firmware/sysfb.c
+++ b/drivers/firmware/sysfb.c
@@ -67,9 +67,11 @@ static bool sysfb_unregister(void)
 void sysfb_disable(struct device *dev)
 {
struct screen_info *si = &screen_info;
+   struct device *parent;
 
mutex_lock(&disable_lock);
-   if (!dev || dev == sysfb_parent_dev(si)) {
+   parent = sysfb_parent_dev(si);
+   if (!dev || !parent || dev == parent) {
sysfb_unregister();
disabled = true;
}
-- 
2.46.0



Re: [pve-devel] [RFC firewall/proxmox{-ve-rs, -firewall, -perl-rs} 00/21] autogenerate ipsets for sdn objects

2024-09-24 Thread Thomas Lamprecht
Am 26/06/2024 um 14:15 schrieb Stefan Hanreich:
> The current series generates all those ipsets in the datacenter scope. My
> initial approach was to introduce an separate scope (sdn/), but I changed my
> mind during the development because that would require non-trivial changes in
> pve-firewall, which is something I wanted to avoid. With this approach we just
> pass a flag to the cluster config loading wherever we need the SDN config - we
> get everything else (rule validation, API output, rule generation) for 'free'
> basically.
> 
> Otherwise, the other way I see would need to introduce a completely new
> parameter into all function calls, or at least a new key in the dc config. All
> call sites would need privileges, due to the IPAM being in /etc/pve/priv. We
> would need to parse the SDN configuration everywhere we need the cluster
> configuration, since otherwise we wouldn't be able to parse / validate the
> cluster configuration and then generate rules.
> 
> I'm still unsure whether the upside of having a separate scope is worth the
> effort, so any input w.r.t this topic is much appreciated. Introducing a new
> scope and then adapting the firewall is something I wanted to get some 
> feedback
> on before diving into it, which is why I've refrained from doing it for now.

I'd prefer a separate scope to avoid potential clashes of IDs on upgrade and
to continue with the scope split we did for cluster-level ("dc" scope) and 
virtual
guest-level ("guest" scope) IPsets back from PVE 7 to 8, so while one _might_
see the SDN ones as fitting into the "dc" scope, a separate SDN scope is IMO
a bit nicer w.r.t. separating the origin.

I'd be good to know what the problems where when introducing that new sdn scope,
maybe there's a simpler workaround/design.


___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel



[PATCH v5 42/80] drm/tilcdc: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup_with_color_mode() to run the kernel's default
client setup for DRM. Set fbdev_probe in struct drm_driver, so that
the client setup can start the common fbdev client.

v5:
- select DRM_CLIENT_SELECTION
v3:
- add DRM_FBDEV_DMA_DRIVER_OPS macro

Signed-off-by: Thomas Zimmermann 
Cc: Jyri Sarha 
Cc: Tomi Valkeinen 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/tilcdc/Kconfig  | 1 +
 drivers/gpu/drm/tilcdc/tilcdc_drv.c | 5 -
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tilcdc/Kconfig b/drivers/gpu/drm/tilcdc/Kconfig
index d3bd2d7a181e..24f9a245ba59 100644
--- a/drivers/gpu/drm/tilcdc/Kconfig
+++ b/drivers/gpu/drm/tilcdc/Kconfig
@@ -2,6 +2,7 @@
 config DRM_TILCDC
tristate "DRM Support for TI LCDC Display Controller"
depends on DRM && OF && ARM
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_GEM_DMA_HELPER
select DRM_BRIDGE
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c 
b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index cd5eefa06060..8c9f3705aa6c 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -14,6 +14,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -374,7 +375,8 @@ static int tilcdc_init(const struct drm_driver *ddrv, 
struct device *dev)
goto init_failed;
priv->is_registered = true;
 
-   drm_fbdev_dma_setup(ddev, bpp);
+   drm_client_setup_with_color_mode(ddev, bpp);
+
return 0;
 
 init_failed:
@@ -472,6 +474,7 @@ DEFINE_DRM_GEM_DMA_FOPS(fops);
 static const struct drm_driver tilcdc_driver = {
.driver_features= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
DRM_GEM_DMA_DRIVER_OPS,
+   DRM_FBDEV_DMA_DRIVER_OPS,
 #ifdef CONFIG_DEBUG_FS
.debugfs_init   = tilcdc_debugfs_init,
 #endif
-- 
2.46.0



[PATCH v5 60/80] drm/udl: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Cc: Dave Airlie 
Cc: Sean Paul 
Cc: Thomas Zimmermann 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/udl/Kconfig   | 1 +
 drivers/gpu/drm/udl/udl_drv.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/udl/Kconfig b/drivers/gpu/drm/udl/Kconfig
index c744175c6992..d7a6abef7d78 100644
--- a/drivers/gpu/drm/udl/Kconfig
+++ b/drivers/gpu/drm/udl/Kconfig
@@ -5,6 +5,7 @@ config DRM_UDL
depends on USB
depends on USB_ARCH_HAS_HCD
depends on MMU
+   select DRM_CLIENT_SELECTION
select DRM_GEM_SHMEM_HELPER
select DRM_KMS_HELPER
help
diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c
index 280a09a6e2ad..8d8ae40f945c 100644
--- a/drivers/gpu/drm/udl/udl_drv.c
+++ b/drivers/gpu/drm/udl/udl_drv.c
@@ -6,6 +6,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -73,6 +74,7 @@ static const struct drm_driver driver = {
.fops = &udl_driver_fops,
DRM_GEM_SHMEM_DRIVER_OPS,
.gem_prime_import = udl_driver_gem_prime_import,
+   DRM_FBDEV_SHMEM_DRIVER_OPS,
 
.name = DRIVER_NAME,
.desc = DRIVER_DESC,
@@ -117,7 +119,7 @@ static int udl_usb_probe(struct usb_interface *interface,
 
DRM_INFO("Initialized udl on minor %d\n", udl->drm.primary->index);
 
-   drm_fbdev_shmem_setup(&udl->drm, 0);
+   drm_client_setup(&udl->drm, NULL);
 
return 0;
 }
-- 
2.46.0



[PATCH v5 41/80] drm/tidss: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

The tidss driver specifies a preferred color mode of 32. As this
is the default if no format has been given, leave it out entirely.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Cc: Jyri Sarha 
Cc: Tomi Valkeinen 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/tidss/Kconfig | 1 +
 drivers/gpu/drm/tidss/tidss_drv.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tidss/Kconfig b/drivers/gpu/drm/tidss/Kconfig
index 2385c56493b9..31ad582b7602 100644
--- a/drivers/gpu/drm/tidss/Kconfig
+++ b/drivers/gpu/drm/tidss/Kconfig
@@ -2,6 +2,7 @@ config DRM_TIDSS
tristate "DRM Support for TI Keystone"
depends on DRM && OF
depends on ARM || ARM64 || COMPILE_TEST
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_DISPLAY_HELPER
select DRM_BRIDGE_CONNECTOR
diff --git a/drivers/gpu/drm/tidss/tidss_drv.c 
b/drivers/gpu/drm/tidss/tidss_drv.c
index d15f836dca95..2428b9aaa003 100644
--- a/drivers/gpu/drm/tidss/tidss_drv.c
+++ b/drivers/gpu/drm/tidss/tidss_drv.c
@@ -11,6 +11,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -109,6 +110,7 @@ static const struct drm_driver tidss_driver = {
.fops   = &tidss_fops,
.release= tidss_release,
DRM_GEM_DMA_DRIVER_OPS_VMAP,
+   DRM_FBDEV_DMA_DRIVER_OPS,
.name   = "tidss",
.desc   = "TI Keystone DSS",
.date   = "20180215",
@@ -186,7 +188,7 @@ static int tidss_probe(struct platform_device *pdev)
goto err_irq_uninstall;
}
 
-   drm_fbdev_dma_setup(ddev, 32);
+   drm_client_setup(ddev, NULL);
 
dev_dbg(dev, "%s done\n", __func__);
 
-- 
2.46.0



[PATCH v5 67/80] drm/loongson: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

The loongson driver specifies a preferred color mode of 32. As this
is the default if no format has been given, leave it out entirely.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Cc: Sui Jingfeng 
Acked-by: Sui Jingfeng 
---
 drivers/gpu/drm/loongson/Kconfig| 1 +
 drivers/gpu/drm/loongson/lsdc_drv.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/loongson/Kconfig b/drivers/gpu/drm/loongson/Kconfig
index 9ed463a76ae2..552edfec7afb 100644
--- a/drivers/gpu/drm/loongson/Kconfig
+++ b/drivers/gpu/drm/loongson/Kconfig
@@ -4,6 +4,7 @@ config DRM_LOONGSON
tristate "DRM support for Loongson Graphics"
depends on DRM && PCI && MMU
depends on LOONGARCH || MIPS || COMPILE_TEST
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_TTM
select DRM_TTM_HELPER
diff --git a/drivers/gpu/drm/loongson/lsdc_drv.c 
b/drivers/gpu/drm/loongson/lsdc_drv.c
index adc7344d2f80..a19dce35c839 100644
--- a/drivers/gpu/drm/loongson/lsdc_drv.c
+++ b/drivers/gpu/drm/loongson/lsdc_drv.c
@@ -9,6 +9,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -47,6 +48,7 @@ static const struct drm_driver lsdc_drm_driver = {
.dumb_create = lsdc_dumb_create,
.dumb_map_offset = lsdc_dumb_map_offset,
.gem_prime_import_sg_table = lsdc_prime_import_sg_table,
+   DRM_FBDEV_TTM_DRIVER_OPS,
 };
 
 static const struct drm_mode_config_funcs lsdc_mode_config_funcs = {
@@ -314,7 +316,7 @@ static int lsdc_pci_probe(struct pci_dev *pdev, const 
struct pci_device_id *ent)
if (ret)
return ret;
 
-   drm_fbdev_ttm_setup(ddev, 32);
+   drm_client_setup(ddev, NULL);
 
return 0;
 }
-- 
2.46.0



[PATCH v5 10/80] drm/aspeed: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

The aspeed driver specifies a preferred color mode of 32. As this
is the default if no format has been given, leave it out entirely.

v5:
- select DRM_CLIENT_SELECTION
v3:
- add DRM_FBDEV_DMA_DRIVER_OPS macro

Signed-off-by: Thomas Zimmermann 
Cc: Joel Stanley 
Cc: Andrew Jeffery 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/aspeed/Kconfig  | 1 +
 drivers/gpu/drm/aspeed/aspeed_gfx_drv.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/aspeed/Kconfig b/drivers/gpu/drm/aspeed/Kconfig
index 8137c39b057b..6e68f20aac21 100644
--- a/drivers/gpu/drm/aspeed/Kconfig
+++ b/drivers/gpu/drm/aspeed/Kconfig
@@ -4,6 +4,7 @@ config DRM_ASPEED_GFX
depends on DRM && OF
depends on (COMPILE_TEST || ARCH_ASPEED)
depends on MMU
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_GEM_DMA_HELPER
select DMA_CMA if HAVE_DMA_CONTIGUOUS
diff --git a/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c 
b/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
index a7a6b70220eb..109023815fa2 100644
--- a/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
+++ b/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
@@ -14,6 +14,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -247,6 +248,7 @@ DEFINE_DRM_GEM_DMA_FOPS(fops);
 static const struct drm_driver aspeed_gfx_driver = {
.driver_features= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
DRM_GEM_DMA_DRIVER_OPS,
+   DRM_FBDEV_DMA_DRIVER_OPS,
.fops = &fops,
.name = "aspeed-gfx-drm",
.desc = "ASPEED GFX DRM",
@@ -339,7 +341,7 @@ static int aspeed_gfx_probe(struct platform_device *pdev)
if (ret)
goto err_unload;
 
-   drm_fbdev_dma_setup(&priv->drm, 32);
+   drm_client_setup(&priv->drm, NULL);
return 0;
 
 err_unload:
-- 
2.46.0



[PATCH v5 30/80] drm/mxsfb: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

The mxsfb driver specifies a preferred color mode of 32. As this
is the default if no format has been given, leave it out entirely.

v5:
- select DRM_CLIENT_SELECTION
v3:
- fix driver name "msxfb" to "mxsfb"

Signed-off-by: Thomas Zimmermann 
Cc: Marek Vasut 
Cc: Stefan Agner 
Cc: Shawn Guo 
Cc: Sascha Hauer 
Cc: Pengutronix Kernel Team 
Cc: Fabio Estevam 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/mxsfb/Kconfig | 1 +
 drivers/gpu/drm/mxsfb/mxsfb_drv.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mxsfb/Kconfig b/drivers/gpu/drm/mxsfb/Kconfig
index ac368c20a0fe..264e74f45554 100644
--- a/drivers/gpu/drm/mxsfb/Kconfig
+++ b/drivers/gpu/drm/mxsfb/Kconfig
@@ -9,6 +9,7 @@ config DRM_MXSFB
depends on DRM && OF
depends on COMMON_CLK
depends on ARCH_MXS || ARCH_MXC || COMPILE_TEST
+   select DRM_CLIENT_SELECTION
select DRM_MXS
select DRM_KMS_HELPER
select DRM_GEM_DMA_HELPER
diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c 
b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
index cb5ce4e81fc7..34a98717b72c 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
@@ -19,6 +19,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -331,6 +332,7 @@ DEFINE_DRM_GEM_DMA_FOPS(fops);
 static const struct drm_driver mxsfb_driver = {
.driver_features= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
DRM_GEM_DMA_DRIVER_OPS,
+   DRM_FBDEV_DMA_DRIVER_OPS,
.fops   = &fops,
.name   = "mxsfb-drm",
.desc   = "MXSFB Controller DRM",
@@ -364,7 +366,7 @@ static int mxsfb_probe(struct platform_device *pdev)
if (ret)
goto err_unload;
 
-   drm_fbdev_dma_setup(drm, 32);
+   drm_client_setup(drm, NULL);
 
return 0;
 
-- 
2.46.0



[PATCH v5 05/80] drm/fbdev-dma: Support struct drm_driver.fbdev_probe

2024-09-24 Thread Thomas Zimmermann
Rework fbdev probing to support fbdev_probe in struct drm_driver
and reimplement the old fb_probe callback on top of it. Provide an
initializer macro for struct drm_driver that sets the callback
according to the kernel configuration.

This change allows the common fbdev client to run on top of DMA-
based DRM drivers.

Signed-off-by: Thomas Zimmermann 
Reviewed-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/drm_fbdev_dma.c | 60 -
 include/drm/drm_fbdev_dma.h | 12 +++
 2 files changed, 48 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/drm_fbdev_dma.c b/drivers/gpu/drm/drm_fbdev_dma.c
index b0602c4f3628..9ce754ebe18e 100644
--- a/drivers/gpu/drm/drm_fbdev_dma.c
+++ b/drivers/gpu/drm/drm_fbdev_dma.c
@@ -104,6 +104,40 @@ static const struct fb_ops drm_fbdev_dma_deferred_fb_ops = 
{
 
 static int drm_fbdev_dma_helper_fb_probe(struct drm_fb_helper *fb_helper,
 struct drm_fb_helper_surface_size 
*sizes)
+{
+   return drm_fbdev_dma_driver_fbdev_probe(fb_helper, sizes);
+}
+
+static int drm_fbdev_dma_helper_fb_dirty(struct drm_fb_helper *helper,
+struct drm_clip_rect *clip)
+{
+   struct drm_device *dev = helper->dev;
+   int ret;
+
+   /* Call damage handlers only if necessary */
+   if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2))
+   return 0;
+
+   if (helper->fb->funcs->dirty) {
+   ret = helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 1);
+   if (drm_WARN_ONCE(dev, ret, "Dirty helper failed: ret=%d\n", 
ret))
+   return ret;
+   }
+
+   return 0;
+}
+
+static const struct drm_fb_helper_funcs drm_fbdev_dma_helper_funcs = {
+   .fb_probe = drm_fbdev_dma_helper_fb_probe,
+   .fb_dirty = drm_fbdev_dma_helper_fb_dirty,
+};
+
+/*
+ * struct drm_fb_helper
+ */
+
+int drm_fbdev_dma_driver_fbdev_probe(struct drm_fb_helper *fb_helper,
+struct drm_fb_helper_surface_size *sizes)
 {
struct drm_client_dev *client = &fb_helper->client;
struct drm_device *dev = fb_helper->dev;
@@ -147,6 +181,7 @@ static int drm_fbdev_dma_helper_fb_probe(struct 
drm_fb_helper *fb_helper,
goto err_drm_client_buffer_delete;
}
 
+   fb_helper->funcs = &drm_fbdev_dma_helper_funcs;
fb_helper->buffer = buffer;
fb_helper->fb = fb;
 
@@ -210,30 +245,7 @@ static int drm_fbdev_dma_helper_fb_probe(struct 
drm_fb_helper *fb_helper,
drm_client_framebuffer_delete(buffer);
return ret;
 }
-
-static int drm_fbdev_dma_helper_fb_dirty(struct drm_fb_helper *helper,
-struct drm_clip_rect *clip)
-{
-   struct drm_device *dev = helper->dev;
-   int ret;
-
-   /* Call damage handlers only if necessary */
-   if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2))
-   return 0;
-
-   if (helper->fb->funcs->dirty) {
-   ret = helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 1);
-   if (drm_WARN_ONCE(dev, ret, "Dirty helper failed: ret=%d\n", 
ret))
-   return ret;
-   }
-
-   return 0;
-}
-
-static const struct drm_fb_helper_funcs drm_fbdev_dma_helper_funcs = {
-   .fb_probe = drm_fbdev_dma_helper_fb_probe,
-   .fb_dirty = drm_fbdev_dma_helper_fb_dirty,
-};
+EXPORT_SYMBOL(drm_fbdev_dma_driver_fbdev_probe);
 
 /*
  * struct drm_client_funcs
diff --git a/include/drm/drm_fbdev_dma.h b/include/drm/drm_fbdev_dma.h
index 2da7ee784133..6ae4de46497c 100644
--- a/include/drm/drm_fbdev_dma.h
+++ b/include/drm/drm_fbdev_dma.h
@@ -4,12 +4,24 @@
 #define DRM_FBDEV_DMA_H
 
 struct drm_device;
+struct drm_fb_helper;
+struct drm_fb_helper_surface_size;
 
 #ifdef CONFIG_DRM_FBDEV_EMULATION
+int drm_fbdev_dma_driver_fbdev_probe(struct drm_fb_helper *fb_helper,
+struct drm_fb_helper_surface_size *sizes);
+
+#define DRM_FBDEV_DMA_DRIVER_OPS \
+   .fbdev_probe = drm_fbdev_dma_driver_fbdev_probe
+
 void drm_fbdev_dma_setup(struct drm_device *dev, unsigned int preferred_bpp);
 #else
 static inline void drm_fbdev_dma_setup(struct drm_device *dev, unsigned int 
preferred_bpp)
 { }
+
+#define DRM_FBDEV_DMA_DRIVER_OPS \
+   .fbdev_probe = NULL
+
 #endif
 
 #endif
-- 
2.46.0



[PATCH v5 33/80] drm/renesas/rcar-du: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

The rcar-du driver specifies a preferred color mode of 32. As this
is the default if no format has been given, leave it out entirely.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Cc: Laurent Pinchart 
Cc: Kieran Bingham 
Reviewed-by: Laurent Pinchart 
---
 drivers/gpu/drm/renesas/rcar-du/Kconfig   | 1 +
 drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/renesas/rcar-du/Kconfig 
b/drivers/gpu/drm/renesas/rcar-du/Kconfig
index e1f41468a9a6..840305fdeb49 100644
--- a/drivers/gpu/drm/renesas/rcar-du/Kconfig
+++ b/drivers/gpu/drm/renesas/rcar-du/Kconfig
@@ -4,6 +4,7 @@ config DRM_RCAR_DU
depends on DRM && OF
depends on ARM || ARM64 || COMPILE_TEST
depends on ARCH_RENESAS || COMPILE_TEST
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_DISPLAY_HELPER
select DRM_BRIDGE_CONNECTOR
diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.c 
b/drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.c
index fb719d9aff10..4e0bafc86f50 100644
--- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.c
@@ -19,6 +19,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -606,6 +607,7 @@ static const struct drm_driver rcar_du_driver = {
.driver_features= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
.dumb_create= rcar_du_dumb_create,
.gem_prime_import_sg_table = rcar_du_gem_prime_import_sg_table,
+   DRM_FBDEV_DMA_DRIVER_OPS,
.fops   = &rcar_du_fops,
.name   = "rcar-du",
.desc   = "Renesas R-Car Display Unit",
@@ -716,7 +718,7 @@ static int rcar_du_probe(struct platform_device *pdev)
 
drm_info(&rcdu->ddev, "Device %s probed\n", dev_name(&pdev->dev));
 
-   drm_fbdev_dma_setup(&rcdu->ddev, 32);
+   drm_client_setup(&rcdu->ddev, NULL);
 
return 0;
 
-- 
2.46.0



[PATCH v5 49/80] drm/fbdev-shmem: Support struct drm_driver.fbdev_probe

2024-09-24 Thread Thomas Zimmermann
Rework fbdev probing to support fbdev_probe in struct drm_driver
and reimplement the old fb_probe callback on top of it. Provide an
initializer macro for struct drm_driver that sets the callback
according to the kernel configuration.

This change allows the common fbdev client to run on top of SHMEM-
based DRM drivers.

Signed-off-by: Thomas Zimmermann 
Reviewed-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/drm_fbdev_shmem.c | 60 ++-
 include/drm/drm_fbdev_shmem.h | 11 ++
 2 files changed, 47 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/drm_fbdev_shmem.c 
b/drivers/gpu/drm/drm_fbdev_shmem.c
index 0c785007f11b..3bca333917d1 100644
--- a/drivers/gpu/drm/drm_fbdev_shmem.c
+++ b/drivers/gpu/drm/drm_fbdev_shmem.c
@@ -107,6 +107,40 @@ static struct page *drm_fbdev_shmem_get_page(struct 
fb_info *info, unsigned long
 
 static int drm_fbdev_shmem_helper_fb_probe(struct drm_fb_helper *fb_helper,
   struct drm_fb_helper_surface_size 
*sizes)
+{
+   return drm_fbdev_shmem_driver_fbdev_probe(fb_helper, sizes);
+}
+
+static int drm_fbdev_shmem_helper_fb_dirty(struct drm_fb_helper *helper,
+  struct drm_clip_rect *clip)
+{
+   struct drm_device *dev = helper->dev;
+   int ret;
+
+   /* Call damage handlers only if necessary */
+   if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2))
+   return 0;
+
+   if (helper->fb->funcs->dirty) {
+   ret = helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 1);
+   if (drm_WARN_ONCE(dev, ret, "Dirty helper failed: ret=%d\n", 
ret))
+   return ret;
+   }
+
+   return 0;
+}
+
+static const struct drm_fb_helper_funcs drm_fbdev_shmem_helper_funcs = {
+   .fb_probe = drm_fbdev_shmem_helper_fb_probe,
+   .fb_dirty = drm_fbdev_shmem_helper_fb_dirty,
+};
+
+/*
+ * struct drm_driver
+ */
+
+int drm_fbdev_shmem_driver_fbdev_probe(struct drm_fb_helper *fb_helper,
+  struct drm_fb_helper_surface_size *sizes)
 {
struct drm_client_dev *client = &fb_helper->client;
struct drm_device *dev = fb_helper->dev;
@@ -139,6 +173,7 @@ static int drm_fbdev_shmem_helper_fb_probe(struct 
drm_fb_helper *fb_helper,
goto err_drm_client_buffer_delete;
}
 
+   fb_helper->funcs = &drm_fbdev_shmem_helper_funcs;
fb_helper->buffer = buffer;
fb_helper->fb = fb;
 
@@ -182,30 +217,7 @@ static int drm_fbdev_shmem_helper_fb_probe(struct 
drm_fb_helper *fb_helper,
drm_client_framebuffer_delete(buffer);
return ret;
 }
-
-static int drm_fbdev_shmem_helper_fb_dirty(struct drm_fb_helper *helper,
-  struct drm_clip_rect *clip)
-{
-   struct drm_device *dev = helper->dev;
-   int ret;
-
-   /* Call damage handlers only if necessary */
-   if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2))
-   return 0;
-
-   if (helper->fb->funcs->dirty) {
-   ret = helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 1);
-   if (drm_WARN_ONCE(dev, ret, "Dirty helper failed: ret=%d\n", 
ret))
-   return ret;
-   }
-
-   return 0;
-}
-
-static const struct drm_fb_helper_funcs drm_fbdev_shmem_helper_funcs = {
-   .fb_probe = drm_fbdev_shmem_helper_fb_probe,
-   .fb_dirty = drm_fbdev_shmem_helper_fb_dirty,
-};
+EXPORT_SYMBOL(drm_fbdev_shmem_driver_fbdev_probe);
 
 /*
  * struct drm_client_funcs
diff --git a/include/drm/drm_fbdev_shmem.h b/include/drm/drm_fbdev_shmem.h
index fb43cadd1950..3a5d1efa9d55 100644
--- a/include/drm/drm_fbdev_shmem.h
+++ b/include/drm/drm_fbdev_shmem.h
@@ -4,12 +4,23 @@
 #define DRM_FBDEV_SHMEM_H
 
 struct drm_device;
+struct drm_fb_helper;
+struct drm_fb_helper_surface_size;
 
 #ifdef CONFIG_DRM_FBDEV_EMULATION
+int drm_fbdev_shmem_driver_fbdev_probe(struct drm_fb_helper *fb_helper,
+  struct drm_fb_helper_surface_size 
*sizes);
+
+#define DRM_FBDEV_SHMEM_DRIVER_OPS \
+   .fbdev_probe = drm_fbdev_shmem_driver_fbdev_probe
+
 void drm_fbdev_shmem_setup(struct drm_device *dev, unsigned int preferred_bpp);
 #else
 static inline void drm_fbdev_shmem_setup(struct drm_device *dev, unsigned int 
preferred_bpp)
 { }
+
+#define DRM_FBDEV_SHMEM_DRIVER_OPS \
+   .fbdev_probe = NULL
 #endif
 
 #endif
-- 
2.46.0



[PATCH v5 70/80] drm/vboxvideo: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

The vboxvideo driver specifies a preferred color mode of 32. As this
is the default if no format has been given, leave it out entirely.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Cc: Hans de Goede 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/vboxvideo/Kconfig| 1 +
 drivers/gpu/drm/vboxvideo/vbox_drv.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vboxvideo/Kconfig 
b/drivers/gpu/drm/vboxvideo/Kconfig
index 45fe135d6e43..180e30b82ab9 100644
--- a/drivers/gpu/drm/vboxvideo/Kconfig
+++ b/drivers/gpu/drm/vboxvideo/Kconfig
@@ -2,6 +2,7 @@
 config DRM_VBOXVIDEO
tristate "Virtual Box Graphics Card"
depends on DRM && X86 && PCI
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_VRAM_HELPER
select DRM_TTM
diff --git a/drivers/gpu/drm/vboxvideo/vbox_drv.c 
b/drivers/gpu/drm/vboxvideo/vbox_drv.c
index ef36834c8673..49dc337b3e01 100644
--- a/drivers/gpu/drm/vboxvideo/vbox_drv.c
+++ b/drivers/gpu/drm/vboxvideo/vbox_drv.c
@@ -13,6 +13,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -80,7 +81,7 @@ static int vbox_pci_probe(struct pci_dev *pdev, const struct 
pci_device_id *ent)
if (ret)
goto err_irq_fini;
 
-   drm_fbdev_ttm_setup(&vbox->ddev, 32);
+   drm_client_setup(&vbox->ddev, NULL);
 
return 0;
 
@@ -193,6 +194,7 @@ static const struct drm_driver driver = {
.patchlevel = DRIVER_PATCHLEVEL,
 
DRM_GEM_VRAM_DRIVER,
+   DRM_FBDEV_TTM_DRIVER_OPS,
 };
 
 drm_module_pci_driver_if_modeset(vbox_pci_driver, vbox_modeset);
-- 
2.46.0



[PATCH v5 18/80] drm/ili9486: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Cc: Kamlesh Gurudasani 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/tiny/Kconfig   | 1 +
 drivers/gpu/drm/tiny/ili9486.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tiny/Kconfig b/drivers/gpu/drm/tiny/Kconfig
index 337ac65390c6..7ee887b55aee 100644
--- a/drivers/gpu/drm/tiny/Kconfig
+++ b/drivers/gpu/drm/tiny/Kconfig
@@ -153,6 +153,7 @@ config TINYDRM_ILI9341
 config TINYDRM_ILI9486
tristate "DRM support for ILI9486 display panels"
depends on DRM && SPI
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_GEM_DMA_HELPER
select DRM_MIPI_DBI
diff --git a/drivers/gpu/drm/tiny/ili9486.c b/drivers/gpu/drm/tiny/ili9486.c
index 70d366260041..7e46a720d5e2 100644
--- a/drivers/gpu/drm/tiny/ili9486.c
+++ b/drivers/gpu/drm/tiny/ili9486.c
@@ -15,6 +15,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -172,6 +173,7 @@ static const struct drm_driver ili9486_driver = {
.driver_features= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
.fops   = &ili9486_fops,
DRM_GEM_DMA_DRIVER_OPS_VMAP,
+   DRM_FBDEV_DMA_DRIVER_OPS,
.debugfs_init   = mipi_dbi_debugfs_init,
.name   = "ili9486",
.desc   = "Ilitek ILI9486",
@@ -247,7 +249,7 @@ static int ili9486_probe(struct spi_device *spi)
 
spi_set_drvdata(spi, drm);
 
-   drm_fbdev_dma_setup(drm, 0);
+   drm_client_setup(drm, NULL);
 
return 0;
 }
-- 
2.46.0



[PATCH v5 62/80] drm/vkms: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Cc: Rodrigo Siqueira 
Cc: Melissa Wen 
Cc: "Maíra Canal" 
Cc: Haneen Mohammed 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/vkms/Kconfig| 1 +
 drivers/gpu/drm/vkms/vkms_drv.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vkms/Kconfig b/drivers/gpu/drm/vkms/Kconfig
index b9ecdebecb0b..9def079f685b 100644
--- a/drivers/gpu/drm/vkms/Kconfig
+++ b/drivers/gpu/drm/vkms/Kconfig
@@ -3,6 +3,7 @@
 config DRM_VKMS
tristate "Virtual KMS (EXPERIMENTAL)"
depends on DRM && MMU
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_GEM_SHMEM_HELPER
select CRC32
diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
index 0c1a713b7b7b..2d1e95cb66e5 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.c
+++ b/drivers/gpu/drm/vkms/vkms_drv.c
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -112,6 +113,7 @@ static const struct drm_driver vkms_driver = {
.release= vkms_release,
.fops   = &vkms_driver_fops,
DRM_GEM_SHMEM_DRIVER_OPS,
+   DRM_FBDEV_SHMEM_DRIVER_OPS,
 
.name   = DRIVER_NAME,
.desc   = DRIVER_DESC,
@@ -225,7 +227,7 @@ static int vkms_create(struct vkms_config *config)
if (ret)
goto out_devres;
 
-   drm_fbdev_shmem_setup(&vkms_device->drm, 0);
+   drm_client_setup(&vkms_device->drm, NULL);
 
return 0;
 
-- 
2.46.0



[PATCH v5 78/80] drm/tegra: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Rework fbdev probing to support fbdev_probe in struct drm_driver
and remove the old fb_probe callback. Provide an initializer macro
for struct drm_driver that sets the callback according to the kernel
configuration.

Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

The tegra driver specifies a preferred color mode of 32. As this
is the default if no format has been given, leave it out entirely.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Cc: Thierry Reding 
Cc: Mikko Perttunen 
Cc: Jonathan Hunter 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/tegra/Kconfig |  1 +
 drivers/gpu/drm/tegra/drm.c   |  5 +-
 drivers/gpu/drm/tegra/drm.h   | 12 +++--
 drivers/gpu/drm/tegra/fbdev.c | 98 +++
 4 files changed, 20 insertions(+), 96 deletions(-)

diff --git a/drivers/gpu/drm/tegra/Kconfig b/drivers/gpu/drm/tegra/Kconfig
index e688d8104652..8a3b16aac5d6 100644
--- a/drivers/gpu/drm/tegra/Kconfig
+++ b/drivers/gpu/drm/tegra/Kconfig
@@ -5,6 +5,7 @@ config DRM_TEGRA
depends on COMMON_CLK
depends on DRM
depends on OF
+   select DRM_CLIENT_SELECTION
select DRM_DISPLAY_DP_HELPER
select DRM_DISPLAY_HDMI_HELPER
select DRM_DISPLAY_HELPER
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index 4938960b5025..a013eb12b91c 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -891,6 +892,8 @@ static const struct drm_driver tegra_drm_driver = {
 
.dumb_create = tegra_bo_dumb_create,
 
+   TEGRA_FBDEV_DRIVER_OPS,
+
.ioctls = tegra_drm_ioctls,
.num_ioctls = ARRAY_SIZE(tegra_drm_ioctls),
.fops = &tegra_drm_fops,
@@ -1269,7 +1272,7 @@ static int host1x_drm_probe(struct host1x_device *dev)
if (err < 0)
goto hub;
 
-   tegra_fbdev_setup(drm);
+   drm_client_setup(drm, NULL);
 
return 0;
 
diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h
index 2f3781e04b0a..0b65e69f3a8a 100644
--- a/drivers/gpu/drm/tegra/drm.h
+++ b/drivers/gpu/drm/tegra/drm.h
@@ -25,6 +25,9 @@
 /* XXX move to include/uapi/drm/drm_fourcc.h? */
 #define DRM_FORMAT_MOD_NVIDIA_SECTOR_LAYOUT BIT_ULL(22)
 
+struct drm_fb_helper;
+struct drm_fb_helper_surface_size;
+
 struct edid;
 struct reset_control;
 
@@ -190,10 +193,13 @@ struct drm_framebuffer *tegra_fb_create(struct drm_device 
*drm,
const struct drm_mode_fb_cmd2 *cmd);
 
 #ifdef CONFIG_DRM_FBDEV_EMULATION
-void tegra_fbdev_setup(struct drm_device *drm);
+int tegra_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
+  struct drm_fb_helper_surface_size *sizes);
+#define TEGRA_FBDEV_DRIVER_OPS \
+   .fbdev_probe = tegra_fbdev_driver_fbdev_probe
 #else
-static inline void tegra_fbdev_setup(struct drm_device *drm)
-{ }
+#define TEGRA_FBDEV_DRIVER_OPS \
+   .fbdev_probe = NULL
 #endif
 
 extern struct platform_driver tegra_display_hub_driver;
diff --git a/drivers/gpu/drm/tegra/fbdev.c b/drivers/gpu/drm/tegra/fbdev.c
index db6eaac3d30e..cd9d798f8870 100644
--- a/drivers/gpu/drm/tegra/fbdev.c
+++ b/drivers/gpu/drm/tegra/fbdev.c
@@ -66,8 +66,11 @@ static const struct fb_ops tegra_fb_ops = {
.fb_destroy = tegra_fbdev_fb_destroy,
 };
 
-static int tegra_fbdev_probe(struct drm_fb_helper *helper,
-struct drm_fb_helper_surface_size *sizes)
+static const struct drm_fb_helper_funcs tegra_fbdev_helper_funcs = {
+};
+
+int tegra_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
+  struct drm_fb_helper_surface_size *sizes)
 {
struct tegra_drm *tegra = helper->dev->dev_private;
struct drm_device *drm = helper->dev;
@@ -112,6 +115,7 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper,
return PTR_ERR(fb);
}
 
+   helper->funcs = &tegra_fbdev_helper_funcs;
helper->fb = fb;
helper->info = info;
 
@@ -144,93 +148,3 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper,
drm_framebuffer_remove(fb);
return err;
 }
-
-static const struct drm_fb_helper_funcs tegra_fb_helper_funcs = {
-   .fb_probe = tegra_fbdev_probe,
-};
-
-/*
- * struct drm_client
- */
-
-static void tegra_fbdev_client_unregister(struct drm_client_dev *client)
-{
-   struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client);
-
-   if (fb_helper->info) {
-   drm_fb_helper_unregister_info(fb_helper);
-   } else {
-   drm_client_release(&fb_helper->client);
-   drm_fb_helper_unprepare(fb_helper);
-   kfree(fb_helper);
-   }
-}
-
-static int tegr

[PATCH v5 32/80] drm/pl111: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup_with_color_mode() to run the kernel's default
client setup for DRM. Set fbdev_probe in struct drm_driver, so that
the client setup can start the common fbdev client.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/pl111/Kconfig | 1 +
 drivers/gpu/drm/pl111/pl111_drv.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/pl111/Kconfig b/drivers/gpu/drm/pl111/Kconfig
index 20fe1d2c0aaf..82e918820950 100644
--- a/drivers/gpu/drm/pl111/Kconfig
+++ b/drivers/gpu/drm/pl111/Kconfig
@@ -5,6 +5,7 @@ config DRM_PL111
depends on ARM || ARM64 || COMPILE_TEST
depends on VEXPRESS_CONFIG || VEXPRESS_CONFIG=n
depends on COMMON_CLK
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_GEM_DMA_HELPER
select DRM_BRIDGE
diff --git a/drivers/gpu/drm/pl111/pl111_drv.c 
b/drivers/gpu/drm/pl111/pl111_drv.c
index 02e6b74d5016..13362150b9c6 100644
--- a/drivers/gpu/drm/pl111/pl111_drv.c
+++ b/drivers/gpu/drm/pl111/pl111_drv.c
@@ -47,6 +47,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -225,6 +226,7 @@ static const struct drm_driver pl111_drm_driver = {
.patchlevel = 0,
.dumb_create = drm_gem_dma_dumb_create,
.gem_prime_import_sg_table = pl111_gem_import_sg_table,
+   DRM_FBDEV_DMA_DRIVER_OPS,
 
 #if defined(CONFIG_DEBUG_FS)
.debugfs_init = pl111_debugfs_init,
@@ -305,7 +307,7 @@ static int pl111_amba_probe(struct amba_device *amba_dev,
if (ret < 0)
goto dev_put;
 
-   drm_fbdev_dma_setup(drm, priv->variant->fb_depth);
+   drm_client_setup_with_color_mode(drm, priv->variant->fb_depth);
 
return 0;
 
-- 
2.46.0



[PATCH v5 26/80] drm/mediatek: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

The mediatek driver specifies a preferred color mode of 32. As this
is the default if no format has been given, leave it out entirely.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Cc: Chun-KuaIng Hu 
Cc: Philipp Zabel 
Cc: Matthias Brugger 
Cc: AngeloGioacchino Del Regno 
Reviewed-by: Matthias Brugger 
---
 drivers/gpu/drm/mediatek/Kconfig   | 1 +
 drivers/gpu/drm/mediatek/mtk_drm_drv.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mediatek/Kconfig b/drivers/gpu/drm/mediatek/Kconfig
index 417ac8c9af41..3d2436272ff2 100644
--- a/drivers/gpu/drm/mediatek/Kconfig
+++ b/drivers/gpu/drm/mediatek/Kconfig
@@ -7,6 +7,7 @@ config DRM_MEDIATEK
depends on HAVE_ARM_SMCCC
depends on OF
depends on MTK_MMSYS
+   select DRM_CLIENT_SELECTION
select DRM_GEM_DMA_HELPER if DRM_FBDEV_EMULATION
select DRM_KMS_HELPER
select DRM_DISPLAY_HELPER
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c 
b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index 77b50c56c124..b1309a70fdcd 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -14,6 +14,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -610,6 +611,7 @@ static const struct drm_driver mtk_drm_driver = {
.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
 
.dumb_create = mtk_gem_dumb_create,
+   DRM_FBDEV_DMA_DRIVER_OPS,
 
.gem_prime_import = mtk_gem_prime_import,
.gem_prime_import_sg_table = mtk_gem_prime_import_sg_table,
@@ -666,7 +668,7 @@ static int mtk_drm_bind(struct device *dev)
if (ret < 0)
goto err_deinit;
 
-   drm_fbdev_dma_setup(drm, 32);
+   drm_client_setup(drm, NULL);
 
return 0;
 
-- 
2.46.0



[PATCH v5 48/80] drm/fbdev-dma: Remove obsolete setup function

2024-09-24 Thread Thomas Zimmermann
The old setup function drm_fbdev_dma_setup() is unused. Remove it and
its internal callbacks. New drivers should call drm_client_setup()
instead.

Signed-off-by: Thomas Zimmermann 
Reviewed-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/drm_fbdev_dma.c | 120 +---
 include/drm/drm_fbdev_dma.h |   7 --
 2 files changed, 1 insertion(+), 126 deletions(-)

diff --git a/drivers/gpu/drm/drm_fbdev_dma.c b/drivers/gpu/drm/drm_fbdev_dma.c
index 9ce754ebe18e..2343af1b09bc 100644
--- a/drivers/gpu/drm/drm_fbdev_dma.c
+++ b/drivers/gpu/drm/drm_fbdev_dma.c
@@ -2,15 +2,13 @@
 
 #include 
 
-#include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 
-#include 
-
 /*
  * struct fb_ops
  */
@@ -102,12 +100,6 @@ static const struct fb_ops drm_fbdev_dma_deferred_fb_ops = 
{
  * struct drm_fb_helper
  */
 
-static int drm_fbdev_dma_helper_fb_probe(struct drm_fb_helper *fb_helper,
-struct drm_fb_helper_surface_size 
*sizes)
-{
-   return drm_fbdev_dma_driver_fbdev_probe(fb_helper, sizes);
-}
-
 static int drm_fbdev_dma_helper_fb_dirty(struct drm_fb_helper *helper,
 struct drm_clip_rect *clip)
 {
@@ -128,7 +120,6 @@ static int drm_fbdev_dma_helper_fb_dirty(struct 
drm_fb_helper *helper,
 }
 
 static const struct drm_fb_helper_funcs drm_fbdev_dma_helper_funcs = {
-   .fb_probe = drm_fbdev_dma_helper_fb_probe,
.fb_dirty = drm_fbdev_dma_helper_fb_dirty,
 };
 
@@ -246,112 +237,3 @@ int drm_fbdev_dma_driver_fbdev_probe(struct drm_fb_helper 
*fb_helper,
return ret;
 }
 EXPORT_SYMBOL(drm_fbdev_dma_driver_fbdev_probe);
-
-/*
- * struct drm_client_funcs
- */
-
-static void drm_fbdev_dma_client_unregister(struct drm_client_dev *client)
-{
-   struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client);
-
-   if (fb_helper->info) {
-   drm_fb_helper_unregister_info(fb_helper);
-   } else {
-   drm_client_release(&fb_helper->client);
-   drm_fb_helper_unprepare(fb_helper);
-   kfree(fb_helper);
-   }
-}
-
-static int drm_fbdev_dma_client_restore(struct drm_client_dev *client)
-{
-   drm_fb_helper_lastclose(client->dev);
-
-   return 0;
-}
-
-static int drm_fbdev_dma_client_hotplug(struct drm_client_dev *client)
-{
-   struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client);
-   struct drm_device *dev = client->dev;
-   int ret;
-
-   if (dev->fb_helper)
-   return drm_fb_helper_hotplug_event(dev->fb_helper);
-
-   ret = drm_fb_helper_init(dev, fb_helper);
-   if (ret)
-   goto err_drm_err;
-
-   if (!drm_drv_uses_atomic_modeset(dev))
-   drm_helper_disable_unused_functions(dev);
-
-   ret = drm_fb_helper_initial_config(fb_helper);
-   if (ret)
-   goto err_drm_fb_helper_fini;
-
-   return 0;
-
-err_drm_fb_helper_fini:
-   drm_fb_helper_fini(fb_helper);
-err_drm_err:
-   drm_err(dev, "fbdev-dma: Failed to setup generic emulation (ret=%d)\n", 
ret);
-   return ret;
-}
-
-static const struct drm_client_funcs drm_fbdev_dma_client_funcs = {
-   .owner  = THIS_MODULE,
-   .unregister = drm_fbdev_dma_client_unregister,
-   .restore= drm_fbdev_dma_client_restore,
-   .hotplug= drm_fbdev_dma_client_hotplug,
-};
-
-/**
- * drm_fbdev_dma_setup() - Setup fbdev emulation for GEM DMA helpers
- * @dev: DRM device
- * @preferred_bpp: Preferred bits per pixel for the device.
- * 32 is used if this is zero.
- *
- * This function sets up fbdev emulation for GEM DMA drivers that support
- * dumb buffers with a virtual address and that can be mmap'ed.
- * drm_fbdev_dma_setup() shall be called after the DRM driver registered
- * the new DRM device with drm_dev_register().
- *
- * Restore, hotplug events and teardown are all taken care of. Drivers that do
- * suspend/resume need to call drm_fb_helper_set_suspend_unlocked() themselves.
- * Simple drivers might use drm_mode_config_helper_suspend().
- *
- * This function is safe to call even when there are no connectors present.
- * Setup will be retried on the next hotplug event.
- *
- * The fbdev is destroyed by drm_dev_unregister().
- */
-void drm_fbdev_dma_setup(struct drm_device *dev, unsigned int preferred_bpp)
-{
-   struct drm_fb_helper *fb_helper;
-   int ret;
-
-   drm_WARN(dev, !dev->registered, "Device has not been registered.\n");
-   drm_WARN(dev, dev->fb_helper, "fb_helper is already set!\n");
-
-   fb_helper = kzalloc(sizeof(*fb_helper), GFP_KERNEL);
-   if (!fb_helper)
-   return;
-   drm_fb_helper_prepare(dev, fb_helper, preferred_bpp, 
&drm_fbdev_dma_helper_funcs);
-
-   ret = drm_client_init(dev, &fb_helper->client, "fbdev", 
&drm_fbdev_dma_client_funcs)

Elapsed Time incorrect for HTTP/2.0?

2024-09-24 Thread Thomas Meyer
Hi,

We see sometimes elapsed time values with over 100 million milliseconds and 
status code 500 in the Tomcat logs for HTTP/2.0 connections.

Is that expected or a bug?

I assume this is because of http2 multiplexing maybe?

Tomcat version is 10.1.30

Mfg
Thomas 

[PATCH v5 73/80] drm/armada: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Rework fbdev probing to support fbdev_probe in struct drm_driver
and remove the old fb_probe callback. Provide an initializer macro
for struct drm_driver that sets the callback according to the kernel
configuration.

Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

The armada driver specifies a preferred color mode of 32. As this
is the default if no format has been given, leave it out entirely.

v5:
- select DRM_CLIENT_SELECTION
v4:
- revert an unrelated cleanup (Javier)

Signed-off-by: Thomas Zimmermann 
Cc: Russell King 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/armada/Kconfig|   1 +
 drivers/gpu/drm/armada/armada_drm.h   |  11 ++-
 drivers/gpu/drm/armada/armada_drv.c   |   4 +-
 drivers/gpu/drm/armada/armada_fbdev.c | 113 ++
 4 files changed, 17 insertions(+), 112 deletions(-)

diff --git a/drivers/gpu/drm/armada/Kconfig b/drivers/gpu/drm/armada/Kconfig
index e5597d7c9ae1..b22c891a670b 100644
--- a/drivers/gpu/drm/armada/Kconfig
+++ b/drivers/gpu/drm/armada/Kconfig
@@ -2,6 +2,7 @@
 config DRM_ARMADA
tristate "DRM support for Marvell Armada SoCs"
depends on DRM && HAVE_CLK && ARM && MMU
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select FB_IOMEM_HELPERS if DRM_FBDEV_EMULATION
help
diff --git a/drivers/gpu/drm/armada/armada_drm.h 
b/drivers/gpu/drm/armada/armada_drm.h
index c303e8c7ff6c..3c0ff221a43b 100644
--- a/drivers/gpu/drm/armada/armada_drm.h
+++ b/drivers/gpu/drm/armada/armada_drm.h
@@ -16,6 +16,8 @@ struct armada_crtc;
 struct armada_gem_object;
 struct clk;
 struct drm_display_mode;
+struct drm_fb_helper;
+struct drm_fb_helper_surface_size;
 
 static inline void
 armada_updatel(uint32_t val, uint32_t mask, void __iomem *ptr)
@@ -74,10 +76,13 @@ struct armada_private {
 #define drm_to_armada_dev(dev) container_of(dev, struct armada_private, drm)
 
 #if defined(CONFIG_DRM_FBDEV_EMULATION)
-void armada_fbdev_setup(struct drm_device *dev);
+int armada_fbdev_driver_fbdev_probe(struct drm_fb_helper *fbh,
+   struct drm_fb_helper_surface_size *sizes);
+#define ARMADA_FBDEV_DRIVER_OPS \
+   .fbdev_probe = armada_fbdev_driver_fbdev_probe
 #else
-static inline void armada_fbdev_setup(struct drm_device *dev)
-{ }
+#define ARMADA_FBDEV_DRIVER_OPS \
+   .fbdev_probe = NULL
 #endif
 
 int armada_overlay_plane_create(struct drm_device *, unsigned long);
diff --git a/drivers/gpu/drm/armada/armada_drv.c 
b/drivers/gpu/drm/armada/armada_drv.c
index e51ecc4f7ef4..3dc5f0499e4c 100644
--- a/drivers/gpu/drm/armada/armada_drv.c
+++ b/drivers/gpu/drm/armada/armada_drv.c
@@ -12,6 +12,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -39,6 +40,7 @@ DEFINE_DRM_GEM_FOPS(armada_drm_fops);
 static const struct drm_driver armada_drm_driver = {
.gem_prime_import   = armada_gem_prime_import,
.dumb_create= armada_gem_dumb_create,
+   ARMADA_FBDEV_DRIVER_OPS,
.major  = 1,
.minor  = 0,
.name   = "armada-drm",
@@ -137,7 +139,7 @@ static int armada_drm_bind(struct device *dev)
armada_drm_debugfs_init(priv->drm.primary);
 #endif
 
-   armada_fbdev_setup(&priv->drm);
+   drm_client_setup(&priv->drm, NULL);
 
return 0;
 
diff --git a/drivers/gpu/drm/armada/armada_fbdev.c 
b/drivers/gpu/drm/armada/armada_fbdev.c
index d223176912b6..6ee7ce04ee71 100644
--- a/drivers/gpu/drm/armada/armada_fbdev.c
+++ b/drivers/gpu/drm/armada/armada_fbdev.c
@@ -39,8 +39,10 @@ static const struct fb_ops armada_fb_ops = {
.fb_destroy = armada_fbdev_fb_destroy,
 };
 
-static int armada_fbdev_create(struct drm_fb_helper *fbh,
-   struct drm_fb_helper_surface_size *sizes)
+static const struct drm_fb_helper_funcs armada_fbdev_helper_funcs;
+
+int armada_fbdev_driver_fbdev_probe(struct drm_fb_helper *fbh,
+   struct drm_fb_helper_surface_size *sizes)
 {
struct drm_device *dev = fbh->dev;
struct drm_mode_fb_cmd2 mode;
@@ -98,6 +100,7 @@ static int armada_fbdev_create(struct drm_fb_helper *fbh,
info->fix.smem_len = obj->obj.size;
info->screen_size = obj->obj.size;
info->screen_base = ptr;
+   fbh->funcs = &armada_fbdev_helper_funcs;
fbh->fb = &dfb->fb;
 
drm_fb_helper_fill_info(info, fbh, sizes);
@@ -112,109 +115,3 @@ static int armada_fbdev_create(struct drm_fb_helper *fbh,
dfb->fb.funcs->destroy(&dfb->fb);
return ret;
 }
-
-static int armada_fb_probe(struct drm_fb_helper *fbh,
-   struct drm_fb_helper_surface_size *sizes)
-{
-   int ret = 0;
-
-   if (!fbh->fb) {
-   ret = armada_

[PATCH v5 73/80] drm/armada: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Rework fbdev probing to support fbdev_probe in struct drm_driver
and remove the old fb_probe callback. Provide an initializer macro
for struct drm_driver that sets the callback according to the kernel
configuration.

Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

The armada driver specifies a preferred color mode of 32. As this
is the default if no format has been given, leave it out entirely.

v5:
- select DRM_CLIENT_SELECTION
v4:
- revert an unrelated cleanup (Javier)

Signed-off-by: Thomas Zimmermann 
Cc: Russell King 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/armada/Kconfig|   1 +
 drivers/gpu/drm/armada/armada_drm.h   |  11 ++-
 drivers/gpu/drm/armada/armada_drv.c   |   4 +-
 drivers/gpu/drm/armada/armada_fbdev.c | 113 ++
 4 files changed, 17 insertions(+), 112 deletions(-)

diff --git a/drivers/gpu/drm/armada/Kconfig b/drivers/gpu/drm/armada/Kconfig
index e5597d7c9ae1..b22c891a670b 100644
--- a/drivers/gpu/drm/armada/Kconfig
+++ b/drivers/gpu/drm/armada/Kconfig
@@ -2,6 +2,7 @@
 config DRM_ARMADA
tristate "DRM support for Marvell Armada SoCs"
depends on DRM && HAVE_CLK && ARM && MMU
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select FB_IOMEM_HELPERS if DRM_FBDEV_EMULATION
help
diff --git a/drivers/gpu/drm/armada/armada_drm.h 
b/drivers/gpu/drm/armada/armada_drm.h
index c303e8c7ff6c..3c0ff221a43b 100644
--- a/drivers/gpu/drm/armada/armada_drm.h
+++ b/drivers/gpu/drm/armada/armada_drm.h
@@ -16,6 +16,8 @@ struct armada_crtc;
 struct armada_gem_object;
 struct clk;
 struct drm_display_mode;
+struct drm_fb_helper;
+struct drm_fb_helper_surface_size;
 
 static inline void
 armada_updatel(uint32_t val, uint32_t mask, void __iomem *ptr)
@@ -74,10 +76,13 @@ struct armada_private {
 #define drm_to_armada_dev(dev) container_of(dev, struct armada_private, drm)
 
 #if defined(CONFIG_DRM_FBDEV_EMULATION)
-void armada_fbdev_setup(struct drm_device *dev);
+int armada_fbdev_driver_fbdev_probe(struct drm_fb_helper *fbh,
+   struct drm_fb_helper_surface_size *sizes);
+#define ARMADA_FBDEV_DRIVER_OPS \
+   .fbdev_probe = armada_fbdev_driver_fbdev_probe
 #else
-static inline void armada_fbdev_setup(struct drm_device *dev)
-{ }
+#define ARMADA_FBDEV_DRIVER_OPS \
+   .fbdev_probe = NULL
 #endif
 
 int armada_overlay_plane_create(struct drm_device *, unsigned long);
diff --git a/drivers/gpu/drm/armada/armada_drv.c 
b/drivers/gpu/drm/armada/armada_drv.c
index e51ecc4f7ef4..3dc5f0499e4c 100644
--- a/drivers/gpu/drm/armada/armada_drv.c
+++ b/drivers/gpu/drm/armada/armada_drv.c
@@ -12,6 +12,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -39,6 +40,7 @@ DEFINE_DRM_GEM_FOPS(armada_drm_fops);
 static const struct drm_driver armada_drm_driver = {
.gem_prime_import   = armada_gem_prime_import,
.dumb_create= armada_gem_dumb_create,
+   ARMADA_FBDEV_DRIVER_OPS,
.major  = 1,
.minor  = 0,
.name   = "armada-drm",
@@ -137,7 +139,7 @@ static int armada_drm_bind(struct device *dev)
armada_drm_debugfs_init(priv->drm.primary);
 #endif
 
-   armada_fbdev_setup(&priv->drm);
+   drm_client_setup(&priv->drm, NULL);
 
return 0;
 
diff --git a/drivers/gpu/drm/armada/armada_fbdev.c 
b/drivers/gpu/drm/armada/armada_fbdev.c
index d223176912b6..6ee7ce04ee71 100644
--- a/drivers/gpu/drm/armada/armada_fbdev.c
+++ b/drivers/gpu/drm/armada/armada_fbdev.c
@@ -39,8 +39,10 @@ static const struct fb_ops armada_fb_ops = {
.fb_destroy = armada_fbdev_fb_destroy,
 };
 
-static int armada_fbdev_create(struct drm_fb_helper *fbh,
-   struct drm_fb_helper_surface_size *sizes)
+static const struct drm_fb_helper_funcs armada_fbdev_helper_funcs;
+
+int armada_fbdev_driver_fbdev_probe(struct drm_fb_helper *fbh,
+   struct drm_fb_helper_surface_size *sizes)
 {
struct drm_device *dev = fbh->dev;
struct drm_mode_fb_cmd2 mode;
@@ -98,6 +100,7 @@ static int armada_fbdev_create(struct drm_fb_helper *fbh,
info->fix.smem_len = obj->obj.size;
info->screen_size = obj->obj.size;
info->screen_base = ptr;
+   fbh->funcs = &armada_fbdev_helper_funcs;
fbh->fb = &dfb->fb;
 
drm_fb_helper_fill_info(info, fbh, sizes);
@@ -112,109 +115,3 @@ static int armada_fbdev_create(struct drm_fb_helper *fbh,
dfb->fb.funcs->destroy(&dfb->fb);
return ret;
 }
-
-static int armada_fb_probe(struct drm_fb_helper *fbh,
-   struct drm_fb_helper_surface_size *sizes)
-{
-   int ret = 0;
-
-   if (!fbh->fb) {
-   ret = armada_

[PATCH v5 79/80] drm/omapdrm: Remove struct drm_fb_helper from struct omap_fbdev.

2024-09-24 Thread Thomas Zimmermann
Store instances of drm_fb_helper and struct omap_fbdev separately.
This will allow omapdrm to use the common fbdev client, which allocates
its own instance of struct drm_fb_helper.

There is at most one instance of each per DRM device, so both can be
referenced directly from the omap and DRM device structures. A later
patchset might rework the common fbdev client to allow for storing
both, drm_fb_helper and omap_fbdev, together in the same place.

Signed-off-by: Thomas Zimmermann 
Cc: Tomi Valkeinen 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/omapdrm/omap_drv.h   |  3 ++
 drivers/gpu/drm/omapdrm/omap_fbdev.c | 42 +++-
 2 files changed, 26 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h 
b/drivers/gpu/drm/omapdrm/omap_drv.h
index 4c7217b35f6b..d903568fd8cc 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -32,6 +32,7 @@
 #define MODULE_NAME "omapdrm"
 
 struct omap_drm_usergart;
+struct omap_fbdev;
 
 struct omap_drm_pipeline {
struct drm_crtc *crtc;
@@ -97,6 +98,8 @@ struct omap_drm_private {
 
/* memory bandwidth limit if it is needed on the platform */
unsigned int max_bandwidth;
+
+   struct omap_fbdev *fbdev;
 };
 
 
diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c 
b/drivers/gpu/drm/omapdrm/omap_fbdev.c
index 523be34682ca..044e80403c3b 100644
--- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
+++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "omap_drv.h"
@@ -26,10 +27,8 @@ module_param_named(ywrap, ywrap_enabled, bool, 0644);
  * fbdev funcs, to implement legacy fbdev interface on top of drm driver
  */
 
-#define to_omap_fbdev(x) container_of(x, struct omap_fbdev, base)
-
 struct omap_fbdev {
-   struct drm_fb_helper base;
+   struct drm_device *dev;
bool ywrap_enabled;
 
/* for deferred dmm roll when getting called in atomic ctx */
@@ -41,7 +40,7 @@ static struct drm_fb_helper *get_fb(struct fb_info *fbi);
 static void pan_worker(struct work_struct *work)
 {
struct omap_fbdev *fbdev = container_of(work, struct omap_fbdev, work);
-   struct drm_fb_helper *helper = &fbdev->base;
+   struct drm_fb_helper *helper = fbdev->dev->fb_helper;
struct fb_info *fbi = helper->info;
struct drm_gem_object *bo = drm_gem_fb_get_obj(helper->fb, 0);
int npages;
@@ -55,24 +54,25 @@ FB_GEN_DEFAULT_DEFERRED_DMAMEM_OPS(omap_fbdev,
   drm_fb_helper_damage_range,
   drm_fb_helper_damage_area)
 
-static int omap_fbdev_pan_display(struct fb_var_screeninfo *var,
-   struct fb_info *fbi)
+static int omap_fbdev_pan_display(struct fb_var_screeninfo *var, struct 
fb_info *fbi)
 {
struct drm_fb_helper *helper = get_fb(fbi);
-   struct omap_fbdev *fbdev = to_omap_fbdev(helper);
+   struct omap_drm_private *priv;
+   struct omap_fbdev *fbdev;
 
if (!helper)
goto fallback;
 
+   priv = helper->dev->dev_private;
+   fbdev = priv->fbdev;
+
if (!fbdev->ywrap_enabled)
goto fallback;
 
-   if (drm_can_sleep()) {
+   if (drm_can_sleep())
pan_worker(&fbdev->work);
-   } else {
-   struct omap_drm_private *priv = helper->dev->dev_private;
+   else
queue_work(priv->wq, &fbdev->work);
-   }
 
return 0;
 
@@ -92,7 +92,6 @@ static void omap_fbdev_fb_destroy(struct fb_info *info)
struct drm_fb_helper *helper = info->par;
struct drm_framebuffer *fb = helper->fb;
struct drm_gem_object *bo = drm_gem_fb_get_obj(fb, 0);
-   struct omap_fbdev *fbdev = to_omap_fbdev(helper);
 
DBG();
 
@@ -104,7 +103,7 @@ static void omap_fbdev_fb_destroy(struct fb_info *info)
 
drm_client_release(&helper->client);
drm_fb_helper_unprepare(helper);
-   kfree(fbdev);
+   kfree(helper);
 }
 
 /*
@@ -128,9 +127,9 @@ static const struct fb_ops omap_fb_ops = {
 static int omap_fbdev_create(struct drm_fb_helper *helper,
struct drm_fb_helper_surface_size *sizes)
 {
-   struct omap_fbdev *fbdev = to_omap_fbdev(helper);
struct drm_device *dev = helper->dev;
struct omap_drm_private *priv = dev->dev_private;
+   struct omap_fbdev *fbdev = priv->fbdev;
struct drm_framebuffer *fb = NULL;
union omap_gem_size gsize;
struct fb_info *fbi = NULL;
@@ -338,6 +337,7 @@ static const struct drm_client_funcs 
omap_fbdev_client_funcs = {
 
 void omap_fbdev_setup(struct drm_device *dev)
 {
+   struct omap_drm_private *priv = dev->dev_private;
struct omap_fbdev *fbdev;
struct drm_fb_helper *helper;
int ret;
@@ -345,24 +345,28 @@ void omap_fbdev_setup

[PATCH v5 70/80] drm/vboxvideo: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

The vboxvideo driver specifies a preferred color mode of 32. As this
is the default if no format has been given, leave it out entirely.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Cc: Hans de Goede 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/vboxvideo/Kconfig| 1 +
 drivers/gpu/drm/vboxvideo/vbox_drv.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vboxvideo/Kconfig 
b/drivers/gpu/drm/vboxvideo/Kconfig
index 45fe135d6e43..180e30b82ab9 100644
--- a/drivers/gpu/drm/vboxvideo/Kconfig
+++ b/drivers/gpu/drm/vboxvideo/Kconfig
@@ -2,6 +2,7 @@
 config DRM_VBOXVIDEO
tristate "Virtual Box Graphics Card"
depends on DRM && X86 && PCI
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_VRAM_HELPER
select DRM_TTM
diff --git a/drivers/gpu/drm/vboxvideo/vbox_drv.c 
b/drivers/gpu/drm/vboxvideo/vbox_drv.c
index ef36834c8673..49dc337b3e01 100644
--- a/drivers/gpu/drm/vboxvideo/vbox_drv.c
+++ b/drivers/gpu/drm/vboxvideo/vbox_drv.c
@@ -13,6 +13,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -80,7 +81,7 @@ static int vbox_pci_probe(struct pci_dev *pdev, const struct 
pci_device_id *ent)
if (ret)
goto err_irq_fini;
 
-   drm_fbdev_ttm_setup(&vbox->ddev, 32);
+   drm_client_setup(&vbox->ddev, NULL);
 
return 0;
 
@@ -193,6 +194,7 @@ static const struct drm_driver driver = {
.patchlevel = DRIVER_PATCHLEVEL,
 
DRM_GEM_VRAM_DRIVER,
+   DRM_FBDEV_TTM_DRIVER_OPS,
 };
 
 drm_module_pci_driver_if_modeset(vbox_pci_driver, vbox_modeset);
-- 
2.46.0



[PATCH v5 62/80] drm/vkms: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Cc: Rodrigo Siqueira 
Cc: Melissa Wen 
Cc: "Maíra Canal" 
Cc: Haneen Mohammed 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/vkms/Kconfig| 1 +
 drivers/gpu/drm/vkms/vkms_drv.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vkms/Kconfig b/drivers/gpu/drm/vkms/Kconfig
index b9ecdebecb0b..9def079f685b 100644
--- a/drivers/gpu/drm/vkms/Kconfig
+++ b/drivers/gpu/drm/vkms/Kconfig
@@ -3,6 +3,7 @@
 config DRM_VKMS
tristate "Virtual KMS (EXPERIMENTAL)"
depends on DRM && MMU
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_GEM_SHMEM_HELPER
select CRC32
diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
index 0c1a713b7b7b..2d1e95cb66e5 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.c
+++ b/drivers/gpu/drm/vkms/vkms_drv.c
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -112,6 +113,7 @@ static const struct drm_driver vkms_driver = {
.release= vkms_release,
.fops   = &vkms_driver_fops,
DRM_GEM_SHMEM_DRIVER_OPS,
+   DRM_FBDEV_SHMEM_DRIVER_OPS,
 
.name   = DRIVER_NAME,
.desc   = DRIVER_DESC,
@@ -225,7 +227,7 @@ static int vkms_create(struct vkms_config *config)
if (ret)
goto out_devres;
 
-   drm_fbdev_shmem_setup(&vkms_device->drm, 0);
+   drm_client_setup(&vkms_device->drm, NULL);
 
return 0;
 
-- 
2.46.0



[PATCH v5 79/80] drm/omapdrm: Remove struct drm_fb_helper from struct omap_fbdev.

2024-09-24 Thread Thomas Zimmermann
Store instances of drm_fb_helper and struct omap_fbdev separately.
This will allow omapdrm to use the common fbdev client, which allocates
its own instance of struct drm_fb_helper.

There is at most one instance of each per DRM device, so both can be
referenced directly from the omap and DRM device structures. A later
patchset might rework the common fbdev client to allow for storing
both, drm_fb_helper and omap_fbdev, together in the same place.

Signed-off-by: Thomas Zimmermann 
Cc: Tomi Valkeinen 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/omapdrm/omap_drv.h   |  3 ++
 drivers/gpu/drm/omapdrm/omap_fbdev.c | 42 +++-
 2 files changed, 26 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h 
b/drivers/gpu/drm/omapdrm/omap_drv.h
index 4c7217b35f6b..d903568fd8cc 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -32,6 +32,7 @@
 #define MODULE_NAME "omapdrm"
 
 struct omap_drm_usergart;
+struct omap_fbdev;
 
 struct omap_drm_pipeline {
struct drm_crtc *crtc;
@@ -97,6 +98,8 @@ struct omap_drm_private {
 
/* memory bandwidth limit if it is needed on the platform */
unsigned int max_bandwidth;
+
+   struct omap_fbdev *fbdev;
 };
 
 
diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c 
b/drivers/gpu/drm/omapdrm/omap_fbdev.c
index 523be34682ca..044e80403c3b 100644
--- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
+++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "omap_drv.h"
@@ -26,10 +27,8 @@ module_param_named(ywrap, ywrap_enabled, bool, 0644);
  * fbdev funcs, to implement legacy fbdev interface on top of drm driver
  */
 
-#define to_omap_fbdev(x) container_of(x, struct omap_fbdev, base)
-
 struct omap_fbdev {
-   struct drm_fb_helper base;
+   struct drm_device *dev;
bool ywrap_enabled;
 
/* for deferred dmm roll when getting called in atomic ctx */
@@ -41,7 +40,7 @@ static struct drm_fb_helper *get_fb(struct fb_info *fbi);
 static void pan_worker(struct work_struct *work)
 {
struct omap_fbdev *fbdev = container_of(work, struct omap_fbdev, work);
-   struct drm_fb_helper *helper = &fbdev->base;
+   struct drm_fb_helper *helper = fbdev->dev->fb_helper;
struct fb_info *fbi = helper->info;
struct drm_gem_object *bo = drm_gem_fb_get_obj(helper->fb, 0);
int npages;
@@ -55,24 +54,25 @@ FB_GEN_DEFAULT_DEFERRED_DMAMEM_OPS(omap_fbdev,
   drm_fb_helper_damage_range,
   drm_fb_helper_damage_area)
 
-static int omap_fbdev_pan_display(struct fb_var_screeninfo *var,
-   struct fb_info *fbi)
+static int omap_fbdev_pan_display(struct fb_var_screeninfo *var, struct 
fb_info *fbi)
 {
struct drm_fb_helper *helper = get_fb(fbi);
-   struct omap_fbdev *fbdev = to_omap_fbdev(helper);
+   struct omap_drm_private *priv;
+   struct omap_fbdev *fbdev;
 
if (!helper)
goto fallback;
 
+   priv = helper->dev->dev_private;
+   fbdev = priv->fbdev;
+
if (!fbdev->ywrap_enabled)
goto fallback;
 
-   if (drm_can_sleep()) {
+   if (drm_can_sleep())
pan_worker(&fbdev->work);
-   } else {
-   struct omap_drm_private *priv = helper->dev->dev_private;
+   else
queue_work(priv->wq, &fbdev->work);
-   }
 
return 0;
 
@@ -92,7 +92,6 @@ static void omap_fbdev_fb_destroy(struct fb_info *info)
struct drm_fb_helper *helper = info->par;
struct drm_framebuffer *fb = helper->fb;
struct drm_gem_object *bo = drm_gem_fb_get_obj(fb, 0);
-   struct omap_fbdev *fbdev = to_omap_fbdev(helper);
 
DBG();
 
@@ -104,7 +103,7 @@ static void omap_fbdev_fb_destroy(struct fb_info *info)
 
drm_client_release(&helper->client);
drm_fb_helper_unprepare(helper);
-   kfree(fbdev);
+   kfree(helper);
 }
 
 /*
@@ -128,9 +127,9 @@ static const struct fb_ops omap_fb_ops = {
 static int omap_fbdev_create(struct drm_fb_helper *helper,
struct drm_fb_helper_surface_size *sizes)
 {
-   struct omap_fbdev *fbdev = to_omap_fbdev(helper);
struct drm_device *dev = helper->dev;
struct omap_drm_private *priv = dev->dev_private;
+   struct omap_fbdev *fbdev = priv->fbdev;
struct drm_framebuffer *fb = NULL;
union omap_gem_size gsize;
struct fb_info *fbi = NULL;
@@ -338,6 +337,7 @@ static const struct drm_client_funcs 
omap_fbdev_client_funcs = {
 
 void omap_fbdev_setup(struct drm_device *dev)
 {
+   struct omap_drm_private *priv = dev->dev_private;
struct omap_fbdev *fbdev;
struct drm_fb_helper *helper;
int ret;
@@ -345,24 +345,28 @@ void omap_fbdev_setup

[PATCH v5 35/80] drm/renesas/shmobile: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup_with_fourcc() to run the kernel's default client
setup for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

v5:
- select DRM_CLIENT_SELECTION
v2:
- use drm_client_setup_with_fourcc()

Signed-off-by: Thomas Zimmermann 
Cc: Laurent Pinchart 
Cc: Geert Uytterhoeven 
Reviewed-by: Laurent Pinchart 
Reviewed-by: Geert Uytterhoeven 
Tested-by: Geert Uytterhoeven 
---
 drivers/gpu/drm/renesas/shmobile/Kconfig | 1 +
 drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c | 5 -
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/renesas/shmobile/Kconfig 
b/drivers/gpu/drm/renesas/shmobile/Kconfig
index c329ab8a7a8b..52e160464001 100644
--- a/drivers/gpu/drm/renesas/shmobile/Kconfig
+++ b/drivers/gpu/drm/renesas/shmobile/Kconfig
@@ -4,6 +4,7 @@ config DRM_SHMOBILE
depends on DRM && PM
depends on ARCH_RENESAS || ARCH_SHMOBILE || COMPILE_TEST
select BACKLIGHT_CLASS_DEVICE
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_DISPLAY_HELPER
select DRM_BRIDGE_CONNECTOR
diff --git a/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c 
b/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c
index ff2883c7fd46..8d3effe3f598 100644
--- a/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c
+++ b/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c
@@ -18,8 +18,10 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -101,6 +103,7 @@ DEFINE_DRM_GEM_DMA_FOPS(shmob_drm_fops);
 static const struct drm_driver shmob_drm_driver = {
.driver_features= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
DRM_GEM_DMA_DRIVER_OPS,
+   DRM_FBDEV_DMA_DRIVER_OPS,
.fops   = &shmob_drm_fops,
.name   = "shmob-drm",
.desc   = "Renesas SH Mobile DRM",
@@ -257,7 +260,7 @@ static int shmob_drm_probe(struct platform_device *pdev)
if (ret < 0)
goto err_modeset_cleanup;
 
-   drm_fbdev_dma_setup(ddev, 16);
+   drm_client_setup_with_fourcc(ddev, DRM_FORMAT_RGB565);
 
return 0;
 
-- 
2.46.0



[PATCH v5 56/80] drm/mgag200: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup_with_fourcc() to run the kernel's default client
setup for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

v5:
- select DRM_CLIENT_SELECTION
v2:
- use drm_client_setup_with_fourcc()

Signed-off-by: Thomas Zimmermann 
Cc: Dave Airlie 
Cc: Thomas Zimmermann 
Cc: Jocelyn Falempe 
Reviewed-by: Jocelyn Falempe 
---
 drivers/gpu/drm/mgag200/Kconfig   | 3 ++-
 drivers/gpu/drm/mgag200/mgag200_drv.c | 5 -
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/mgag200/Kconfig b/drivers/gpu/drm/mgag200/Kconfig
index 3096944a8f0a..412dcbea0e2d 100644
--- a/drivers/gpu/drm/mgag200/Kconfig
+++ b/drivers/gpu/drm/mgag200/Kconfig
@@ -2,6 +2,7 @@
 config DRM_MGAG200
tristate "Matrox G200"
depends on DRM && PCI && MMU
+   select DRM_CLIENT_SELECTION
select DRM_GEM_SHMEM_HELPER
select DRM_KMS_HELPER
select I2C
@@ -20,4 +21,4 @@ config DRM_MGAG200_DISABLE_WRITECOMBINE
  performances. This can interfere with real-time tasks; even if they
  are running on other CPU cores than the graphics output.
  Enable this option only if you run realtime tasks on a server with a
- Matrox G200.
\ No newline at end of file
+ Matrox G200.
diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c 
b/drivers/gpu/drm/mgag200/mgag200_drv.c
index 6623ee4e3277..29087e2398df 100644
--- a/drivers/gpu/drm/mgag200/mgag200_drv.c
+++ b/drivers/gpu/drm/mgag200/mgag200_drv.c
@@ -11,9 +11,11 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -129,6 +131,7 @@ static const struct drm_driver mgag200_driver = {
.minor = DRIVER_MINOR,
.patchlevel = DRIVER_PATCHLEVEL,
DRM_GEM_SHMEM_DRIVER_OPS,
+   DRM_FBDEV_SHMEM_DRIVER_OPS,
 };
 
 /*
@@ -314,7 +317,7 @@ mgag200_pci_probe(struct pci_dev *pdev, const struct 
pci_device_id *ent)
 * FIXME: A 24-bit color depth does not work with 24 bpp on
 * G200ER. Force 32 bpp.
 */
-   drm_fbdev_shmem_setup(dev, 32);
+   drm_client_setup_with_fourcc(dev, DRM_FORMAT_XRGB);
 
return 0;
 }
-- 
2.46.0



[PATCH v5 68/80] drm/nouveau: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

The nouveau driver specifies a preferred color mode depending on
the available video memory, with a default of 32. Adapt this for
the new client interface.

v5:
- select DRM_CLIENT_SELECTION
v2:
- style changes

Signed-off-by: Thomas Zimmermann 
Cc: Karol Herbst 
Cc: Lyude Paul 
Cc: Danilo Krummrich 
Reviewed-by: Lyude Paul 
Acked-by: Danilo Krummrich 
---
 drivers/gpu/drm/nouveau/Kconfig   |  1 +
 drivers/gpu/drm/nouveau/nouveau_drm.c | 10 --
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/Kconfig b/drivers/gpu/drm/nouveau/Kconfig
index ceef470c9fbf..ce840300578d 100644
--- a/drivers/gpu/drm/nouveau/Kconfig
+++ b/drivers/gpu/drm/nouveau/Kconfig
@@ -4,6 +4,7 @@ config DRM_NOUVEAU
depends on DRM && PCI && MMU
select IOMMU_API
select FW_LOADER
+   select DRM_CLIENT_SELECTION
select DRM_DISPLAY_DP_HELPER
select DRM_DISPLAY_HDMI_HELPER
select DRM_DISPLAY_HELPER
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c 
b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 4a9a9b9c3935..628c47a60de5 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -31,6 +31,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -836,6 +837,7 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
 {
struct nvkm_device *device;
struct nouveau_drm *drm;
+   const struct drm_format_info *format;
int ret;
 
if (vga_switcheroo_client_probe_defer(pdev))
@@ -873,9 +875,11 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
goto fail_pci;
 
if (drm->client.device.info.ram_size <= 32 * 1024 * 1024)
-   drm_fbdev_ttm_setup(drm->dev, 8);
+   format = drm_format_info(DRM_FORMAT_C8);
else
-   drm_fbdev_ttm_setup(drm->dev, 32);
+   format = NULL;
+
+   drm_client_setup(drm->dev, format);
 
quirk_broken_nv_runpm(pdev);
return 0;
@@ -1317,6 +1321,8 @@ driver_stub = {
.dumb_create = nouveau_display_dumb_create,
.dumb_map_offset = drm_gem_ttm_dumb_map_offset,
 
+   DRM_FBDEV_TTM_DRIVER_OPS,
+
.name = DRIVER_NAME,
.desc = DRIVER_DESC,
 #ifdef GIT_REVISION
-- 
2.46.0



[PATCH v5 80/80] drm/omapdrm: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Rework fbdev probing to support fbdev_probe in struct drm_driver
and remove the old fb_probe callback. Provide an initializer macro
for struct drm_driver that sets the callback according to the kernel
configuration.

Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

The omapdrm driver specifies a preferred color mode of 32. As this
is the default if no format has been given, leave it out entirely.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Cc: Tomi Valkeinen 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/omapdrm/Kconfig  |   1 +
 drivers/gpu/drm/omapdrm/omap_drv.c   |   1 +
 drivers/gpu/drm/omapdrm/omap_fbdev.c | 131 ++-
 drivers/gpu/drm/omapdrm/omap_fbdev.h |   8 ++
 4 files changed, 39 insertions(+), 102 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/Kconfig b/drivers/gpu/drm/omapdrm/Kconfig
index fbd9af758581..9d4016bd0f44 100644
--- a/drivers/gpu/drm/omapdrm/Kconfig
+++ b/drivers/gpu/drm/omapdrm/Kconfig
@@ -4,6 +4,7 @@ config DRM_OMAP
depends on MMU
depends on DRM && OF
depends on ARCH_OMAP2PLUS || (COMPILE_TEST && PAGE_SIZE_LESS_THAN_64KB)
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_DISPLAY_HELPER
select DRM_BRIDGE_CONNECTOR
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c 
b/drivers/gpu/drm/omapdrm/omap_drv.c
index a982378aa141..1796cd20a877 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -647,6 +647,7 @@ static const struct drm_driver omap_drm_driver = {
.gem_prime_import = omap_gem_prime_import,
.dumb_create = omap_gem_dumb_create,
.dumb_map_offset = omap_gem_dumb_map_offset,
+   OMAP_FBDEV_DRIVER_OPS,
.ioctls = ioctls,
.num_ioctls = DRM_OMAP_NUM_IOCTLS,
.fops = &omapdriver_fops,
diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c 
b/drivers/gpu/drm/omapdrm/omap_fbdev.c
index 044e80403c3b..f4bd0c6e3f34 100644
--- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
+++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
@@ -6,6 +6,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -124,8 +125,32 @@ static const struct fb_ops omap_fb_ops = {
.fb_destroy = omap_fbdev_fb_destroy,
 };
 
-static int omap_fbdev_create(struct drm_fb_helper *helper,
-   struct drm_fb_helper_surface_size *sizes)
+static int omap_fbdev_dirty(struct drm_fb_helper *helper, struct drm_clip_rect 
*clip)
+{
+   if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2))
+   return 0;
+
+   if (helper->fb->funcs->dirty)
+   return helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 
1);
+
+   return 0;
+}
+
+static const struct drm_fb_helper_funcs omap_fbdev_helper_funcs = {
+   .fb_dirty = omap_fbdev_dirty,
+};
+
+static struct drm_fb_helper *get_fb(struct fb_info *fbi)
+{
+   if (!fbi || strcmp(fbi->fix.id, MODULE_NAME)) {
+   /* these are not the fb's you're looking for */
+   return NULL;
+   }
+   return fbi->par;
+}
+
+int omap_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
+ struct drm_fb_helper_surface_size *sizes)
 {
struct drm_device *dev = helper->dev;
struct omap_drm_private *priv = dev->dev_private;
@@ -207,6 +232,7 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,
 
DBG("fbi=%p, dev=%p", fbi, dev);
 
+   helper->funcs = &omap_fbdev_helper_funcs;
helper->fb = fb;
 
fbi->fbops = &omap_fb_ops;
@@ -253,94 +279,10 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,
return ret;
 }
 
-static int omap_fbdev_dirty(struct drm_fb_helper *helper, struct drm_clip_rect 
*clip)
-{
-   if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2))
-   return 0;
-
-   if (helper->fb->funcs->dirty)
-   return helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 
1);
-
-   return 0;
-}
-
-static const struct drm_fb_helper_funcs omap_fb_helper_funcs = {
-   .fb_probe = omap_fbdev_create,
-   .fb_dirty = omap_fbdev_dirty,
-};
-
-static struct drm_fb_helper *get_fb(struct fb_info *fbi)
-{
-   if (!fbi || strcmp(fbi->fix.id, MODULE_NAME)) {
-   /* these are not the fb's you're looking for */
-   return NULL;
-   }
-   return fbi->par;
-}
-
-/*
- * struct drm_client
- */
-
-static void omap_fbdev_client_unregister(struct drm_client_dev *client)
-{
-   struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client);
-
-   if (fb_helper->info) {
-   drm_fb_helper_unregister_info(fb_helper);
-   } else {
-  

[PATCH v5 63/80] drm/fbdev-shmem: Remove obsolete setup function

2024-09-24 Thread Thomas Zimmermann
The old setup function drm_fbdev_shmem_setup() is unused. Remove it
and its internal callbacks. New drivers should call drm_client_setup()
instead.

Signed-off-by: Thomas Zimmermann 
Reviewed-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/drm_fbdev_shmem.c | 120 +-
 include/drm/drm_fbdev_shmem.h |   6 --
 2 files changed, 1 insertion(+), 125 deletions(-)

diff --git a/drivers/gpu/drm/drm_fbdev_shmem.c 
b/drivers/gpu/drm/drm_fbdev_shmem.c
index 3bca333917d1..f824369baacd 100644
--- a/drivers/gpu/drm/drm_fbdev_shmem.c
+++ b/drivers/gpu/drm/drm_fbdev_shmem.c
@@ -2,15 +2,13 @@
 
 #include 
 
-#include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 
-#include 
-
 /*
  * struct fb_ops
  */
@@ -105,12 +103,6 @@ static struct page *drm_fbdev_shmem_get_page(struct 
fb_info *info, unsigned long
  * struct drm_fb_helper
  */
 
-static int drm_fbdev_shmem_helper_fb_probe(struct drm_fb_helper *fb_helper,
-  struct drm_fb_helper_surface_size 
*sizes)
-{
-   return drm_fbdev_shmem_driver_fbdev_probe(fb_helper, sizes);
-}
-
 static int drm_fbdev_shmem_helper_fb_dirty(struct drm_fb_helper *helper,
   struct drm_clip_rect *clip)
 {
@@ -131,7 +123,6 @@ static int drm_fbdev_shmem_helper_fb_dirty(struct 
drm_fb_helper *helper,
 }
 
 static const struct drm_fb_helper_funcs drm_fbdev_shmem_helper_funcs = {
-   .fb_probe = drm_fbdev_shmem_helper_fb_probe,
.fb_dirty = drm_fbdev_shmem_helper_fb_dirty,
 };
 
@@ -218,112 +209,3 @@ int drm_fbdev_shmem_driver_fbdev_probe(struct 
drm_fb_helper *fb_helper,
return ret;
 }
 EXPORT_SYMBOL(drm_fbdev_shmem_driver_fbdev_probe);
-
-/*
- * struct drm_client_funcs
- */
-
-static void drm_fbdev_shmem_client_unregister(struct drm_client_dev *client)
-{
-   struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client);
-
-   if (fb_helper->info) {
-   drm_fb_helper_unregister_info(fb_helper);
-   } else {
-   drm_client_release(&fb_helper->client);
-   drm_fb_helper_unprepare(fb_helper);
-   kfree(fb_helper);
-   }
-}
-
-static int drm_fbdev_shmem_client_restore(struct drm_client_dev *client)
-{
-   drm_fb_helper_lastclose(client->dev);
-
-   return 0;
-}
-
-static int drm_fbdev_shmem_client_hotplug(struct drm_client_dev *client)
-{
-   struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client);
-   struct drm_device *dev = client->dev;
-   int ret;
-
-   if (dev->fb_helper)
-   return drm_fb_helper_hotplug_event(dev->fb_helper);
-
-   ret = drm_fb_helper_init(dev, fb_helper);
-   if (ret)
-   goto err_drm_err;
-
-   if (!drm_drv_uses_atomic_modeset(dev))
-   drm_helper_disable_unused_functions(dev);
-
-   ret = drm_fb_helper_initial_config(fb_helper);
-   if (ret)
-   goto err_drm_fb_helper_fini;
-
-   return 0;
-
-err_drm_fb_helper_fini:
-   drm_fb_helper_fini(fb_helper);
-err_drm_err:
-   drm_err(dev, "fbdev-shmem: Failed to setup emulation (ret=%d)\n", ret);
-   return ret;
-}
-
-static const struct drm_client_funcs drm_fbdev_shmem_client_funcs = {
-   .owner  = THIS_MODULE,
-   .unregister = drm_fbdev_shmem_client_unregister,
-   .restore= drm_fbdev_shmem_client_restore,
-   .hotplug= drm_fbdev_shmem_client_hotplug,
-};
-
-/**
- * drm_fbdev_shmem_setup() - Setup fbdev emulation for GEM SHMEM helpers
- * @dev: DRM device
- * @preferred_bpp: Preferred bits per pixel for the device.
- * 32 is used if this is zero.
- *
- * This function sets up fbdev emulation for GEM DMA drivers that support
- * dumb buffers with a virtual address and that can be mmap'ed.
- * drm_fbdev_shmem_setup() shall be called after the DRM driver registered
- * the new DRM device with drm_dev_register().
- *
- * Restore, hotplug events and teardown are all taken care of. Drivers that do
- * suspend/resume need to call drm_fb_helper_set_suspend_unlocked() themselves.
- * Simple drivers might use drm_mode_config_helper_suspend().
- *
- * This function is safe to call even when there are no connectors present.
- * Setup will be retried on the next hotplug event.
- *
- * The fbdev is destroyed by drm_dev_unregister().
- */
-void drm_fbdev_shmem_setup(struct drm_device *dev, unsigned int preferred_bpp)
-{
-   struct drm_fb_helper *fb_helper;
-   int ret;
-
-   drm_WARN(dev, !dev->registered, "Device has not been registered.\n");
-   drm_WARN(dev, dev->fb_helper, "fb_helper is already set!\n");
-
-   fb_helper = kzalloc(sizeof(*fb_helper), GFP_KERNEL);
-   if (!fb_helper)
-   return;
-   drm_fb_helper_prepare(dev, fb_helper, preferred_bpp, 
&drm_fbdev_shmem_helper_funcs);
-
-   ret = drm_client_init(dev, &fb_he

[PATCH v5 54/80] drm/gud: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Cc: "Noralf Trønnes" 
Acked-by: Noralf Trønnes 
---
 drivers/gpu/drm/gud/Kconfig   | 1 +
 drivers/gpu/drm/gud/gud_drv.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/gud/Kconfig b/drivers/gpu/drm/gud/Kconfig
index 9c1e61f9eec3..b4d2136942f0 100644
--- a/drivers/gpu/drm/gud/Kconfig
+++ b/drivers/gpu/drm/gud/Kconfig
@@ -4,6 +4,7 @@ config DRM_GUD
tristate "GUD USB Display"
depends on DRM && USB && MMU
select LZ4_COMPRESS
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_GEM_SHMEM_HELPER
select BACKLIGHT_CLASS_DEVICE
diff --git a/drivers/gpu/drm/gud/gud_drv.c b/drivers/gpu/drm/gud/gud_drv.c
index ac6bbf920c72..09ccdc1dc1a2 100644
--- a/drivers/gpu/drm/gud/gud_drv.c
+++ b/drivers/gpu/drm/gud/gud_drv.c
@@ -15,6 +15,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -376,6 +377,7 @@ static const struct drm_driver gud_drm_driver = {
.fops   = &gud_fops,
DRM_GEM_SHMEM_DRIVER_OPS,
.gem_prime_import   = gud_gem_prime_import,
+   DRM_FBDEV_SHMEM_DRIVER_OPS,
 
.name   = "gud",
.desc   = "Generic USB Display",
@@ -622,7 +624,7 @@ static int gud_probe(struct usb_interface *intf, const 
struct usb_device_id *id)
 
drm_kms_helper_poll_init(drm);
 
-   drm_fbdev_shmem_setup(drm, 0);
+   drm_client_setup(drm, NULL);
 
return 0;
 }
-- 
2.46.0



[PATCH v5 67/80] drm/loongson: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

The loongson driver specifies a preferred color mode of 32. As this
is the default if no format has been given, leave it out entirely.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Cc: Sui Jingfeng 
Acked-by: Sui Jingfeng 
---
 drivers/gpu/drm/loongson/Kconfig| 1 +
 drivers/gpu/drm/loongson/lsdc_drv.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/loongson/Kconfig b/drivers/gpu/drm/loongson/Kconfig
index 9ed463a76ae2..552edfec7afb 100644
--- a/drivers/gpu/drm/loongson/Kconfig
+++ b/drivers/gpu/drm/loongson/Kconfig
@@ -4,6 +4,7 @@ config DRM_LOONGSON
tristate "DRM support for Loongson Graphics"
depends on DRM && PCI && MMU
depends on LOONGARCH || MIPS || COMPILE_TEST
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_TTM
select DRM_TTM_HELPER
diff --git a/drivers/gpu/drm/loongson/lsdc_drv.c 
b/drivers/gpu/drm/loongson/lsdc_drv.c
index adc7344d2f80..a19dce35c839 100644
--- a/drivers/gpu/drm/loongson/lsdc_drv.c
+++ b/drivers/gpu/drm/loongson/lsdc_drv.c
@@ -9,6 +9,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -47,6 +48,7 @@ static const struct drm_driver lsdc_drm_driver = {
.dumb_create = lsdc_dumb_create,
.dumb_map_offset = lsdc_dumb_map_offset,
.gem_prime_import_sg_table = lsdc_prime_import_sg_table,
+   DRM_FBDEV_TTM_DRIVER_OPS,
 };
 
 static const struct drm_mode_config_funcs lsdc_mode_config_funcs = {
@@ -314,7 +316,7 @@ static int lsdc_pci_probe(struct pci_dev *pdev, const 
struct pci_device_id *ent)
if (ret)
return ret;
 
-   drm_fbdev_ttm_setup(ddev, 32);
+   drm_client_setup(ddev, NULL);
 
return 0;
 }
-- 
2.46.0



[PATCH v5 31/80] drm/panel-mipi-dbi: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Cc: "Noralf Trønnes" 
Acked-by: Noralf Trønnes 
---
 drivers/gpu/drm/tiny/Kconfig  | 1 +
 drivers/gpu/drm/tiny/panel-mipi-dbi.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tiny/Kconfig b/drivers/gpu/drm/tiny/Kconfig
index 17e0160b05ac..98af6fd6aa70 100644
--- a/drivers/gpu/drm/tiny/Kconfig
+++ b/drivers/gpu/drm/tiny/Kconfig
@@ -66,6 +66,7 @@ config DRM_OFDRM
 config DRM_PANEL_MIPI_DBI
tristate "DRM support for MIPI DBI compatible panels"
depends on DRM && SPI
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_GEM_DMA_HELPER
select DRM_MIPI_DBI
diff --git a/drivers/gpu/drm/tiny/panel-mipi-dbi.c 
b/drivers/gpu/drm/tiny/panel-mipi-dbi.c
index f753cdffe6f8..e66729b31bd6 100644
--- a/drivers/gpu/drm/tiny/panel-mipi-dbi.c
+++ b/drivers/gpu/drm/tiny/panel-mipi-dbi.c
@@ -15,6 +15,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -264,6 +265,7 @@ static const struct drm_driver panel_mipi_dbi_driver = {
.driver_features= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
.fops   = &panel_mipi_dbi_fops,
DRM_GEM_DMA_DRIVER_OPS_VMAP,
+   DRM_FBDEV_DMA_DRIVER_OPS,
.debugfs_init   = mipi_dbi_debugfs_init,
.name   = "panel-mipi-dbi",
.desc   = "MIPI DBI compatible display panel",
@@ -388,7 +390,7 @@ static int panel_mipi_dbi_spi_probe(struct spi_device *spi)
 
spi_set_drvdata(spi, drm);
 
-   drm_fbdev_dma_setup(drm, 0);
+   drm_client_setup(drm, NULL);
 
return 0;
 }
-- 
2.46.0



[PATCH v5 80/80] drm/omapdrm: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Rework fbdev probing to support fbdev_probe in struct drm_driver
and remove the old fb_probe callback. Provide an initializer macro
for struct drm_driver that sets the callback according to the kernel
configuration.

Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

The omapdrm driver specifies a preferred color mode of 32. As this
is the default if no format has been given, leave it out entirely.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Cc: Tomi Valkeinen 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/omapdrm/Kconfig  |   1 +
 drivers/gpu/drm/omapdrm/omap_drv.c   |   1 +
 drivers/gpu/drm/omapdrm/omap_fbdev.c | 131 ++-
 drivers/gpu/drm/omapdrm/omap_fbdev.h |   8 ++
 4 files changed, 39 insertions(+), 102 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/Kconfig b/drivers/gpu/drm/omapdrm/Kconfig
index fbd9af758581..9d4016bd0f44 100644
--- a/drivers/gpu/drm/omapdrm/Kconfig
+++ b/drivers/gpu/drm/omapdrm/Kconfig
@@ -4,6 +4,7 @@ config DRM_OMAP
depends on MMU
depends on DRM && OF
depends on ARCH_OMAP2PLUS || (COMPILE_TEST && PAGE_SIZE_LESS_THAN_64KB)
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_DISPLAY_HELPER
select DRM_BRIDGE_CONNECTOR
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c 
b/drivers/gpu/drm/omapdrm/omap_drv.c
index a982378aa141..1796cd20a877 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -647,6 +647,7 @@ static const struct drm_driver omap_drm_driver = {
.gem_prime_import = omap_gem_prime_import,
.dumb_create = omap_gem_dumb_create,
.dumb_map_offset = omap_gem_dumb_map_offset,
+   OMAP_FBDEV_DRIVER_OPS,
.ioctls = ioctls,
.num_ioctls = DRM_OMAP_NUM_IOCTLS,
.fops = &omapdriver_fops,
diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c 
b/drivers/gpu/drm/omapdrm/omap_fbdev.c
index 044e80403c3b..f4bd0c6e3f34 100644
--- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
+++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
@@ -6,6 +6,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -124,8 +125,32 @@ static const struct fb_ops omap_fb_ops = {
.fb_destroy = omap_fbdev_fb_destroy,
 };
 
-static int omap_fbdev_create(struct drm_fb_helper *helper,
-   struct drm_fb_helper_surface_size *sizes)
+static int omap_fbdev_dirty(struct drm_fb_helper *helper, struct drm_clip_rect 
*clip)
+{
+   if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2))
+   return 0;
+
+   if (helper->fb->funcs->dirty)
+   return helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 
1);
+
+   return 0;
+}
+
+static const struct drm_fb_helper_funcs omap_fbdev_helper_funcs = {
+   .fb_dirty = omap_fbdev_dirty,
+};
+
+static struct drm_fb_helper *get_fb(struct fb_info *fbi)
+{
+   if (!fbi || strcmp(fbi->fix.id, MODULE_NAME)) {
+   /* these are not the fb's you're looking for */
+   return NULL;
+   }
+   return fbi->par;
+}
+
+int omap_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
+ struct drm_fb_helper_surface_size *sizes)
 {
struct drm_device *dev = helper->dev;
struct omap_drm_private *priv = dev->dev_private;
@@ -207,6 +232,7 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,
 
DBG("fbi=%p, dev=%p", fbi, dev);
 
+   helper->funcs = &omap_fbdev_helper_funcs;
helper->fb = fb;
 
fbi->fbops = &omap_fb_ops;
@@ -253,94 +279,10 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,
return ret;
 }
 
-static int omap_fbdev_dirty(struct drm_fb_helper *helper, struct drm_clip_rect 
*clip)
-{
-   if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2))
-   return 0;
-
-   if (helper->fb->funcs->dirty)
-   return helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 
1);
-
-   return 0;
-}
-
-static const struct drm_fb_helper_funcs omap_fb_helper_funcs = {
-   .fb_probe = omap_fbdev_create,
-   .fb_dirty = omap_fbdev_dirty,
-};
-
-static struct drm_fb_helper *get_fb(struct fb_info *fbi)
-{
-   if (!fbi || strcmp(fbi->fix.id, MODULE_NAME)) {
-   /* these are not the fb's you're looking for */
-   return NULL;
-   }
-   return fbi->par;
-}
-
-/*
- * struct drm_client
- */
-
-static void omap_fbdev_client_unregister(struct drm_client_dev *client)
-{
-   struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client);
-
-   if (fb_helper->info) {
-   drm_fb_helper_unregister_info(fb_helper);
-   } else {
-  

[PATCH v5 39/80] drm/stm: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup_with-fourcc() to run the kernel's default client
setup for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

v5:
- select DRM_CLIENT_SELECTION
v4:
- remove duplicated S-o-b tag (Gerd)
v2:
- use drm_client_setup_with_fourcc()

Signed-off-by: Thomas Zimmermann 
Cc: Yannick Fertre 
Cc: Raphael Gallais-Pou 
Cc: Philippe Cornu 
Cc: Maxime Coquelin 
Cc: Alexandre Torgue 
Acked-by: Raphael Gallais-Pou 
---
 drivers/gpu/drm/stm/Kconfig | 1 +
 drivers/gpu/drm/stm/drv.c   | 5 -
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/stm/Kconfig b/drivers/gpu/drm/stm/Kconfig
index d7f41a87808e..635be0ac00af 100644
--- a/drivers/gpu/drm/stm/Kconfig
+++ b/drivers/gpu/drm/stm/Kconfig
@@ -3,6 +3,7 @@ config DRM_STM
tristate "DRM Support for STMicroelectronics SoC Series"
depends on DRM && (ARCH_STM32 || COMPILE_TEST)
depends on COMMON_CLK
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_GEM_DMA_HELPER
select DRM_PANEL_BRIDGE
diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
index e1232f74dfa5..fee274a60623 100644
--- a/drivers/gpu/drm/stm/drv.c
+++ b/drivers/gpu/drm/stm/drv.c
@@ -18,8 +18,10 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -66,6 +68,7 @@ static const struct drm_driver drv_driver = {
.patchlevel = 0,
.fops = &drv_driver_fops,
DRM_GEM_DMA_DRIVER_OPS_WITH_DUMB_CREATE(stm_gem_dma_dumb_create),
+   DRM_FBDEV_DMA_DRIVER_OPS,
 };
 
 static int drv_load(struct drm_device *ddev)
@@ -206,7 +209,7 @@ static int stm_drm_platform_probe(struct platform_device 
*pdev)
if (ret)
goto err_unload;
 
-   drm_fbdev_dma_setup(ddev, 16);
+   drm_client_setup_with_fourcc(ddev, DRM_FORMAT_RGB565);
 
return 0;
 
-- 
2.46.0



[PATCH v5 07/80] drm/arm/komeda: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

The komeda driver specifies a preferred color mode of 32. As this
is the default if no format has been given, leave it out entirely.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Cc: Liviu Dudau 
Acked-by: Liviu Dudau 
---
 drivers/gpu/drm/arm/display/Kconfig | 1 +
 drivers/gpu/drm/arm/display/komeda/komeda_drv.c | 4 ++--
 drivers/gpu/drm/arm/display/komeda/komeda_kms.c | 2 ++
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/arm/display/Kconfig 
b/drivers/gpu/drm/arm/display/Kconfig
index 4acc4285a4eb..415c10a6374b 100644
--- a/drivers/gpu/drm/arm/display/Kconfig
+++ b/drivers/gpu/drm/arm/display/Kconfig
@@ -3,6 +3,7 @@ config DRM_KOMEDA
tristate "ARM Komeda display driver"
depends on DRM && OF
depends on COMMON_CLK
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_GEM_DMA_HELPER
select VIDEOMODE_HELPERS
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c 
b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
index 55c3773befde..6d475bb34002 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
@@ -9,7 +9,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include "komeda_dev.h"
@@ -84,7 +84,7 @@ static int komeda_platform_probe(struct platform_device *pdev)
}
 
dev_set_drvdata(dev, mdrv);
-   drm_fbdev_dma_setup(&mdrv->kms->base, 32);
+   drm_client_setup(&mdrv->kms->base, NULL);
 
return 0;
 
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c 
b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
index e5eb5d672bcd..1e7b1fcb2848 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
@@ -9,6 +9,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -58,6 +59,7 @@ static irqreturn_t komeda_kms_irq_handler(int irq, void *data)
 static const struct drm_driver komeda_kms_driver = {
.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
DRM_GEM_DMA_DRIVER_OPS_WITH_DUMB_CREATE(komeda_gem_dma_dumb_create),
+   DRM_FBDEV_DMA_DRIVER_OPS,
.fops = &komeda_cma_fops,
.name = "komeda",
.desc = "Arm Komeda Display Processor driver",
-- 
2.46.0



[PATCH v5 28/80] drm/mi0283qt: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Cc: "Noralf Trønnes" 
Acked-by: Noralf Trønnes 
---
 drivers/gpu/drm/tiny/Kconfig| 1 +
 drivers/gpu/drm/tiny/mi0283qt.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tiny/Kconfig b/drivers/gpu/drm/tiny/Kconfig
index 7ee887b55aee..17e0160b05ac 100644
--- a/drivers/gpu/drm/tiny/Kconfig
+++ b/drivers/gpu/drm/tiny/Kconfig
@@ -168,6 +168,7 @@ config TINYDRM_ILI9486
 config TINYDRM_MI0283QT
tristate "DRM support for MI0283QT"
depends on DRM && SPI
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_GEM_DMA_HELPER
select DRM_MIPI_DBI
diff --git a/drivers/gpu/drm/tiny/mi0283qt.c b/drivers/gpu/drm/tiny/mi0283qt.c
index cdc5423990ca..f1461c55dba6 100644
--- a/drivers/gpu/drm/tiny/mi0283qt.c
+++ b/drivers/gpu/drm/tiny/mi0283qt.c
@@ -14,6 +14,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -154,6 +155,7 @@ static const struct drm_driver mi0283qt_driver = {
.driver_features= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
.fops   = &mi0283qt_fops,
DRM_GEM_DMA_DRIVER_OPS_VMAP,
+   DRM_FBDEV_DMA_DRIVER_OPS,
.debugfs_init   = mipi_dbi_debugfs_init,
.name   = "mi0283qt",
.desc   = "Multi-Inno MI0283QT",
@@ -226,7 +228,7 @@ static int mi0283qt_probe(struct spi_device *spi)
 
spi_set_drvdata(spi, drm);
 
-   drm_fbdev_dma_setup(drm, 0);
+   drm_client_setup(drm, NULL);
 
return 0;
 }
-- 
2.46.0



[PATCH v5 14/80] drm/hx8357d: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/tiny/Kconfig   | 1 +
 drivers/gpu/drm/tiny/hx8357d.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tiny/Kconfig b/drivers/gpu/drm/tiny/Kconfig
index 750616a8ee05..5e0dd0dfc55f 100644
--- a/drivers/gpu/drm/tiny/Kconfig
+++ b/drivers/gpu/drm/tiny/Kconfig
@@ -98,6 +98,7 @@ config DRM_SIMPLEDRM
 config TINYDRM_HX8357D
tristate "DRM support for HX8357D display panels"
depends on DRM && SPI
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_GEM_DMA_HELPER
select DRM_MIPI_DBI
diff --git a/drivers/gpu/drm/tiny/hx8357d.c b/drivers/gpu/drm/tiny/hx8357d.c
index 2e631282edeb..6b0d1846cfcf 100644
--- a/drivers/gpu/drm/tiny/hx8357d.c
+++ b/drivers/gpu/drm/tiny/hx8357d.c
@@ -17,6 +17,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -194,6 +195,7 @@ static const struct drm_driver hx8357d_driver = {
.driver_features= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
.fops   = &hx8357d_fops,
DRM_GEM_DMA_DRIVER_OPS_VMAP,
+   DRM_FBDEV_DMA_DRIVER_OPS,
.debugfs_init   = mipi_dbi_debugfs_init,
.name   = "hx8357d",
.desc   = "HX8357D",
@@ -256,7 +258,7 @@ static int hx8357d_probe(struct spi_device *spi)
 
spi_set_drvdata(spi, drm);
 
-   drm_fbdev_dma_setup(drm, 0);
+   drm_client_setup(drm, NULL);
 
return 0;
 }
-- 
2.46.0



[PATCH v5 10/80] drm/aspeed: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

The aspeed driver specifies a preferred color mode of 32. As this
is the default if no format has been given, leave it out entirely.

v5:
- select DRM_CLIENT_SELECTION
v3:
- add DRM_FBDEV_DMA_DRIVER_OPS macro

Signed-off-by: Thomas Zimmermann 
Cc: Joel Stanley 
Cc: Andrew Jeffery 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/aspeed/Kconfig  | 1 +
 drivers/gpu/drm/aspeed/aspeed_gfx_drv.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/aspeed/Kconfig b/drivers/gpu/drm/aspeed/Kconfig
index 8137c39b057b..6e68f20aac21 100644
--- a/drivers/gpu/drm/aspeed/Kconfig
+++ b/drivers/gpu/drm/aspeed/Kconfig
@@ -4,6 +4,7 @@ config DRM_ASPEED_GFX
depends on DRM && OF
depends on (COMPILE_TEST || ARCH_ASPEED)
depends on MMU
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_GEM_DMA_HELPER
select DMA_CMA if HAVE_DMA_CONTIGUOUS
diff --git a/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c 
b/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
index a7a6b70220eb..109023815fa2 100644
--- a/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
+++ b/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
@@ -14,6 +14,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -247,6 +248,7 @@ DEFINE_DRM_GEM_DMA_FOPS(fops);
 static const struct drm_driver aspeed_gfx_driver = {
.driver_features= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
DRM_GEM_DMA_DRIVER_OPS,
+   DRM_FBDEV_DMA_DRIVER_OPS,
.fops = &fops,
.name = "aspeed-gfx-drm",
.desc = "ASPEED GFX DRM",
@@ -339,7 +341,7 @@ static int aspeed_gfx_probe(struct platform_device *pdev)
if (ret)
goto err_unload;
 
-   drm_fbdev_dma_setup(&priv->drm, 32);
+   drm_client_setup(&priv->drm, NULL);
return 0;
 
 err_unload:
-- 
2.46.0



[PATCH v5 04/80] drm: Add client-agnostic setup helper

2024-09-24 Thread Thomas Zimmermann
DRM may support multiple in-kernel clients that run as soon as a DRM
driver has been registered. To select the client(s) in a single place,
introduce drm_client_setup().

Drivers that call the new helper automatically instantiate the kernel's
configured default clients. Only fbdev emulation is currently supported.
Later versions can add support for DRM-based logging, a boot logo or even
a console.

Some drivers handle the color mode for clients internally. Provide the
helper drm_client_setup_with_color_mode() for them.

Using the new interface requires the driver to select
DRM_CLIENT_SELECTION in its Kconfig. For now this only enables the
client-setup helpers if the fbdev client has been configured by the
user. A future patchset will further modularize client support and
rework DRM_CLIENT_SELECTION to select the correct dependencies for
all its clients.

v5:
- add CONFIG_DRM_CLIENT_SELECTION und DRM_CLIENT_SETUP
v4:
- fix docs for drm_client_setup_with_fourcc() (Geert)
v3:
- fix build error
v2:
- add drm_client_setup_with_fourcc() (Laurent)
- push default-format handling into actual clients

Signed-off-by: Thomas Zimmermann 
Reviewed-by: Laurent Pinchart 
---
 drivers/gpu/drm/Kconfig| 12 ++
 drivers/gpu/drm/Makefile   |  2 +
 drivers/gpu/drm/drm_client_setup.c | 66 ++
 include/drm/drm_client_setup.h | 26 
 4 files changed, 106 insertions(+)
 create mode 100644 drivers/gpu/drm/drm_client_setup.c
 create mode 100644 include/drm/drm_client_setup.h

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 1cb5a4f19293..f045ff0e8c99 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -210,6 +210,18 @@ config DRM_DEBUG_MODESET_LOCK
 
  If in doubt, say "N".
 
+config DRM_CLIENT_SELECTION
+   bool
+   depends on DRM
+   select DRM_CLIENT_SETUP if DRM_FBDEV_EMULATION
+   help
+ Drivers that support in-kernel DRM clients have to select this
+ option.
+
+config DRM_CLIENT_SETUP
+   bool
+   depends on DRM_CLIENT_SELECTION
+
 config DRM_FBDEV_EMULATION
bool "Enable legacy fbdev support for your modesetting driver"
depends on DRM
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index d7a684ae6a59..47d66fe28367 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -143,6 +143,8 @@ drm_kms_helper-y := \
drm_rect.o \
drm_self_refresh_helper.o \
drm_simple_kms_helper.o
+drm_kms_helper-$(CONFIG_DRM_CLIENT_SETUP) += \
+   drm_client_setup.o
 drm_kms_helper-$(CONFIG_DRM_PANEL_BRIDGE) += bridge/panel.o
 drm_kms_helper-$(CONFIG_DRM_FBDEV_EMULATION) += \
drm_fbdev_client.o \
diff --git a/drivers/gpu/drm/drm_client_setup.c 
b/drivers/gpu/drm/drm_client_setup.c
new file mode 100644
index ..5969c4ffe31b
--- /dev/null
+++ b/drivers/gpu/drm/drm_client_setup.c
@@ -0,0 +1,66 @@
+// SPDX-License-Identifier: MIT
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/**
+ * drm_client_setup() - Setup in-kernel DRM clients
+ * @dev: DRM device
+ * @format: Preferred pixel format for the device. Use NULL, unless
+ *  there is clearly a driver-preferred format.
+ *
+ * This function sets up the in-kernel DRM clients. Restore, hotplug
+ * events and teardown are all taken care of.
+ *
+ * Drivers should call drm_client_setup() after registering the new
+ * DRM device with drm_dev_register(). This function is safe to call
+ * even when there are no connectors present. Setup will be retried
+ * on the next hotplug event.
+ *
+ * The clients are destroyed by drm_dev_unregister().
+ */
+void drm_client_setup(struct drm_device *dev, const struct drm_format_info 
*format)
+{
+   int ret;
+
+   ret = drm_fbdev_client_setup(dev, format);
+   if (ret)
+   drm_warn(dev, "Failed to set up DRM client; error %d\n", ret);
+}
+EXPORT_SYMBOL(drm_client_setup);
+
+/**
+ * drm_client_setup_with_fourcc() - Setup in-kernel DRM clients for color mode
+ * @dev: DRM device
+ * @fourcc: Preferred pixel format as 4CC code for the device
+ *
+ * This function sets up the in-kernel DRM clients. It is equivalent
+ * to drm_client_setup(), but expects a 4CC code as second argument.
+ */
+void drm_client_setup_with_fourcc(struct drm_device *dev, u32 fourcc)
+{
+   drm_client_setup(dev, drm_format_info(fourcc));
+}
+EXPORT_SYMBOL(drm_client_setup_with_fourcc);
+
+/**
+ * drm_client_setup_with_color_mode() - Setup in-kernel DRM clients for color 
mode
+ * @dev: DRM device
+ * @color_mode: Preferred color mode for the device
+ *
+ * This function sets up the in-kernel DRM clients. It is equivalent
+ * to drm_client_setup(), but expects a color mode as second argument.
+ *
+ * Do not use this function in new drivers. Prefer drm_client_setup() with a
+ * format of NULL.
+ */
+void drm_client_setup_with_color_mode(struct drm_device *dev, unsigned int

Re: [PATCH for-9.1 6/9] block/nbd: Use URI parsing code from glib

2024-09-24 Thread Thomas Huth

On 23/09/2024 18.03, Eric Blake wrote:

On Sun, Sep 22, 2024 at 08:51:22PM GMT, Richard W.M. Jones wrote:

On Thu, Mar 28, 2024 at 02:13:42PM +, Richard W.M. Jones wrote:

On Thu, Mar 28, 2024 at 03:06:03PM +0100, Thomas Huth wrote:

Since version 2.66, glib has useful URI parsing functions, too.
Use those instead of the QEMU-internal ones to be finally able
to get rid of the latter. The g_uri_get_host() also takes care
of removing the square brackets from IPv6 addresses, so we can
drop that part of the QEMU code now, too.



  
-p = uri->path ? uri->path : "";

+p = g_uri_get_path(uri) ?: "";
  if (p[0] == '/') {
  p++;
  }



Looks ok,

Reviewed-by: Richard W.M. Jones 


Or maybe not.  This caused a regression in the nbdkit test suite (when
we use qemu-img from 9.1).  It seems the exportname part of the NBD
URI gets munged:

https://gitlab.com/qemu-project/qemu/-/issues/2584


To be more specific, it looks like
g_uri_get_path("./name//with//..//slashes") is getting munged to
"name/slashes".  That is, glib is blindly assuming that ./ and XXX/../
can be dropped, and // can be simplified to /, which may be true for
arbitrary file names but not true for abitrary URIs (since URIs have
application-specific semantics, which may not match path name
traversal semantics).  Looks like we need to report a bug to glib,
and/or see if glib's URI functions have a flag for turning off this
unwanted munging.

Or we may just want to document this corner case change as
intentional.


Ok ... so how bad is this for NBD? Can we go along with the odditiy or is 
this breaking some real world NBD scenarios?


... in the worst case, we have to revert the patch ...

 Thomas




Re: [PATCH for-9.1 6/9] block/nbd: Use URI parsing code from glib

2024-09-24 Thread Thomas Huth

On 23/09/2024 18.03, Eric Blake wrote:

On Sun, Sep 22, 2024 at 08:51:22PM GMT, Richard W.M. Jones wrote:

On Thu, Mar 28, 2024 at 02:13:42PM +, Richard W.M. Jones wrote:

On Thu, Mar 28, 2024 at 03:06:03PM +0100, Thomas Huth wrote:

Since version 2.66, glib has useful URI parsing functions, too.
Use those instead of the QEMU-internal ones to be finally able
to get rid of the latter. The g_uri_get_host() also takes care
of removing the square brackets from IPv6 addresses, so we can
drop that part of the QEMU code now, too.



  
-p = uri->path ? uri->path : "";

+p = g_uri_get_path(uri) ?: "";
  if (p[0] == '/') {
  p++;
  }



Looks ok,

Reviewed-by: Richard W.M. Jones 


Or maybe not.  This caused a regression in the nbdkit test suite (when
we use qemu-img from 9.1).  It seems the exportname part of the NBD
URI gets munged:

https://gitlab.com/qemu-project/qemu/-/issues/2584


To be more specific, it looks like
g_uri_get_path("./name//with//..//slashes") is getting munged to
"name/slashes".  That is, glib is blindly assuming that ./ and XXX/../
can be dropped, and // can be simplified to /, which may be true for
arbitrary file names but not true for abitrary URIs (since URIs have
application-specific semantics, which may not match path name
traversal semantics).  Looks like we need to report a bug to glib,
and/or see if glib's URI functions have a flag for turning off this
unwanted munging.

Or we may just want to document this corner case change as
intentional.


Ok ... so how bad is this for NBD? Can we go along with the odditiy or is 
this breaking some real world NBD scenarios?


... in the worst case, we have to revert the patch ...

 Thomas




Re: [PATCH 6/6] fbcon: Use 'bool' where appopriate

2024-09-24 Thread Thomas Zimmermann




Am 23.09.24 um 17:57 schrieb Ville Syrjala:

From: Ville Syrjälä 

Use 'bool' type where it makes more sense than 'int'.

Signed-off-by: Ville Syrjälä 


Reviewed-by: Thomas Zimmermann 


---
  drivers/video/fbdev/core/fbcon.c | 23 ---
  1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 17540cdf1edf..03d48e665bba 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -129,9 +129,9 @@ static int logo_shown = FBCON_LOGO_CANSHOW;
  /* console mappings */
  static unsigned int first_fb_vc;
  static unsigned int last_fb_vc = MAX_NR_CONSOLES - 1;
-static int fbcon_is_default = 1;
+static bool fbcon_is_default = true;
  static int primary_device = -1;
-static int fbcon_has_console_bind;
+static bool fbcon_has_console_bind;
  
  #ifdef CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY

  static int map_override;
@@ -166,7 +166,7 @@ static const struct consw fb_con;
  
  #define advance_row(p, delta) (unsigned short *)((unsigned long)(p) + (delta) * vc->vc_size_row)
  
-static int fbcon_cursor_blink;

+static bool fbcon_cursor_blink;
  
  #define divides(a, b)	((!(a) || (b)%(a)) ? 0 : 1)
  
@@ -281,7 +281,7 @@ static bool fbcon_skip_panic(struct fb_info *info)

  #endif
  }
  
-static inline int fbcon_is_active(struct vc_data *vc, struct fb_info *info)

+static inline bool fbcon_is_active(struct vc_data *vc, struct fb_info *info)
  {
struct fbcon_ops *ops = info->fbcon_par;
  
@@ -290,7 +290,7 @@ static inline int fbcon_is_active(struct vc_data *vc, struct fb_info *info)

  }
  
  static int get_color(struct vc_data *vc, struct fb_info *info,

- u16 c, int is_fg)
+u16 c, bool is_fg)
  {
int depth = fb_get_color_depth(&info->var, &info->fix);
int color = 0;
@@ -358,12 +358,12 @@ static int get_color(struct vc_data *vc, struct fb_info 
*info,
  
  static int get_fg_color(struct vc_data *vc, struct fb_info *info, u16 c)

  {
-   return get_color(vc, info, c, 1);
+   return get_color(vc, info, c, true);
  }
  
  static int get_bg_color(struct vc_data *vc, struct fb_info *info, u16 c)

  {
-   return get_color(vc, info, c, 0);
+   return get_color(vc, info, c, false);
  }
  
  static void fb_flashcursor(struct work_struct *work)

@@ -467,7 +467,7 @@ static int __init fb_console_setup(char *this_opt)
last_fb_vc = simple_strtoul(options, &options, 
10) - 1;
if (last_fb_vc < first_fb_vc || last_fb_vc >= 
MAX_NR_CONSOLES)
last_fb_vc = MAX_NR_CONSOLES - 1;
-   fbcon_is_default = 0;
+   fbcon_is_default = false;
continue;
}
  
@@ -558,7 +558,7 @@ static int do_fbcon_takeover(int show_logo)

con2fb_map[i] = -1;
info_idx = -1;
} else {
-   fbcon_has_console_bind = 1;
+   fbcon_has_console_bind = true;
}
  
  	return err;

@@ -2802,7 +2802,7 @@ static void fbcon_unbind(void)
fbcon_is_default);
  
  	if (!ret)

-   fbcon_has_console_bind = 0;
+   fbcon_has_console_bind = false;
  }
  #else
  static inline void fbcon_unbind(void) {}
@@ -3234,8 +3234,9 @@ static ssize_t cursor_blink_store(struct device *device,
  const char *buf, size_t count)
  {
struct fb_info *info;
-   int blink, idx;
char **last = NULL;
+   bool blink;
+   int idx;
  
  	blink = simple_strtoul(buf, last, 0);
  


--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)



Re: [PATCH 4/6] fbcon: fbcon_is_inactive() -> fbcon_is_active()

2024-09-24 Thread Thomas Zimmermann




Am 23.09.24 um 17:57 schrieb Ville Syrjala:

From: Ville Syrjälä 

Invert fbcon_is_inactive() into fbcon_is_active(). Much easier
on the poor brain when you don't have to do dobule negations
all over the place.

Signed-off-by: Ville Syrjälä 


Reviewed-by: Thomas Zimmermann 


---
  drivers/video/fbdev/core/fbcon.c | 30 +++---
  1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index eb30aa872371..2a78cca3e9de 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -281,12 +281,12 @@ static bool fbcon_skip_panic(struct fb_info *info)
  #endif
  }
  
-static inline int fbcon_is_inactive(struct vc_data *vc, struct fb_info *info)

+static inline int fbcon_is_active(struct vc_data *vc, struct fb_info *info)
  {
struct fbcon_ops *ops = info->fbcon_par;
  
-	return (info->state != FBINFO_STATE_RUNNING ||

-   vc->vc_mode != KD_TEXT || ops->graphics || 
fbcon_skip_panic(info));
+   return info->state == FBINFO_STATE_RUNNING &&
+   vc->vc_mode == KD_TEXT && !ops->graphics && 
!fbcon_skip_panic(info);
  }
  
  static int get_color(struct vc_data *vc, struct fb_info *info,

@@ -1253,7 +1253,7 @@ static void __fbcon_clear(struct vc_data *vc, unsigned 
int sy, unsigned int sx,
struct fbcon_display *p = &fb_display[vc->vc_num];
u_int y_break;
  
-	if (fbcon_is_inactive(vc, info))

+   if (!fbcon_is_active(vc, info))
return;
  
  	if (!height || !width)

@@ -1295,7 +1295,7 @@ static void fbcon_putcs(struct vc_data *vc, const u16 *s, 
unsigned int count,
struct fbcon_display *p = &fb_display[vc->vc_num];
struct fbcon_ops *ops = info->fbcon_par;
  
-	if (!fbcon_is_inactive(vc, info))

+   if (fbcon_is_active(vc, info))
ops->putcs(vc, info, s, count, real_y(p, ypos), xpos,
   get_color(vc, info, scr_readw(s), 1),
   get_color(vc, info, scr_readw(s), 0));
@@ -1306,7 +1306,7 @@ static void fbcon_clear_margins(struct vc_data *vc, int 
bottom_only)
struct fb_info *info = fbcon_info_from_console(vc->vc_num);
struct fbcon_ops *ops = info->fbcon_par;
  
-	if (!fbcon_is_inactive(vc, info))

+   if (fbcon_is_active(vc, info))
ops->clear_margins(vc, info, margin_color, bottom_only);
  }
  
@@ -1318,7 +1318,7 @@ static void fbcon_cursor(struct vc_data *vc, bool enable)
  
  	ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms);
  
-	if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1)

+   if (!fbcon_is_active(vc, info) || vc->vc_deccm != 1)
return;
  
  	if (vc->vc_cursor_type & CUR_SW)

@@ -1724,7 +1724,7 @@ static void fbcon_bmove(struct vc_data *vc, int sy, int 
sx, int dy, int dx,
struct fb_info *info = fbcon_info_from_console(vc->vc_num);
struct fbcon_display *p = &fb_display[vc->vc_num];
  
-	if (fbcon_is_inactive(vc, info))

+   if (!fbcon_is_active(vc, info))
return;
  
  	if (!width || !height)

@@ -1748,7 +1748,7 @@ static bool fbcon_scroll(struct vc_data *vc, unsigned int 
t, unsigned int b,
struct fbcon_display *p = &fb_display[vc->vc_num];
int scroll_partial = info->flags & FBINFO_PARTIAL_PAN_OK;
  
-	if (fbcon_is_inactive(vc, info))

+   if (!fbcon_is_active(vc, info))
return true;
  
  	fbcon_cursor(vc, false);

@@ -2132,7 +2132,7 @@ static bool fbcon_switch(struct vc_data *vc)
fbcon_del_cursor_work(old_info);
}
  
-	if (fbcon_is_inactive(vc, info) ||

+   if (!fbcon_is_active(vc, info) ||
ops->blank_state != FB_BLANK_UNBLANK)
fbcon_del_cursor_work(info);
else
@@ -2172,7 +2172,7 @@ static bool fbcon_switch(struct vc_data *vc)
scrollback_max = 0;
scrollback_current = 0;
  
-	if (!fbcon_is_inactive(vc, info)) {

+   if (fbcon_is_active(vc, info)) {
ops->var.xoffset = ops->var.yoffset = p->yscroll = 0;
ops->update_start(info);
}
@@ -2228,7 +2228,7 @@ static bool fbcon_blank(struct vc_data *vc, enum 
vesa_blank_mode blank,
}
}
  
- 	if (!fbcon_is_inactive(vc, info)) {

+   if (fbcon_is_active(vc, info)) {
if (ops->blank_state != blank) {
ops->blank_state = blank;
fbcon_cursor(vc, !blank);
@@ -2242,7 +2242,7 @@ static bool fbcon_blank(struct vc_data *vc, enum 
vesa_blank_mode blank,
update_screen(vc);
}
  
-	if (mode_switch || fbcon_is_inactive(vc, info) ||

+   if (mode_switch || !fbcon_is_active(vc, info) ||
ops->blank_state != FB_BLANK_UNBLANK)
fbcon_del_cursor_work(i

[PATCH v5 45/80] drm/tve200: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup_with_fourcc() to run the kernel's default client
setup for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

v5:
- select DRM_CLIENT_SELECTION
v2:
- use drm_client_setup_with_fourcc()

Signed-off-by: Thomas Zimmermann 
Cc: Linus Walleij 
Acked-by: Linus Walleij 
---
 drivers/gpu/drm/tve200/Kconfig  | 1 +
 drivers/gpu/drm/tve200/tve200_drv.c | 9 -
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/tve200/Kconfig b/drivers/gpu/drm/tve200/Kconfig
index 5121fed571a5..a9d6fe535d88 100644
--- a/drivers/gpu/drm/tve200/Kconfig
+++ b/drivers/gpu/drm/tve200/Kconfig
@@ -6,6 +6,7 @@ config DRM_TVE200
depends on ARM || COMPILE_TEST
depends on OF
select DRM_BRIDGE
+   select DRM_CLIENT_SELECTION
select DRM_PANEL_BRIDGE
select DRM_KMS_HELPER
select DRM_GEM_DMA_HELPER
diff --git a/drivers/gpu/drm/tve200/tve200_drv.c 
b/drivers/gpu/drm/tve200/tve200_drv.c
index acce210e2554..b30340a2141d 100644
--- a/drivers/gpu/drm/tve200/tve200_drv.c
+++ b/drivers/gpu/drm/tve200/tve200_drv.c
@@ -39,8 +39,10 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -149,6 +151,7 @@ static const struct drm_driver tve200_drm_driver = {
.minor = 0,
.patchlevel = 0,
DRM_GEM_DMA_DRIVER_OPS,
+   DRM_FBDEV_DMA_DRIVER_OPS,
 };
 
 static int tve200_probe(struct platform_device *pdev)
@@ -221,11 +224,7 @@ static int tve200_probe(struct platform_device *pdev)
if (ret < 0)
goto clk_disable;
 
-   /*
-* Passing in 16 here will make the RGB565 mode the default
-* Passing in 32 will use XRGB mode
-*/
-   drm_fbdev_dma_setup(drm, 16);
+   drm_client_setup_with_fourcc(drm, DRM_FORMAT_RGB565);
 
return 0;
 
-- 
2.46.0



[PATCH v5 15/80] drm/ili9163: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

Signed-off-by: Thomas Zimmermann 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/tiny/Kconfig   | 1 +
 drivers/gpu/drm/tiny/ili9163.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tiny/Kconfig b/drivers/gpu/drm/tiny/Kconfig
index 5e0dd0dfc55f..f666aa6ae2ed 100644
--- a/drivers/gpu/drm/tiny/Kconfig
+++ b/drivers/gpu/drm/tiny/Kconfig
@@ -113,6 +113,7 @@ config TINYDRM_ILI9163
tristate "DRM support for ILI9163 display panels"
depends on DRM && SPI
select BACKLIGHT_CLASS_DEVICE
+   select DRM_CLIENT_SELECTION
select DRM_GEM_DMA_HELPER
select DRM_KMS_HELPER
select DRM_MIPI_DBI
diff --git a/drivers/gpu/drm/tiny/ili9163.c b/drivers/gpu/drm/tiny/ili9163.c
index 86f9d8834901..5eb39ca1a855 100644
--- a/drivers/gpu/drm/tiny/ili9163.c
+++ b/drivers/gpu/drm/tiny/ili9163.c
@@ -8,6 +8,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -113,6 +114,7 @@ static struct drm_driver ili9163_driver = {
.driver_features= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
.fops   = &ili9163_fops,
DRM_GEM_DMA_DRIVER_OPS_VMAP,
+   DRM_FBDEV_DMA_DRIVER_OPS,
.debugfs_init   = mipi_dbi_debugfs_init,
.name   = "ili9163",
.desc   = "Ilitek ILI9163",
@@ -185,7 +187,7 @@ static int ili9163_probe(struct spi_device *spi)
if (ret)
return ret;
 
-   drm_fbdev_dma_setup(drm, 0);
+   drm_client_setup(drm, NULL);
 
return 0;
 }
-- 
2.46.0



[PATCH v5 49/80] drm/fbdev-shmem: Support struct drm_driver.fbdev_probe

2024-09-24 Thread Thomas Zimmermann
Rework fbdev probing to support fbdev_probe in struct drm_driver
and reimplement the old fb_probe callback on top of it. Provide an
initializer macro for struct drm_driver that sets the callback
according to the kernel configuration.

This change allows the common fbdev client to run on top of SHMEM-
based DRM drivers.

Signed-off-by: Thomas Zimmermann 
Reviewed-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/drm_fbdev_shmem.c | 60 ++-
 include/drm/drm_fbdev_shmem.h | 11 ++
 2 files changed, 47 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/drm_fbdev_shmem.c 
b/drivers/gpu/drm/drm_fbdev_shmem.c
index 0c785007f11b..3bca333917d1 100644
--- a/drivers/gpu/drm/drm_fbdev_shmem.c
+++ b/drivers/gpu/drm/drm_fbdev_shmem.c
@@ -107,6 +107,40 @@ static struct page *drm_fbdev_shmem_get_page(struct 
fb_info *info, unsigned long
 
 static int drm_fbdev_shmem_helper_fb_probe(struct drm_fb_helper *fb_helper,
   struct drm_fb_helper_surface_size 
*sizes)
+{
+   return drm_fbdev_shmem_driver_fbdev_probe(fb_helper, sizes);
+}
+
+static int drm_fbdev_shmem_helper_fb_dirty(struct drm_fb_helper *helper,
+  struct drm_clip_rect *clip)
+{
+   struct drm_device *dev = helper->dev;
+   int ret;
+
+   /* Call damage handlers only if necessary */
+   if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2))
+   return 0;
+
+   if (helper->fb->funcs->dirty) {
+   ret = helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 1);
+   if (drm_WARN_ONCE(dev, ret, "Dirty helper failed: ret=%d\n", 
ret))
+   return ret;
+   }
+
+   return 0;
+}
+
+static const struct drm_fb_helper_funcs drm_fbdev_shmem_helper_funcs = {
+   .fb_probe = drm_fbdev_shmem_helper_fb_probe,
+   .fb_dirty = drm_fbdev_shmem_helper_fb_dirty,
+};
+
+/*
+ * struct drm_driver
+ */
+
+int drm_fbdev_shmem_driver_fbdev_probe(struct drm_fb_helper *fb_helper,
+  struct drm_fb_helper_surface_size *sizes)
 {
struct drm_client_dev *client = &fb_helper->client;
struct drm_device *dev = fb_helper->dev;
@@ -139,6 +173,7 @@ static int drm_fbdev_shmem_helper_fb_probe(struct 
drm_fb_helper *fb_helper,
goto err_drm_client_buffer_delete;
}
 
+   fb_helper->funcs = &drm_fbdev_shmem_helper_funcs;
fb_helper->buffer = buffer;
fb_helper->fb = fb;
 
@@ -182,30 +217,7 @@ static int drm_fbdev_shmem_helper_fb_probe(struct 
drm_fb_helper *fb_helper,
drm_client_framebuffer_delete(buffer);
return ret;
 }
-
-static int drm_fbdev_shmem_helper_fb_dirty(struct drm_fb_helper *helper,
-  struct drm_clip_rect *clip)
-{
-   struct drm_device *dev = helper->dev;
-   int ret;
-
-   /* Call damage handlers only if necessary */
-   if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2))
-   return 0;
-
-   if (helper->fb->funcs->dirty) {
-   ret = helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 1);
-   if (drm_WARN_ONCE(dev, ret, "Dirty helper failed: ret=%d\n", 
ret))
-   return ret;
-   }
-
-   return 0;
-}
-
-static const struct drm_fb_helper_funcs drm_fbdev_shmem_helper_funcs = {
-   .fb_probe = drm_fbdev_shmem_helper_fb_probe,
-   .fb_dirty = drm_fbdev_shmem_helper_fb_dirty,
-};
+EXPORT_SYMBOL(drm_fbdev_shmem_driver_fbdev_probe);
 
 /*
  * struct drm_client_funcs
diff --git a/include/drm/drm_fbdev_shmem.h b/include/drm/drm_fbdev_shmem.h
index fb43cadd1950..3a5d1efa9d55 100644
--- a/include/drm/drm_fbdev_shmem.h
+++ b/include/drm/drm_fbdev_shmem.h
@@ -4,12 +4,23 @@
 #define DRM_FBDEV_SHMEM_H
 
 struct drm_device;
+struct drm_fb_helper;
+struct drm_fb_helper_surface_size;
 
 #ifdef CONFIG_DRM_FBDEV_EMULATION
+int drm_fbdev_shmem_driver_fbdev_probe(struct drm_fb_helper *fb_helper,
+  struct drm_fb_helper_surface_size 
*sizes);
+
+#define DRM_FBDEV_SHMEM_DRIVER_OPS \
+   .fbdev_probe = drm_fbdev_shmem_driver_fbdev_probe
+
 void drm_fbdev_shmem_setup(struct drm_device *dev, unsigned int preferred_bpp);
 #else
 static inline void drm_fbdev_shmem_setup(struct drm_device *dev, unsigned int 
preferred_bpp)
 { }
+
+#define DRM_FBDEV_SHMEM_DRIVER_OPS \
+   .fbdev_probe = NULL
 #endif
 
 #endif
-- 
2.46.0



[PATCH v5 51/80] drm/bochs: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

The bochs driver specifies a preferred color mode of 32. As this
is the default if no format has been given, leave it out entirely.

v5:
- select DRM_CLIENT_SELECTION
v4:
- rebase on top of GEM-SHMEM

Signed-off-by: Thomas Zimmermann 
Cc: Gerd Hoffmann 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/tiny/Kconfig | 1 +
 drivers/gpu/drm/tiny/bochs.c | 5 -
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tiny/Kconfig b/drivers/gpu/drm/tiny/Kconfig
index 7ab8d6c02dab..5e047ba8a30d 100644
--- a/drivers/gpu/drm/tiny/Kconfig
+++ b/drivers/gpu/drm/tiny/Kconfig
@@ -14,6 +14,7 @@ config DRM_ARCPGU
 config DRM_BOCHS
tristate "DRM Support for bochs dispi vga interface (qemu stdvga)"
depends on DRM && PCI && MMU
+   select DRM_CLIENT_SELECTION
select DRM_GEM_SHMEM_HELPER
select DRM_KMS_HELPER
help
diff --git a/drivers/gpu/drm/tiny/bochs.c b/drivers/gpu/drm/tiny/bochs.c
index 9055b1dd66df..5d2d34976d4b 100644
--- a/drivers/gpu/drm/tiny/bochs.c
+++ b/drivers/gpu/drm/tiny/bochs.c
@@ -6,6 +6,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -674,6 +675,7 @@ static const struct drm_driver bochs_driver = {
.major  = 1,
.minor  = 0,
DRM_GEM_SHMEM_DRIVER_OPS,
+   DRM_FBDEV_SHMEM_DRIVER_OPS,
 };
 
 /* -- */
@@ -732,7 +734,8 @@ static int bochs_pci_probe(struct pci_dev *pdev, const 
struct pci_device_id *ent
if (ret)
goto err_free_dev;
 
-   drm_fbdev_shmem_setup(dev, 32);
+   drm_client_setup(dev, NULL);
+
return ret;
 
 err_free_dev:
-- 
2.46.0



[PATCH v5 72/80] drm/fbdev-ttm: Remove obsolete setup function

2024-09-24 Thread Thomas Zimmermann
The old setup function drm_fbdev_ttm_setup() is unused. Remove it and
its internal callbacks. New drivers should call drm_client_setup()
instead.

Signed-off-by: Thomas Zimmermann 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/drm_fbdev_ttm.c | 119 
 include/drm/drm_fbdev_ttm.h |   6 --
 2 files changed, 125 deletions(-)

diff --git a/drivers/gpu/drm/drm_fbdev_ttm.c b/drivers/gpu/drm/drm_fbdev_ttm.c
index d799cbe944cd..73d35d59590c 100644
--- a/drivers/gpu/drm/drm_fbdev_ttm.c
+++ b/drivers/gpu/drm/drm_fbdev_ttm.c
@@ -65,15 +65,6 @@ static const struct fb_ops drm_fbdev_ttm_fb_ops = {
.fb_destroy = drm_fbdev_ttm_fb_destroy,
 };
 
-/*
- * This function uses the client API to create a framebuffer backed by a dumb 
buffer.
- */
-static int drm_fbdev_ttm_helper_fb_probe(struct drm_fb_helper *fb_helper,
-struct drm_fb_helper_surface_size 
*sizes)
-{
-   return drm_fbdev_ttm_driver_fbdev_probe(fb_helper, sizes);
-}
-
 static void drm_fbdev_ttm_damage_blit_real(struct drm_fb_helper *fb_helper,
   struct drm_clip_rect *clip,
   struct iosys_map *dst)
@@ -172,7 +163,6 @@ static int drm_fbdev_ttm_helper_fb_dirty(struct 
drm_fb_helper *helper,
 }
 
 static const struct drm_fb_helper_funcs drm_fbdev_ttm_helper_funcs = {
-   .fb_probe = drm_fbdev_ttm_helper_fb_probe,
.fb_dirty = drm_fbdev_ttm_helper_fb_dirty,
 };
 
@@ -251,112 +241,3 @@ int drm_fbdev_ttm_driver_fbdev_probe(struct drm_fb_helper 
*fb_helper,
return ret;
 }
 EXPORT_SYMBOL(drm_fbdev_ttm_driver_fbdev_probe);
-
-static void drm_fbdev_ttm_client_unregister(struct drm_client_dev *client)
-{
-   struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client);
-
-   if (fb_helper->info) {
-   drm_fb_helper_unregister_info(fb_helper);
-   } else {
-   drm_client_release(&fb_helper->client);
-   drm_fb_helper_unprepare(fb_helper);
-   kfree(fb_helper);
-   }
-}
-
-static int drm_fbdev_ttm_client_restore(struct drm_client_dev *client)
-{
-   drm_fb_helper_lastclose(client->dev);
-
-   return 0;
-}
-
-static int drm_fbdev_ttm_client_hotplug(struct drm_client_dev *client)
-{
-   struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client);
-   struct drm_device *dev = client->dev;
-   int ret;
-
-   if (dev->fb_helper)
-   return drm_fb_helper_hotplug_event(dev->fb_helper);
-
-   ret = drm_fb_helper_init(dev, fb_helper);
-   if (ret)
-   goto err_drm_err;
-
-   if (!drm_drv_uses_atomic_modeset(dev))
-   drm_helper_disable_unused_functions(dev);
-
-   ret = drm_fb_helper_initial_config(fb_helper);
-   if (ret)
-   goto err_drm_fb_helper_fini;
-
-   return 0;
-
-err_drm_fb_helper_fini:
-   drm_fb_helper_fini(fb_helper);
-err_drm_err:
-   drm_err(dev, "fbdev: Failed to setup emulation (ret=%d)\n", ret);
-   return ret;
-}
-
-static const struct drm_client_funcs drm_fbdev_ttm_client_funcs = {
-   .owner  = THIS_MODULE,
-   .unregister = drm_fbdev_ttm_client_unregister,
-   .restore= drm_fbdev_ttm_client_restore,
-   .hotplug= drm_fbdev_ttm_client_hotplug,
-};
-
-/**
- * drm_fbdev_ttm_setup() - Setup fbdev emulation for TTM-based drivers
- * @dev: DRM device
- * @preferred_bpp: Preferred bits per pixel for the device.
- *
- * This function sets up fbdev emulation for TTM-based drivers that support
- * dumb buffers with a virtual address and that can be mmap'ed.
- * drm_fbdev_ttm_setup() shall be called after the DRM driver registered
- * the new DRM device with drm_dev_register().
- *
- * Restore, hotplug events and teardown are all taken care of. Drivers that do
- * suspend/resume need to call drm_fb_helper_set_suspend_unlocked() themselves.
- * Simple drivers might use drm_mode_config_helper_suspend().
- *
- * In order to provide fixed mmap-able memory ranges, fbdev emulation
- * uses a shadow buffer in system memory. The implementation blits the shadow
- * fbdev buffer onto the real buffer in regular intervals.
- *
- * This function is safe to call even when there are no connectors present.
- * Setup will be retried on the next hotplug event.
- *
- * The fbdev is destroyed by drm_dev_unregister().
- */
-void drm_fbdev_ttm_setup(struct drm_device *dev, unsigned int preferred_bpp)
-{
-   struct drm_fb_helper *fb_helper;
-   int ret;
-
-   drm_WARN(dev, !dev->registered, "Device has not been registered.\n");
-   drm_WARN(dev, dev->fb_helper, "fb_helper is already set!\n");
-
-   fb_helper = kzalloc(sizeof(*fb_helper), GFP_KERNEL);
-   if (!fb_helper)
-   return;
-   drm_fb_helper_prepare(dev, fb_helper, preferred_bpp, 
&drm_fbdev_ttm_hel

[PATCH v5 61/80] drm/virtgpu: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

The virtgpu driver specifies a preferred color mode of 32. As this
is the default if no format has been given, leave it out entirely.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Cc: David Airlie 
Cc: Gerd Hoffmann 
Cc: Gurchetan Singh 
Cc: Chia-I Wu 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/virtio/Kconfig   | 1 +
 drivers/gpu/drm/virtio/virtgpu_drv.c | 6 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/virtio/Kconfig b/drivers/gpu/drm/virtio/Kconfig
index ea06ff2aa4b4..fc884fb57b7e 100644
--- a/drivers/gpu/drm/virtio/Kconfig
+++ b/drivers/gpu/drm/virtio/Kconfig
@@ -3,6 +3,7 @@ config DRM_VIRTIO_GPU
tristate "Virtio GPU driver"
depends on DRM && VIRTIO_MENU && MMU
select VIRTIO
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_GEM_SHMEM_HELPER
select VIRTIO_DMA_SHARED_BUFFER
diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c 
b/drivers/gpu/drm/virtio/virtgpu_drv.c
index e5a2665e50ea..1e08d91a4d17 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.c
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.c
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -103,7 +104,8 @@ static int virtio_gpu_probe(struct virtio_device *vdev)
if (ret)
goto err_deinit;
 
-   drm_fbdev_shmem_setup(vdev->priv, 32);
+   drm_client_setup(vdev->priv, NULL);
+
return 0;
 
 err_deinit:
@@ -184,6 +186,8 @@ static const struct drm_driver driver = {
.dumb_create = virtio_gpu_mode_dumb_create,
.dumb_map_offset = virtio_gpu_mode_dumb_mmap,
 
+   DRM_FBDEV_SHMEM_DRIVER_OPS,
+
 #if defined(CONFIG_DEBUG_FS)
.debugfs_init = virtio_gpu_debugfs_init,
 #endif
-- 
2.46.0



[PATCH v5 74/80] drm/exynos-drm: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Rework fbdev probing to support fbdev_probe in struct drm_driver
and remove the old fb_probe callback. Provide an initializer macro
for struct drm_driver that sets the callback according to the kernel
configuration.

Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

The exynos-drm driver specifies a preferred color mode of 32. As this
is the default if no format has been given, leave it out entirely.

v5:
- select DRM_CLIENT_SELECTION
v4:
- revert an unrelated cleanup (Javier)

Signed-off-by: Thomas Zimmermann 
Cc: Inki Dae 
Cc: Seung-Woo Kim 
Cc: Kyungmin Park 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/exynos/Kconfig|  1 +
 drivers/gpu/drm/exynos/exynos_drm_drv.c   |  4 +-
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 99 ++-
 drivers/gpu/drm/exynos/exynos_drm_fbdev.h | 15 ++--
 4 files changed, 20 insertions(+), 99 deletions(-)

diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig
index 733b109a5095..0d13828e7d9e 100644
--- a/drivers/gpu/drm/exynos/Kconfig
+++ b/drivers/gpu/drm/exynos/Kconfig
@@ -4,6 +4,7 @@ config DRM_EXYNOS
depends on OF && DRM && COMMON_CLK
depends on ARCH_S3C64XX || ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST
depends on MMU
+   select DRM_CLIENT_SELECTION
select DRM_DISPLAY_HELPER if DRM_EXYNOS_DP
select DRM_KMS_HELPER
select VIDEOMODE_HELPERS
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index 7c59e1164a48..2a466d8179f4 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -15,6 +15,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -111,6 +112,7 @@ static const struct drm_driver exynos_drm_driver = {
.dumb_create= exynos_drm_gem_dumb_create,
.gem_prime_import   = exynos_drm_gem_prime_import,
.gem_prime_import_sg_table  = exynos_drm_gem_prime_import_sg_table,
+   EXYNOS_DRM_FBDEV_DRIVER_OPS,
.ioctls = exynos_ioctls,
.num_ioctls = ARRAY_SIZE(exynos_ioctls),
.fops   = &exynos_drm_driver_fops,
@@ -288,7 +290,7 @@ static int exynos_drm_bind(struct device *dev)
if (ret < 0)
goto err_cleanup_poll;
 
-   exynos_drm_fbdev_setup(drm);
+   drm_client_setup(drm, NULL);
 
return 0;
 
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c 
b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
index a379c8ca435a..9526a25e90ac 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
@@ -23,7 +23,6 @@
 #include "exynos_drm_fbdev.h"
 
 #define MAX_CONNECTOR  4
-#define PREFERRED_BPP  32
 
 static int exynos_drm_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
 {
@@ -87,8 +86,11 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper 
*helper,
return 0;
 }
 
-static int exynos_drm_fbdev_create(struct drm_fb_helper *helper,
-   struct drm_fb_helper_surface_size *sizes)
+static const struct drm_fb_helper_funcs exynos_drm_fbdev_helper_funcs = {
+};
+
+int exynos_drm_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
+   struct drm_fb_helper_surface_size 
*sizes)
 {
struct exynos_drm_gem *exynos_gem;
struct drm_device *dev = helper->dev;
@@ -120,6 +122,7 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper 
*helper,
ret = PTR_ERR(helper->fb);
goto err_destroy_gem;
}
+   helper->funcs = &exynos_drm_fbdev_helper_funcs;
 
ret = exynos_drm_fbdev_update(helper, sizes, exynos_gem);
if (ret < 0)
@@ -134,93 +137,3 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper 
*helper,
exynos_drm_gem_destroy(exynos_gem);
return ret;
 }
-
-static const struct drm_fb_helper_funcs exynos_drm_fb_helper_funcs = {
-   .fb_probe = exynos_drm_fbdev_create,
-};
-
-/*
- * struct drm_client
- */
-
-static void exynos_drm_fbdev_client_unregister(struct drm_client_dev *client)
-{
-   struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client);
-
-   if (fb_helper->info) {
-   drm_fb_helper_unregister_info(fb_helper);
-   } else {
-   drm_client_release(&fb_helper->client);
-   drm_fb_helper_unprepare(fb_helper);
-   kfree(fb_helper);
-   }
-}
-
-static int exynos_drm_fbdev_client_restore(struct drm_client_dev *client)
-{
-   drm_fb_helper_lastclose(client->dev);
-
-   return 0;
-}
-
-static int exynos_drm_fbdev_client_hotplug(struct drm_client_dev *client)
-{
-   struct drm_fb_helper *fb_helper = drm_fb_helper_from_client

[PATCH v5 65/80] drm/amdgpu: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

The amdgpu driver specifies a preferred color mode depending on
the available video memory, with a default of 32. Adapt this for
the new client interface.

v5:
- select DRM_CLIENT_SELECTION
v2:
- style changes

Signed-off-by: Thomas Zimmermann 
Cc: Alex Deucher 
Cc: "Christian König" 
Cc: Xinhui Pan 
Tested-by: Hamza Mahfooz 
Acked-by: Hamza Mahfooz 
Acked-by: Alex Deucher 
---
 drivers/gpu/drm/amd/amdgpu/Kconfig  |  1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 11 +--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/Kconfig 
b/drivers/gpu/drm/amd/amdgpu/Kconfig
index fc3237da8090..680a94c361ba 100644
--- a/drivers/gpu/drm/amd/amdgpu/Kconfig
+++ b/drivers/gpu/drm/amd/amdgpu/Kconfig
@@ -5,6 +5,7 @@ config DRM_AMDGPU
depends on DRM && PCI && MMU
depends on !UML
select FW_LOADER
+   select DRM_CLIENT_SELECTION
select DRM_DISPLAY_DP_HELPER
select DRM_DISPLAY_DSC_HELPER
select DRM_DISPLAY_HDMI_HELPER
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 86cff30d5c4e..cd82437cf860 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -23,6 +23,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2364,11 +2365,15 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
 */
if (adev->mode_info.mode_config_initialized &&
!list_empty(&adev_to_drm(adev)->mode_config.connector_list)) {
+   const struct drm_format_info *format;
+
/* select 8 bpp console on low vram cards */
if (adev->gmc.real_vram_size <= (32*1024*1024))
-   drm_fbdev_ttm_setup(adev_to_drm(adev), 8);
+   format = drm_format_info(DRM_FORMAT_C8);
else
-   drm_fbdev_ttm_setup(adev_to_drm(adev), 32);
+   format = NULL;
+
+   drm_client_setup(adev_to_drm(adev), format);
}
 
ret = amdgpu_debugfs_init(adev);
@@ -2980,6 +2985,7 @@ static const struct drm_driver amdgpu_kms_driver = {
.num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
.dumb_create = amdgpu_mode_dumb_create,
.dumb_map_offset = amdgpu_mode_dumb_mmap,
+   DRM_FBDEV_TTM_DRIVER_OPS,
.fops = &amdgpu_driver_kms_fops,
.release = &amdgpu_driver_release_kms,
 #ifdef CONFIG_PROC_FS
@@ -3006,6 +3012,7 @@ const struct drm_driver amdgpu_partition_driver = {
.num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
.dumb_create = amdgpu_mode_dumb_create,
.dumb_map_offset = amdgpu_mode_dumb_mmap,
+   DRM_FBDEV_TTM_DRIVER_OPS,
.fops = &amdgpu_driver_kms_fops,
.release = &amdgpu_driver_release_kms,
 
-- 
2.46.0



[PATCH v5 72/80] drm/fbdev-ttm: Remove obsolete setup function

2024-09-24 Thread Thomas Zimmermann
The old setup function drm_fbdev_ttm_setup() is unused. Remove it and
its internal callbacks. New drivers should call drm_client_setup()
instead.

Signed-off-by: Thomas Zimmermann 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/drm_fbdev_ttm.c | 119 
 include/drm/drm_fbdev_ttm.h |   6 --
 2 files changed, 125 deletions(-)

diff --git a/drivers/gpu/drm/drm_fbdev_ttm.c b/drivers/gpu/drm/drm_fbdev_ttm.c
index d799cbe944cd..73d35d59590c 100644
--- a/drivers/gpu/drm/drm_fbdev_ttm.c
+++ b/drivers/gpu/drm/drm_fbdev_ttm.c
@@ -65,15 +65,6 @@ static const struct fb_ops drm_fbdev_ttm_fb_ops = {
.fb_destroy = drm_fbdev_ttm_fb_destroy,
 };
 
-/*
- * This function uses the client API to create a framebuffer backed by a dumb 
buffer.
- */
-static int drm_fbdev_ttm_helper_fb_probe(struct drm_fb_helper *fb_helper,
-struct drm_fb_helper_surface_size 
*sizes)
-{
-   return drm_fbdev_ttm_driver_fbdev_probe(fb_helper, sizes);
-}
-
 static void drm_fbdev_ttm_damage_blit_real(struct drm_fb_helper *fb_helper,
   struct drm_clip_rect *clip,
   struct iosys_map *dst)
@@ -172,7 +163,6 @@ static int drm_fbdev_ttm_helper_fb_dirty(struct 
drm_fb_helper *helper,
 }
 
 static const struct drm_fb_helper_funcs drm_fbdev_ttm_helper_funcs = {
-   .fb_probe = drm_fbdev_ttm_helper_fb_probe,
.fb_dirty = drm_fbdev_ttm_helper_fb_dirty,
 };
 
@@ -251,112 +241,3 @@ int drm_fbdev_ttm_driver_fbdev_probe(struct drm_fb_helper 
*fb_helper,
return ret;
 }
 EXPORT_SYMBOL(drm_fbdev_ttm_driver_fbdev_probe);
-
-static void drm_fbdev_ttm_client_unregister(struct drm_client_dev *client)
-{
-   struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client);
-
-   if (fb_helper->info) {
-   drm_fb_helper_unregister_info(fb_helper);
-   } else {
-   drm_client_release(&fb_helper->client);
-   drm_fb_helper_unprepare(fb_helper);
-   kfree(fb_helper);
-   }
-}
-
-static int drm_fbdev_ttm_client_restore(struct drm_client_dev *client)
-{
-   drm_fb_helper_lastclose(client->dev);
-
-   return 0;
-}
-
-static int drm_fbdev_ttm_client_hotplug(struct drm_client_dev *client)
-{
-   struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client);
-   struct drm_device *dev = client->dev;
-   int ret;
-
-   if (dev->fb_helper)
-   return drm_fb_helper_hotplug_event(dev->fb_helper);
-
-   ret = drm_fb_helper_init(dev, fb_helper);
-   if (ret)
-   goto err_drm_err;
-
-   if (!drm_drv_uses_atomic_modeset(dev))
-   drm_helper_disable_unused_functions(dev);
-
-   ret = drm_fb_helper_initial_config(fb_helper);
-   if (ret)
-   goto err_drm_fb_helper_fini;
-
-   return 0;
-
-err_drm_fb_helper_fini:
-   drm_fb_helper_fini(fb_helper);
-err_drm_err:
-   drm_err(dev, "fbdev: Failed to setup emulation (ret=%d)\n", ret);
-   return ret;
-}
-
-static const struct drm_client_funcs drm_fbdev_ttm_client_funcs = {
-   .owner  = THIS_MODULE,
-   .unregister = drm_fbdev_ttm_client_unregister,
-   .restore= drm_fbdev_ttm_client_restore,
-   .hotplug= drm_fbdev_ttm_client_hotplug,
-};
-
-/**
- * drm_fbdev_ttm_setup() - Setup fbdev emulation for TTM-based drivers
- * @dev: DRM device
- * @preferred_bpp: Preferred bits per pixel for the device.
- *
- * This function sets up fbdev emulation for TTM-based drivers that support
- * dumb buffers with a virtual address and that can be mmap'ed.
- * drm_fbdev_ttm_setup() shall be called after the DRM driver registered
- * the new DRM device with drm_dev_register().
- *
- * Restore, hotplug events and teardown are all taken care of. Drivers that do
- * suspend/resume need to call drm_fb_helper_set_suspend_unlocked() themselves.
- * Simple drivers might use drm_mode_config_helper_suspend().
- *
- * In order to provide fixed mmap-able memory ranges, fbdev emulation
- * uses a shadow buffer in system memory. The implementation blits the shadow
- * fbdev buffer onto the real buffer in regular intervals.
- *
- * This function is safe to call even when there are no connectors present.
- * Setup will be retried on the next hotplug event.
- *
- * The fbdev is destroyed by drm_dev_unregister().
- */
-void drm_fbdev_ttm_setup(struct drm_device *dev, unsigned int preferred_bpp)
-{
-   struct drm_fb_helper *fb_helper;
-   int ret;
-
-   drm_WARN(dev, !dev->registered, "Device has not been registered.\n");
-   drm_WARN(dev, dev->fb_helper, "fb_helper is already set!\n");
-
-   fb_helper = kzalloc(sizeof(*fb_helper), GFP_KERNEL);
-   if (!fb_helper)
-   return;
-   drm_fb_helper_prepare(dev, fb_helper, preferred_bpp, 
&drm_fbdev_ttm_hel

[PATCH v5 21/80] drm/imx/lcdc: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Cc: Shawn Guo 
Cc: Sascha Hauer 
Cc: Pengutronix Kernel Team 
Cc: Fabio Estevam 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/imx/lcdc/Kconfig| 1 +
 drivers/gpu/drm/imx/lcdc/imx-lcdc.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/imx/lcdc/Kconfig b/drivers/gpu/drm/imx/lcdc/Kconfig
index 9c28bb0f4662..75869489b0e6 100644
--- a/drivers/gpu/drm/imx/lcdc/Kconfig
+++ b/drivers/gpu/drm/imx/lcdc/Kconfig
@@ -1,6 +1,7 @@
 config DRM_IMX_LCDC
   tristate "Freescale i.MX LCDC displays"
   depends on DRM && (ARCH_MXC || COMPILE_TEST)
+  select DRM_CLIENT_SELECTION
   select DRM_GEM_DMA_HELPER
   select DRM_KMS_HELPER
   select DRM_DISPLAY_HELPER
diff --git a/drivers/gpu/drm/imx/lcdc/imx-lcdc.c 
b/drivers/gpu/drm/imx/lcdc/imx-lcdc.c
index 36668455aee8..3215c4acd675 100644
--- a/drivers/gpu/drm/imx/lcdc/imx-lcdc.c
+++ b/drivers/gpu/drm/imx/lcdc/imx-lcdc.c
@@ -3,6 +3,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -348,6 +349,7 @@ static struct drm_driver imx_lcdc_drm_driver = {
.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
.fops = &imx_lcdc_drm_fops,
DRM_GEM_DMA_DRIVER_OPS_VMAP,
+   DRM_FBDEV_DMA_DRIVER_OPS,
.name = "imx-lcdc",
.desc = "i.MX LCDC driver",
.date = "20200716",
@@ -501,7 +503,7 @@ static int imx_lcdc_probe(struct platform_device *pdev)
if (ret)
return dev_err_probe(dev, ret, "Cannot register device\n");
 
-   drm_fbdev_dma_setup(drm, 0);
+   drm_client_setup(drm, NULL);
 
return 0;
 }
-- 
2.46.0



[PATCH v5 39/80] drm/stm: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup_with-fourcc() to run the kernel's default client
setup for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

v5:
- select DRM_CLIENT_SELECTION
v4:
- remove duplicated S-o-b tag (Gerd)
v2:
- use drm_client_setup_with_fourcc()

Signed-off-by: Thomas Zimmermann 
Cc: Yannick Fertre 
Cc: Raphael Gallais-Pou 
Cc: Philippe Cornu 
Cc: Maxime Coquelin 
Cc: Alexandre Torgue 
Acked-by: Raphael Gallais-Pou 
---
 drivers/gpu/drm/stm/Kconfig | 1 +
 drivers/gpu/drm/stm/drv.c   | 5 -
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/stm/Kconfig b/drivers/gpu/drm/stm/Kconfig
index d7f41a87808e..635be0ac00af 100644
--- a/drivers/gpu/drm/stm/Kconfig
+++ b/drivers/gpu/drm/stm/Kconfig
@@ -3,6 +3,7 @@ config DRM_STM
tristate "DRM Support for STMicroelectronics SoC Series"
depends on DRM && (ARCH_STM32 || COMPILE_TEST)
depends on COMMON_CLK
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_GEM_DMA_HELPER
select DRM_PANEL_BRIDGE
diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
index e1232f74dfa5..fee274a60623 100644
--- a/drivers/gpu/drm/stm/drv.c
+++ b/drivers/gpu/drm/stm/drv.c
@@ -18,8 +18,10 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -66,6 +68,7 @@ static const struct drm_driver drv_driver = {
.patchlevel = 0,
.fops = &drv_driver_fops,
DRM_GEM_DMA_DRIVER_OPS_WITH_DUMB_CREATE(stm_gem_dma_dumb_create),
+   DRM_FBDEV_DMA_DRIVER_OPS,
 };
 
 static int drv_load(struct drm_device *ddev)
@@ -206,7 +209,7 @@ static int stm_drm_platform_probe(struct platform_device 
*pdev)
if (ret)
goto err_unload;
 
-   drm_fbdev_dma_setup(ddev, 16);
+   drm_client_setup_with_fourcc(ddev, DRM_FORMAT_RGB565);
 
return 0;
 
-- 
2.46.0



[PATCH v5 77/80] drm/radeon: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Rework fbdev probing to support fbdev_probe in struct drm_driver
and remove the old fb_probe callback. Provide an initializer macro
for struct drm_driver that sets the callback according to the kernel
configuration.

Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

The radeon driver specifies a preferred color mode depending on
the available video memory, with a default of 32. Adapt this for
the new client interface.

v5:
- select DRM_CLIENT_SELECTION
v2:
- style changes

Signed-off-by: Thomas Zimmermann 
Cc: Alex Deucher 
Cc: "Christian König" 
Cc: Xinhui Pan 
Acked-by: Alex Deucher 
---
 drivers/gpu/drm/radeon/Kconfig|   1 +
 drivers/gpu/drm/radeon/radeon_drv.c   |  14 +++-
 drivers/gpu/drm/radeon/radeon_fbdev.c | 114 ++
 drivers/gpu/drm/radeon/radeon_mode.h  |  12 ++-
 4 files changed, 28 insertions(+), 113 deletions(-)

diff --git a/drivers/gpu/drm/radeon/Kconfig b/drivers/gpu/drm/radeon/Kconfig
index f98356be0af2..9c6c74a75778 100644
--- a/drivers/gpu/drm/radeon/Kconfig
+++ b/drivers/gpu/drm/radeon/Kconfig
@@ -5,6 +5,7 @@ config DRM_RADEON
depends on DRM && PCI && MMU
depends on AGP || !AGP
select FW_LOADER
+   select DRM_CLIENT_SELECTION
select DRM_DISPLAY_DP_HELPER
select DRM_DISPLAY_HELPER
 select DRM_KMS_HELPER
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c 
b/drivers/gpu/drm/radeon/radeon_drv.c
index f36aa71c57c7..eae79f02d254 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -38,8 +38,10 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -261,6 +263,7 @@ static int radeon_pci_probe(struct pci_dev *pdev,
unsigned long flags = 0;
struct drm_device *ddev;
struct radeon_device *rdev;
+   const struct drm_format_info *format;
int ret;
 
if (!ent)
@@ -324,7 +327,14 @@ static int radeon_pci_probe(struct pci_dev *pdev,
if (ret)
goto err_agp;
 
-   radeon_fbdev_setup(ddev->dev_private);
+   if (rdev->mc.real_vram_size <= (8 * 1024 * 1024))
+   format = drm_format_info(DRM_FORMAT_C8);
+   else if (ASIC_IS_RN50(rdev) || rdev->mc.real_vram_size <= (32 * 1024 * 
1024))
+   format = drm_format_info(DRM_FORMAT_RGB565);
+   else
+   format = NULL;
+
+   drm_client_setup(ddev, format);
 
return 0;
 
@@ -590,6 +600,8 @@ static const struct drm_driver kms_driver = {
 
.gem_prime_import_sg_table = radeon_gem_prime_import_sg_table,
 
+   RADEON_FBDEV_DRIVER_OPS,
+
.name = DRIVER_NAME,
.desc = DRIVER_DESC,
.date = DRIVER_DATE,
diff --git a/drivers/gpu/drm/radeon/radeon_fbdev.c 
b/drivers/gpu/drm/radeon/radeon_fbdev.c
index fb70de29545c..0aa20c8df546 100644
--- a/drivers/gpu/drm/radeon/radeon_fbdev.c
+++ b/drivers/gpu/drm/radeon/radeon_fbdev.c
@@ -198,12 +198,11 @@ static const struct fb_ops radeon_fbdev_fb_ops = {
.fb_destroy = radeon_fbdev_fb_destroy,
 };
 
-/*
- * Fbdev helpers and struct drm_fb_helper_funcs
- */
+static const struct drm_fb_helper_funcs radeon_fbdev_fb_helper_funcs = {
+};
 
-static int radeon_fbdev_fb_helper_fb_probe(struct drm_fb_helper *fb_helper,
-  struct drm_fb_helper_surface_size 
*sizes)
+int radeon_fbdev_driver_fbdev_probe(struct drm_fb_helper *fb_helper,
+   struct drm_fb_helper_surface_size *sizes)
 {
struct radeon_device *rdev = fb_helper->dev->dev_private;
struct drm_mode_fb_cmd2 mode_cmd = { };
@@ -243,6 +242,7 @@ static int radeon_fbdev_fb_helper_fb_probe(struct 
drm_fb_helper *fb_helper,
}
 
/* setup helper */
+   fb_helper->funcs = &radeon_fbdev_fb_helper_funcs;
fb_helper->fb = fb;
 
/* okay we have an object now allocate the framebuffer */
@@ -288,110 +288,6 @@ static int radeon_fbdev_fb_helper_fb_probe(struct 
drm_fb_helper *fb_helper,
return ret;
 }
 
-static const struct drm_fb_helper_funcs radeon_fbdev_fb_helper_funcs = {
-   .fb_probe = radeon_fbdev_fb_helper_fb_probe,
-};
-
-/*
- * Fbdev client and struct drm_client_funcs
- */
-
-static void radeon_fbdev_client_unregister(struct drm_client_dev *client)
-{
-   struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client);
-   struct drm_device *dev = fb_helper->dev;
-   struct radeon_device *rdev = dev->dev_private;
-
-   if (fb_helper->info) {
-   vga_switcheroo_client_fb_set(rdev->pdev, NULL);
-   drm_helper_force_disable_all(dev);
-   drm_fb_helper_unregister_info(fb_helper);
-   } else {
-   drm_client_release(&fb_helper->client);
-   drm_fb_help

[PATCH v5 28/80] drm/mi0283qt: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Cc: "Noralf Trønnes" 
Acked-by: Noralf Trønnes 
---
 drivers/gpu/drm/tiny/Kconfig| 1 +
 drivers/gpu/drm/tiny/mi0283qt.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tiny/Kconfig b/drivers/gpu/drm/tiny/Kconfig
index 7ee887b55aee..17e0160b05ac 100644
--- a/drivers/gpu/drm/tiny/Kconfig
+++ b/drivers/gpu/drm/tiny/Kconfig
@@ -168,6 +168,7 @@ config TINYDRM_ILI9486
 config TINYDRM_MI0283QT
tristate "DRM support for MI0283QT"
depends on DRM && SPI
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_GEM_DMA_HELPER
select DRM_MIPI_DBI
diff --git a/drivers/gpu/drm/tiny/mi0283qt.c b/drivers/gpu/drm/tiny/mi0283qt.c
index cdc5423990ca..f1461c55dba6 100644
--- a/drivers/gpu/drm/tiny/mi0283qt.c
+++ b/drivers/gpu/drm/tiny/mi0283qt.c
@@ -14,6 +14,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -154,6 +155,7 @@ static const struct drm_driver mi0283qt_driver = {
.driver_features= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
.fops   = &mi0283qt_fops,
DRM_GEM_DMA_DRIVER_OPS_VMAP,
+   DRM_FBDEV_DMA_DRIVER_OPS,
.debugfs_init   = mipi_dbi_debugfs_init,
.name   = "mi0283qt",
.desc   = "Multi-Inno MI0283QT",
@@ -226,7 +228,7 @@ static int mi0283qt_probe(struct spi_device *spi)
 
spi_set_drvdata(spi, drm);
 
-   drm_fbdev_dma_setup(drm, 0);
+   drm_client_setup(drm, NULL);
 
return 0;
 }
-- 
2.46.0



[PATCH v5 73/80] drm/armada: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Rework fbdev probing to support fbdev_probe in struct drm_driver
and remove the old fb_probe callback. Provide an initializer macro
for struct drm_driver that sets the callback according to the kernel
configuration.

Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

The armada driver specifies a preferred color mode of 32. As this
is the default if no format has been given, leave it out entirely.

v5:
- select DRM_CLIENT_SELECTION
v4:
- revert an unrelated cleanup (Javier)

Signed-off-by: Thomas Zimmermann 
Cc: Russell King 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/armada/Kconfig|   1 +
 drivers/gpu/drm/armada/armada_drm.h   |  11 ++-
 drivers/gpu/drm/armada/armada_drv.c   |   4 +-
 drivers/gpu/drm/armada/armada_fbdev.c | 113 ++
 4 files changed, 17 insertions(+), 112 deletions(-)

diff --git a/drivers/gpu/drm/armada/Kconfig b/drivers/gpu/drm/armada/Kconfig
index e5597d7c9ae1..b22c891a670b 100644
--- a/drivers/gpu/drm/armada/Kconfig
+++ b/drivers/gpu/drm/armada/Kconfig
@@ -2,6 +2,7 @@
 config DRM_ARMADA
tristate "DRM support for Marvell Armada SoCs"
depends on DRM && HAVE_CLK && ARM && MMU
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select FB_IOMEM_HELPERS if DRM_FBDEV_EMULATION
help
diff --git a/drivers/gpu/drm/armada/armada_drm.h 
b/drivers/gpu/drm/armada/armada_drm.h
index c303e8c7ff6c..3c0ff221a43b 100644
--- a/drivers/gpu/drm/armada/armada_drm.h
+++ b/drivers/gpu/drm/armada/armada_drm.h
@@ -16,6 +16,8 @@ struct armada_crtc;
 struct armada_gem_object;
 struct clk;
 struct drm_display_mode;
+struct drm_fb_helper;
+struct drm_fb_helper_surface_size;
 
 static inline void
 armada_updatel(uint32_t val, uint32_t mask, void __iomem *ptr)
@@ -74,10 +76,13 @@ struct armada_private {
 #define drm_to_armada_dev(dev) container_of(dev, struct armada_private, drm)
 
 #if defined(CONFIG_DRM_FBDEV_EMULATION)
-void armada_fbdev_setup(struct drm_device *dev);
+int armada_fbdev_driver_fbdev_probe(struct drm_fb_helper *fbh,
+   struct drm_fb_helper_surface_size *sizes);
+#define ARMADA_FBDEV_DRIVER_OPS \
+   .fbdev_probe = armada_fbdev_driver_fbdev_probe
 #else
-static inline void armada_fbdev_setup(struct drm_device *dev)
-{ }
+#define ARMADA_FBDEV_DRIVER_OPS \
+   .fbdev_probe = NULL
 #endif
 
 int armada_overlay_plane_create(struct drm_device *, unsigned long);
diff --git a/drivers/gpu/drm/armada/armada_drv.c 
b/drivers/gpu/drm/armada/armada_drv.c
index e51ecc4f7ef4..3dc5f0499e4c 100644
--- a/drivers/gpu/drm/armada/armada_drv.c
+++ b/drivers/gpu/drm/armada/armada_drv.c
@@ -12,6 +12,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -39,6 +40,7 @@ DEFINE_DRM_GEM_FOPS(armada_drm_fops);
 static const struct drm_driver armada_drm_driver = {
.gem_prime_import   = armada_gem_prime_import,
.dumb_create= armada_gem_dumb_create,
+   ARMADA_FBDEV_DRIVER_OPS,
.major  = 1,
.minor  = 0,
.name   = "armada-drm",
@@ -137,7 +139,7 @@ static int armada_drm_bind(struct device *dev)
armada_drm_debugfs_init(priv->drm.primary);
 #endif
 
-   armada_fbdev_setup(&priv->drm);
+   drm_client_setup(&priv->drm, NULL);
 
return 0;
 
diff --git a/drivers/gpu/drm/armada/armada_fbdev.c 
b/drivers/gpu/drm/armada/armada_fbdev.c
index d223176912b6..6ee7ce04ee71 100644
--- a/drivers/gpu/drm/armada/armada_fbdev.c
+++ b/drivers/gpu/drm/armada/armada_fbdev.c
@@ -39,8 +39,10 @@ static const struct fb_ops armada_fb_ops = {
.fb_destroy = armada_fbdev_fb_destroy,
 };
 
-static int armada_fbdev_create(struct drm_fb_helper *fbh,
-   struct drm_fb_helper_surface_size *sizes)
+static const struct drm_fb_helper_funcs armada_fbdev_helper_funcs;
+
+int armada_fbdev_driver_fbdev_probe(struct drm_fb_helper *fbh,
+   struct drm_fb_helper_surface_size *sizes)
 {
struct drm_device *dev = fbh->dev;
struct drm_mode_fb_cmd2 mode;
@@ -98,6 +100,7 @@ static int armada_fbdev_create(struct drm_fb_helper *fbh,
info->fix.smem_len = obj->obj.size;
info->screen_size = obj->obj.size;
info->screen_base = ptr;
+   fbh->funcs = &armada_fbdev_helper_funcs;
fbh->fb = &dfb->fb;
 
drm_fb_helper_fill_info(info, fbh, sizes);
@@ -112,109 +115,3 @@ static int armada_fbdev_create(struct drm_fb_helper *fbh,
dfb->fb.funcs->destroy(&dfb->fb);
return ret;
 }
-
-static int armada_fb_probe(struct drm_fb_helper *fbh,
-   struct drm_fb_helper_surface_size *sizes)
-{
-   int ret = 0;
-
-   if (!fbh->fb) {
-   ret = armada_

[PATCH v5 76/80] drm/msm: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Rework fbdev probing to support fbdev_probe in struct drm_driver
and remove the old fb_probe callback. Provide an initializer macro
for struct drm_driver that sets the callback according to the kernel
configuration.

Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

The msm driver specifies a preferred color mode of 32. As this
is the default if no format has been given, leave it out entirely.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Cc: Rob Clark 
Cc: Abhinav Kumar 
Cc: Dmitry Baryshkov 
Cc: Sean Paul 
Cc: Marijn Suijten 
Acked-by: Javier Martinez Canillas 
Reviewed-by: Dmitry Baryshkov 
---
 drivers/gpu/drm/msm/Kconfig |   1 +
 drivers/gpu/drm/msm/msm_drv.c   |   4 +-
 drivers/gpu/drm/msm/msm_drv.h   |  13 ++-
 drivers/gpu/drm/msm/msm_fbdev.c | 144 ++--
 4 files changed, 39 insertions(+), 123 deletions(-)

diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
index c8dda0ebd043..f16d7c00e089 100644
--- a/drivers/gpu/drm/msm/Kconfig
+++ b/drivers/gpu/drm/msm/Kconfig
@@ -14,6 +14,7 @@ config DRM_MSM
select IOMMU_IO_PGTABLE
select QCOM_MDT_LOADER if ARCH_QCOM
select REGULATOR
+   select DRM_CLIENT_SELECTION
select DRM_DISPLAY_DP_AUX_BUS
select DRM_DISPLAY_DP_HELPER
select DRM_DISPLAY_HELPER
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 9c33f4e3f822..22fe0716d18b 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -10,6 +10,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -292,7 +293,7 @@ static int msm_drm_init(struct device *dev, const struct 
drm_driver *drv)
 
if (priv->kms_init) {
drm_kms_helper_poll_init(ddev);
-   msm_fbdev_setup(ddev);
+   drm_client_setup(ddev, NULL);
}
 
return 0;
@@ -903,6 +904,7 @@ static const struct drm_driver msm_driver = {
 #ifdef CONFIG_DEBUG_FS
.debugfs_init   = msm_debugfs_init,
 #endif
+   MSM_FBDEV_DRIVER_OPS,
.show_fdinfo= msm_show_fdinfo,
.ioctls = msm_ioctls,
.num_ioctls = ARRAY_SIZE(msm_ioctls),
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index 0d3adf398bc1..15de89b3cd3e 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -40,6 +40,9 @@ extern struct fault_attr fail_gem_iova;
 #  define should_fail(attr, size) 0
 #endif
 
+struct drm_fb_helper;
+struct drm_fb_helper_surface_size;
+
 struct msm_kms;
 struct msm_gpu;
 struct msm_mmu;
@@ -294,11 +297,13 @@ struct drm_framebuffer * msm_alloc_stolen_fb(struct 
drm_device *dev,
int w, int h, int p, uint32_t format);
 
 #ifdef CONFIG_DRM_FBDEV_EMULATION
-void msm_fbdev_setup(struct drm_device *dev);
+int msm_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
+struct drm_fb_helper_surface_size *sizes);
+#define MSM_FBDEV_DRIVER_OPS \
+   .fbdev_probe = msm_fbdev_driver_fbdev_probe
 #else
-static inline void msm_fbdev_setup(struct drm_device *dev)
-{
-}
+#define MSM_FBDEV_DRIVER_OPS \
+   .fbdev_probe = NULL
 #endif
 
 struct hdmi;
diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c
index 030bedac632d..c62249b1ab3d 100644
--- a/drivers/gpu/drm/msm/msm_fbdev.c
+++ b/drivers/gpu/drm/msm/msm_fbdev.c
@@ -65,8 +65,31 @@ static const struct fb_ops msm_fb_ops = {
.fb_destroy = msm_fbdev_fb_destroy,
 };
 
-static int msm_fbdev_create(struct drm_fb_helper *helper,
-   struct drm_fb_helper_surface_size *sizes)
+static int msm_fbdev_fb_dirty(struct drm_fb_helper *helper,
+ struct drm_clip_rect *clip)
+{
+   struct drm_device *dev = helper->dev;
+   int ret;
+
+   /* Call damage handlers only if necessary */
+   if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2))
+   return 0;
+
+   if (helper->fb->funcs->dirty) {
+   ret = helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 1);
+   if (drm_WARN_ONCE(dev, ret, "Dirty helper failed: ret=%d\n", 
ret))
+   return ret;
+   }
+
+   return 0;
+}
+
+static const struct drm_fb_helper_funcs msm_fbdev_helper_funcs = {
+   .fb_dirty = msm_fbdev_fb_dirty,
+};
+
+int msm_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
+struct drm_fb_helper_surface_size *sizes)
 {
struct drm_device *dev = helper->dev;
struct msm_drm_private *priv = dev->dev_private;
@@ -114,6 +137,7 @@ static int msm_fbdev_create(struct drm_fb_helper *helper,
 
DBG("fbi=%p, dev=%p", fbi, dev);
 
+   helper->funcs = &msm_fbdev_he

[PATCH v5 49/80] drm/fbdev-shmem: Support struct drm_driver.fbdev_probe

2024-09-24 Thread Thomas Zimmermann
Rework fbdev probing to support fbdev_probe in struct drm_driver
and reimplement the old fb_probe callback on top of it. Provide an
initializer macro for struct drm_driver that sets the callback
according to the kernel configuration.

This change allows the common fbdev client to run on top of SHMEM-
based DRM drivers.

Signed-off-by: Thomas Zimmermann 
Reviewed-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/drm_fbdev_shmem.c | 60 ++-
 include/drm/drm_fbdev_shmem.h | 11 ++
 2 files changed, 47 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/drm_fbdev_shmem.c 
b/drivers/gpu/drm/drm_fbdev_shmem.c
index 0c785007f11b..3bca333917d1 100644
--- a/drivers/gpu/drm/drm_fbdev_shmem.c
+++ b/drivers/gpu/drm/drm_fbdev_shmem.c
@@ -107,6 +107,40 @@ static struct page *drm_fbdev_shmem_get_page(struct 
fb_info *info, unsigned long
 
 static int drm_fbdev_shmem_helper_fb_probe(struct drm_fb_helper *fb_helper,
   struct drm_fb_helper_surface_size 
*sizes)
+{
+   return drm_fbdev_shmem_driver_fbdev_probe(fb_helper, sizes);
+}
+
+static int drm_fbdev_shmem_helper_fb_dirty(struct drm_fb_helper *helper,
+  struct drm_clip_rect *clip)
+{
+   struct drm_device *dev = helper->dev;
+   int ret;
+
+   /* Call damage handlers only if necessary */
+   if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2))
+   return 0;
+
+   if (helper->fb->funcs->dirty) {
+   ret = helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 1);
+   if (drm_WARN_ONCE(dev, ret, "Dirty helper failed: ret=%d\n", 
ret))
+   return ret;
+   }
+
+   return 0;
+}
+
+static const struct drm_fb_helper_funcs drm_fbdev_shmem_helper_funcs = {
+   .fb_probe = drm_fbdev_shmem_helper_fb_probe,
+   .fb_dirty = drm_fbdev_shmem_helper_fb_dirty,
+};
+
+/*
+ * struct drm_driver
+ */
+
+int drm_fbdev_shmem_driver_fbdev_probe(struct drm_fb_helper *fb_helper,
+  struct drm_fb_helper_surface_size *sizes)
 {
struct drm_client_dev *client = &fb_helper->client;
struct drm_device *dev = fb_helper->dev;
@@ -139,6 +173,7 @@ static int drm_fbdev_shmem_helper_fb_probe(struct 
drm_fb_helper *fb_helper,
goto err_drm_client_buffer_delete;
}
 
+   fb_helper->funcs = &drm_fbdev_shmem_helper_funcs;
fb_helper->buffer = buffer;
fb_helper->fb = fb;
 
@@ -182,30 +217,7 @@ static int drm_fbdev_shmem_helper_fb_probe(struct 
drm_fb_helper *fb_helper,
drm_client_framebuffer_delete(buffer);
return ret;
 }
-
-static int drm_fbdev_shmem_helper_fb_dirty(struct drm_fb_helper *helper,
-  struct drm_clip_rect *clip)
-{
-   struct drm_device *dev = helper->dev;
-   int ret;
-
-   /* Call damage handlers only if necessary */
-   if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2))
-   return 0;
-
-   if (helper->fb->funcs->dirty) {
-   ret = helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 1);
-   if (drm_WARN_ONCE(dev, ret, "Dirty helper failed: ret=%d\n", 
ret))
-   return ret;
-   }
-
-   return 0;
-}
-
-static const struct drm_fb_helper_funcs drm_fbdev_shmem_helper_funcs = {
-   .fb_probe = drm_fbdev_shmem_helper_fb_probe,
-   .fb_dirty = drm_fbdev_shmem_helper_fb_dirty,
-};
+EXPORT_SYMBOL(drm_fbdev_shmem_driver_fbdev_probe);
 
 /*
  * struct drm_client_funcs
diff --git a/include/drm/drm_fbdev_shmem.h b/include/drm/drm_fbdev_shmem.h
index fb43cadd1950..3a5d1efa9d55 100644
--- a/include/drm/drm_fbdev_shmem.h
+++ b/include/drm/drm_fbdev_shmem.h
@@ -4,12 +4,23 @@
 #define DRM_FBDEV_SHMEM_H
 
 struct drm_device;
+struct drm_fb_helper;
+struct drm_fb_helper_surface_size;
 
 #ifdef CONFIG_DRM_FBDEV_EMULATION
+int drm_fbdev_shmem_driver_fbdev_probe(struct drm_fb_helper *fb_helper,
+  struct drm_fb_helper_surface_size 
*sizes);
+
+#define DRM_FBDEV_SHMEM_DRIVER_OPS \
+   .fbdev_probe = drm_fbdev_shmem_driver_fbdev_probe
+
 void drm_fbdev_shmem_setup(struct drm_device *dev, unsigned int preferred_bpp);
 #else
 static inline void drm_fbdev_shmem_setup(struct drm_device *dev, unsigned int 
preferred_bpp)
 { }
+
+#define DRM_FBDEV_SHMEM_DRIVER_OPS \
+   .fbdev_probe = NULL
 #endif
 
 #endif
-- 
2.46.0



[PATCH v5 68/80] drm/nouveau: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

The nouveau driver specifies a preferred color mode depending on
the available video memory, with a default of 32. Adapt this for
the new client interface.

v5:
- select DRM_CLIENT_SELECTION
v2:
- style changes

Signed-off-by: Thomas Zimmermann 
Cc: Karol Herbst 
Cc: Lyude Paul 
Cc: Danilo Krummrich 
Reviewed-by: Lyude Paul 
Acked-by: Danilo Krummrich 
---
 drivers/gpu/drm/nouveau/Kconfig   |  1 +
 drivers/gpu/drm/nouveau/nouveau_drm.c | 10 --
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/Kconfig b/drivers/gpu/drm/nouveau/Kconfig
index ceef470c9fbf..ce840300578d 100644
--- a/drivers/gpu/drm/nouveau/Kconfig
+++ b/drivers/gpu/drm/nouveau/Kconfig
@@ -4,6 +4,7 @@ config DRM_NOUVEAU
depends on DRM && PCI && MMU
select IOMMU_API
select FW_LOADER
+   select DRM_CLIENT_SELECTION
select DRM_DISPLAY_DP_HELPER
select DRM_DISPLAY_HDMI_HELPER
select DRM_DISPLAY_HELPER
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c 
b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 4a9a9b9c3935..628c47a60de5 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -31,6 +31,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -836,6 +837,7 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
 {
struct nvkm_device *device;
struct nouveau_drm *drm;
+   const struct drm_format_info *format;
int ret;
 
if (vga_switcheroo_client_probe_defer(pdev))
@@ -873,9 +875,11 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
goto fail_pci;
 
if (drm->client.device.info.ram_size <= 32 * 1024 * 1024)
-   drm_fbdev_ttm_setup(drm->dev, 8);
+   format = drm_format_info(DRM_FORMAT_C8);
else
-   drm_fbdev_ttm_setup(drm->dev, 32);
+   format = NULL;
+
+   drm_client_setup(drm->dev, format);
 
quirk_broken_nv_runpm(pdev);
return 0;
@@ -1317,6 +1321,8 @@ driver_stub = {
.dumb_create = nouveau_display_dumb_create,
.dumb_map_offset = drm_gem_ttm_dumb_map_offset,
 
+   DRM_FBDEV_TTM_DRIVER_OPS,
+
.name = DRIVER_NAME,
.desc = DRIVER_DESC,
 #ifdef GIT_REVISION
-- 
2.46.0



[PATCH v5 60/80] drm/udl: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Cc: Dave Airlie 
Cc: Sean Paul 
Cc: Thomas Zimmermann 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/udl/Kconfig   | 1 +
 drivers/gpu/drm/udl/udl_drv.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/udl/Kconfig b/drivers/gpu/drm/udl/Kconfig
index c744175c6992..d7a6abef7d78 100644
--- a/drivers/gpu/drm/udl/Kconfig
+++ b/drivers/gpu/drm/udl/Kconfig
@@ -5,6 +5,7 @@ config DRM_UDL
depends on USB
depends on USB_ARCH_HAS_HCD
depends on MMU
+   select DRM_CLIENT_SELECTION
select DRM_GEM_SHMEM_HELPER
select DRM_KMS_HELPER
help
diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c
index 280a09a6e2ad..8d8ae40f945c 100644
--- a/drivers/gpu/drm/udl/udl_drv.c
+++ b/drivers/gpu/drm/udl/udl_drv.c
@@ -6,6 +6,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -73,6 +74,7 @@ static const struct drm_driver driver = {
.fops = &udl_driver_fops,
DRM_GEM_SHMEM_DRIVER_OPS,
.gem_prime_import = udl_driver_gem_prime_import,
+   DRM_FBDEV_SHMEM_DRIVER_OPS,
 
.name = DRIVER_NAME,
.desc = DRIVER_DESC,
@@ -117,7 +119,7 @@ static int udl_usb_probe(struct usb_interface *interface,
 
DRM_INFO("Initialized udl on minor %d\n", udl->drm.primary->index);
 
-   drm_fbdev_shmem_setup(&udl->drm, 0);
+   drm_client_setup(&udl->drm, NULL);
 
return 0;
 }
-- 
2.46.0



[PATCH v5 63/80] drm/fbdev-shmem: Remove obsolete setup function

2024-09-24 Thread Thomas Zimmermann
The old setup function drm_fbdev_shmem_setup() is unused. Remove it
and its internal callbacks. New drivers should call drm_client_setup()
instead.

Signed-off-by: Thomas Zimmermann 
Reviewed-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/drm_fbdev_shmem.c | 120 +-
 include/drm/drm_fbdev_shmem.h |   6 --
 2 files changed, 1 insertion(+), 125 deletions(-)

diff --git a/drivers/gpu/drm/drm_fbdev_shmem.c 
b/drivers/gpu/drm/drm_fbdev_shmem.c
index 3bca333917d1..f824369baacd 100644
--- a/drivers/gpu/drm/drm_fbdev_shmem.c
+++ b/drivers/gpu/drm/drm_fbdev_shmem.c
@@ -2,15 +2,13 @@
 
 #include 
 
-#include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 
-#include 
-
 /*
  * struct fb_ops
  */
@@ -105,12 +103,6 @@ static struct page *drm_fbdev_shmem_get_page(struct 
fb_info *info, unsigned long
  * struct drm_fb_helper
  */
 
-static int drm_fbdev_shmem_helper_fb_probe(struct drm_fb_helper *fb_helper,
-  struct drm_fb_helper_surface_size 
*sizes)
-{
-   return drm_fbdev_shmem_driver_fbdev_probe(fb_helper, sizes);
-}
-
 static int drm_fbdev_shmem_helper_fb_dirty(struct drm_fb_helper *helper,
   struct drm_clip_rect *clip)
 {
@@ -131,7 +123,6 @@ static int drm_fbdev_shmem_helper_fb_dirty(struct 
drm_fb_helper *helper,
 }
 
 static const struct drm_fb_helper_funcs drm_fbdev_shmem_helper_funcs = {
-   .fb_probe = drm_fbdev_shmem_helper_fb_probe,
.fb_dirty = drm_fbdev_shmem_helper_fb_dirty,
 };
 
@@ -218,112 +209,3 @@ int drm_fbdev_shmem_driver_fbdev_probe(struct 
drm_fb_helper *fb_helper,
return ret;
 }
 EXPORT_SYMBOL(drm_fbdev_shmem_driver_fbdev_probe);
-
-/*
- * struct drm_client_funcs
- */
-
-static void drm_fbdev_shmem_client_unregister(struct drm_client_dev *client)
-{
-   struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client);
-
-   if (fb_helper->info) {
-   drm_fb_helper_unregister_info(fb_helper);
-   } else {
-   drm_client_release(&fb_helper->client);
-   drm_fb_helper_unprepare(fb_helper);
-   kfree(fb_helper);
-   }
-}
-
-static int drm_fbdev_shmem_client_restore(struct drm_client_dev *client)
-{
-   drm_fb_helper_lastclose(client->dev);
-
-   return 0;
-}
-
-static int drm_fbdev_shmem_client_hotplug(struct drm_client_dev *client)
-{
-   struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client);
-   struct drm_device *dev = client->dev;
-   int ret;
-
-   if (dev->fb_helper)
-   return drm_fb_helper_hotplug_event(dev->fb_helper);
-
-   ret = drm_fb_helper_init(dev, fb_helper);
-   if (ret)
-   goto err_drm_err;
-
-   if (!drm_drv_uses_atomic_modeset(dev))
-   drm_helper_disable_unused_functions(dev);
-
-   ret = drm_fb_helper_initial_config(fb_helper);
-   if (ret)
-   goto err_drm_fb_helper_fini;
-
-   return 0;
-
-err_drm_fb_helper_fini:
-   drm_fb_helper_fini(fb_helper);
-err_drm_err:
-   drm_err(dev, "fbdev-shmem: Failed to setup emulation (ret=%d)\n", ret);
-   return ret;
-}
-
-static const struct drm_client_funcs drm_fbdev_shmem_client_funcs = {
-   .owner  = THIS_MODULE,
-   .unregister = drm_fbdev_shmem_client_unregister,
-   .restore= drm_fbdev_shmem_client_restore,
-   .hotplug= drm_fbdev_shmem_client_hotplug,
-};
-
-/**
- * drm_fbdev_shmem_setup() - Setup fbdev emulation for GEM SHMEM helpers
- * @dev: DRM device
- * @preferred_bpp: Preferred bits per pixel for the device.
- * 32 is used if this is zero.
- *
- * This function sets up fbdev emulation for GEM DMA drivers that support
- * dumb buffers with a virtual address and that can be mmap'ed.
- * drm_fbdev_shmem_setup() shall be called after the DRM driver registered
- * the new DRM device with drm_dev_register().
- *
- * Restore, hotplug events and teardown are all taken care of. Drivers that do
- * suspend/resume need to call drm_fb_helper_set_suspend_unlocked() themselves.
- * Simple drivers might use drm_mode_config_helper_suspend().
- *
- * This function is safe to call even when there are no connectors present.
- * Setup will be retried on the next hotplug event.
- *
- * The fbdev is destroyed by drm_dev_unregister().
- */
-void drm_fbdev_shmem_setup(struct drm_device *dev, unsigned int preferred_bpp)
-{
-   struct drm_fb_helper *fb_helper;
-   int ret;
-
-   drm_WARN(dev, !dev->registered, "Device has not been registered.\n");
-   drm_WARN(dev, dev->fb_helper, "fb_helper is already set!\n");
-
-   fb_helper = kzalloc(sizeof(*fb_helper), GFP_KERNEL);
-   if (!fb_helper)
-   return;
-   drm_fb_helper_prepare(dev, fb_helper, preferred_bpp, 
&drm_fbdev_shmem_helper_funcs);
-
-   ret = drm_client_init(dev, &fb_he

[PATCH v5 21/80] drm/imx/lcdc: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Cc: Shawn Guo 
Cc: Sascha Hauer 
Cc: Pengutronix Kernel Team 
Cc: Fabio Estevam 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/imx/lcdc/Kconfig| 1 +
 drivers/gpu/drm/imx/lcdc/imx-lcdc.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/imx/lcdc/Kconfig b/drivers/gpu/drm/imx/lcdc/Kconfig
index 9c28bb0f4662..75869489b0e6 100644
--- a/drivers/gpu/drm/imx/lcdc/Kconfig
+++ b/drivers/gpu/drm/imx/lcdc/Kconfig
@@ -1,6 +1,7 @@
 config DRM_IMX_LCDC
   tristate "Freescale i.MX LCDC displays"
   depends on DRM && (ARCH_MXC || COMPILE_TEST)
+  select DRM_CLIENT_SELECTION
   select DRM_GEM_DMA_HELPER
   select DRM_KMS_HELPER
   select DRM_DISPLAY_HELPER
diff --git a/drivers/gpu/drm/imx/lcdc/imx-lcdc.c 
b/drivers/gpu/drm/imx/lcdc/imx-lcdc.c
index 36668455aee8..3215c4acd675 100644
--- a/drivers/gpu/drm/imx/lcdc/imx-lcdc.c
+++ b/drivers/gpu/drm/imx/lcdc/imx-lcdc.c
@@ -3,6 +3,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -348,6 +349,7 @@ static struct drm_driver imx_lcdc_drm_driver = {
.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
.fops = &imx_lcdc_drm_fops,
DRM_GEM_DMA_DRIVER_OPS_VMAP,
+   DRM_FBDEV_DMA_DRIVER_OPS,
.name = "imx-lcdc",
.desc = "i.MX LCDC driver",
.date = "20200716",
@@ -501,7 +503,7 @@ static int imx_lcdc_probe(struct platform_device *pdev)
if (ret)
return dev_err_probe(dev, ret, "Cannot register device\n");
 
-   drm_fbdev_dma_setup(drm, 0);
+   drm_client_setup(drm, NULL);
 
return 0;
 }
-- 
2.46.0



[PATCH v5 76/80] drm/msm: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Rework fbdev probing to support fbdev_probe in struct drm_driver
and remove the old fb_probe callback. Provide an initializer macro
for struct drm_driver that sets the callback according to the kernel
configuration.

Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

The msm driver specifies a preferred color mode of 32. As this
is the default if no format has been given, leave it out entirely.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Cc: Rob Clark 
Cc: Abhinav Kumar 
Cc: Dmitry Baryshkov 
Cc: Sean Paul 
Cc: Marijn Suijten 
Acked-by: Javier Martinez Canillas 
Reviewed-by: Dmitry Baryshkov 
---
 drivers/gpu/drm/msm/Kconfig |   1 +
 drivers/gpu/drm/msm/msm_drv.c   |   4 +-
 drivers/gpu/drm/msm/msm_drv.h   |  13 ++-
 drivers/gpu/drm/msm/msm_fbdev.c | 144 ++--
 4 files changed, 39 insertions(+), 123 deletions(-)

diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
index c8dda0ebd043..f16d7c00e089 100644
--- a/drivers/gpu/drm/msm/Kconfig
+++ b/drivers/gpu/drm/msm/Kconfig
@@ -14,6 +14,7 @@ config DRM_MSM
select IOMMU_IO_PGTABLE
select QCOM_MDT_LOADER if ARCH_QCOM
select REGULATOR
+   select DRM_CLIENT_SELECTION
select DRM_DISPLAY_DP_AUX_BUS
select DRM_DISPLAY_DP_HELPER
select DRM_DISPLAY_HELPER
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 9c33f4e3f822..22fe0716d18b 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -10,6 +10,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -292,7 +293,7 @@ static int msm_drm_init(struct device *dev, const struct 
drm_driver *drv)
 
if (priv->kms_init) {
drm_kms_helper_poll_init(ddev);
-   msm_fbdev_setup(ddev);
+   drm_client_setup(ddev, NULL);
}
 
return 0;
@@ -903,6 +904,7 @@ static const struct drm_driver msm_driver = {
 #ifdef CONFIG_DEBUG_FS
.debugfs_init   = msm_debugfs_init,
 #endif
+   MSM_FBDEV_DRIVER_OPS,
.show_fdinfo= msm_show_fdinfo,
.ioctls = msm_ioctls,
.num_ioctls = ARRAY_SIZE(msm_ioctls),
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index 0d3adf398bc1..15de89b3cd3e 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -40,6 +40,9 @@ extern struct fault_attr fail_gem_iova;
 #  define should_fail(attr, size) 0
 #endif
 
+struct drm_fb_helper;
+struct drm_fb_helper_surface_size;
+
 struct msm_kms;
 struct msm_gpu;
 struct msm_mmu;
@@ -294,11 +297,13 @@ struct drm_framebuffer * msm_alloc_stolen_fb(struct 
drm_device *dev,
int w, int h, int p, uint32_t format);
 
 #ifdef CONFIG_DRM_FBDEV_EMULATION
-void msm_fbdev_setup(struct drm_device *dev);
+int msm_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
+struct drm_fb_helper_surface_size *sizes);
+#define MSM_FBDEV_DRIVER_OPS \
+   .fbdev_probe = msm_fbdev_driver_fbdev_probe
 #else
-static inline void msm_fbdev_setup(struct drm_device *dev)
-{
-}
+#define MSM_FBDEV_DRIVER_OPS \
+   .fbdev_probe = NULL
 #endif
 
 struct hdmi;
diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c
index 030bedac632d..c62249b1ab3d 100644
--- a/drivers/gpu/drm/msm/msm_fbdev.c
+++ b/drivers/gpu/drm/msm/msm_fbdev.c
@@ -65,8 +65,31 @@ static const struct fb_ops msm_fb_ops = {
.fb_destroy = msm_fbdev_fb_destroy,
 };
 
-static int msm_fbdev_create(struct drm_fb_helper *helper,
-   struct drm_fb_helper_surface_size *sizes)
+static int msm_fbdev_fb_dirty(struct drm_fb_helper *helper,
+ struct drm_clip_rect *clip)
+{
+   struct drm_device *dev = helper->dev;
+   int ret;
+
+   /* Call damage handlers only if necessary */
+   if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2))
+   return 0;
+
+   if (helper->fb->funcs->dirty) {
+   ret = helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 1);
+   if (drm_WARN_ONCE(dev, ret, "Dirty helper failed: ret=%d\n", 
ret))
+   return ret;
+   }
+
+   return 0;
+}
+
+static const struct drm_fb_helper_funcs msm_fbdev_helper_funcs = {
+   .fb_dirty = msm_fbdev_fb_dirty,
+};
+
+int msm_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper,
+struct drm_fb_helper_surface_size *sizes)
 {
struct drm_device *dev = helper->dev;
struct msm_drm_private *priv = dev->dev_private;
@@ -114,6 +137,7 @@ static int msm_fbdev_create(struct drm_fb_helper *helper,
 
DBG("fbi=%p, dev=%p", fbi, dev);
 
+   helper->funcs = &msm_fbdev_he

[PATCH v5 36/80] drm/repaper: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Cc: "Noralf Trønnes" 
Acked-by: Noralf Trønnes 
---
 drivers/gpu/drm/tiny/Kconfig   | 1 +
 drivers/gpu/drm/tiny/repaper.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tiny/Kconfig b/drivers/gpu/drm/tiny/Kconfig
index 98af6fd6aa70..1bceb34a09dd 100644
--- a/drivers/gpu/drm/tiny/Kconfig
+++ b/drivers/gpu/drm/tiny/Kconfig
@@ -181,6 +181,7 @@ config TINYDRM_MI0283QT
 config TINYDRM_REPAPER
tristate "DRM support for Pervasive Displays RePaper panels (V231)"
depends on DRM && SPI
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_GEM_DMA_HELPER
help
diff --git a/drivers/gpu/drm/tiny/repaper.c b/drivers/gpu/drm/tiny/repaper.c
index 1f78aa3d26bb..77944eb17b3c 100644
--- a/drivers/gpu/drm/tiny/repaper.c
+++ b/drivers/gpu/drm/tiny/repaper.c
@@ -22,6 +22,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -913,6 +914,7 @@ static const struct drm_driver repaper_driver = {
.driver_features= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
.fops   = &repaper_fops,
DRM_GEM_DMA_DRIVER_OPS_VMAP,
+   DRM_FBDEV_DMA_DRIVER_OPS,
.name   = "repaper",
.desc   = "Pervasive Displays RePaper e-ink panels",
.date   = "20170405",
@@ -1118,7 +1120,7 @@ static int repaper_probe(struct spi_device *spi)
 
DRM_DEBUG_DRIVER("SPI speed: %uMHz\n", spi->max_speed_hz / 100);
 
-   drm_fbdev_dma_setup(drm, 0);
+   drm_client_setup(drm, NULL);
 
return 0;
 }
-- 
2.46.0



[PATCH v5 53/80] drm/gm12u320: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Cc: Hans de Goede 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/tiny/Kconfig| 1 +
 drivers/gpu/drm/tiny/gm12u320.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tiny/Kconfig b/drivers/gpu/drm/tiny/Kconfig
index d6194296d6da..86abd90d19aa 100644
--- a/drivers/gpu/drm/tiny/Kconfig
+++ b/drivers/gpu/drm/tiny/Kconfig
@@ -46,6 +46,7 @@ config DRM_CIRRUS_QEMU
 config DRM_GM12U320
tristate "GM12U320 driver for USB projectors"
depends on DRM && USB && MMU
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_GEM_SHMEM_HELPER
help
diff --git a/drivers/gpu/drm/tiny/gm12u320.c b/drivers/gpu/drm/tiny/gm12u320.c
index 0bd7707c053e..0c17ae532fb4 100644
--- a/drivers/gpu/drm/tiny/gm12u320.c
+++ b/drivers/gpu/drm/tiny/gm12u320.c
@@ -9,6 +9,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -632,6 +633,7 @@ static const struct drm_driver gm12u320_drm_driver = {
.fops= &gm12u320_fops,
DRM_GEM_SHMEM_DRIVER_OPS,
.gem_prime_import = gm12u320_gem_prime_import,
+   DRM_FBDEV_SHMEM_DRIVER_OPS,
 };
 
 static const struct drm_mode_config_funcs gm12u320_mode_config_funcs = {
@@ -706,7 +708,7 @@ static int gm12u320_usb_probe(struct usb_interface 
*interface,
if (ret)
goto err_put_device;
 
-   drm_fbdev_shmem_setup(dev, 0);
+   drm_client_setup(dev, NULL);
 
return 0;
 
-- 
2.46.0



[PATCH v5 25/80] drm/mcde: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

The mcde driver specifies a preferred color mode of 32. As this
is the default if no format has been given, leave it out entirely.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Cc: Linus Walleij 
Acked-by: Linus Walleij 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/mcde/Kconfig| 1 +
 drivers/gpu/drm/mcde/mcde_drv.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mcde/Kconfig b/drivers/gpu/drm/mcde/Kconfig
index 907460b69d4f..3516c8d2a5d9 100644
--- a/drivers/gpu/drm/mcde/Kconfig
+++ b/drivers/gpu/drm/mcde/Kconfig
@@ -6,6 +6,7 @@ config DRM_MCDE
depends on OF
depends on COMMON_CLK
select MFD_SYSCON
+   select DRM_CLIENT_SELECTION
select DRM_MIPI_DSI
select DRM_BRIDGE
select DRM_PANEL_BRIDGE
diff --git a/drivers/gpu/drm/mcde/mcde_drv.c b/drivers/gpu/drm/mcde/mcde_drv.c
index 10c06440c7e7..6f4e0f3bf532 100644
--- a/drivers/gpu/drm/mcde/mcde_drv.c
+++ b/drivers/gpu/drm/mcde/mcde_drv.c
@@ -67,6 +67,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -212,6 +213,7 @@ static const struct drm_driver mcde_drm_driver = {
.minor = 0,
.patchlevel = 0,
DRM_GEM_DMA_DRIVER_OPS,
+   DRM_FBDEV_DMA_DRIVER_OPS,
 };
 
 static int mcde_drm_bind(struct device *dev)
@@ -237,7 +239,7 @@ static int mcde_drm_bind(struct device *dev)
if (ret < 0)
goto unbind;
 
-   drm_fbdev_dma_setup(drm, 32);
+   drm_client_setup(drm, NULL);
 
return 0;
 
-- 
2.46.0



[PATCH v5 27/80] drm/meson: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

The meson driver specifies a preferred color mode of 32. As this
is the default if no format has been given, leave it out entirely.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Cc: Neil Armstrong 
Cc: Kevin Hilman 
Cc: Jerome Brunet 
Cc: Martin Blumenstingl 
Reviewed-by: Neil Armstrong 
---
 drivers/gpu/drm/meson/Kconfig | 1 +
 drivers/gpu/drm/meson/meson_drv.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/meson/Kconfig b/drivers/gpu/drm/meson/Kconfig
index 2544756538cc..b410e0d8015a 100644
--- a/drivers/gpu/drm/meson/Kconfig
+++ b/drivers/gpu/drm/meson/Kconfig
@@ -3,6 +3,7 @@ config DRM_MESON
tristate "DRM Support for Amlogic Meson Display Controller"
depends on DRM && OF && (ARM || ARM64)
depends on ARCH_MESON || COMPILE_TEST
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_DISPLAY_HELPER
select DRM_BRIDGE_CONNECTOR
diff --git a/drivers/gpu/drm/meson/meson_drv.c 
b/drivers/gpu/drm/meson/meson_drv.c
index 4bd0baa2a4f5..2f76f48da38d 100644
--- a/drivers/gpu/drm/meson/meson_drv.c
+++ b/drivers/gpu/drm/meson/meson_drv.c
@@ -17,6 +17,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -98,6 +99,7 @@ static const struct drm_driver meson_driver = {
 
/* DMA Ops */
DRM_GEM_DMA_DRIVER_OPS_WITH_DUMB_CREATE(meson_dumb_create),
+   DRM_FBDEV_DMA_DRIVER_OPS,
 
/* Misc */
.fops   = &fops,
@@ -353,7 +355,7 @@ static int meson_drv_bind_master(struct device *dev, bool 
has_components)
if (ret)
goto uninstall_irq;
 
-   drm_fbdev_dma_setup(drm, 32);
+   drm_client_setup(drm, NULL);
 
return 0;
 
-- 
2.46.0



[PATCH v5 38/80] drm/sti: Run DRM default client setup

2024-09-24 Thread Thomas Zimmermann
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

The sti driver specifies a preferred color mode of 32. As this
is the default if no format has been given, leave it out entirely.

v5:
- select DRM_CLIENT_SELECTION

Signed-off-by: Thomas Zimmermann 
Cc: Alain Volmat 
Acked-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/sti/Kconfig   | 1 +
 drivers/gpu/drm/sti/sti_drv.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sti/Kconfig b/drivers/gpu/drm/sti/Kconfig
index 75c301aadcbc..ec341a4720d4 100644
--- a/drivers/gpu/drm/sti/Kconfig
+++ b/drivers/gpu/drm/sti/Kconfig
@@ -3,6 +3,7 @@ config DRM_STI
tristate "DRM Support for STMicroelectronics SoC stiH4xx Series"
depends on OF && DRM && (ARCH_STI || COMPILE_TEST)
select RESET_CONTROLLER
+   select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_GEM_DMA_HELPER
select DRM_PANEL
diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index 1799c12babf5..65f180c8e8e2 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -15,6 +15,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -136,6 +137,7 @@ static const struct drm_driver sti_driver = {
.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
.fops = &sti_driver_fops,
DRM_GEM_DMA_DRIVER_OPS,
+   DRM_FBDEV_DMA_DRIVER_OPS,
 
.debugfs_init = sti_drm_dbg_init,
 
@@ -203,7 +205,7 @@ static int sti_bind(struct device *dev)
 
drm_mode_config_reset(ddev);
 
-   drm_fbdev_dma_setup(ddev, 32);
+   drm_client_setup(ddev, NULL);
 
return 0;
 
-- 
2.46.0



[PATCH v5 02/80] drm/fbdev-helper: Set and clear VGA switcheroo client from fb_info

2024-09-24 Thread Thomas Zimmermann
Call vga_switcheroo_client_fb_set() with the PCI device from the
instance of struct fb_info. All fbdev clients now run these calls.
For non-PCI devices or drivers without vga-switcheroo, this does
nothing. For i915 and radeon, it allows these drivers to use a
common fbdev client.

The device is the same as the one stored in struct drm_client and
struct drm_fb_helper, so there is no difference in behavior. Some
NULL-pointer checks are being removed, where those pointers cannot
be NULL.

v4:
- clarify call semantics for drm_fb_helper_unregister_info() (Javier)

Signed-off-by: Thomas Zimmermann 
Reviewed-by: Javier Martinez Canillas 
---
 drivers/gpu/drm/drm_fb_helper.c | 17 -
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index af1fe79c701d..550fa69311cb 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -554,7 +554,7 @@ EXPORT_SYMBOL(drm_fb_helper_release_info);
 
 /**
  * drm_fb_helper_unregister_info - unregister fb_info framebuffer device
- * @fb_helper: driver-allocated fbdev helper, can be NULL
+ * @fb_helper: driver-allocated fbdev helper, must not be NULL
  *
  * A wrapper around unregister_framebuffer, to release the fb_info
  * framebuffer device. This must be called before releasing all resources for
@@ -562,8 +562,12 @@ EXPORT_SYMBOL(drm_fb_helper_release_info);
  */
 void drm_fb_helper_unregister_info(struct drm_fb_helper *fb_helper)
 {
-   if (fb_helper && fb_helper->info)
-   unregister_framebuffer(fb_helper->info);
+   struct fb_info *info = fb_helper->info;
+   struct device *dev = info->device;
+
+   if (dev_is_pci(dev))
+   vga_switcheroo_client_fb_set(to_pci_dev(dev), NULL);
+   unregister_framebuffer(fb_helper->info);
 }
 EXPORT_SYMBOL(drm_fb_helper_unregister_info);
 
@@ -1615,6 +1619,7 @@ static int drm_fb_helper_single_fb_probe(struct 
drm_fb_helper *fb_helper)
struct drm_client_dev *client = &fb_helper->client;
struct drm_device *dev = fb_helper->dev;
struct drm_fb_helper_surface_size sizes;
+   struct fb_info *info;
int ret;
 
ret = drm_fb_helper_find_sizes(fb_helper, &sizes);
@@ -1632,9 +1637,11 @@ static int drm_fb_helper_single_fb_probe(struct 
drm_fb_helper *fb_helper)
 
strcpy(fb_helper->fb->comm, "[fbcon]");
 
+   info = fb_helper->info;
+
/* Set the fb info for vgaswitcheroo clients. Does nothing otherwise. */
-   if (dev_is_pci(dev->dev))
-   vga_switcheroo_client_fb_set(to_pci_dev(dev->dev), 
fb_helper->info);
+   if (dev_is_pci(info->device))
+   vga_switcheroo_client_fb_set(to_pci_dev(info->device), info);
 
return 0;
 }
-- 
2.46.0



<    3   4   5   6   7   8   9   10   11   12   >