Skip to contentSkip to conversation

drm: LogiCVC display controller support

PATCH Superseded Paul Kocialkowski 3 participants 7 messages Dec 3, 2019 – Apr 3, 2020

Subsystems (4)

v4 of 12 Superseded Latest is v12 →

lore
Share & tools
lore
#0 lore raw

v4 cover drm: LogiCVC display controller support

This series introduces support for the LogiCVC display controller. The controller is a bit unusual since it is usually loaded as programmable logic on Xilinx FPGAs or Zynq-7000 SoCs. More details are presented on the main commit for the driver.

More information about the controller is available on the dedicated web page: https://www.logicbricks.com/Products/logiCVC-ML.aspx

Changes since v3:
- Rebased on latest drm-misc;
- Improved event lock wrapping;
- Added collect tag;
- Added color-key support patch (not for merge, for reference only).

Changes since v2:
- Fixed and slightly improved dt schema.

Changes since v1:
- Switched dt bindings documentation to dt schema;
- Described more possible dt parameters;
- Added support for the lvds-3bit interface;
- Added support for grabbing syscon regmap from parent node;
- Removed layers count property and count layers child nodes instead.

Cheers!

Paul Kocialkowski (3):
dt-bindings: display: Document the Xylon LogiCVC display controller
drm: Add support for the LogiCVC display controller
WIP: drm/logicvc: Add plane colorkey support

 .../display/xylon,logicvc-display.yaml        | 313 ++++++++
 drivers/gpu/drm/Kconfig                       |   2 +
 drivers/gpu/drm/Makefile                      |   1 +
 drivers/gpu/drm/logicvc/Kconfig               |   8 +
 drivers/gpu/drm/logicvc/Makefile              |   4 +
 drivers/gpu/drm/logicvc/logicvc_crtc.c        | 271 +++++++
 drivers/gpu/drm/logicvc/logicvc_crtc.h        |  25 +
 drivers/gpu/drm/logicvc/logicvc_drm.c         | 467 +++++++++++
 drivers/gpu/drm/logicvc/logicvc_drm.h         |  63 ++
 drivers/gpu/drm/logicvc/logicvc_interface.c   | 235 ++++++
 drivers/gpu/drm/logicvc/logicvc_interface.h   |  32 +
 drivers/gpu/drm/logicvc/logicvc_layer.c       | 733 ++++++++++++++++++
 drivers/gpu/drm/logicvc/logicvc_layer.h       |  72 ++
 drivers/gpu/drm/logicvc/logicvc_mode.c        | 103 +++
 drivers/gpu/drm/logicvc/logicvc_mode.h        |  15 +
 drivers/gpu/drm/logicvc/logicvc_of.c          | 205 +++++
 drivers/gpu/drm/logicvc/logicvc_of.h          |  28 +
 drivers/gpu/drm/logicvc/logicvc_regs.h        |  88 +++
 18 files changed, 2665 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/xylon,logicvc-display.yaml
 create mode 100644 drivers/gpu/drm/logicvc/Kconfig
 create mode 100644 drivers/gpu/drm/logicvc/Makefile
 create mode 100644 drivers/gpu/drm/logicvc/logicvc_crtc.c
 create mode 100644 drivers/gpu/drm/logicvc/logicvc_crtc.h
 create mode 100644 drivers/gpu/drm/logicvc/logicvc_drm.c
 create mode 100644 drivers/gpu/drm/logicvc/logicvc_drm.h
 create mode 100644 drivers/gpu/drm/logicvc/logicvc_interface.c
 create mode 100644 drivers/gpu/drm/logicvc/logicvc_interface.h
 create mode 100644 drivers/gpu/drm/logicvc/logicvc_layer.c
 create mode 100644 drivers/gpu/drm/logicvc/logicvc_layer.h
 create mode 100644 drivers/gpu/drm/logicvc/logicvc_mode.c
 create mode 100644 drivers/gpu/drm/logicvc/logicvc_mode.h
 create mode 100644 drivers/gpu/drm/logicvc/logicvc_of.c
 create mode 100644 drivers/gpu/drm/logicvc/logicvc_of.h
 create mode 100644 drivers/gpu/drm/logicvc/logicvc_regs.h
Signature · 1 line
2.24.0
#1 lore raw

PATCH v4 1/3 dt-bindings: display: Document the Xylon LogiCVC display controller

The Xylon LogiCVC is a display controller implemented as programmable logic in Xilinx FPGAs.

---
 .../display/xylon,logicvc-display.yaml        | 313 ++++++++++++++++++
 1 file changed, 313 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/xylon,logicvc-display.yaml
