mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: "open list:BAREBOX" <barebox@lists.infradead.org>
Subject: [PATCH v2 10/15] fb: Accept overlay framebuffers without modes
Date: Fri, 27 Sep 2024 12:37:43 +0200	[thread overview]
Message-ID: <20240927-vop2-v2-10-dc8dcfc651d5@pengutronix.de> (raw)
In-Reply-To: <20240927-vop2-v2-0-dc8dcfc651d5@pengutronix.de>

This adds a pointer to the base framebuffer to struct fb_info
in case the framebuffer is an overlay. As overlays do not have modes,
accept them in fb_enable() even when it doesn't have a mode.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/video/fb.c | 20 ++++++++++++++------
 include/fb.h       |  3 +++
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index a752c114e2..ccc755322e 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -138,7 +138,7 @@ static int fb_enable_set(struct param_d *param, void *priv)
 {
 	struct fb_info *info = priv;
 
-	if (!info->mode)
+	if (!info->mode && !info->base_plane)
 		return -EINVAL;
 
 	if (info->p_enable)
@@ -284,7 +284,7 @@ static int fb_set_shadowfb(struct param_d *p, void *priv)
 
 int register_framebuffer(struct fb_info *info)
 {
-	int id = get_free_deviceid("fb");
+	int id;
 	struct device *dev;
 	int ret, num_modes, i;
 	const char **names;
@@ -304,7 +304,18 @@ int register_framebuffer(struct fb_info *info)
 		info->line_length = info->xres * (info->bits_per_pixel >> 3);
 
 	info->cdev.ops = &fb_ops;
-	info->cdev.name = basprintf("fb%d", id);
+	if (info->base_plane) {
+		int ovl_id = info->base_plane->n_overlays++;
+
+		info->cdev.name = basprintf("%s_%d", dev_name(&info->base_plane->dev), ovl_id);
+		dev->id = DEVICE_ID_SINGLE;
+		dev_set_name(dev, info->cdev.name);
+	} else {
+		id = get_free_deviceid("fb");
+		dev->id = id;
+		dev_set_name(dev, "fb");
+		info->cdev.name = basprintf("fb%d", id);
+	}
 	info->cdev.size = info->line_length * info->yres;
 	info->cdev.dev = dev;
 	info->cdev.priv = info;
@@ -315,11 +326,8 @@ int register_framebuffer(struct fb_info *info)
 	dev->num_resources = 1;
 
 	dev->priv = info;
-	dev->id = id;
 	dev->info = fb_info;
 
-	dev_set_name(dev, "fb");
-
 	ret = register_device(&info->dev);
 	if (ret)
 		goto err_free;
diff --git a/include/fb.h b/include/fb.h
index 574a66a396..76f0c99449 100644
--- a/include/fb.h
+++ b/include/fb.h
@@ -175,6 +175,9 @@ struct fb_info {
 					 * be created.
 					 */
 	int shadowfb;
+
+	struct fb_info *base_plane;
+	int n_overlays;
 };
 
 int of_get_display_timing(const struct device_node *np, const char *name,

-- 
2.39.5




  parent reply	other threads:[~2024-09-27 10:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-27 10:37 [PATCH v2 00/15] video: Add Rockchip VOP2 support Sascha Hauer
2024-09-27 10:37 ` [PATCH v2 01/15] clk: rockchip: rk3568: Fix HDMI clocks Sascha Hauer
2024-09-27 10:37 ` [PATCH v2 02/15] video: add videomode helpers Sascha Hauer
2024-09-27 10:37 ` [PATCH v2 03/15] media-bus-format: update from kernel Sascha Hauer
2024-09-27 10:37 ` [PATCH v2 04/15] regmap: add regfield support Sascha Hauer
2024-09-27 10:37 ` [PATCH v2 05/15] video: add include/video/drm/drm_connector.h Sascha Hauer
2024-09-27 10:37 ` [PATCH v2 06/15] fb: add fb_rect functions Sascha Hauer
2024-09-27 10:37 ` [PATCH v2 07/15] video: Add Sitronix st7789v panel driver Sascha Hauer
2024-09-27 10:37 ` [PATCH v2 08/15] video: add dw-hdmi driver Sascha Hauer
2024-09-27 10:37 ` [PATCH v2 09/15] video: i.MX ipuv3: switch to upstream hdmi driver Sascha Hauer
2024-09-27 10:37 ` Sascha Hauer [this message]
2024-09-27 10:37 ` [PATCH v2 11/15] fb: print more information on devinfo Sascha Hauer
2024-09-27 10:37 ` [PATCH v2 12/15] fbconsole: Adjust fbconsole names for overlays Sascha Hauer
2024-09-27 10:37 ` [PATCH v2 13/15] ARM: ARM64: implement dma_alloc_writecombine() Sascha Hauer
2024-09-27 10:37 ` [PATCH v2 14/15] vpl: make vpl deep probe aware Sascha Hauer
2024-09-27 10:37 ` [PATCH v2 15/15] video: Rockchip: Add VOP2 driver Sascha Hauer
2024-09-30  6:35   ` Ahmad Fatoum
2024-10-01  6:35     ` Sascha Hauer
2024-10-01  6:32 ` [PATCH v2 00/15] video: Add Rockchip VOP2 support Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240927-vop2-v2-10-dc8dcfc651d5@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox