2
0
Fork 0

genodelabs/vbox: nitpicker patch

This commit is contained in:
Emery Hemingway 2020-05-15 20:24:33 +05:30
parent 72c4e4d2f3
commit 3704785f69
2 changed files with 139 additions and 1 deletions

View File

@ -12,11 +12,15 @@ with ports; {
portInputs = [ dde_linux ];
};
ipxe_nic_drv.portInputs = [ dde_ipxe ];
libc = {
portInputs = [ libc ];
patches = [ ./libc.patch ];
};
libiconv.portInputs = [ libc libiconv ];
lighttpd.portInputs = [ libc lighttpd openssl zlib ];
noux.portInputs = [ libc ];
@ -28,6 +32,8 @@ with ports; {
buildInputs = with buildPackages; [ zlib ];
};
stdcxx.portInputs = [ libc stdcxx ];
# The following are tests that never exit
# and have no conventions on log output.
@ -41,7 +47,13 @@ with ports; {
vbox5 = {
nativeBuildInputs = with buildPackages; [ iasl yasm ];
patches = [ ./vbox5-iasl.patch ];
patches = [ ./vbox5-iasl.patch ./vbox-framebuffer-fail-on-fail.patch ];
portInputs = [ libc libiconv qemu-usb stdcxx virtualbox5 ];
};
vbox5-nova = {
nativeBuildInputs = with buildPackages; [ iasl yasm ];
patches = [ ./vbox5-iasl.patch ./vbox-framebuffer-fail-on-fail.patch ];
portInputs = [ libc libiconv qemu-usb stdcxx virtualbox5 ];
};

View File

@ -0,0 +1,126 @@
commit d2a28a33f6a2bda7000ce201d52ff99714895640
Author: Emery Hemingway <ehmry@posteo.net>
Date: Fri May 15 11:28:10 2020 +0530
vbox: use Nitpicker mode for initial resolution
diff --git a/repos/ports/src/virtualbox5/frontend/fb.h b/repos/ports/src/virtualbox5/frontend/fb.h
index 95a7db8602..bf2d65d7c1 100644
--- a/repos/ports/src/virtualbox5/frontend/fb.h
+++ b/repos/ports/src/virtualbox5/frontend/fb.h
@@ -40,7 +40,7 @@ class Genodefb :
Nitpicker::Connection &_nitpicker;
Fb_Genode::Session &_fb { *_nitpicker.framebuffer() };
View_handle _view;
- Fb_Genode::Mode _fb_mode { 1024, 768, Fb_Genode::Mode::RGB565 };
+ Fb_Genode::Mode _fb_mode { _nitpicker.mode() };
/*
* The mode currently used by the VM. Can be smaller than the
commit b6bf91067a4c1c6d5b3508aedd949c8e1a7fe4b3
Author: Emery Hemingway <ehmry@posteo.net>
Date: Fri May 15 11:20:47 2020 +0530
vbox: fail on invalid framebuffer dataspace
VirtualBox can hang during initialization if Nitpicker returns an
invalid dataspace due to insufficient server-side resources. Make
an invalid dataspace a critical rather than silent error.
diff --git a/repos/ports/src/virtualbox5/frontend/fb.h b/repos/ports/src/virtualbox5/frontend/fb.h
index dce00fe4eb..95a7db8602 100644
--- a/repos/ports/src/virtualbox5/frontend/fb.h
+++ b/repos/ports/src/virtualbox5/frontend/fb.h
@@ -21,6 +21,9 @@
#include <os/texture_rgb888.h>
#include <os/dither_painter.h>
+#include <base/attached_dataspace.h>
+#include <util/reconstructible.h>
+
/* VirtualBox includes */
#include "Global.h"
@@ -35,7 +38,7 @@ class Genodefb :
Genode::Env &_env;
Nitpicker::Connection &_nitpicker;
- Fb_Genode::Session &_fb;
+ Fb_Genode::Session &_fb { *_nitpicker.framebuffer() };
View_handle _view;
Fb_Genode::Mode _fb_mode { 1024, 768, Fb_Genode::Mode::RGB565 };
@@ -43,18 +46,18 @@ class Genodefb :
* The mode currently used by the VM. Can be smaller than the
* framebuffer mode.
*/
- Fb_Genode::Mode _virtual_fb_mode;
+ Fb_Genode::Mode _virtual_fb_mode { _initial_setup() };
+
+ Genode::Reconstructible<Genode::Attached_dataspace>
+ _fb_dataspace { _env.rm(), _fb.dataspace() };
- void *_fb_base;
RTCRITSECT _fb_lock;
void _clear_screen()
{
- if (!_fb_base) return;
-
size_t const max_h = Genode::min(_fb_mode.height(), _virtual_fb_mode.height());
size_t const num_pixels = _fb_mode.width() * max_h;
- memset(_fb_base, 0, num_pixels * _fb_mode.bytes_per_pixel());
+ memset(_fb_dataspace->local_addr<char>(), 0, num_pixels * _fb_mode.bytes_per_pixel());
_fb.refresh(0, 0, _virtual_fb_mode.width(), _virtual_fb_mode.height());
}
@@ -91,10 +94,7 @@ class Genodefb :
Genodefb (Genode::Env &env, Nitpicker::Connection &nitpicker)
:
_env(env),
- _nitpicker(nitpicker),
- _fb(*nitpicker.framebuffer()),
- _virtual_fb_mode(_initial_setup()),
- _fb_base(env.rm().attach(_fb.dataspace()))
+ _nitpicker(nitpicker)
{
int rc = RTCritSectInit(&_fb_lock);
Assert(rc == VINF_SUCCESS);
@@ -109,16 +109,11 @@ class Genodefb :
_fb_mode = mode;
- if (_fb_base)
- _env.rm().detach(_fb_base);
+ _fb_dataspace.destruct();
_adjust_buffer();
- try {
- _fb_base = _env.rm().attach(_fb.dataspace());
- } catch (...) {
- _fb_base = nullptr;
- }
+ _fb_dataspace.construct(_env.rm(), _fb.dataspace());
Unlock();
}
@@ -201,8 +196,6 @@ class Genodefb :
PRUint32 imageSize,
PRUint8 *image) override
{
- if (!_fb_base) return S_OK;
-
Lock();
Nitpicker::Area const area_fb = Nitpicker::Area(_fb_mode.width(),
@@ -215,7 +208,7 @@ class Genodefb :
typedef Pixel_rgb565 Pixel_dst;
Texture<Pixel_src> texture((Pixel_src *)image, nullptr, area_vm);
- Surface<Pixel_dst> surface((Pixel_dst *)_fb_base, area_fb);
+ Surface<Pixel_dst> surface(_fb_dataspace->local_addr<Pixel_dst>(), area_fb);
Dither_painter::paint(surface, texture, Surface_base::Point(o_x, o_y));