Documentation/devicetree/bindings/display/xylon,logicvc-display.yaml new file +313 -0
new file mode 100644
index 000000000000..817fcced764f
@@ -0,0 +1,313 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2019 Bootlin
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/display/xylon,logicvc-display.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Xylon LogiCVC display controller
+
+maintainers:
+  - Paul Kocialkowski <[email protected]>
+
+description: |
+  The Xylon LogiCVC is a display controller that supports multiple layers.
+  It is usually implemented as programmable logic and was optimized for use
+  with Xilinx Zynq-7000 SoCs and Xilinx FPGAs.
+
+  Because the controller is intended for use in a FPGA, most of the
+  configuration of the controller takes place at logic configuration bitstream
+  synthesis time. As a result, many of the device-tree bindings are meant to
+  reflect the synthesis configuration and must not be configured differently.
+  Matching synthesis parameters are provided when applicable.
+
+  Layers are declared in the "layers" sub-node and have dedicated configuration.
+  In version 3 of the controller, each layer has fixed memory offset and address
+  starting from the video memory base address for its framebuffer. In version 4,
+  framebuffers are configured with a direct memory address instead.
+
+properties:
+  compatible:
+    enum:
+      - xylon,logicvc-3.02.a-display
+      - xylon,logicvc-4.01.a-display
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    minItems: 1
+    maxItems: 4
+
+  clock-names:
+    minItems: 1
+    maxItems: 4
+    items:
+      # vclk is required and must be provided as first item.
+      - const: vclk
+      # Other clocks are optional and can be provided in any order.
+      - enum:
+          - vclk2
+          - lvdsclk
+          - lvdsclkn
+      - enum:
+          - vclk2
+          - lvdsclk
+          - lvdsclkn
+      - enum:
+          - vclk2
+          - lvdsclk
+          - lvdsclkn
+
+  interrupts:
+    maxItems: 1
+
+  memory-region:
+    maxItems: 1
+
+  xylon,display-interface:
+    enum:
+      # Parallel RGB interface (C_DISPLAY_INTERFACE == 0)
+      - parallel-rgb
+      # ITU-T BR656 interface (C_DISPLAY_INTERFACE == 1)
+      - bt656
+      # 4-bit LVDS interface (C_DISPLAY_INTERFACE == 2)
+      - lvds-4bits
+      # 3-bit LVDS interface (C_DISPLAY_INTERFACE == 4)
+      - lvds-3bits
+      # DVI interface (C_DISPLAY_INTERFACE == 5)
+      - dvi
+    description: Display output interface (C_DISPLAY_INTERFACE).
+
+  xylon,display-colorspace:
+    enum:
+      # RGB colorspace (C_DISPLAY_COLOR_SPACE == 0)
+      - rgb
+      # YUV 4:2:2 colorspace (C_DISPLAY_COLOR_SPACE == 1)
+      - yuv422
+      # YUV 4:4:4 colorspace (C_DISPLAY_COLOR_SPACE == 2)
+      - yuv444
+    description: Display output colorspace (C_DISPLAY_COLOR_SPACE).
+
+  xylon,display-depth:
+    $ref: "/schemas/types.yaml#/definitions/uint32"
+    description: Display output depth (C_PIXEL_DATA_WIDTH).
+
+  xylon,row-stride:
+    $ref: "/schemas/types.yaml#/definitions/uint32"
+    description: Fixed number of pixels in a framebuffer row (C_ROW_STRIDE).
+
+  xylon,syscon:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: |
+      Syscon phandle representing the top-level logicvc instance, useful when
+      the parent node is not the top-level logicvc instance.
+
+  xylon,dithering:
+    $ref: "/schemas/types.yaml#/definitions/flag"
+    description: Dithering module is enabled (C_XCOLOR)
+
+  xylon,background-layer:
+    $ref: "/schemas/types.yaml#/definitions/flag"
+    description: |
+      The last layer is used to display a black background (C_USE_BACKGROUND).
+      The layer must still be registered.
+
+  xylon,layers-configurable:
+     $ref: "/schemas/types.yaml#/definitions/flag"
+     description: |
+       Configuration of layers' size, position and offset is enabled
+       (C_USE_SIZE_POSITION).
+
+  layers:
+    type: object
+
+    properties:
+      "#address-cells":
+        const: 1
+
+      "#size-cells":
+        const: 0
+
+    patternProperties:
+      "^layer@[0-9]+$":
+        type: object
+
+        properties:
+          reg:
+            maxItems: 1
+
+          xylon,layer-depth:
+            $ref: "/schemas/types.yaml#/definitions/uint32"
+            description: Layer depth (C_LAYER_X_DATA_WIDTH).
+
+          xylon,layer-colorspace:
+            enum:
+              # RGB colorspace (C_LAYER_X_TYPE == 0)
+              - rgb
+              # YUV packed colorspace (C_LAYER_X_TYPE == 0)
+              - yuv
+            description: Layer colorspace (C_LAYER_X_TYPE).
+
+          xylon,layer-alpha-mode:
+            enum:
+              # Alpha is configured layer-wide (C_LAYER_X_ALPHA_MODE == 0)
+              - layer
+              # Alpha is configured per-pixel (C_LAYER_X_ALPHA_MODE == 1)
+              - pixel
+            description: Alpha mode for the layer (C_LAYER_X_ALPHA_MODE).
+
+          xylon,layer-base-offset:
+            $ref: "/schemas/types.yaml#/definitions/uint32"
+            description: |
+              Offset in number of lines (C_LAYER_X_OFFSET) starting from the
+              video RAM base (C_VMEM_BASEADDR), only for version 3.
+
+          xylon,layer-buffer-offset:
+            $ref: "/schemas/types.yaml#/definitions/uint32"
+            description: |
+              Offset in number of lines (C_BUFFER_*_OFFSET) starting from the
+              layer base offset for the second buffer used in double-buffering.
+
+          xylon,layer-primary:
+            $ref: "/schemas/types.yaml#/definitions/flag"
+            description: |
+              Layer should be registered as a primary plane (exactly one is
+              required).
+
+        additionalProperties: false
+
+        required:
+          - reg
+          - xylon,layer-depth
+          - xylon,layer-colorspace
+          - xylon,layer-alpha-mode
+
+    required:
+      - "#address-cells"
+      - "#size-cells"
+      - layer@0
+
+    additionalProperties: false
+
+    description: |
+      The description of the display controller layers, containing layer
+      sub-nodes that each describe a registered layer.
+
+  ports:
+    type: object
+
+additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - interrupts
+  - xylon,display-interface
+  - xylon,display-colorspace
+  - xylon,display-depth
+  - xylon,row-stride
+  - layers
+  - ports
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    logicvc: logicvc@43c00000 {
+      compatible = "xylon,logicvc-3.02.a", "syscon", "simple-mfd";
+      reg = <0x43c00000 0x6000>;
+
+      #address-cells = <1>;
+      #size-cells = <1>;
+
+      logicvc_display: display-engine@0 {
+        compatible = "xylon,logicvc-3.02.a-display";
+        reg = <0x0 0x6000>;
+
+        memory-region = <&logicvc_cma>;
+
+        clocks = <&logicvc_vclk 0>, <&logicvc_lvdsclk 0>;
+        clock-names = "vclk", "lvdsclk";
+
+        interrupt-parent = <&intc>;
+        interrupts = <0 34 IRQ_TYPE_LEVEL_HIGH>;
+
+        xylon,display-interface = "lvds-4bits";
+        xylon,display-colorspace = "rgb";
+        xylon,display-depth = <16>;
+        xylon,row-stride = <1024>;
+
+        xylon,layers-configurable;
+
+        layers {
+          #address-cells = <1>;
+          #size-cells = <0>;
+
+          layer@0 {
+            reg = <0>;
+            xylon,layer-depth = <16>;
+            xylon,layer-colorspace = "rgb";
+            xylon,layer-alpha-mode = "layer";
+            xylon,layer-base-offset = <0>;
+            xylon,layer-buffer-offset = <480>;
+            xylon,layer-primary;
+          };
+
+          layer@1 {
+            reg = <1>;
+            xylon,layer-depth = <16>;
+            xylon,layer-colorspace = "rgb";
+            xylon,layer-alpha-mode = "layer";
+            xylon,layer-base-offset = <2400>;
+            xylon,layer-buffer-offset = <480>;
+          };
+
+          layer@2 {
+            reg = <2>;
+            xylon,layer-depth = <16>;
+            xylon,layer-colorspace = "rgb";
+            xylon,layer-alpha-mode = "layer";
+            xylon,layer-base-offset = <960>;
+            xylon,layer-buffer-offset = <480>;
+          };
+
+          layer@3 {
+            reg = <3>;
+            xylon,layer-depth = <16>;
+            xylon,layer-colorspace = "rgb";
+            xylon,layer-alpha-mode = "layer";
+            xylon,layer-base-offset = <480>;
+            xylon,layer-buffer-offset = <480>;
+          };
+
+          layer@4 {
+            reg = <4>;
+            xylon,layer-depth = <16>;
+            xylon,layer-colorspace = "rgb";
+            xylon,layer-alpha-mode = "layer";
+            xylon,layer-base-offset = <8192>;
+            xylon,layer-buffer-offset = <480>;
+          };
+        };
+
+        ports {
+          #address-cells = <1>;
+          #size-cells = <0>;
+
+          logicvc_out: port@1 {
+            reg = <1>;
+
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            logicvc_output: endpoint@0 {
+              reg = <0>;
+              remote-endpoint = <&panel_input>;
+            };
+          };
+        };
+      };
+    };
Signature · 6 lines
2.24.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer Acked-by on v4 1/3
#2 lore raw

