All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Kettenis <kettenis@openbsd.org>
To: u-boot@lists.denx.de
Cc: Mark Kettenis <kettenis@openbsd.org>,
	Anatolij Gustschin <agust@denx.de>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Alexander Graf <agraf@csgraf.de>
Subject: [PATCH v2 1/4] video: Add 30bpp support
Date: Sat, 25 Sep 2021 22:47:36 +0200	[thread overview]
Message-ID: <20210925204740.52468-2-kettenis@openbsd.org> (raw)
In-Reply-To: <20210925204740.52468-1-kettenis@openbsd.org>

Add support for 30bpp mode where pixels are picked in 32-bit
integers but use 10 bits instead of 8 bits for each component.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
---
 drivers/video/vidconsole-uclass.c | 11 ++++++++---
 include/video.h                   |  9 +++++++++
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c
index 8132efa55a..f42db40d4c 100644
--- a/drivers/video/vidconsole-uclass.c
+++ b/drivers/video/vidconsole-uclass.c
@@ -155,9 +155,14 @@ u32 vid_console_color(struct video_priv *priv, unsigned int idx)
 		break;
 	case VIDEO_BPP32:
 		if (CONFIG_IS_ENABLED(VIDEO_BPP32)) {
-			return (colors[idx].r << 16) |
-			       (colors[idx].g <<  8) |
-			       (colors[idx].b <<  0);
+			if (priv->format == VIDEO_X2R10G10B10)
+				return (colors[idx].r << 22) |
+				       (colors[idx].g << 12) |
+				       (colors[idx].b <<  2);
+			else
+				return (colors[idx].r << 16) |
+				       (colors[idx].g <<  8) |
+				       (colors[idx].b <<  0);
 		}
 		break;
 	default:
diff --git a/include/video.h b/include/video.h
index 827733305e..f14fb15f84 100644
--- a/include/video.h
+++ b/include/video.h
@@ -64,6 +64,13 @@ enum video_log2_bpp {
 
 #define VNBITS(bpix)	(1 << (bpix))
 
+enum video_format {
+	VIDEO_UNKNOWN,
+	VIDEO_X8B8G8R8,
+	VIDEO_X8R8G8B8,
+	VIDEO_X2R10G10B10,
+};
+
 /**
  * struct video_priv - Device information used by the video uclass
  *
@@ -71,6 +78,7 @@ enum video_log2_bpp {
  * @ysize:	Number of pixels rows (e.g.. 768)
  * @rot:	Display rotation (0=none, 1=90 degrees clockwise, etc.)
  * @bpix:	Encoded bits per pixel (enum video_log2_bpp)
+ * @format:	Pixel format (enum video_format)
  * @vidconsole_drv_name:	Driver to use for the text console, NULL to
  *		select automatically
  * @font_size:	Font size in pixels (0 to use a default value)
@@ -95,6 +103,7 @@ struct video_priv {
 	ushort ysize;
 	ushort rot;
 	enum video_log2_bpp bpix;
+	enum video_format format;
 	const char *vidconsole_drv_name;
 	int font_size;
 
-- 
2.33.0


  reply	other threads:[~2021-09-25 20:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-25 20:47 [PATCH v2 0/4] 30bpp framebuffer support Mark Kettenis
2021-09-25 20:47 ` Mark Kettenis [this message]
2021-09-25 20:47 ` [PATCH v2 2/4] efi_loader: GOP: Add 30bpp support Mark Kettenis
2021-09-25 20:47 ` [PATCH v2 3/4] video: simplefb: " Mark Kettenis
2021-09-25 20:47 ` [PATCH v2 4/4] efi_loader: GOP: Fix 30bpp block transfer support Mark Kettenis
2021-09-26  6:51   ` Heinrich Schuchardt
2021-10-12  7:24 ` [PATCH v2 0/4] 30bpp framebuffer support Anatolij Gustschin

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=20210925204740.52468-2-kettenis@openbsd.org \
    --to=kettenis@openbsd.org \
    --cc=agraf@csgraf.de \
    --cc=agust@denx.de \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.