qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* can surface_bits_per_pixel() for the console surface ever return anything other than 32 ?
@ 2021-02-10 18:02 Peter Maydell
  2021-02-11 10:12 ` Gerd Hoffmann
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Maydell @ 2021-02-10 18:02 UTC (permalink / raw)
  To: QEMU Developers, Gerd Hoffmann

Hi; I was doing a bit of cleanup of one or two of the older
display devices based on a note in BiteSizedTasks about removing
dead code that tries to support bit depths other than 32 for the
console display surface.

I notice that as well as handling surface_bits_per_pixel()
possibly returning 8, 15, 16, 24, these devices also seem to
check for the possibility it returns 0 (presumably meaning
"no surface" or "no surface yet" ?).

Is it still possible that surface_bits_per_pixel() could return 0
here, either transiently during system initialization or more
generally, eg for '-display none' ? Or is the 'case 0' code also
entirely dead ?

thanks
-- PMM


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

* Re: can surface_bits_per_pixel() for the console surface ever return anything other than 32 ?
  2021-02-10 18:02 can surface_bits_per_pixel() for the console surface ever return anything other than 32 ? Peter Maydell
@ 2021-02-11 10:12 ` Gerd Hoffmann
  2021-02-11 10:51   ` Peter Maydell
  2021-02-12 18:38   ` Peter Maydell
  0 siblings, 2 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2021-02-11 10:12 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers

  Hi,

> I notice that as well as handling surface_bits_per_pixel()
> possibly returning 8, 15, 16, 24, these devices also seem to
> check for the possibility it returns 0 (presumably meaning
> "no surface" or "no surface yet" ?).

Depends a bit on how the surface is created.

When using host memory as backing storage (typical workflow is
qemu_console_resize() + qemu_console_surface() calls) bits per pixel is
32 no matter what (format is PIXMAN_x8r8g8b8 to be exact).  I think this
is true for most if not all arm display devices.

Depth 15+15+24 can happen when the display device uses
qemu_create_displaysurface_from().  That is typically the case when
using guest-accessible memory (vga vram for example) as backing storage
for the surface.  Which implies there is no need for the display device
to update the surface in the first place because the guest can render
directly to the surface then.

"no surface" can only happen when the display device explicitly calls 
dpy_gfx_replace_surface(con, NULL).  virtio-gpu does that in case the
guest disables the output for example.

HTH,
  Gerd



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

* Re: can surface_bits_per_pixel() for the console surface ever return anything other than 32 ?
  2021-02-11 10:12 ` Gerd Hoffmann
@ 2021-02-11 10:51   ` Peter Maydell
  2021-02-12 18:38   ` Peter Maydell
  1 sibling, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2021-02-11 10:51 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: QEMU Developers

On Thu, 11 Feb 2021 at 10:12, Gerd Hoffmann <kraxel@redhat.com> wrote:
> > I notice that as well as handling surface_bits_per_pixel()
> > possibly returning 8, 15, 16, 24, these devices also seem to
> > check for the possibility it returns 0 (presumably meaning
> > "no surface" or "no surface yet" ?).
>
> Depends a bit on how the surface is created.
>
> When using host memory as backing storage (typical workflow is
> qemu_console_resize() + qemu_console_surface() calls) bits per pixel is
> 32 no matter what (format is PIXMAN_x8r8g8b8 to be exact).  I think this
> is true for most if not all arm display devices.
>
> Depth 15+15+24 can happen when the display device uses
> qemu_create_displaysurface_from().  That is typically the case when
> using guest-accessible memory (vga vram for example) as backing storage
> for the surface.  Which implies there is no need for the display device
> to update the surface in the first place because the guest can render
> directly to the surface then.
>
> "no surface" can only happen when the display device explicitly calls
> dpy_gfx_replace_surface(con, NULL).  virtio-gpu does that in case the
> guest disables the output for example.

Thanks. It sounds like for the displays I'm interested in
I can just assume the surface is always 32 bits with no
exceptions (and it's easy enough to grep for whether the
device is making one of the function calls you list).

-- PMM


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

* Re: can surface_bits_per_pixel() for the console surface ever return anything other than 32 ?
  2021-02-11 10:12 ` Gerd Hoffmann
  2021-02-11 10:51   ` Peter Maydell
@ 2021-02-12 18:38   ` Peter Maydell
  2021-02-15  9:01     ` Gerd Hoffmann
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Maydell @ 2021-02-12 18:38 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: QEMU Developers

On Thu, 11 Feb 2021 at 10:12, Gerd Hoffmann <kraxel@redhat.com> wrote:
>
>   Hi,
>
> > I notice that as well as handling surface_bits_per_pixel()
> > possibly returning 8, 15, 16, 24, these devices also seem to
> > check for the possibility it returns 0 (presumably meaning
> > "no surface" or "no surface yet" ?).
>
> Depends a bit on how the surface is created.
>
> When using host memory as backing storage (typical workflow is
> qemu_console_resize() + qemu_console_surface() calls) bits per pixel is
> 32 no matter what (format is PIXMAN_x8r8g8b8 to be exact).  I think this
> is true for most if not all arm display devices.

Quick follow-up check: this is always RGB, ie is_surface_bgr()
will always return false, right ?

thanks
-- PMM


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

* Re: can surface_bits_per_pixel() for the console surface ever return anything other than 32 ?
  2021-02-12 18:38   ` Peter Maydell
@ 2021-02-15  9:01     ` Gerd Hoffmann
  0 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2021-02-15  9:01 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers

On Fri, Feb 12, 2021 at 06:38:16PM +0000, Peter Maydell wrote:
> On Thu, 11 Feb 2021 at 10:12, Gerd Hoffmann <kraxel@redhat.com> wrote:
> >
> >   Hi,
> >
> > > I notice that as well as handling surface_bits_per_pixel()
> > > possibly returning 8, 15, 16, 24, these devices also seem to
> > > check for the possibility it returns 0 (presumably meaning
> > > "no surface" or "no surface yet" ?).
> >
> > Depends a bit on how the surface is created.
> >
> > When using host memory as backing storage (typical workflow is
> > qemu_console_resize() + qemu_console_surface() calls) bits per pixel is
> > 32 no matter what (format is PIXMAN_x8r8g8b8 to be exact).  I think this
> > is true for most if not all arm display devices.
> 
> Quick follow-up check: this is always RGB, ie is_surface_bgr()
> will always return false, right ?

Yes, always rgb (in host native byte order).

take care,
  Gerd



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

end of thread, other threads:[~2021-02-15  9:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-10 18:02 can surface_bits_per_pixel() for the console surface ever return anything other than 32 ? Peter Maydell
2021-02-11 10:12 ` Gerd Hoffmann
2021-02-11 10:51   ` Peter Maydell
2021-02-12 18:38   ` Peter Maydell
2021-02-15  9:01     ` Gerd Hoffmann

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