Re: [PATCH v4 1/3] dt-bindings: display: Document the Xylon LogiCVC display controller

Quoted 9 lines · Paul Kocialkowski

The Xylon LogiCVC is a display controller implemented as programmable logic in Xilinx FPGAs.

---
 .../display/xylon,logicvc-display.yaml        | 313 ++++++++++++++++++
 1 file changed, 313 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/xylon,logicvc-display.yaml
#3 lore raw

PATCH v4 2/3 drm: Add support for the LogiCVC display controller

In reply to Paul Kocialkowski

Introduces a driver for the LogiCVC display controller, a programmable logic controller optimized for use in Xilinx Zynq-7000 SoCs and other Xilinx FPGAs. The controller is mostly configured at logic synthesis time so only a subset of configuration is left for the driver to handle.

The following features are implemented and tested:
- LVDS 4-bit interface;
- RGB565 pixel formats;
- Multiple layers and hardware composition;
- Layer-wide alpha mode;

The following features are implemented but untested:
- Other RGB pixel formats;
- Layer framebuffer configuration for version 4;
- Lowest-layer used as background color;
- Per-pixel alpha mode.

The following features are not implemented:
- YUV pixel formats;
- DVI, LVDS 3-bit, ITU656 and camera link interfaces;
- External parallel input for layer;
- Color-keying;
- LUT-based alpha modes.

Additional implementation-specific notes:
- Panels are only enabled after the first page flip to avoid flashing a white screen.
- Depth used in context of the LogiCVC driver only counts color components to match the definition of the synthesis parameters.

Support is implemented for both version 3 and 4 of the controller.

With version 3, framebuffers are stored in a dedicated contiguous memory area, with a base address hardcoded for each layer. This requires using a dedicated CMA pool registered at the base address and tweaking a few offset-related registers to try to use any buffer allocated from the pool. This is done on a best-effort basis to have the hardware cope with the DRM framebuffer allocation model and there is no guarantee that each buffer allocated by GEM CMA can be used for any layer. In particular, buffers allocated below the base address for a layer are guaranteed not to be configurable for that layer. See the implementation of logicvc_layer_buffer_find_setup for specifics.

Version 4 allows configuring each buffer address directly, which guarantees that any buffer can be configured.

---
 drivers/gpu/drm/Kconfig                     |   2 +
 drivers/gpu/drm/Makefile                    |   1 +
 drivers/gpu/drm/logicvc/Kconfig             |   8 +
 drivers/gpu/drm/logicvc/Makefile            |   4 +
 drivers/gpu/drm/logicvc/logicvc_crtc.c      | 271 +++++++++
 drivers/gpu/drm/logicvc/logicvc_crtc.h      |  25 +
 drivers/gpu/drm/logicvc/logicvc_drm.c       | 467 +++++++++++++++
 drivers/gpu/drm/logicvc/logicvc_drm.h       |  60 ++
 drivers/gpu/drm/logicvc/logicvc_interface.c | 235 ++++++++
 drivers/gpu/drm/logicvc/logicvc_interface.h |  32 ++
 drivers/gpu/drm/logicvc/logicvc_layer.c     | 594 ++++++++++++++++++++
 drivers/gpu/drm/logicvc/logicvc_layer.h     |  65 +++
 drivers/gpu/drm/logicvc/logicvc_mode.c      | 103 ++++
 drivers/gpu/drm/logicvc/logicvc_mode.h      |  15 +
 drivers/gpu/drm/logicvc/logicvc_of.c        | 205 +++++++
 drivers/gpu/drm/logicvc/logicvc_of.h        |  28 +
 drivers/gpu/drm/logicvc/logicvc_regs.h      |  88 +++
 17 files changed, 2203 insertions(+)
 create mode 100644 drivers/gpu/drm/logicvc/Kconfig
 create mode 100644 drivers/gpu/drm/logicvc/Makefile
 create mode 100644 drivers/gpu/drm/logicvc/logicvc_crtc.c
 create mode 100644 drivers/gpu/drm/logicvc/logicvc_crtc.h
 create mode 100644 drivers/gpu/drm/logicvc/logicvc_drm.c
 create mode 100644 drivers/gpu/drm/logicvc/logicvc_drm.h
 create mode 100644 drivers/gpu/drm/logicvc/logicvc_interface.c
 create mode 100644 drivers/gpu/drm/logicvc/logicvc_interface.h
 create mode 100644 drivers/gpu/drm/logicvc/logicvc_layer.c
 create mode 100644 drivers/gpu/drm/logicvc/logicvc_layer.h
 create mode 100644 drivers/gpu/drm/logicvc/logicvc_mode.c
 create mode 100644 drivers/gpu/drm/logicvc/logicvc_mode.h
 create mode 100644 drivers/gpu/drm/logicvc/logicvc_of.c
 create mode 100644 drivers/gpu/drm/logicvc/logicvc_of.h
 create mode 100644 drivers/gpu/drm/logicvc/logicvc_regs.h
