From: Matthias Brugger <mbrugger@suse.com>
To: "Ivan T. Ivanov" <iivanov@suse.de>,
Peter Robinson <pbrobinson@gmail.com>
Cc: Dmitry Malkin <dmitry@bedrocksystems.com>,
Thomas Fitzsimmons <fitzsim@fitzsim.org>,
Peng Fan <peng.fan@nxp.com>,
Jaehoon Chung <jh80.chung@samsung.com>,
Anatolij Gustschin <agust@denx.de>,
wahrenst@gmx.net, florian.fainelli@broadcom.com,
u-boot@lists.denx.de
Subject: Re: [PATCH v4 4/6] bcm2835: Dynamically calculate bytes per pixel parameter
Date: Wed, 10 Jan 2024 16:12:03 +0100 [thread overview]
Message-ID: <2fc1ea46-78d0-4ce2-aabc-d78f826152a4@suse.com> (raw)
In-Reply-To: <20240110122908.31612-5-iivanov@suse.de>
On 10/01/2024 13:29, Ivan T. Ivanov wrote:
> brcm,bcm2708-fb device provided by firmware on RPi5 uses
> 16 bits per pixel, so lets calculate framebuffer bytes
> per pixel dynamically based on queried information.
>
> Tested to work for RPi2b v1.2, RPi3b v1.3, RPi4b v1.1,
> RPi2 Zero W, RPi5b v1.0.
>
> Signed-off-by: Ivan T. Ivanov <iivanov@suse.de>
Reviewed-by: Matthias Brugger <mbrugger@suse.com>
> ---
> drivers/video/bcm2835.c | 18 ++++++++++++++++--
> 1 file changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/video/bcm2835.c b/drivers/video/bcm2835.c
> index 14942526f1..63efa762db 100644
> --- a/drivers/video/bcm2835.c
> +++ b/drivers/video/bcm2835.c
> @@ -16,7 +16,7 @@ static int bcm2835_video_probe(struct udevice *dev)
> struct video_uc_plat *plat = dev_get_uclass_plat(dev);
> struct video_priv *uc_priv = dev_get_uclass_priv(dev);
> int ret;
> - int w, h, pitch;
> + int w, h, pitch, bpp;
> ulong fb_base, fb_size, fb_start, fb_end;
>
> debug("bcm2835: Query resolution...\n");
> @@ -41,9 +41,23 @@ static int bcm2835_video_probe(struct udevice *dev)
> DCACHE_WRITEBACK);
> video_set_flush_dcache(dev, true);
>
> + bpp = pitch / w;
> + switch (bpp) {
> + case 2:
> + uc_priv->bpix = VIDEO_BPP16;
> + break;
> + case 4:
> + uc_priv->bpix = VIDEO_BPP32;
> + break;
> + default:
> + printf("bcm2835: unexpected bpp %d, pitch %d, width %d\n",
> + bpp, pitch, w);
> + uc_priv->bpix = VIDEO_BPP32;
> + break;
> + }
> +
> uc_priv->xsize = w;
> uc_priv->ysize = h;
> - uc_priv->bpix = VIDEO_BPP32;
> plat->base = fb_base;
> plat->size = fb_size;
>
next prev parent reply other threads:[~2024-01-10 15:12 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-10 12:29 [PATCH v4 0/6] rpi5: initial support Ivan T. Ivanov
2024-01-10 12:29 ` [PATCH v4 1/6] rpi5: add initial memory map for bcm2712 Ivan T. Ivanov
2024-01-10 17:57 ` Florian Fainelli
2024-01-10 12:29 ` [PATCH v4 2/6] rpi5: Use devicetree as alternative way to read IO base addresses Ivan T. Ivanov
2024-01-10 18:00 ` Florian Fainelli
2024-01-16 9:11 ` Ivan T. Ivanov
2024-01-10 12:29 ` [PATCH v4 3/6] rpi5: Use devicetree to retrieve board revision Ivan T. Ivanov
2024-01-10 12:29 ` [PATCH v4 4/6] bcm2835: Dynamically calculate bytes per pixel parameter Ivan T. Ivanov
2024-01-10 15:12 ` Matthias Brugger [this message]
2024-01-10 12:29 ` [PATCH v4 5/6] mmc: bcmstb: Add support for bcm2712 SD controller Ivan T. Ivanov
2024-01-11 22:07 ` Stefan Wahren
2024-01-12 7:44 ` Ivan T. Ivanov
2024-01-16 9:14 ` Ivan T. Ivanov
2024-01-10 12:29 ` [PATCH v4 6/6] configs: rpi_arm64: enable SDHCI BCMSTB driver Ivan T. Ivanov
2024-01-22 13:46 ` [PATCH v4 0/6] rpi5: initial support Matthias Brugger
2024-09-19 9:36 ` Stefan Agner
2024-09-19 9:52 ` Ivan T. Ivanov
2024-09-19 14:01 ` Stefan Agner
2024-09-19 14:22 ` Ivan T. Ivanov
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=2fc1ea46-78d0-4ce2-aabc-d78f826152a4@suse.com \
--to=mbrugger@suse.com \
--cc=agust@denx.de \
--cc=dmitry@bedrocksystems.com \
--cc=fitzsim@fitzsim.org \
--cc=florian.fainelli@broadcom.com \
--cc=iivanov@suse.de \
--cc=jh80.chung@samsung.com \
--cc=pbrobinson@gmail.com \
--cc=peng.fan@nxp.com \
--cc=u-boot@lists.denx.de \
--cc=wahrenst@gmx.net \
/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.