qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hw/display/bcm2835_fb: fix fb_use_offsets condition
@ 2024-07-13 15:56 SamJakob
  2024-07-13 21:08 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 7+ messages in thread
From: SamJakob @ 2024-07-13 15:56 UTC (permalink / raw)
  To: qemu-devel
  Cc: SamJakob, Peter Maydell, Philippe Mathieu-Daudé,
	open list:Raspberry Pi

	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.

Signed-off-by: SamJakob <me@samjakob.com>
---
 hw/display/bcm2835_fb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/display/bcm2835_fb.c b/hw/display/bcm2835_fb.c
index e40ed2d2e1..650db3da82 100644
--- a/hw/display/bcm2835_fb.c
+++ b/hw/display/bcm2835_fb.c
@@ -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;
 }
 
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH] hw/display/bcm2835_fb: fix fb_use_offsets condition
@ 2024-07-13 16:03 SamJakob
  2024-07-16 10:35 ` Peter Maydell
  0 siblings, 1 reply; 7+ messages in thread
From: SamJakob @ 2024-07-13 16:03 UTC (permalink / raw)
  To: qemu-trivial
  Cc: SamJakob, Peter Maydell, Philippe Mathieu-Daudé,
	open list:Raspberry Pi, open list:All patches CC here

	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.

Signed-off-by: SamJakob <me@samjakob.com>
---
 hw/display/bcm2835_fb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/display/bcm2835_fb.c b/hw/display/bcm2835_fb.c
index e40ed2d2e1..650db3da82 100644
--- a/hw/display/bcm2835_fb.c
+++ b/hw/display/bcm2835_fb.c
@@ -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;
 }
 
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] hw/display/bcm2835_fb: fix fb_use_offsets condition
  2024-07-13 15:56 SamJakob
@ 2024-07-13 21:08 ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-07-13 21:08 UTC (permalink / raw)
  To: SamJakob, qemu-devel; +Cc: Peter Maydell, open list:Raspberry Pi

On 13/7/24 17:56, SamJakob wrote:
> 	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.
> 
> Signed-off-by: SamJakob <me@samjakob.com>
> ---
>   hw/display/bcm2835_fb.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/display/bcm2835_fb.c b/hw/display/bcm2835_fb.c
> index e40ed2d2e1..650db3da82 100644
> --- a/hw/display/bcm2835_fb.c
> +++ b/hw/display/bcm2835_fb.c
> @@ -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;
>   }
>   

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] hw/display/bcm2835_fb: fix fb_use_offsets condition
  2024-07-13 16:03 [PATCH] hw/display/bcm2835_fb: fix fb_use_offsets condition SamJakob
@ 2024-07-16 10:35 ` Peter Maydell
  2024-07-16 14:37   ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Maydell @ 2024-07-16 10:35 UTC (permalink / raw)
  To: SamJakob
  Cc: qemu-trivial, Philippe Mathieu-Daudé, open list:Raspberry Pi,
	open list:All patches CC here

On Sat, 13 Jul 2024 at 17:04, SamJakob <me@samjakob.com> wrote:
>
>         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.
>
> Signed-off-by: SamJakob <me@samjakob.com>

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] hw/display/bcm2835_fb: fix fb_use_offsets condition
  2024-07-16 10:35 ` Peter Maydell
@ 2024-07-16 14:37   ` Philippe Mathieu-Daudé
  2024-07-16 14:44     ` Peter Maydell
  0 siblings, 1 reply; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-07-16 14:37 UTC (permalink / raw)
  To: Peter Maydell, SamJakob
  Cc: qemu-trivial, open list:Raspberry Pi,
	open list:All patches CC here

On 16/7/24 12:35, Peter Maydell wrote:
> On Sat, 13 Jul 2024 at 17:04, SamJakob <me@samjakob.com> wrote:
>>
>>          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.
>>
>> Signed-off-by: SamJakob <me@samjakob.com>
> 
> 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:

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

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

Thanks,

Phil.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] hw/display/bcm2835_fb: fix fb_use_offsets condition
  2024-07-16 14:37   ` Philippe Mathieu-Daudé
@ 2024-07-16 14:44     ` Peter Maydell
  2024-07-16 16:10       ` Sam M.
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Maydell @ 2024-07-16 14:44 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: SamJakob, qemu-trivial, open list:Raspberry Pi,
	open list:All patches CC here

On Tue, 16 Jul 2024 at 15:37, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> On 16/7/24 12:35, Peter Maydell wrote:
> > On Sat, 13 Jul 2024 at 17:04, SamJakob <me@samjakob.com> wrote:
> >>
> >>          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.
> >>
> >> Signed-off-by: SamJakob <me@samjakob.com>
> >
> > 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:
>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>
> (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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] hw/display/bcm2835_fb: fix fb_use_offsets condition
  2024-07-16 14:44     ` Peter Maydell
@ 2024-07-16 16:10       ` Sam M.
  0 siblings, 0 replies; 7+ messages in thread
From: Sam M. @ 2024-07-16 16:10 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Philippe Mathieu-Daudé, qemu-trivial, open list:Raspberry Pi,
	open list:All patches CC here

Thank you!

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

> On Jul 16, 2024, at 3:44 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> 
> On Tue, 16 Jul 2024 at 15:37, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>> 
>>> On 16/7/24 12:35, Peter Maydell wrote:
>>> On Sat, 13 Jul 2024 at 17:04, SamJakob <me@samjakob.com> wrote:
>>>> 
>>>>         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.
>>>> 
>>>> Signed-off-by: SamJakob <me@samjakob.com>
>>> 
>>> 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:
>> 
>> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> 
>> (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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-07-16 16:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-13 16:03 [PATCH] hw/display/bcm2835_fb: fix fb_use_offsets condition SamJakob
2024-07-16 10:35 ` Peter Maydell
2024-07-16 14:37   ` Philippe Mathieu-Daudé
2024-07-16 14:44     ` Peter Maydell
2024-07-16 16:10       ` Sam M.
  -- strict thread matches above, loose matches on Subject: below --
2024-07-13 15:56 SamJakob
2024-07-13 21:08 ` Philippe Mathieu-Daudé

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).