drivers/gpu/drm/Kconfig +2 -0
index 7e089c47a58e..f122499c9c0e 100644
@@ -336,6 +336,8 @@ source "drivers/gpu/drm/arc/Kconfig"
 
 source "drivers/gpu/drm/hisilicon/Kconfig"
 
+source "drivers/gpu/drm/logicvc/Kconfig"
+
 source "drivers/gpu/drm/mediatek/Kconfig"
 
 source "drivers/gpu/drm/zte/Kconfig"
drivers/gpu/drm/Makefile +1 -0
index d9bcc9f2a0a4..f7dbedc477d4 100644
@@ -101,6 +101,7 @@ obj-$(CONFIG_DRM_STM) += stm/
 obj-$(CONFIG_DRM_STI) += sti/
 obj-$(CONFIG_DRM_IMX) += imx/
 obj-$(CONFIG_DRM_INGENIC) += ingenic/
+obj-$(CONFIG_DRM_LOGICVC) += logicvc/
 obj-$(CONFIG_DRM_MEDIATEK) += mediatek/
 obj-$(CONFIG_DRM_MESON)	+= meson/
 obj-y			+= i2c/
drivers/gpu/drm/logicvc/Kconfig new file +8 -0
new file mode 100644
index 000000000000..34dacabbb49a
@@ -0,0 +1,8 @@
+config DRM_LOGICVC
+	tristate "LogiCVC DRM"
+	depends on DRM
+	select DRM_KMS_HELPER
+	select DRM_KMS_CMA_HELPER
+	select DRM_GEM_CMA_HELPER
+	help
+	  DRM display driver for the logiCVC programmable logic block from Xylon
drivers/gpu/drm/logicvc/Makefile new file +4 -0
new file mode 100644
index 000000000000..c09531fbd6ad
@@ -0,0 +1,4 @@
+logicvc-drm-y += logicvc_crtc.o logicvc_drm.o logicvc_interface.o \
+		 logicvc_layer.o logicvc_mode.o logicvc_of.o
+
+obj-$(CONFIG_DRM_LOGICVC) += logicvc-drm.o
drivers/gpu/drm/logicvc/logicvc_crtc.c new file +271 -0

271 lines not on this page · raw message

drivers/gpu/drm/logicvc/logicvc_crtc.h new file +25 -0
new file mode 100644
index 000000000000..dfa55c377ac3
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2019 Bootlin
+ * Author: Paul Kocialkowski <[email protected]>
+ */
+
+#ifndef _LOGICVC_CRTC_H_
+#define _LOGICVC_CRTC_H_
+
+#include <drm/drm_crtc.h>
+#include <drm/drm_vblank.h>
+
+struct logicvc_drm;
+
+struct logicvc_crtc {
+	struct logicvc_drm *logicvc;
+
+	struct drm_crtc drm_crtc;
+	struct drm_pending_vblank_event *event;
+};
+
+void logicvc_crtc_vblank_handler(struct logicvc_drm *logicvc);
+int logicvc_crtc_init(struct logicvc_drm *logicvc);
+
+#endif
drivers/gpu/drm/logicvc/logicvc_drm.c new file +467 -0

467 lines not on this page · raw message

drivers/gpu/drm/logicvc/logicvc_drm.h new file +60 -0

60 lines not on this page · raw message

drivers/gpu/drm/logicvc/logicvc_interface.c new file +235 -0

235 lines not on this page · raw message

drivers/gpu/drm/logicvc/logicvc_interface.h new file +32 -0
new file mode 100644
index 000000000000..d27abfff929f
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2019 Bootlin
+ * Author: Paul Kocialkowski <[email protected]>
+ */
+
+#ifndef _LOGICVC_INTERFACE_H_
+#define _LOGICVC_INTERFACE_H_
+
+#include <drm/drm_bridge.h>
+#include <drm/drm_connector.h>
+#include <drm/drm_encoder.h>
+#include <drm/drm_panel.h>
+
+struct logicvc_drm;
+
+struct logicvc_interface {
+	struct logicvc_drm *logicvc;
+
+	struct drm_encoder drm_encoder;
+	struct drm_connector drm_connector;
+
+	struct drm_panel *drm_panel;
+	struct drm_bridge *drm_bridge;
+
+	bool drm_panel_enabled;
+};
+
+void logicvc_interface_attach_crtc(struct logicvc_drm *logicvc);
+int logicvc_interface_init(struct logicvc_drm *logicvc);
+
+#endif
drivers/gpu/drm/logicvc/logicvc_layer.c new file +594 -0

594 lines not on this page · raw message

drivers/gpu/drm/logicvc/logicvc_layer.h new file +65 -0

65 lines not on this page · raw message

drivers/gpu/drm/logicvc/logicvc_mode.c new file +103 -0

103 lines not on this page · raw message

drivers/gpu/drm/logicvc/logicvc_mode.h new file +15 -0
new file mode 100644
index 000000000000..690def1619a6
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2019 Bootlin
+ * Author: Paul Kocialkowski <[email protected]>
+ */
+
+#ifndef _LOGICVC_MODE_H_
+#define _LOGICVC_MODE_H_
+
+struct logicvc_drm;
+
+int logicvc_mode_init(struct logicvc_drm *logicvc);
+void logicvc_mode_fini(struct logicvc_drm *logicvc);
+
+#endif
drivers/gpu/drm/logicvc/logicvc_of.c new file +205 -0

205 lines not on this page · raw message

drivers/gpu/drm/logicvc/logicvc_of.h new file +28 -0
new file mode 100644
index 000000000000..5c6f3f33503a
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2019 Bootlin
+ * Author: Paul Kocialkowski <[email protected]>
+ */
+
+#ifndef _LOGICVC_OF_H_
+#define _LOGICVC_OF_H_
+
+struct logicvc_of_property_sv {
+	const char *string;
+	u32 value;
+};
+
+struct logicvc_of_property {
+	char *name;
+	bool optional;
+	struct logicvc_of_property_sv *sv;
+	u32 range[2];
+};
+
+int logicvc_of_property_parse_u32(struct device_node *of_node,
+				  const char *name, u32 *target);
+void logicvc_of_property_parse_bool(struct device_node *of_node,
+				    const char *name, bool *target);
+bool logicvc_of_node_is_layer(struct device_node *of_node);
+
+#endif
drivers/gpu/drm/logicvc/logicvc_regs.h new file +88 -0

