Skip to contentSkip to conversation

hw/display/bcm2835_fb: fix fb_use_offsets condition

PATCH In review SamJakob 3 participants 5 messages Jul 13, 2024 – Jul 16, 2024

Subsystems (2)
lore
Share & tools
lore

SamJakob

author
#0 lore raw

PATCH 1/1 hw/display/bcm2835_fb: fix fb_use_offsets condition

It is common practice when implementing double-buffering on VideoCore to do so by multiplying the height of the virtual buffer by the number of virtual screens desired (i.e., two - in the case of double-bufferring).

At present, this won't work in QEMU because the logic in fb_use_offsets require that both the virtual width and height exceed their physical counterparts.

This appears to be unintentional/a typo and indeed the comment states; "Experimentally, the hardware seems to do this only if the viewport size is larger than the physical screen". The viewport/virtual size would be larger than the physical size if either virtual dimension were larger than their physical counterparts and not necessarily both.

---
 hw/display/bcm2835_fb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/display/bcm2835_fb.c +1 -1
index e40ed2d2e1..650db3da82 100644
@@ -145,7 +145,7 @@ static bool fb_use_offsets(BCM2835FBConfig *config)
      * viewport size is larger than the physical screen. (It doesn't
      * prevent the guest setting this silly viewport setting, though...)
      */
-    return config->xres_virtual > config->xres &&
+    return config->xres_virtual > config->xres ||
         config->yres_virtual > config->yres;
 }
 
Signature · 1 line
2.45.2
#1 lore raw
Quoted 18 lines · SamJakob

It is common practice when implementing double-buffering on VideoCore to do so by multiplying the height of the virtual buffer by the number of virtual screens desired (i.e., two - in the case of double-bufferring).

At present, this won't work in QEMU because the logic in fb_use_offsets require that both the virtual width and height exceed their physical counterparts.

This appears to be unintentional/a typo and indeed the comment states; "Experimentally, the hardware seems to do this only if the viewport size is larger than the physical screen". The viewport/virtual size would be larger than the physical size if either virtual dimension were larger than their physical counterparts and not necessarily both.

Quoted 1 line

Thanks for this bugfix; I've applied it to my target-arm.next queue and it should get upstream within a week or so.

-- PMM

#2 lore raw
Quoted 19 lines · Peter Maydell
Quoted 18 lines · SamJakob

It is common practice when implementing double-buffering on VideoCore to do so by multiplying the height of the virtual buffer by the number of virtual screens desired (i.e., two - in the case of double-bufferring).

At present, this won't work in QEMU because the logic in fb_use_offsets require that both the virtual width and height exceed their physical counterparts.

This appears to be unintentional/a typo and indeed the comment states; "Experimentally, the hardware seems to do this only if the viewport size is larger than the physical screen". The viewport/virtual size would be larger than the physical size if either virtual dimension were larger than their physical counterparts and not necessarily both.

Quoted 4 lines
Quoted 1 line

Thanks for this bugfix; I've applied it to my target-arm.next queue and it should get upstream within a week or so.

Since I'm seeing 2 times the same patch, adding R-b again on this one:

(BTW Peter the commit description is mis-aligned, if you don't mind, correcting it while applying would be appreciated!)

Thanks,

Phil.

#3 lore raw
Quoted 26 lines · Philippe Mathieu-Daudé
Quoted 19 lines · Peter Maydell
Quoted 18 lines · SamJakob

It is common practice when implementing double-buffering on VideoCore to do so by multiplying the height of the virtual buffer by the number of virtual screens desired (i.e., two - in the case of double-bufferring).

At present, this won't work in QEMU because the logic in fb_use_offsets require that both the virtual width and height exceed their physical counterparts.

This appears to be unintentional/a typo and indeed the comment states; "Experimentally, the hardware seems to do this only if the viewport size is larger than the physical screen". The viewport/virtual size would be larger than the physical size if either virtual dimension were larger than their physical counterparts and not necessarily both.

Quoted 4 lines
Quoted 1 line

Thanks for this bugfix; I've applied it to my target-arm.next queue and it should get upstream within a week or so.

Quoted 7 lines

Since I'm seeing 2 times the same patch, adding R-b again on this one:

(BTW Peter the commit description is mis-aligned, if you don't mind, correcting it while applying would be appreciated!)

Yep, I already picked up your r-by and rewrapped the commit message.

-- PMM

author
#4 lore raw

Thank you!

My apologies for the duplicates and alignment - it’s my first time using a mailing list!

Quoted 41 lines · Peter Maydell
Quoted 26 lines · Philippe Mathieu-Daudé
Quoted 21 lines · Peter Maydell
Quoted 18 lines · SamJakob

It is common practice when implementing double-buffering on VideoCore to do so by multiplying the height of the virtual buffer by the number of virtual screens desired (i.e., two - in the case of double-bufferring).

At present, this won't work in QEMU because the logic in fb_use_offsets require that both the virtual width and height exceed their physical counterparts.

This appears to be unintentional/a typo and indeed the comment states; "Experimentally, the hardware seems to do this only if the viewport size is larger than the physical screen". The viewport/virtual size would be larger than the physical size if either virtual dimension were larger than their physical counterparts and not necessarily both.

Quoted 4 lines
Quoted 1 line

Thanks for this bugfix; I've applied it to my target-arm.next queue and it should get upstream within a week or so.

Quoted 7 lines

Since I'm seeing 2 times the same patch, adding R-b again on this one:

(BTW Peter the commit description is mis-aligned, if you don't mind, correcting it while applying would be appreciated!)

Yep, I already picked up your r-by and rewrapped the commit message.

-- PMM