* [PATCH v2] hw/display/bcm2835_fb: Fix framebuffer allocation address
@ 2022-07-25 14:58 Alan Jian
2022-07-26 14:04 ` Peter Maydell
0 siblings, 1 reply; 2+ messages in thread
From: Alan Jian @ 2022-07-25 14:58 UTC (permalink / raw)
To: qemu-arm; +Cc: qemu-devel, Alan Jian
This patch fixes the dedicated framebuffer mailbox interface(marked as
deprecated in official docs, but can still be fixed for emulation purposes)
by removing unneeded offset to make it works like buffer allocate tag in
bcm2835_property interface[1], some baremetal applications like the
Screen01/Screen02 examples from Baking Pi tutorial[2] didn't work
before this patch.
[1] https://github.com/qemu/qemu/blob/master/hw/misc/bcm2835_property.c#L158
[2] https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen01.html
Signed-off-by: Alan Jian <alanjian85@outlook.com>
---
This patch is v2 because the previous one is signed by my username, not my full name,
which is not allowed in the submission rule of QEMU.
hw/display/bcm2835_fb.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/hw/display/bcm2835_fb.c b/hw/display/bcm2835_fb.c
index 088fc3d51c..a05277674f 100644
--- a/hw/display/bcm2835_fb.c
+++ b/hw/display/bcm2835_fb.c
@@ -279,8 +279,7 @@ static void bcm2835_fb_mbox_push(BCM2835FBState *s, uint32_t value)
newconf.xoffset = ldl_le_phys(&s->dma_as, value + 24);
newconf.yoffset = ldl_le_phys(&s->dma_as, value + 28);
- newconf.base = s->vcram_base | (value & 0xc0000000);
- newconf.base += BCM2835_FB_OFFSET;
+ newconf.base = s->vcram_base + BCM2835_FB_OFFSET;
/* Copy fields which we don't want to change from the existing config */
newconf.pixo = s->config.pixo;
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] hw/display/bcm2835_fb: Fix framebuffer allocation address
2022-07-25 14:58 [PATCH v2] hw/display/bcm2835_fb: Fix framebuffer allocation address Alan Jian
@ 2022-07-26 14:04 ` Peter Maydell
0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2022-07-26 14:04 UTC (permalink / raw)
To: Alan Jian; +Cc: qemu-arm, qemu-devel, Alan Jian
On Mon, 25 Jul 2022 at 16:06, Alan Jian <alanjian85@gmail.com> wrote:
>
> This patch fixes the dedicated framebuffer mailbox interface(marked as
> deprecated in official docs, but can still be fixed for emulation purposes)
> by removing unneeded offset to make it works like buffer allocate tag in
> bcm2835_property interface[1], some baremetal applications like the
> Screen01/Screen02 examples from Baking Pi tutorial[2] didn't work
> before this patch.
>
> [1] https://github.com/qemu/qemu/blob/master/hw/misc/bcm2835_property.c#L158
> [2] https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen01.html
Thanks. If examples which work on real hardware don't work on QEMU
then we presumably have a bug, and the documentation of this fb mbox
https://github.com/raspberrypi/firmware/wiki/Mailbox-framebuffer-interface
doesn't say anything about using the top bits of the config-struct
address for anything, so the current code definitely looks wrong.
This was the only place where we ever changed the config
struct's .base field to something other than s->vcram_base + BCM2835_FB_OFFSET.
If the .base field is now effectively constant then it's pointless
and we can clean things up a bit by getting rid of it. I'll send a
followup patch at some point.
Applied to target-arm.next, thanks. (I tweaked the commit message
slightly.)
-- PMM
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-26 14:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-25 14:58 [PATCH v2] hw/display/bcm2835_fb: Fix framebuffer allocation address Alan Jian
2022-07-26 14:04 ` Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).