88 lines not on this page · raw message

Signature · 6 lines
2.24.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v4 2/3
#4 lore raw

Re: [PATCH v4 2/3] drm: Add support for the LogiCVC display controller

Hi Paul.

Good looking driver. Well structured in a number of relevant files. A few comments in the following.
Some parts I fail to follow - due to my lack of DRM knowledge. So all in all - only trivial comments.

With these fixed you can add:

Sam

Quoted 44 lines · Paul Kocialkowski

Introduces a driver for the LogiCVC display controller, a programmable logic controller optimized for use in Xilinx Zynq-7000 SoCs and other Xilinx FPGAs. The controller is mostly configured at logic synthesis time so only a subset of configuration is left for the driver to handle.

The following features are implemented and tested:
- LVDS 4-bit interface;
- RGB565 pixel formats;
- Multiple layers and hardware composition;
- Layer-wide alpha mode;

The following features are implemented but untested:
- Other RGB pixel formats;
- Layer framebuffer configuration for version 4;
- Lowest-layer used as background color;
- Per-pixel alpha mode.

The following features are not implemented:
- YUV pixel formats;
- DVI, LVDS 3-bit, ITU656 and camera link interfaces;
- External parallel input for layer;
- Color-keying;
- LUT-based alpha modes.

Additional implementation-specific notes:
- Panels are only enabled after the first page flip to avoid flashing a white screen.
- Depth used in context of the LogiCVC driver only counts color components to match the definition of the synthesis parameters.

Support is implemented for both version 3 and 4 of the controller.

With version 3, framebuffers are stored in a dedicated contiguous memory area, with a base address hardcoded for each layer. This requires using a dedicated CMA pool registered at the base address and tweaking a few offset-related registers to try to use any buffer allocated from the pool. This is done on a best-effort basis to have the hardware cope with the DRM framebuffer allocation model and there is no guarantee that each buffer allocated by GEM CMA can be used for any layer. In particular, buffers allocated below the base address for a layer are guaranteed not to be configurable for that layer. See the implementation of logicvc_layer_buffer_find_setup for specifics.

Quoted 6 lines

Version 4 allows configuring each buffer address directly, which guarantees that any buffer can be configured.

---

MAINTAINERS needs an entry.
Will this driver be supported in drm-misc?
If yes, then yoy need to apply for write access (if you do not have it).

Quoted 6 lines
drivers/gpu/drm/logicvc/Kconfig new file +0 -0
new file mode 100644
index 000000000000..34dacabbb49a

drivers/gpu/drm/logicvc/Kconfig line 8

Quoted 8 lines
drivers/gpu/drm/logicvc/Kconfig new file +8 -0
@@ -0,0 +1,8 @@
+config DRM_LOGICVC
+       tristate "LogiCVC DRM"
+       depends on DRM
+       select DRM_KMS_HELPER
+       select DRM_KMS_CMA_HELPER
+       select DRM_GEM_CMA_HELPER
+       help
+         DRM display driver for the logiCVC programmable logic block from Xylon

The driver, as far as I can tell, required OF.
So a depends on OF seems missing.

Quoted 6 lines
drivers/gpu/drm/logicvc/logicvc_crtc.c new file +0 -0
new file mode 100644
index 000000000000..2c07f4594c32

drivers/gpu/drm/logicvc/logicvc_crtc.c line 10

Quoted 10 lines
drivers/gpu/drm/logicvc/logicvc_crtc.c new file +10 -0
@@ -0,0 +1,271 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Bootlin
+ * Author: Paul Kocialkowski <[email protected]>
+ */
+
+#include <linux/of.h>
+#include <linux/of_graph.h>
+#include <linux/types.h>
+#include <linux/workqueue.h>

Empty line between the include blocks.

drivers/gpu/drm/logicvc/logicvc_crtc.c line 22

Quoted 12 lines
drivers/gpu/drm/logicvc/logicvc_crtc.c new file +12 -0
+#include <drm/drm_atomic_helper.h>
+#include <drm/drm_crtc.h>
+#include <drm/drm_drv.h>
+#include <drm/drm_gem_cma_helper.h>
+#include <drm/drm_print.h>
+#include <drm/drm_vblank.h>
+
+#include "logicvc_crtc.h"
+#include "logicvc_drm.h"
+#include "logicvc_interface.h"
+#include "logicvc_layer.h"
+#include "logicvc_regs.h"

All sorted within each block - good.

Quoted 25 lines
drivers/gpu/drm/logicvc/logicvc_crtc.c new file +24 -0
+
+#define logicvc_crtc(c) \
+	container_of(c, struct logicvc_crtc, drm_crtc)
+
+static int logicvc_crtc_atomic_check(struct drm_crtc *drm_crtc,
+				     struct drm_crtc_state *state)
+{
+	struct drm_display_mode *mode = &state->adjusted_mode;
+
+	if (mode->flags & DRM_MODE_FLAG_INTERLACE)
+		return -EINVAL;
+
+	return 0;
+}
+
 
