* [PATCH v9 0/5] drm/microchip: add GFX2D support for SAM9X60 and SAM9X75
@ 2026-10-06 12:56 Cyrille Pitchen
2026-10-06 12:56 ` [PATCH v9 1/5] dt-bindings: gpu: add bindings for the Microchip GFX2D GPU Cyrille Pitchen
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Cyrille Pitchen @ 2026-10-06 12:56 UTC (permalink / raw)
To: David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Nicolas Ferre, Alexandre Belloni, Claudiu Beznea, Russell King
Cc: dri-devel, devicetree, linux-kernel, linux-arm-kernel,
Cyrille Pitchen, Conor Dooley, Manikandan Muralidharan
Hi all,
This series of patches adds GFX2D support.
The GFX2D is a 2D GPU embedded in some Microchip SoCs such as the
SAM9X60 and SAM9X75.
Patches have been developped on top the 'linux-6.12-mchp' branch of the
https://github.com/linux4microchip/linux.git repository and tested on
mainly on a sam9x75-curiosity board and also on a sam9x60-ek board.
Later, the patches have also been rebased on the 'linux-6.18-mchp'
branch of the https://github.com/linux4microchip/linux.git repository
then tested on a sam9x75-curiosity board.
Finally, they have been rebased on top of the 'drm-misc-next' branch
of the https://gitlab.freedesktop.org/drm/misc/kernel.git repository
for mainlining. Hence, they have been tested on a sam9x75-curiosity
board running a linux4microchip 26.04 image where the kernel + DTB
have been replaced with the new kernel compiled from the 'drm-misc-next'
branch (currently based on linux 7.3.0-rc4).
About the tests, the GFX2D driver was used with the M2D (Multi 2D)
library: https://github.com/linux4sam/libm2d
This is an open source library that abstracts 2D GPUs like the Microchip
GFX2D and the Vivante GC520UL, providing graphics applications or
libraries with a unified API, inspired from OpenGL but focused on 2D GPUs.
The libm2d library itself relies on the libdrm library to send commands to
the relevant DRM driver in the Linux kernel.
The libm2d library has not been designed to be thread-safe. Indeed, it is
intended to be used by a single thread for better performances.
M2D comes with a m2d_test program to run basic unitary tests.
In addition, libm2d has been integrated to two graphics frameworks:
- EGT: https://github.com/linux4sam/egt
- LVGL: https://github.com/lvgl/lvgl/pull/8729
Tested the system suspend with the 'systemctl suspend' command.
Tested the runtime pm with the 'egt_boards' application.
BR,
Cyrille
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@microchip.com>
---
Changes in v9:
- Rebased onto the 'drm-misc-next' branch on 2026-10-06.
- Reworked patch 2 mainly based on sashiko comments:
+ Used 'struct drm_gem_dma_object' as the new base for 'struct
mchp_gfx2d_gem_object'.
+ Removed useless initialization of 'ret' in mchp_gfx2d_schedule().
+ Changed type of 'struct drm_mchp_gfx2d_submit.num_rectangles' from
'__kernel_size_t' to '__u32'.
+ Added missing support of special blend functions in blend commands.
+ Added helper functions to {en,de}queue commands in the running list.
+ Enabled the EXEND interrupt when partial or pending commands are
scheduled to make sure such commands can actually progress.
+ Replaced pm_runtime_resume_and_get() with pm_runtime_get_noresume()
in mchp_gfx2d_thread().
+ Added a comment about the 'BLEND_SREG' GPU internal register that
could be overwritten on SAM9X60 SoCs.
+ Fixed integer truncation of the ROP mode in
mchp_gfx2d_set_rop_params() to prevent userspace from bypassing mask
validation.
+ Added upper bound check for the number of rectangles in SUBMIT ioctl.
+ Fixed mchp_gfx2d_cleanup_command_queue() to access hardware
registers only if the peripheral clock is enabled.
+ Fixed potential corrumption of 'priv->wlist' by concurrent WAIT ioctls
on the same GEM object.
+ Kept imported surface metadata immutable after first import.
+ Changed type of 'next_id' from 'static uint32_t' to 'static
atomic_t' to avoid potential races.
+ Replaced atomic_dec() with atomic_dec_return() in
mchp_gfx2d_gem_unref().
+ Fixed potential corruption of the shared per-file 'rectangles' buffer
by concurrent SUBMIT ioctls on the same file descriptor.
+ Fixed the potential Use-After-Free of GEM object in
mchp_gfx2d_ioctl_alloc_buffer().
+ Made mchp_gfx2d_ioctl_sync_for_cpu() invalidate the CPU cache for
non-coherent buffers by calling dma_sync_single_for_cpu().
+ Made mchp_gfx2d_ioctl_sync_for_gpu() clean the CPU cache for
non-coherent buffers by calling dma_sync_single_for_device().
+ Replaced flush_cache_range() with flush_cache_mm() in
mchp_gfx2d_ioctl_sync_for_gpu() to manage the cache aliasing issue
on SAM9 (ARM926) without copying a 'struct vm_area_struct'.
- Link to v8: https://lore.kernel.org/r/20260828-cpitchen-mainline_gfx2d-v8-0-378374559738@microchip.com
Changes in v8:
- Rebased onto the 'drm-misc-next' branch on 2026-08-28.
- Collected Reviewed-by tags from Manikandan Muralidharan on patches 3
and 4
- Replaced kzalloc() with kzalloc_obj() in patch 2 as suggested by
checkpatch.pl.
- Link to v7: https://lore.kernel.org/r/20260209-cpitchen-mainline_gfx2d-v7-0-0c12e64a0950@microchip.com
Changes in v7:
- Rebased onto the 'drm-misc-next' branch on 2026-02-09.
- Rewored patch 2:
+ Reworked the former valid_pixel_format() function into the new
mchp_gfx2d_valid_buffer_params() function, which is called from both
the mchp_gfx2d_ioctl_{alloc,import}_buffer() functions and now checks
the `width` and `stride` parameters in addition to the `format` one.
+ Added the mchp_gfx2d_valid_size() function, which is called from both
the mchp_gfx2d_ioctl_{alloc,import}_buffer() functions and checks
(`stride` * `height`) against `size` as suggested by Daniel Stone.
- Link to v6: https://lore.kernel.org/r/20260120-cpitchen-mainline_gfx2d-v6-0-1a16cd1d70b8@microchip.com
Changes in v6:
- Shrank the size of the register set in the device tree from 0x4000
down to 0x100 (patches 1, 3 and 4).
- Collected Reviewed-by and Acked-by tags from Nicolas Ferre on patches
1 and 5.
- Rebased onto the 'drm-misc-next' branch on 2026-01-20.
- Link to v5: https://lore.kernel.org/r/20260113-cpitchen-mainline_gfx2d-v5-0-9cdab8fa699b@microchip.com
Changes in v5:
- Fixed compilation issues in patch 2:
+ Included <drm/drm_print.h> from mchp_gfx2d_cmd.c, mchp_gfx2d_drv.c
and mchp_gfx2d_gem.c.
+ Replaced '.remove_new' with '.remove' in definition of 'struct
platform_driver mchp_gfx2d_platform_driver' to match the latest
definition of 'struct platform_driver'.
+ Removed the '.date' member from the definition of 'struct drm_driver
mchp_gfx2d_drm_driver' since this 'date' member has been removed from
'struct drm_driver'.
- Fixed typos in doxygen documentations of two functions:
+ mchp_gfx2d_process_completed_commands()
+ mchp_gfx2d_init_command_queue()
- Link to v4: https://lore.kernel.org/r/20260112-cpitchen-mainline_gfx2d-v4-0-f210041ad343@microchip.com
Changes in v4:
- Rebased onto the 'drm-misc-next' branch on 2026-01-12.
- Link to v3: https://lore.kernel.org/r/20251124-cpitchen-mainline_gfx2d-v3-0-607f8c407286@microchip.com
Changes in v3:
- Collected Acked-by tag from Conor Dooley on patch 1
- Rebased onto the 'drm-misc-next' branch on 2025-11-24.
- Link to v2: https://lore.kernel.org/r/20250918-cpitchen-mainline_gfx2d-v2-0-6cfac9d56612@microchip.com
Changes in v2:
- Renamed microchip,gfx2d.yaml into microchip,sam9x60-gfx2d.yaml.
- Removed the 'clock-names' property from the DT bindings.
- Renamed the GPU node from 'gfx2d' to 'gpu' in sam9x{60,7}.dtsi files.
- Link to v1: https://lore.kernel.org/r/20250911-cpitchen-mainline_gfx2d-v1-0-d7fab1a381ee@microchip.com
---
Cyrille Pitchen (5):
dt-bindings: gpu: add bindings for the Microchip GFX2D GPU
drm/microchip: add a driver for the Microchip GFX2D GPU
ARM: dts: microchip: sam9x60: Add GFX2D GPU
ARM: dts: microchip: sam9x7: Add GFX2D GPU
ARM: configs: at91_dt_defconfig: enable GFX2D driver
.../bindings/gpu/microchip,sam9x60-gfx2d.yaml | 46 +
MAINTAINERS | 10 +
arch/arm/boot/dts/microchip/sam9x60.dtsi | 8 +
arch/arm/boot/dts/microchip/sam9x7.dtsi | 8 +
arch/arm/configs/at91_dt_defconfig | 1 +
drivers/gpu/drm/Kconfig | 1 +
drivers/gpu/drm/Makefile | 1 +
drivers/gpu/drm/microchip/Kconfig | 22 +
drivers/gpu/drm/microchip/Makefile | 8 +
drivers/gpu/drm/microchip/mchp_gfx2d_cmd.c | 1925 ++++++++++++++++++++
drivers/gpu/drm/microchip/mchp_gfx2d_cmd.h | 181 ++
drivers/gpu/drm/microchip/mchp_gfx2d_drv.c | 363 ++++
drivers/gpu/drm/microchip/mchp_gfx2d_drv.h | 134 ++
drivers/gpu/drm/microchip/mchp_gfx2d_gem.c | 178 ++
drivers/gpu/drm/microchip/mchp_gfx2d_gem.h | 78 +
drivers/gpu/drm/microchip/mchp_gfx2d_ioctl.c | 334 ++++
drivers/gpu/drm/microchip/mchp_gfx2d_ioctl.h | 17 +
include/uapi/drm/microchip_drm.h | 286 +++
18 files changed, 3601 insertions(+)
---
base-commit: 4f2fb106c459e6b96ddfa542de40e517b5274c44
change-id: 20250911-cpitchen-mainline_gfx2d-6631e9352af7
Best regards,
--
Cyrille Pitchen <cyrille.pitchen@microchip.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v9 1/5] dt-bindings: gpu: add bindings for the Microchip GFX2D GPU
2026-10-06 12:56 [PATCH v9 0/5] drm/microchip: add GFX2D support for SAM9X60 and SAM9X75 Cyrille Pitchen
@ 2026-10-06 12:56 ` Cyrille Pitchen
2026-10-06 12:56 ` [PATCH v9 3/5] ARM: dts: microchip: sam9x60: Add " Cyrille Pitchen
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Cyrille Pitchen @ 2026-10-06 12:56 UTC (permalink / raw)
To: David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Nicolas Ferre, Alexandre Belloni, Claudiu Beznea, Russell King
Cc: dri-devel, devicetree, linux-kernel, linux-arm-kernel,
Cyrille Pitchen, Conor Dooley
The Microchip GFX2D GPU is embedded in the SAM9X60 and SAM9X7 SoC family.
Describe how the GFX2D GPU is integrated in these SoCs, including
register space, interrupt and clock.
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@microchip.com>
---
.../bindings/gpu/microchip,sam9x60-gfx2d.yaml | 46 ++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/Documentation/devicetree/bindings/gpu/microchip,sam9x60-gfx2d.yaml b/Documentation/devicetree/bindings/gpu/microchip,sam9x60-gfx2d.yaml
new file mode 100644
index 000000000000..1c0faef83900
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpu/microchip,sam9x60-gfx2d.yaml
@@ -0,0 +1,46 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/gpu/microchip,sam9x60-gfx2d.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microchip GFX2D GPU
+
+maintainers:
+ - Cyrille Pitchen <cyrille.pitchen@microchip.com>
+
+properties:
+ compatible:
+ enum:
+ - microchip,sam9x60-gfx2d
+ - microchip,sam9x7-gfx2d
+
+ reg:
+ maxItems: 1
+
+ interrupts:
+ maxItems: 1
+
+ clocks:
+ maxItems: 1
+
+required:
+ - compatible
+ - reg
+ - interrupts
+ - clocks
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/interrupt-controller/irq.h>
+ #include <dt-bindings/clock/at91.h>
+ gpu@f0018000 {
+ compatible = "microchip,sam9x60-gfx2d";
+ reg = <0xf0018000 0x100>;
+ interrupts = <36 IRQ_TYPE_LEVEL_HIGH 0>;
+ clocks = <&pmc PMC_TYPE_PERIPHERAL 36>;
+ };
+
+...
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v9 3/5] ARM: dts: microchip: sam9x60: Add GFX2D GPU
2026-10-06 12:56 [PATCH v9 0/5] drm/microchip: add GFX2D support for SAM9X60 and SAM9X75 Cyrille Pitchen
2026-10-06 12:56 ` [PATCH v9 1/5] dt-bindings: gpu: add bindings for the Microchip GFX2D GPU Cyrille Pitchen
@ 2026-10-06 12:56 ` Cyrille Pitchen
2026-10-06 12:56 ` [PATCH v9 4/5] ARM: dts: microchip: sam9x7: " Cyrille Pitchen
2026-10-06 12:56 ` [PATCH v9 5/5] ARM: configs: at91_dt_defconfig: enable GFX2D driver Cyrille Pitchen
3 siblings, 0 replies; 5+ messages in thread
From: Cyrille Pitchen @ 2026-10-06 12:56 UTC (permalink / raw)
To: David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Nicolas Ferre, Alexandre Belloni, Claudiu Beznea, Russell King
Cc: dri-devel, devicetree, linux-kernel, linux-arm-kernel,
Cyrille Pitchen, Manikandan Muralidharan
Add support for the GFX2D GPU.
Reviewed-by: Manikandan Muralidharan <manikandan.m@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@microchip.com>
---
arch/arm/boot/dts/microchip/sam9x60.dtsi | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/arm/boot/dts/microchip/sam9x60.dtsi b/arch/arm/boot/dts/microchip/sam9x60.dtsi
index e708b3df4ccd..1155f4f997f8 100644
--- a/arch/arm/boot/dts/microchip/sam9x60.dtsi
+++ b/arch/arm/boot/dts/microchip/sam9x60.dtsi
@@ -351,6 +351,14 @@ AT91_XDMAC_DT_PERID(26))>,
status = "disabled";
};
+ gpu: gpu@f0018000 {
+ compatible = "microchip,sam9x60-gfx2d";
+ reg = <0xf0018000 0x100>;
+ interrupts = <36 IRQ_TYPE_LEVEL_HIGH 0>;
+ clocks = <&pmc PMC_TYPE_PERIPHERAL 36>;
+ status = "disabled";
+ };
+
i2s: i2s@f001c000 {
compatible = "microchip,sam9x60-i2smcc";
reg = <0xf001c000 0x100>;
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v9 4/5] ARM: dts: microchip: sam9x7: Add GFX2D GPU
2026-10-06 12:56 [PATCH v9 0/5] drm/microchip: add GFX2D support for SAM9X60 and SAM9X75 Cyrille Pitchen
2026-10-06 12:56 ` [PATCH v9 1/5] dt-bindings: gpu: add bindings for the Microchip GFX2D GPU Cyrille Pitchen
2026-10-06 12:56 ` [PATCH v9 3/5] ARM: dts: microchip: sam9x60: Add " Cyrille Pitchen
@ 2026-10-06 12:56 ` Cyrille Pitchen
2026-10-06 12:56 ` [PATCH v9 5/5] ARM: configs: at91_dt_defconfig: enable GFX2D driver Cyrille Pitchen
3 siblings, 0 replies; 5+ messages in thread
From: Cyrille Pitchen @ 2026-10-06 12:56 UTC (permalink / raw)
To: David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Nicolas Ferre, Alexandre Belloni, Claudiu Beznea, Russell King
Cc: dri-devel, devicetree, linux-kernel, linux-arm-kernel,
Cyrille Pitchen, Manikandan Muralidharan
Add support for the GFX2D GPU.
Reviewed-by: Manikandan Muralidharan <manikandan.m@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@microchip.com>
---
arch/arm/boot/dts/microchip/sam9x7.dtsi | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/arm/boot/dts/microchip/sam9x7.dtsi b/arch/arm/boot/dts/microchip/sam9x7.dtsi
index c680a5033b6b..5450fddf89dd 100644
--- a/arch/arm/boot/dts/microchip/sam9x7.dtsi
+++ b/arch/arm/boot/dts/microchip/sam9x7.dtsi
@@ -292,6 +292,14 @@ AT91_XDMAC_DT_PERID(26))>,
status = "disabled";
};
+ gpu: gpu@f0018000 {
+ compatible = "microchip,sam9x7-gfx2d";
+ reg = <0xf0018000 0x100>;
+ interrupts = <36 IRQ_TYPE_LEVEL_HIGH 0>;
+ clocks = <&pmc PMC_TYPE_PERIPHERAL 36>;
+ status = "disabled";
+ };
+
i2s: i2s@f001c000 {
compatible = "microchip,sam9x7-i2smcc", "microchip,sam9x60-i2smcc";
reg = <0xf001c000 0x100>;
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v9 5/5] ARM: configs: at91_dt_defconfig: enable GFX2D driver
2026-10-06 12:56 [PATCH v9 0/5] drm/microchip: add GFX2D support for SAM9X60 and SAM9X75 Cyrille Pitchen
` (2 preceding siblings ...)
2026-10-06 12:56 ` [PATCH v9 4/5] ARM: dts: microchip: sam9x7: " Cyrille Pitchen
@ 2026-10-06 12:56 ` Cyrille Pitchen
3 siblings, 0 replies; 5+ messages in thread
From: Cyrille Pitchen @ 2026-10-06 12:56 UTC (permalink / raw)
To: David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Nicolas Ferre, Alexandre Belloni, Claudiu Beznea, Russell King
Cc: dri-devel, devicetree, linux-kernel, linux-arm-kernel,
Cyrille Pitchen
The GFX2D GPU is embedded in both SAM9X60 and SAM9X75; enable the
driver to use it.
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@microchip.com>
---
arch/arm/configs/at91_dt_defconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/configs/at91_dt_defconfig b/arch/arm/configs/at91_dt_defconfig
index 830c6c0dbdaf..2a4a2d4c1865 100644
--- a/arch/arm/configs/at91_dt_defconfig
+++ b/arch/arm/configs/at91_dt_defconfig
@@ -142,6 +142,7 @@ CONFIG_VIDEO_OV2640=m
CONFIG_VIDEO_OV7740=m
CONFIG_DRM=y
CONFIG_DRM_ATMEL_HLCDC=y
+CONFIG_DRM_MICROCHIP_GFX2D=y
CONFIG_DRM_MICROCHIP_LVDS_SERIALIZER=y
CONFIG_DRM_PANEL_SIMPLE=y
CONFIG_DRM_PANEL_EDP=y
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-10-06 12:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-06 12:56 [PATCH v9 0/5] drm/microchip: add GFX2D support for SAM9X60 and SAM9X75 Cyrille Pitchen
2026-10-06 12:56 ` [PATCH v9 1/5] dt-bindings: gpu: add bindings for the Microchip GFX2D GPU Cyrille Pitchen
2026-10-06 12:56 ` [PATCH v9 3/5] ARM: dts: microchip: sam9x60: Add " Cyrille Pitchen
2026-10-06 12:56 ` [PATCH v9 4/5] ARM: dts: microchip: sam9x7: " Cyrille Pitchen
2026-10-06 12:56 ` [PATCH v9 5/5] ARM: configs: at91_dt_defconfig: enable GFX2D driver Cyrille Pitchen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox