[Qemu-devel] [PATCH v3 0/6] ramfb: simple boot framebuffer, no legacy vga

Gerd Hoffmann posted 6 patches 5 years, 10 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20180608112001.14729-1-kraxel@redhat.com
Test checkpatch failed
Test docker-mingw@fedora passed
Test docker-quick@centos7 passed
Test s390x passed
include/hw/display/ramfb.h    |  12 ++++
include/hw/vfio/vfio-common.h |   2 +
hw/arm/sysbus-fdt.c           |   7 ++
hw/arm/virt.c                 |   2 +
hw/display/bochs-display.c    |   1 +
hw/display/ramfb-standalone.c |  62 ++++++++++++++++++
hw/display/ramfb.c            |  96 +++++++++++++++++++++++++++
hw/display/virtio-ramfb.c     | 149 ++++++++++++++++++++++++++++++++++++++++++
hw/i386/pc_piix.c             |   2 +
hw/i386/pc_q35.c              |   2 +
hw/vfio/display.c             |  10 +++
hw/vfio/pci.c                 |  15 +++++
hw/display/Makefile.objs      |   5 +-
13 files changed, 364 insertions(+), 1 deletion(-)
create mode 100644 include/hw/display/ramfb.h
create mode 100644 hw/display/ramfb-standalone.c
create mode 100644 hw/display/ramfb.c
create mode 100644 hw/display/virtio-ramfb.c
[Qemu-devel] [PATCH v3 0/6] ramfb: simple boot framebuffer, no legacy vga
Posted by Gerd Hoffmann 5 years, 10 months ago
  Hi,

Ok folks, here is a experimental patch series for a legacy free boot
framebuffer.  If you want play with it I recommend getting the bits from

	https://www.kraxel.org/cgit/qemu/log/?h=sirius/ramfb

because they come with an updated seabios and a new vgabios rom and an
experimental OVMF build.

Functional overview
-------------------

The boot framebuffer is expected to be configured by the firmware, so it
uses fw_cfg as interface.  Initialization goes as follows:

  (1) Check whenever etc/ramfb is present.
  (2) Allocate framebuffer from RAM.
  (3) Fill struct RAMFBCfg, write it to etc/ramfb.

Done.  You can write stuff to the framebuffer now, and it should appear
automagically on the screen.

Note that this isn't very efficient because it does a full display
update on each refresh.  No dirty tracking.  Dirty tracking would have
to be active for the whole ram slot, so that wouldn't be very efficient
either.

Firmware support -- seabios
---------------------------

seavgabios is able to emulate vga text mode on top of a framebuffer, for
coreboot native graphics initialialization.  Which works fine for
everything which writes text using the vgabios interface (basically
everyhing which works with sgabios).

So I hacked that up to work with ramfb (and, while being at it,
bochs-display too).  Right now it's proof-of-concept code with fwcfg
support being cut+paste, so it'll need cleanups before merging.
Look here:

	https://www.kraxe.org/cgit/seabios/log/?h=bochs

Firmware support -- edk2
------------------------

There is a EFI driver too.  Code is here:

	https://github.com/kraxel/edk2/commits/ramfb

Firmware blob is in pc-bios/OVMF-ramfb.fd, to be used with -bios.

So, how to play?
----------------

There is ramfb.  Standalone device.

There is virtio-ramfb.  Simliar to virtio-vga, but using ramfb instead of
adding vga compatibility.  Shows how you can wire up ramfb support to
some display device.  Unlike virtio-vga it should work fine on arm.  Use
"qemu -vga none -device virtio-ramfb" for this one.  Not clear whenever
this will be actually be merged, given that edk2 has a native virtio-gpu
driver.

There is virtio-pci-ramfb, which provides boot display support to vgpu
devices.

What works?
-----------

Both windows (x86 tested) and linux (x86 + arm tested) UEFI guests
handle the ramfb GOP just fine.

BIOS boot loaders for linux all use vgabios calls for text mode, so they
show up just fine.  Also ipxe, seabios itself of course.  So you can
boot up your linux guest.  vesafb works too.

Windows in BIOS mode doesn't use text mode and works fine too.

What doesn't work?
------------------

vgacon (direct vga hardware access).  Linux boots just fine
nevertheless, the only effect is that you don't see any boot messages
until the drm driver loads.

Known issues
------------

Handover from ramfb-backed efifb to the native linux driver is tricky.
Usually efifb gets kicked out when the native driver loads because of
overlapping ressources.  With efifb being in RAM instead of using a GPU
PCI bar this doesn't happen though, so you'll end up with two
framebuffer devices.

In case vgaarb classifies the GPU as primary display device fbcon will
switch all VTs over to the framebuffer device of the real GPU, so there
isn't a noticable difference.  Otherwise you'll end up with a
non-visible fbcon, because it continues to run on ramfb whereas qemu
switched over to the GPU because the native linux driver initialized the
display.

xorg/wayland will show up on the GPU in any case because they prefer drm
over fbdev, so they wouldn't run on efifb.

enjoy,
  Gerd

Gerd Hoffmann (6):
  hw/display: add ramfb, a simple boot framebuffer living in guest ram
  hw/display: add standalone ramfb device
  hw/display: add virtio-ramfb device
  hw/vfio/display: add ramfb support
  ramfb: enable vgabios
  bochs-display: enable vgabios

 include/hw/display/ramfb.h    |  12 ++++
 include/hw/vfio/vfio-common.h |   2 +
 hw/arm/sysbus-fdt.c           |   7 ++
 hw/arm/virt.c                 |   2 +
 hw/display/bochs-display.c    |   1 +
 hw/display/ramfb-standalone.c |  62 ++++++++++++++++++
 hw/display/ramfb.c            |  96 +++++++++++++++++++++++++++
 hw/display/virtio-ramfb.c     | 149 ++++++++++++++++++++++++++++++++++++++++++
 hw/i386/pc_piix.c             |   2 +
 hw/i386/pc_q35.c              |   2 +
 hw/vfio/display.c             |  10 +++
 hw/vfio/pci.c                 |  15 +++++
 hw/display/Makefile.objs      |   5 +-
 13 files changed, 364 insertions(+), 1 deletion(-)
 create mode 100644 include/hw/display/ramfb.h
 create mode 100644 hw/display/ramfb-standalone.c
 create mode 100644 hw/display/ramfb.c
 create mode 100644 hw/display/virtio-ramfb.c

-- 
2.9.3


Re: [Qemu-devel] [PATCH v3 0/6] ramfb: simple boot framebuffer, no legacy vga
Posted by no-reply@patchew.org 5 years, 10 months ago
Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20180608112001.14729-1-kraxel@redhat.com
Subject: [Qemu-devel] [PATCH v3 0/6] ramfb: simple boot framebuffer, no legacy vga

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
   a674da0ab7..bac5ba3dc5  master     -> master
 * [new tag]               patchew/20180608112001.14729-1-kraxel@redhat.com -> patchew/20180608112001.14729-1-kraxel@redhat.com
Switched to a new branch 'test'
b3b768bdcf bochs-display: enable vgabios
be08ed14be ramfb: enable vgabios
f2f2069625 hw/vfio/display: add ramfb support
717edb2f4d hw/display: add virtio-ramfb device
cfb87c9b3b hw/display: add standalone ramfb device
add39ce518 hw/display: add ramfb, a simple boot framebuffer living in guest ram

=== OUTPUT BEGIN ===
Checking PATCH 1/6: hw/display: add ramfb, a simple boot framebuffer living in guest ram...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#41: 
new file mode 100644

total: 0 errors, 1 warnings, 109 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 2/6: hw/display: add standalone ramfb device...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#71: 
new file mode 100644

total: 0 errors, 1 warnings, 141 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 3/6: hw/display: add virtio-ramfb device...
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#32: 
new file mode 100644

total: 0 errors, 1 warnings, 157 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 4/6: hw/vfio/display: add ramfb support...
ERROR: braces {} are necessary for all arms of this statement
#31: FILE: hw/vfio/display.c:187:
+    if (strcmp(object_get_typename(OBJECT(vdev)), "vfio-pci-ramfb") == 0)
[...]

ERROR: braces {} are necessary for all arms of this statement
#50: FILE: hw/vfio/display.c:311:
+    if (strcmp(object_get_typename(OBJECT(vdev)), "vfio-pci-ramfb") == 0)
[...]

total: 2 errors, 0 warnings, 72 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 5/6: ramfb: enable vgabios...
Checking PATCH 6/6: bochs-display: enable vgabios...
=== OUTPUT END ===

Test command exited with code: 1


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@redhat.com