+
+void logicvc_crtc_vblank_handler(struct logicvc_drm *logicvc)
+{
+	struct logicvc_crtc *crtc = logicvc->crtc;
+	struct drm_device *drm = logicvc->drm;
+	unsigned long flags;
+
+	if (!crtc)
+		return;

drivers/gpu/drm/logicvc/logicvc_crtc.c

Quoted 10 lines
drivers/gpu/drm/logicvc/logicvc_crtc.c new file +10 -0
+
+	drm_crtc_handle_vblank(&crtc->drm_crtc);
+
+	spin_lock_irqsave(&drm->event_lock, flags);
+	if (crtc->event) {
+		drm_crtc_send_vblank_event(&crtc->drm_crtc, crtc->event);
+		drm_crtc_vblank_put(&crtc->drm_crtc);
+		crtc->event = NULL;
+	}
+	spin_unlock_irqrestore(&drm->event_lock, flags);

In the other cases you have spin_* inside the block. No nbeed to take the spinlock if crtc->event equals NULL

Quoted 8 lines
drivers/gpu/drm/logicvc/logicvc_crtc.c new file +8 -0
+}
+
+int logicvc_crtc_init(struct logicvc_drm *logicvc)
+{
+	struct device_node *of_node = logicvc->drm->dev->of_node;
+	struct logicvc_crtc *crtc;
+	struct logicvc_layer *layer_primary;
+	int ret;

drivers/gpu/drm/logicvc/logicvc_crtc.c line 252

Quoted 10 lines
drivers/gpu/drm/logicvc/logicvc_crtc.c new file +10 -0
+
+	crtc = devm_kzalloc(logicvc->drm->dev, sizeof(*crtc), GFP_KERNEL);
+	if (!crtc)
+		return -ENOMEM;
+
+	crtc->logicvc = logicvc;
+
+	layer_primary = logicvc_layer_get_primary(logicvc);
+	if (!layer_primary) {
+		DRM_ERROR("Failed to get primary layer\n");

Please use drm_err(logicvc->drm, "...");
This goes for all uses of DRM_ where you have a drm_device available.

Quoted 26 lines
drivers/gpu/drm/logicvc/logicvc_crtc.c new file +19 -0
+		return -EINVAL;
+	}
+
+	ret = drm_crtc_init_with_planes(logicvc->drm, &crtc->drm_crtc,
+					&layer_primary->drm_plane, NULL,
+					&logicvc_crtc_funcs, NULL);
+	if (ret) {
+		DRM_ERROR("Failed to initalize CRTC\n");
+		return ret;
+	}
+
+	drm_crtc_helper_add(&crtc->drm_crtc, &logicvc_crtc_helper_funcs);
+
+	crtc->drm_crtc.port = of_graph_get_port_by_id(of_node, 1);
+
+	logicvc->crtc = crtc;
+
+	return 0;
+}
drivers/gpu/drm/logicvc/logicvc_crtc.h new file +1 -0
new file mode 100644
index 000000000000..dfa55c377ac3
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0+ */

drivers/gpu/drm/logicvc/logicvc_crtc.h line 11

Quoted 10 lines
drivers/gpu/drm/logicvc/logicvc_crtc.h new file +10 -0
+/*
+ * Copyright (C) 2019 Bootlin
+ * Author: Paul Kocialkowski <[email protected]>
+ */
+
+#ifndef _LOGICVC_CRTC_H_
+#define _LOGICVC_CRTC_H_
+
+#include <drm/drm_crtc.h>
+#include <drm/drm_vblank.h>

Use a forward declaration of drm_pending_vblank_event, then you can drop the above include.

Quoted 26 lines
drivers/gpu/drm/logicvc/logicvc_crtc.h new file +14 -0
+
+struct logicvc_drm;
+
+struct logicvc_crtc {
+	struct logicvc_drm *logicvc;
+
+	struct drm_crtc drm_crtc;
+	struct drm_pending_vblank_event *event;
+};
+
+void logicvc_crtc_vblank_handler(struct logicvc_drm *logicvc);
+int logicvc_crtc_init(struct logicvc_drm *logicvc);
+
+#endif
drivers/gpu/drm/logicvc/logicvc_drm.c new file +6 -0
new file mode 100644
index 000000000000..c9a1a6b38692
@@ -0,0 +1,467 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Bootlin
+ * Author: Paul Kocialkowski <[email protected]>
+ */
+

drivers/gpu/drm/logicvc/logicvc_drm.c line 16

Quoted 10 lines
drivers/gpu/drm/logicvc/logicvc_drm.c new file +10 -0
+#include <linux/clk.h>
+#include <linux/mfd/syscon.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_device.h>
+#include <linux/of_reserved_mem.h>
+#include <linux/regmap.h>
+#include <linux/types.h>
+#include <drm/drm_atomic_helper.h>

Add empty lines between include blocks (one line up)..

Quoted 25 lines
drivers/gpu/drm/logicvc/logicvc_drm.c new file +25 -0
+#include <drm/drm_drv.h>
+#include <drm/drm_fb_helper.h>
+#include <drm/drm_gem_cma_helper.h>
+#include <drm/drm_print.h>
+
+#include "logicvc_crtc.h"
+#include "logicvc_drm.h"
+#include "logicvc_interface.h"
+#include "logicvc_mode.h"
+#include "logicvc_layer.h"
+#include "logicvc_of.h"
+#include "logicvc_regs.h"
+
+DEFINE_DRM_GEM_CMA_FOPS(logicvc_drm_fops);
+
+static int logicvc_drm_gem_cma_dumb_create(struct drm_file *file_priv,
+					   struct drm_device *drm,
+					   struct drm_mode_create_dumb *args)
+{
+	struct logicvc_drm *logicvc = drm->dev_private;
+
+	/* Stride is always fixed to its configuration value. */
+	args->pitch = logicvc->config.row_stride * DIV_ROUND_UP(args->bpp, 8);
+
+	return drm_gem_cma_dumb_create_internal(file_priv, drm, args);

drivers/gpu/drm/logicvc/logicvc_drm.c line 51

Quoted 10 lines
drivers/gpu/drm/logicvc/logicvc_drm.c new file +10 -0
+}
+
+static struct drm_driver logicvc_drm_driver = {
+	.driver_features		= DRIVER_GEM | DRIVER_MODESET |
+					  DRIVER_ATOMIC,
+
+	.fops				= &logicvc_drm_fops,
+	.name				= "logicvc-drm",
+	.desc				= "Xylon LogiCVC DRM driver",
+	.date				= "20190319",

2020?

Quoted 49 lines
drivers/gpu/drm/logicvc/logicvc_drm.c new file +7 -0
+	.major				= 1,
+	.minor				= 0,
+
+	DRM_GEM_CMA_VMAP_DRIVER_OPS,
+	.dumb_create			= logicvc_drm_gem_cma_dumb_create,
+};
+

new file mode 100644
index 000000000000..cc728d5a4aee

