* [PATCH v4 1/8] dt-bindings: display: simple-framebuffer: Support system memory framebuffers
2023-01-20 17:30 [PATCH v4 0/8] drm/simpledrm: Support system memory framebuffers Thierry Reding
@ 2023-01-20 17:30 ` Thierry Reding
2023-01-20 17:30 ` [PATCH v4 2/8] dt-bindings: display: simple-framebuffer: Document 32-bit BGR format Thierry Reding
` (6 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Thierry Reding @ 2023-01-20 17:30 UTC (permalink / raw)
To: David Airlie, Daniel Vetter, Thomas Zimmermann
Cc: Jon Hunter, Robin Murphy, dri-devel, linux-tegra, devicetree,
Rob Herring
From: Thierry Reding <treding@nvidia.com>
In order to support framebuffers residing in system memory, allow the
memory-region property to override the framebuffer memory specification
in the "reg" property.
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
.../devicetree/bindings/display/simple-framebuffer.yaml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Documentation/devicetree/bindings/display/simple-framebuffer.yaml b/Documentation/devicetree/bindings/display/simple-framebuffer.yaml
index dd64f70b5014..3e9857eb002e 100644
--- a/Documentation/devicetree/bindings/display/simple-framebuffer.yaml
+++ b/Documentation/devicetree/bindings/display/simple-framebuffer.yaml
@@ -63,6 +63,11 @@ properties:
reg:
description: Location and size of the framebuffer memory
+ memory-region:
+ maxItems: 1
+ description: Phandle to a node describing the memory to be used for the
+ framebuffer. If present, overrides the "reg" property (if one exists).
+
clocks:
description: List of clocks used by the framebuffer.
--
2.39.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH v4 2/8] dt-bindings: display: simple-framebuffer: Document 32-bit BGR format
2023-01-20 17:30 [PATCH v4 0/8] drm/simpledrm: Support system memory framebuffers Thierry Reding
2023-01-20 17:30 ` [PATCH v4 1/8] dt-bindings: display: simple-framebuffer: " Thierry Reding
@ 2023-01-20 17:30 ` Thierry Reding
2023-01-20 17:30 ` [PATCH v4 3/8] dt-bindings: reserved-memory: Support framebuffer reserved memory Thierry Reding
` (5 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Thierry Reding @ 2023-01-20 17:30 UTC (permalink / raw)
To: David Airlie, Daniel Vetter, Thomas Zimmermann
Cc: Jon Hunter, Robin Murphy, dri-devel, linux-tegra, devicetree,
Rob Herring
From: Thierry Reding <treding@nvidia.com>
This is a variant of the 32-bit RGB format where the red and blue
components are swapped.
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
.../devicetree/bindings/display/simple-framebuffer.yaml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Documentation/devicetree/bindings/display/simple-framebuffer.yaml b/Documentation/devicetree/bindings/display/simple-framebuffer.yaml
index 3e9857eb002e..3c9f29e428a4 100644
--- a/Documentation/devicetree/bindings/display/simple-framebuffer.yaml
+++ b/Documentation/devicetree/bindings/display/simple-framebuffer.yaml
@@ -99,6 +99,7 @@ properties:
* `x1r5g5b5` - 16-bit pixels, d[14:10]=r, d[9:5]=g, d[4:0]=b
* `x2r10g10b10` - 32-bit pixels, d[29:20]=r, d[19:10]=g, d[9:0]=b
* `x8r8g8b8` - 32-bit pixels, d[23:16]=r, d[15:8]=g, d[7:0]=b
+ * `x8b8g8r8` - 32-bit pixels, d[23:16]=b, d[15:8]=g, d[7:0]=r
enum:
- a1r5g5b5
- a2r10g10b10
@@ -110,6 +111,7 @@ properties:
- x1r5g5b5
- x2r10g10b10
- x8r8g8b8
+ - x8b8g8r8
display:
$ref: /schemas/types.yaml#/definitions/phandle
--
2.39.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH v4 3/8] dt-bindings: reserved-memory: Support framebuffer reserved memory
2023-01-20 17:30 [PATCH v4 0/8] drm/simpledrm: Support system memory framebuffers Thierry Reding
2023-01-20 17:30 ` [PATCH v4 1/8] dt-bindings: display: simple-framebuffer: " Thierry Reding
2023-01-20 17:30 ` [PATCH v4 2/8] dt-bindings: display: simple-framebuffer: Document 32-bit BGR format Thierry Reding
@ 2023-01-20 17:30 ` Thierry Reding
2023-01-20 17:30 ` [PATCH v4 4/8] drm/simpledrm: Use struct iosys_map consistently Thierry Reding
` (4 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Thierry Reding @ 2023-01-20 17:30 UTC (permalink / raw)
To: David Airlie, Daniel Vetter, Thomas Zimmermann
Cc: Jon Hunter, Robin Murphy, dri-devel, linux-tegra, devicetree,
Rob Herring
From: Thierry Reding <treding@nvidia.com>
Document the "framebuffer" compatible string for reserved memory nodes
to annotate reserved memory regions used for framebuffer carveouts.
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
Changes in v2:
- use four spaces for indentation in example (as recommended elsewhere)
- add explicit root node
- drop unneeded quotes
.../bindings/reserved-memory/framebuffer.yaml | 52 +++++++++++++++++++
1 file changed, 52 insertions(+)
create mode 100644 Documentation/devicetree/bindings/reserved-memory/framebuffer.yaml
diff --git a/Documentation/devicetree/bindings/reserved-memory/framebuffer.yaml b/Documentation/devicetree/bindings/reserved-memory/framebuffer.yaml
new file mode 100644
index 000000000000..05b6648b3458
--- /dev/null
+++ b/Documentation/devicetree/bindings/reserved-memory/framebuffer.yaml
@@ -0,0 +1,52 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/reserved-memory/framebuffer.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: /reserved-memory framebuffer node bindings
+
+maintainers:
+ - devicetree-spec@vger.kernel.org
+
+allOf:
+ - $ref: reserved-memory.yaml
+
+properties:
+ compatible:
+ const: framebuffer
+ description: >
+ This indicates a region of memory meant to be used as a framebuffer for
+ a set of display devices. It can be used by an operating system to keep
+ the framebuffer from being overwritten and use it as the backing memory
+ for a display device (such as simple-framebuffer).
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ / {
+ compatible = "foo";
+ model = "foo";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ chosen {
+ framebuffer {
+ compatible = "simple-framebuffer";
+ memory-region = <&fb>;
+ };
+ };
+
+ reserved-memory {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ ranges;
+
+ fb: framebuffer@80000000 {
+ compatible = "framebuffer";
+ reg = <0x80000000 0x007e9000>;
+ };
+ };
+ };
+...
--
2.39.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH v4 4/8] drm/simpledrm: Use struct iosys_map consistently
2023-01-20 17:30 [PATCH v4 0/8] drm/simpledrm: Support system memory framebuffers Thierry Reding
` (2 preceding siblings ...)
2023-01-20 17:30 ` [PATCH v4 3/8] dt-bindings: reserved-memory: Support framebuffer reserved memory Thierry Reding
@ 2023-01-20 17:30 ` Thierry Reding
2023-01-20 17:31 ` [PATCH v4 5/8] drm/simpledrm: Add support for system memory framebuffers Thierry Reding
` (3 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Thierry Reding @ 2023-01-20 17:30 UTC (permalink / raw)
To: David Airlie, Daniel Vetter, Thomas Zimmermann
Cc: Jon Hunter, Robin Murphy, dri-devel, linux-tegra, devicetree
From: Thierry Reding <treding@nvidia.com>
The majority of the driver already uses struct iosys_map to encapsulate
accesses to I/O remapped vs. system memory. Accesses via the screen base
pointer still use __iomem annotations, which can lead to inconsistencies
and conflicts with subsequent patches.
Convert the screen base to a struct iosys_map as well for consistency
and to avoid these issues.
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
Changes in v4:
- rename screen variable to dst for consistency with other drivers
- add Reviewed-by from Thomas
drivers/gpu/drm/tiny/simpledrm.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c
index f658b99c796a..c1ed6dd426ec 100644
--- a/drivers/gpu/drm/tiny/simpledrm.c
+++ b/drivers/gpu/drm/tiny/simpledrm.c
@@ -208,7 +208,7 @@ struct simpledrm_device {
unsigned int pitch;
/* memory management */
- void __iomem *screen_base;
+ struct iosys_map screen_base;
/* modesetting */
uint32_t formats[8];
@@ -473,15 +473,15 @@ static void simpledrm_primary_plane_helper_atomic_update(struct drm_plane *plane
drm_atomic_helper_damage_iter_init(&iter, old_plane_state, plane_state);
drm_atomic_for_each_plane_damage(&iter, &damage) {
- struct iosys_map dst = IOSYS_MAP_INIT_VADDR(sdev->screen_base);
struct drm_rect dst_clip = plane_state->dst;
+ struct iosys_map dst = sdev->screen_base;
if (!drm_rect_intersect(&dst_clip, &damage))
continue;
iosys_map_incr(&dst, drm_fb_clip_offset(sdev->pitch, sdev->format, &dst_clip));
- drm_fb_blit(&dst, &sdev->pitch, sdev->format->format, shadow_plane_state->data, fb,
- &damage);
+ drm_fb_blit(&dst, &sdev->pitch, sdev->format->format, shadow_plane_state->data,
+ fb, &damage);
}
drm_dev_exit(idx);
@@ -500,7 +500,7 @@ static void simpledrm_primary_plane_helper_atomic_disable(struct drm_plane *plan
return;
/* Clear screen to black if disabled */
- memset_io(sdev->screen_base, 0, sdev->pitch * sdev->mode.vdisplay);
+ iosys_map_memset(&sdev->screen_base, 0, 0, sdev->pitch * sdev->mode.vdisplay);
drm_dev_exit(idx);
}
@@ -703,7 +703,8 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
screen_base = devm_ioremap_wc(&pdev->dev, mem->start, resource_size(mem));
if (!screen_base)
return ERR_PTR(-ENOMEM);
- sdev->screen_base = screen_base;
+
+ iosys_map_set_vaddr_iomem(&sdev->screen_base, screen_base);
/*
* Modesetting
--
2.39.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH v4 5/8] drm/simpledrm: Add support for system memory framebuffers
2023-01-20 17:30 [PATCH v4 0/8] drm/simpledrm: Support system memory framebuffers Thierry Reding
` (3 preceding siblings ...)
2023-01-20 17:30 ` [PATCH v4 4/8] drm/simpledrm: Use struct iosys_map consistently Thierry Reding
@ 2023-01-20 17:31 ` Thierry Reding
2023-01-20 17:31 ` [PATCH v4 6/8] drm/format-helper: Support the AB24/XB24 formats Thierry Reding
` (2 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Thierry Reding @ 2023-01-20 17:31 UTC (permalink / raw)
To: David Airlie, Daniel Vetter, Thomas Zimmermann
Cc: Jon Hunter, Robin Murphy, dri-devel, linux-tegra, devicetree
From: Thierry Reding <treding@nvidia.com>
Simple framebuffers can be set up in system memory, which cannot be
requested and/or I/O remapped using the I/O resource helpers. Add a
separate code path that obtains system memory framebuffers from the
reserved memory region referenced in the memory-region property.
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
Changes in v4:
- rebase onto latest format helper changes
- turn drm_info() into drm_dbg()
- add Reviewed-by from Thomas
Changes in v3:
- simplify memory code and move back to simpledrm_device_create()
- extract screen_base iosys_map fix into separate patch
Changes in v2:
- make screen base a struct iosys_map to avoid sparse warnings
drivers/gpu/drm/tiny/simpledrm.c | 99 ++++++++++++++++++++++++--------
1 file changed, 75 insertions(+), 24 deletions(-)
diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c
index c1ed6dd426ec..2acc0eb32489 100644
--- a/drivers/gpu/drm/tiny/simpledrm.c
+++ b/drivers/gpu/drm/tiny/simpledrm.c
@@ -3,6 +3,7 @@
#include <linux/clk.h>
#include <linux/of_clk.h>
#include <linux/minmax.h>
+#include <linux/of_address.h>
#include <linux/platform_data/simplefb.h>
#include <linux/platform_device.h>
#include <linux/regulator/consumer.h>
@@ -184,6 +185,31 @@ simplefb_get_format_of(struct drm_device *dev, struct device_node *of_node)
return simplefb_get_validated_format(dev, format);
}
+static struct resource *
+simplefb_get_memory_of(struct drm_device *dev, struct device_node *of_node)
+{
+ struct device_node *np;
+ struct resource *res;
+ int err;
+
+ np = of_parse_phandle(of_node, "memory-region", 0);
+ if (!np)
+ return NULL;
+
+ res = devm_kzalloc(dev->dev, sizeof(*res), GFP_KERNEL);
+ if (!res)
+ return ERR_PTR(-ENOMEM);
+
+ err = of_address_to_resource(np, 0, res);
+ if (err)
+ return ERR_PTR(err);
+
+ if (of_get_property(of_node, "reg", NULL))
+ drm_warn(dev, "preferring \"memory-region\" over \"reg\" property\n");
+
+ return res;
+}
+
/*
* Simple Framebuffer device
*/
@@ -604,8 +630,7 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
struct drm_device *dev;
int width, height, stride;
const struct drm_format_info *format;
- struct resource *res, *mem;
- void __iomem *screen_base;
+ struct resource *res, *mem = NULL;
struct drm_plane *primary_plane;
struct drm_crtc *crtc;
struct drm_encoder *encoder;
@@ -657,6 +682,9 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
format = simplefb_get_format_of(dev, of_node);
if (IS_ERR(format))
return ERR_CAST(format);
+ mem = simplefb_get_memory_of(dev, of_node);
+ if (IS_ERR(mem))
+ return ERR_CAST(mem);
} else {
drm_err(dev, "no simplefb configuration found\n");
return ERR_PTR(-ENODEV);
@@ -679,32 +707,55 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv,
* Memory management
*/
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return ERR_PTR(-EINVAL);
+ if (mem) {
+ void *screen_base;
- ret = devm_aperture_acquire_from_firmware(dev, res->start, resource_size(res));
- if (ret) {
- drm_err(dev, "could not acquire memory range %pr: error %d\n", res, ret);
- return ERR_PTR(ret);
- }
+ ret = devm_aperture_acquire_from_firmware(dev, mem->start, resource_size(mem));
+ if (ret) {
+ drm_err(dev, "could not acquire memory range %pr: %d\n", mem, ret);
+ return ERR_PTR(ret);
+ }
- mem = devm_request_mem_region(&pdev->dev, res->start, resource_size(res), drv->name);
- if (!mem) {
- /*
- * We cannot make this fatal. Sometimes this comes from magic
- * spaces our resource handlers simply don't know about. Use
- * the I/O-memory resource as-is and try to map that instead.
- */
- drm_warn(dev, "could not acquire memory region %pr\n", res);
- mem = res;
- }
+ drm_dbg(dev, "using system memory framebuffer at %pr\n", mem);
- screen_base = devm_ioremap_wc(&pdev->dev, mem->start, resource_size(mem));
- if (!screen_base)
- return ERR_PTR(-ENOMEM);
+ screen_base = devm_memremap(dev->dev, mem->start, resource_size(mem), MEMREMAP_WC);
+ if (!screen_base)
+ return ERR_PTR(-ENOMEM);
+
+ iosys_map_set_vaddr(&sdev->screen_base, screen_base);
+ } else {
+ void __iomem *screen_base;
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res)
+ return ERR_PTR(-EINVAL);
- iosys_map_set_vaddr_iomem(&sdev->screen_base, screen_base);
+ ret = devm_aperture_acquire_from_firmware(dev, res->start, resource_size(res));
+ if (ret) {
+ drm_err(dev, "could not acquire memory range %pr: %d\n", &res, ret);
+ return ERR_PTR(ret);
+ }
+
+ drm_dbg(dev, "using I/O memory framebuffer at %pr\n", res);
+
+ mem = devm_request_mem_region(&pdev->dev, res->start, resource_size(res),
+ drv->name);
+ if (!mem) {
+ /*
+ * We cannot make this fatal. Sometimes this comes from magic
+ * spaces our resource handlers simply don't know about. Use
+ * the I/O-memory resource as-is and try to map that instead.
+ */
+ drm_warn(dev, "could not acquire memory region %pr\n", res);
+ mem = res;
+ }
+
+ screen_base = devm_ioremap_wc(&pdev->dev, mem->start, resource_size(mem));
+ if (!screen_base)
+ return ERR_PTR(-ENOMEM);
+
+ iosys_map_set_vaddr_iomem(&sdev->screen_base, screen_base);
+ }
/*
* Modesetting
--
2.39.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH v4 6/8] drm/format-helper: Support the AB24/XB24 formats
2023-01-20 17:30 [PATCH v4 0/8] drm/simpledrm: Support system memory framebuffers Thierry Reding
` (4 preceding siblings ...)
2023-01-20 17:31 ` [PATCH v4 5/8] drm/simpledrm: Add support for system memory framebuffers Thierry Reding
@ 2023-01-20 17:31 ` Thierry Reding
2023-01-20 17:31 ` [PATCH v4 7/8] drm/simpledrm: Support the XB24/AB24 format Thierry Reding
2023-01-20 17:31 ` [PATCH v4 8/8] arm64: tegra: Add simple framebuffer on Jetson Xavier NX Thierry Reding
7 siblings, 0 replies; 11+ messages in thread
From: Thierry Reding @ 2023-01-20 17:31 UTC (permalink / raw)
To: David Airlie, Daniel Vetter, Thomas Zimmermann
Cc: Jon Hunter, Robin Murphy, dri-devel, linux-tegra, devicetree
From: Thierry Reding <treding@nvidia.com>
Add a conversion helper for the AB24 and XB24 formats to use in
drm_fb_blit().
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
Changes in v4:
- rebased on top of latest drm-format-helper rework, add back AB24 support
- add Reviewed-by from Thomas
Changes in v3:
- rebase onto latest drm-next
Changes in v2:
- support XB24 format instead of AB24
drivers/gpu/drm/drm_format_helper.c | 66 +++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)
diff --git a/drivers/gpu/drm/drm_format_helper.c b/drivers/gpu/drm/drm_format_helper.c
index 994f8fb71f45..f93a4efcee90 100644
--- a/drivers/gpu/drm/drm_format_helper.c
+++ b/drivers/gpu/drm/drm_format_helper.c
@@ -649,6 +649,66 @@ void drm_fb_xrgb8888_to_argb8888(struct iosys_map *dst, const unsigned int *dst_
}
EXPORT_SYMBOL(drm_fb_xrgb8888_to_argb8888);
+static void drm_fb_xrgb8888_to_abgr8888_line(void *dbuf, const void *sbuf, unsigned int pixels)
+{
+ __le32 *dbuf32 = dbuf;
+ const __le32 *sbuf32 = sbuf;
+ unsigned int x;
+ u32 pix;
+
+ for (x = 0; x < pixels; x++) {
+ pix = le32_to_cpu(sbuf32[x]);
+ pix = ((pix & 0x00ff0000) >> 16) << 0 |
+ ((pix & 0x0000ff00) >> 8) << 8 |
+ ((pix & 0x000000ff) >> 0) << 16 |
+ GENMASK(31, 24); /* fill alpha bits */
+ *dbuf32++ = cpu_to_le32(pix);
+ }
+}
+
+static void drm_fb_xrgb8888_to_abgr8888(struct iosys_map *dst, const unsigned int *dst_pitch,
+ const struct iosys_map *src,
+ const struct drm_framebuffer *fb,
+ const struct drm_rect *clip)
+{
+ static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES] = {
+ 4,
+ };
+
+ drm_fb_xfrm(dst, dst_pitch, dst_pixsize, src, fb, clip, false,
+ drm_fb_xrgb8888_to_abgr8888_line);
+}
+
+static void drm_fb_xrgb8888_to_xbgr8888_line(void *dbuf, const void *sbuf, unsigned int pixels)
+{
+ __le32 *dbuf32 = dbuf;
+ const __le32 *sbuf32 = sbuf;
+ unsigned int x;
+ u32 pix;
+
+ for (x = 0; x < pixels; x++) {
+ pix = le32_to_cpu(sbuf32[x]);
+ pix = ((pix & 0x00ff0000) >> 16) << 0 |
+ ((pix & 0x0000ff00) >> 8) << 8 |
+ ((pix & 0x000000ff) >> 0) << 16 |
+ ((pix & 0xff000000) >> 24) << 24;
+ *dbuf32++ = cpu_to_le32(pix);
+ }
+}
+
+static void drm_fb_xrgb8888_to_xbgr8888(struct iosys_map *dst, const unsigned int *dst_pitch,
+ const struct iosys_map *src,
+ const struct drm_framebuffer *fb,
+ const struct drm_rect *clip)
+{
+ static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES] = {
+ 4,
+ };
+
+ drm_fb_xfrm(dst, dst_pitch, dst_pixsize, src, fb, clip, false,
+ drm_fb_xrgb8888_to_xbgr8888_line);
+}
+
static void drm_fb_xrgb8888_to_xrgb2101010_line(void *dbuf, const void *sbuf, unsigned int pixels)
{
__le32 *dbuf32 = dbuf;
@@ -868,6 +928,12 @@ int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t d
} else if (dst_format == DRM_FORMAT_ARGB8888) {
drm_fb_xrgb8888_to_argb8888(dst, dst_pitch, src, fb, clip);
return 0;
+ } else if (dst_format == DRM_FORMAT_XBGR8888) {
+ drm_fb_xrgb8888_to_xbgr8888(dst, dst_pitch, src, fb, clip);
+ return 0;
+ } else if (dst_format == DRM_FORMAT_ABGR8888) {
+ drm_fb_xrgb8888_to_abgr8888(dst, dst_pitch, src, fb, clip);
+ return 0;
} else if (dst_format == DRM_FORMAT_XRGB2101010) {
drm_fb_xrgb8888_to_xrgb2101010(dst, dst_pitch, src, fb, clip);
return 0;
--
2.39.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH v4 7/8] drm/simpledrm: Support the XB24/AB24 format
2023-01-20 17:30 [PATCH v4 0/8] drm/simpledrm: Support system memory framebuffers Thierry Reding
` (5 preceding siblings ...)
2023-01-20 17:31 ` [PATCH v4 6/8] drm/format-helper: Support the AB24/XB24 formats Thierry Reding
@ 2023-01-20 17:31 ` Thierry Reding
2023-01-23 9:16 ` Thomas Zimmermann
2023-01-20 17:31 ` [PATCH v4 8/8] arm64: tegra: Add simple framebuffer on Jetson Xavier NX Thierry Reding
7 siblings, 1 reply; 11+ messages in thread
From: Thierry Reding @ 2023-01-20 17:31 UTC (permalink / raw)
To: David Airlie, Daniel Vetter, Thomas Zimmermann
Cc: Jon Hunter, Robin Murphy, dri-devel, linux-tegra, devicetree
From: Thierry Reding <treding@nvidia.com>
Add XB24 and AB24 to the list of supported formats. The format helpers
support conversion to these formats and they are documented in the
simple-framebuffer device tree bindings.
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
Changes in v4:
- rebase on top of latest drm-format-helper rework
Changes in v2:
- treat AB24 as XB24 and support both at the same time
include/linux/platform_data/simplefb.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/linux/platform_data/simplefb.h b/include/linux/platform_data/simplefb.h
index 27ea99af6e1d..4f94d52ac99f 100644
--- a/include/linux/platform_data/simplefb.h
+++ b/include/linux/platform_data/simplefb.h
@@ -22,6 +22,7 @@
{ "r8g8b8", 24, {16, 8}, {8, 8}, {0, 8}, {0, 0}, DRM_FORMAT_RGB888 }, \
{ "x8r8g8b8", 32, {16, 8}, {8, 8}, {0, 8}, {0, 0}, DRM_FORMAT_XRGB8888 }, \
{ "a8r8g8b8", 32, {16, 8}, {8, 8}, {0, 8}, {24, 8}, DRM_FORMAT_ARGB8888 }, \
+ { "x8b8g8r8", 32, {0, 8}, {8, 8}, {16, 8}, {0, 0}, DRM_FORMAT_XBGR8888 }, \
{ "a8b8g8r8", 32, {0, 8}, {8, 8}, {16, 8}, {24, 8}, DRM_FORMAT_ABGR8888 }, \
{ "x2r10g10b10", 32, {20, 10}, {10, 10}, {0, 10}, {0, 0}, DRM_FORMAT_XRGB2101010 }, \
{ "a2r10g10b10", 32, {20, 10}, {10, 10}, {0, 10}, {30, 2}, DRM_FORMAT_ARGB2101010 }, \
--
2.39.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH v4 7/8] drm/simpledrm: Support the XB24/AB24 format
2023-01-20 17:31 ` [PATCH v4 7/8] drm/simpledrm: Support the XB24/AB24 format Thierry Reding
@ 2023-01-23 9:16 ` Thomas Zimmermann
2023-01-23 15:19 ` Thierry Reding
0 siblings, 1 reply; 11+ messages in thread
From: Thomas Zimmermann @ 2023-01-23 9:16 UTC (permalink / raw)
To: Thierry Reding, David Airlie, Daniel Vetter
Cc: linux-tegra, devicetree, Robin Murphy, dri-devel, Jon Hunter
[-- Attachment #1.1: Type: text/plain, Size: 1695 bytes --]
Hi
Am 20.01.23 um 18:31 schrieb Thierry Reding:
> From: Thierry Reding <treding@nvidia.com>
>
> Add XB24 and AB24 to the list of supported formats. The format helpers
> support conversion to these formats and they are documented in the
> simple-framebuffer device tree bindings.
>
> Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
> Changes in v4:
> - rebase on top of latest drm-format-helper rework
>
> Changes in v2:
> - treat AB24 as XB24 and support both at the same time
>
> include/linux/platform_data/simplefb.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/include/linux/platform_data/simplefb.h b/include/linux/platform_data/simplefb.h
> index 27ea99af6e1d..4f94d52ac99f 100644
> --- a/include/linux/platform_data/simplefb.h
> +++ b/include/linux/platform_data/simplefb.h
> @@ -22,6 +22,7 @@
> { "r8g8b8", 24, {16, 8}, {8, 8}, {0, 8}, {0, 0}, DRM_FORMAT_RGB888 }, \
> { "x8r8g8b8", 32, {16, 8}, {8, 8}, {0, 8}, {0, 0}, DRM_FORMAT_XRGB8888 }, \
> { "a8r8g8b8", 32, {16, 8}, {8, 8}, {0, 8}, {24, 8}, DRM_FORMAT_ARGB8888 }, \
> + { "x8b8g8r8", 32, {0, 8}, {8, 8}, {16, 8}, {0, 0}, DRM_FORMAT_XBGR8888 }, \
> { "a8b8g8r8", 32, {0, 8}, {8, 8}, {16, 8}, {24, 8}, DRM_FORMAT_ABGR8888 }, \
> { "x2r10g10b10", 32, {20, 10}, {10, 10}, {0, 10}, {0, 0}, DRM_FORMAT_XRGB2101010 }, \
> { "a2r10g10b10", 32, {20, 10}, {10, 10}, {0, 10}, {30, 2}, DRM_FORMAT_ARGB2101010 }, \
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH v4 7/8] drm/simpledrm: Support the XB24/AB24 format
2023-01-23 9:16 ` Thomas Zimmermann
@ 2023-01-23 15:19 ` Thierry Reding
0 siblings, 0 replies; 11+ messages in thread
From: Thierry Reding @ 2023-01-23 15:19 UTC (permalink / raw)
To: Thomas Zimmermann
Cc: David Airlie, Daniel Vetter, linux-tegra, devicetree,
Robin Murphy, dri-devel, Jon Hunter
[-- Attachment #1: Type: text/plain, Size: 628 bytes --]
On Mon, Jan 23, 2023 at 10:16:55AM +0100, Thomas Zimmermann wrote:
> Hi
>
> Am 20.01.23 um 18:31 schrieb Thierry Reding:
> > From: Thierry Reding <treding@nvidia.com>
> >
> > Add XB24 and AB24 to the list of supported formats. The format helpers
> > support conversion to these formats and they are documented in the
> > simple-framebuffer device tree bindings.
> >
> > Signed-off-by: Thierry Reding <treding@nvidia.com>
>
> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Thanks. This was the last missing Reviewed-by and builds are successful,
so I've pushed patches 1-7 to drm-misc-next.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v4 8/8] arm64: tegra: Add simple framebuffer on Jetson Xavier NX
2023-01-20 17:30 [PATCH v4 0/8] drm/simpledrm: Support system memory framebuffers Thierry Reding
` (6 preceding siblings ...)
2023-01-20 17:31 ` [PATCH v4 7/8] drm/simpledrm: Support the XB24/AB24 format Thierry Reding
@ 2023-01-20 17:31 ` Thierry Reding
7 siblings, 0 replies; 11+ messages in thread
From: Thierry Reding @ 2023-01-20 17:31 UTC (permalink / raw)
To: David Airlie, Daniel Vetter, Thomas Zimmermann
Cc: Jon Hunter, Robin Murphy, dri-devel, linux-tegra, devicetree
From: Thierry Reding <treding@nvidia.com>
Add the framebuffer carveout reserved memory node as well as a simple-
framebuffer node that is used to bind to the framebuffer that the
bootloader has set up.
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
Changes in v2:
- clear out dynamic fields and leave it up to firmware to fill them in
- mark simple-framebuffer node as disabled by default
.../nvidia/tegra194-p3509-0000+p3668-0001.dts | 43 +++++++++++++++++++
arch/arm64/boot/dts/nvidia/tegra194.dtsi | 2 +-
2 files changed, 44 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/nvidia/tegra194-p3509-0000+p3668-0001.dts b/arch/arm64/boot/dts/nvidia/tegra194-p3509-0000+p3668-0001.dts
index 238fd98e8e45..85b4aaa2ad4e 100644
--- a/arch/arm64/boot/dts/nvidia/tegra194-p3509-0000+p3668-0001.dts
+++ b/arch/arm64/boot/dts/nvidia/tegra194-p3509-0000+p3668-0001.dts
@@ -7,4 +7,47 @@
/ {
model = "NVIDIA Jetson Xavier NX Developer Kit (eMMC)";
compatible = "nvidia,p3509-0000+p3668-0001", "nvidia,tegra194";
+
+ chosen {
+ framebuffer {
+ compatible = "simple-framebuffer";
+ status = "disabled";
+ memory-region = <&fb>;
+ power-domains = <&bpmp TEGRA194_POWER_DOMAIN_DISP>;
+ clocks = <&bpmp TEGRA194_CLK_SOR1_REF>,
+ <&bpmp TEGRA194_CLK_SOR1_OUT>,
+ <&bpmp TEGRA194_CLK_SOR1_PAD_CLKOUT>,
+ <&bpmp TEGRA194_CLK_PLLD2>,
+ <&bpmp TEGRA194_CLK_PLLDP>,
+ <&bpmp TEGRA194_CLK_NVDISPLAY_DISP>,
+ <&bpmp TEGRA194_CLK_NVDISPLAYHUB>,
+ <&bpmp TEGRA194_CLK_NVDISPLAY_P0>;
+ width = <0>;
+ height = <0>;
+ stride = <0>;
+ format = "x8b8g8r8";
+ };
+ };
+
+ reserved-memory {
+ #address-cells = <2>;
+ #size-cells = <2>;
+ ranges;
+
+ fb: framebuffer@0,0 {
+ compatible = "framebuffer";
+ reg = <0x0 0x0 0x0 0x0>;
+ iommu-addresses = <&dc0 0x0 0x0 0x0 0x0>;
+ };
+ };
+
+ bus@0 {
+ host1x@13e00000 {
+ display-hub@15200000 {
+ display@15200000 {
+ memory-region = <&fb>;
+ };
+ };
+ };
+ };
};
diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi
index 5ce2650128b1..e0ce54eae17d 100644
--- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi
+++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi
@@ -1975,7 +1975,7 @@ display-hub@15200000 {
#size-cells = <2>;
ranges = <0x0 0x15200000 0x0 0x15200000 0x0 0x40000>;
- display@15200000 {
+ dc0: display@15200000 {
compatible = "nvidia,tegra194-dc";
reg = <0x0 0x15200000 0x0 0x10000>;
interrupts = <GIC_SPI 153 IRQ_TYPE_LEVEL_HIGH>;
--
2.39.0
^ permalink raw reply related [flat|nested] 11+ messages in thread