drivers/gpu/drm/logicvc/logicvc_drm.h new file +36 -0
@@ -0,0 +1,60 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2019 Bootlin
+ * Author: Paul Kocialkowski <[email protected]>
+ */
+
+#ifndef _LOGICVC_DRM_H_
+#define _LOGICVC_DRM_H_
+
+#include <linux/regmap.h>
+#include <linux/types.h>
+#include <drm/drm_device.h>
+
+#define LOGICVC_DISPLAY_INTERFACE_RGB			0
+#define LOGICVC_DISPLAY_INTERFACE_ITU656		1
+#define LOGICVC_DISPLAY_INTERFACE_LVDS_4BITS		2
+#define LOGICVC_DISPLAY_INTERFACE_LVDS_4BITS_CAMERA	3
+#define LOGICVC_DISPLAY_INTERFACE_LVDS_3BITS		4
+#define LOGICVC_DISPLAY_INTERFACE_DVI			5
+
+#define LOGICVC_DISPLAY_COLORSPACE_RGB		0
+#define LOGICVC_DISPLAY_COLORSPACE_YUV422	1
+#define LOGICVC_DISPLAY_COLORSPACE_YUV444	2
+
+struct logicvc_crtc;
+struct logicvc_interface;
+
+struct logicvc_drm_config {
+	u32 display_interface;
+	u32 display_colorspace;
+	u32 display_depth;
+	u32 row_stride;
+	bool dithering;
+	bool background_layer;
+	bool layers_configurable;
+	u32 layers_count;

drivers/gpu/drm/logicvc/logicvc_drm.h line 46

Quoted 10 lines
drivers/gpu/drm/logicvc/logicvc_drm.h new file +10 -0
+};
+
+struct logicvc_drm_caps {
+	bool layer_address;
+};
+
+struct logicvc_drm {
+	const struct logicvc_drm_caps *caps;
+	struct logicvc_drm_config config;
+	struct drm_device *drm;

Modern drm drivers are expected to embed drm_device. See example in drm_drv.c

Quoted 20 lines
drivers/gpu/drm/logicvc/logicvc_drm.h new file +14 -0
+	phys_addr_t reserved_mem_base;
+	struct regmap *regmap;
+
+	struct clk *vclk;
+	struct clk *vclk2;
+	struct clk *lvdsclk;
+	struct clk *lvdsclkn;
+
+	struct list_head layers_list;
+	struct logicvc_crtc *crtc;
+	struct logicvc_interface *interface;
+};
+
+#endif
drivers/gpu/drm/logicvc/logicvc_interface.c new file +0 -0
new file mode 100644
index 000000000000..792b1fc2a5f7

drivers/gpu/drm/logicvc/logicvc_interface.c line 8

Quoted 8 lines
drivers/gpu/drm/logicvc/logicvc_interface.c new file +8 -0
@@ -0,0 +1,235 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Bootlin
+ * Author: Paul Kocialkowski <[email protected]>
+ */
+
+#include <linux/types.h>
+#include <drm/drm_atomic_helper.h>

Empty line

Quoted 15 lines
drivers/gpu/drm/logicvc/logicvc_interface.c new file +15 -0
+#include <drm/drm_bridge.h>
+#include <drm/drm_connector.h>
+#include <drm/drm_crtc_helper.h>
+#include <drm/drm_drv.h>
+#include <drm/drm_encoder.h>
+#include <drm/drm_gem_cma_helper.h>
+#include <drm/drm_modeset_helper_vtables.h>
+#include <drm/drm_of.h>
+#include <drm/drm_panel.h>
+#include <drm/drm_print.h>
+#include <drm/drm_probe_helper.h>
+
+#include "logicvc_crtc.h"
+#include "logicvc_drm.h"
+#include "logicvc_interface.h"

drivers/gpu/drm/logicvc/logicvc_interface.c line 77

Quoted 10 lines
drivers/gpu/drm/logicvc/logicvc_interface.c new file +9 -0
+#include "logicvc_regs.h"
+
 
+static int logicvc_connector_get_modes(struct drm_connector *drm_connector)
+{
+	struct logicvc_interface *interface =
+		logicvc_interface_from_drm_connector(drm_connector);
+
+	if (interface->drm_panel)
+		return drm_panel_get_modes(interface->drm_panel);

In drm-misc-next this call takes a connector argument.

Quoted 24 lines
drivers/gpu/drm/logicvc/logicvc_interface.c new file +24 -0
+
+	return 0;
+}
+
+static const struct drm_connector_helper_funcs logicvc_connector_helper_funcs = {
+	.get_modes		= logicvc_connector_get_modes,
+};
+
+static void logicvc_connector_destroy(struct drm_connector *drm_connector)
+{
+	struct logicvc_interface *interface =
+		logicvc_interface_from_drm_connector(drm_connector);
+
+	if (interface->drm_panel)
+		drm_panel_detach(interface->drm_panel);
+
+	drm_connector_cleanup(drm_connector);
+}
+
+static const struct drm_connector_funcs logicvc_connector_funcs = {
+	.reset			= drm_atomic_helper_connector_reset,
+	.fill_modes		= drm_helper_probe_single_connector_modes,
+	.destroy		= logicvc_connector_destroy,
+	.atomic_duplicate_state	= drm_atomic_helper_connector_duplicate_state,

drivers/gpu/drm/logicvc/logicvc_interface.c line 159

Quoted 10 lines
drivers/gpu/drm/logicvc/logicvc_interface.c new file +9 -0
+	.atomic_destroy_state	= drm_atomic_helper_connector_destroy_state,
+};
+
 
+int logicvc_interface_init(struct logicvc_drm *logicvc)
+{
+	struct logicvc_interface *interface;
+	struct device_node *of_node = logicvc->drm->dev->of_node;
+	int encoder_type = logicvc_interface_encoder_type(logicvc);
+	int connector_type = logicvc_interface_connector_type(logicvc);

The connector is today part of drm_panel, and should not be decided by the display driver.

Quoted 83 lines
drivers/gpu/drm/logicvc/logicvc_interface.c new file +76 -0
+	bool native_connector = logicvc_interface_native_connector(logicvc);
+	int ret;
+
+	interface = devm_kzalloc(logicvc->drm->dev, sizeof(*interface),
+				 GFP_KERNEL);
+	if (!interface) {
+		ret = -ENOMEM;
+		goto error_early;
+	}
+
+	interface->logicvc = logicvc;
+
+	ret = drm_of_find_panel_or_bridge(of_node, 1, 0, &interface->drm_panel,
+					  &interface->drm_bridge);
+	if (ret == -EPROBE_DEFER)
+		goto error_early;
+
+	ret = drm_encoder_init(logicvc->drm, &interface->drm_encoder,
+			       &logicvc_encoder_funcs, encoder_type, NULL);
+	if (ret) {
+		DRM_ERROR("Failed to initalize encoder\n");
+		goto error_early;
+	}
+
+	drm_encoder_helper_add(&interface->drm_encoder,
+			       &logicvc_encoder_helper_funcs);
+
+	if (native_connector || interface->drm_panel) {
+		ret = drm_connector_init(logicvc->drm,
+					 &interface->drm_connector,
+					 &logicvc_connector_funcs,
+					 connector_type);
+		if (ret) {
+			DRM_ERROR("Failed to initalize connector\n");
+			goto error_encoder;
+		}
+
+		drm_connector_helper_add(&interface->drm_connector,
+					 &logicvc_connector_helper_funcs);
+
+		ret = drm_connector_attach_encoder(&interface->drm_connector,
+						   &interface->drm_encoder);
+		if (ret) {
+			DRM_ERROR("Failed to attach connector to encoder\n");
+			goto error_encoder;
+		}
+	}
+
+	if (interface->drm_panel) {
+		ret = drm_panel_attach(interface->drm_panel,
+				       &interface->drm_connector);
+		if (ret) {
+			DRM_ERROR("Failed to attach panel to connector\n");
+			goto error_encoder;
+		}
+	}
+
+	if (interface->drm_bridge) {
+		ret = drm_bridge_attach(&interface->drm_encoder,
+					interface->drm_bridge, NULL);
+		if (ret) {
+			DRM_ERROR("Failed to attach bridge to encoder\n");
+			goto error_encoder;
+		}
+	}
+
+	logicvc->interface = interface;
+
+	return 0;
+
+error_encoder:
+	drm_encoder_cleanup(&interface->drm_encoder);
+
+error_early:
+	return ret;
+}
drivers/gpu/drm/logicvc/logicvc_layer.c new file +0 -0
new file mode 100644
index 000000000000..c7b092d592ad

drivers/gpu/drm/logicvc/logicvc_layer.c line 9

Quoted 9 lines
drivers/gpu/drm/logicvc/logicvc_layer.c new file +9 -0
@@ -0,0 +1,594 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Bootlin
+ * Author: Paul Kocialkowski <[email protected]>
+ */
+
+#include <linux/of.h>
+#include <linux/types.h>
+#include <drm/drm_atomic.h>

Empty lines between blocks of include

drivers/gpu/drm/logicvc/logicvc_layer.c line 22

Quoted 13 lines
drivers/gpu/drm/logicvc/logicvc_layer.c new file +13 -0
+#include <drm/drm_atomic_helper.h>
+#include <drm/drm_fb_cma_helper.h>
+#include <drm/drm_fourcc.h>
+#include <drm/drm_plane.h>
+#include <drm/drm_plane_helper.h>
+#include <drm/drm_print.h>
+
+#include "logicvc_crtc.h"
+#include "logicvc_drm.h"
+#include "logicvc_layer.h"
+#include "logicvc_of.h"
+#include "logicvc_regs.h"
+

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw

Re: [PATCH v4 2/3] drm: Add support for the LogiCVC display controller

Hi Sam,

Quoted 4 lines · Sam Ravnborg

Good looking driver. Well structured in a number of relevant files. A few comments in the following.
Some parts I fail to follow - due to my lack of DRM knowledge. So all in all - only trivial comments.

Thanks for the review and the friendly feedback!

Quoted 2 lines

With these fixed you can add:

I'll take most of your suggestions in for the next version and there's just one point where I disagree:

Quoted 6 lines

drivers/gpu/drm/logicvc/logicvc_drm.h line 46

Quoted 4 lines
drivers/gpu/drm/logicvc/logicvc_drm.h new file +4 -0
+struct logicvc_drm {
+	const struct logicvc_drm_caps *caps;
+	struct logicvc_drm_config config;
+	struct drm_device *drm;

Modern drm drivers are expected to embed drm_device. See example in drm_drv.c

Well, I see lots of modern drivers that use drm_dev_alloc, including vc4 that I took as a reference.

My understanding is that embedding the struct is a recommendation but drm_dev_alloc is still quite valid and that the choice is left open. Quoting drm_drv.c:

* It is recommended that drivers embed &struct drm_device into their own device
* structure.
*
* Drivers that do not want to allocate their own device struct
* embedding &struct drm_device can call drm_dev_alloc() instead.

In my case, I like the fact that drm_dev_alloc correctly wraps drm_dev_init and drmm_add_final_kfree (and I'd rather not add & all around unless I'm obliged to ;)

Cheers,

Paul

Signature · 3 lines
Paul Kocialkowski, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
#6 lore raw

PATCH v4 3/3 WIP: drm/logicvc: Add plane colorkey support

In reply to Paul Kocialkowski
---
 drivers/gpu/drm/logicvc/logicvc_drm.h   |   3 +
 drivers/gpu/drm/logicvc/logicvc_layer.c | 147 +++++++++++++++++++++++-
 drivers/gpu/drm/logicvc/logicvc_layer.h |   7 ++
 3 files changed, 153 insertions(+), 4 deletions(-)
drivers/gpu/drm/logicvc/logicvc_drm.h +3 -0
index cc728d5a4aee..52f3c09b9659 100644
@@ -55,6 +55,9 @@ struct logicvc_drm {
 	struct list_head layers_list;
 	struct logicvc_crtc *crtc;
 	struct logicvc_interface *interface;
+
+	struct drm_property *colorkey_enabled_property;
+	struct drm_property *colorkey_value_property;
 };
 
 #endif
drivers/gpu/drm/logicvc/logicvc_layer.c +143 -4

204 lines not on this page · raw message

drivers/gpu/drm/logicvc/logicvc_layer.h +7 -0
index 71b3f177b093..2fb161217081 100644
@@ -39,6 +39,13 @@ struct logicvc_layer_formats {
 	uint32_t *formats;
 };
 
+struct logicvc_layer_state {
+	struct drm_plane_state drm_plane_state;
+
+	bool colorkey_enabled;
+	uint32_t colorkey_value;
+};
+
 struct logicvc_layer {
 	struct logicvc_drm *logicvc;
 
Signature · 6 lines
2.24.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel