mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-24 01:28:48 +00:00
Change pixel format to 32 bits per pixel
Until now, Genode's framebuffer session interface was based on the RGB565 pixel format. This patch changes the pixel format to 32-bit XRGB where the X part is ignored. It adapts all graphical applications and device drivers accordingly. The patch also adjusts the users of the drivers_interactive packages, assigning 64 MiB RAM and 1500 caps to the drivers subsystem, which is sufficient for covering high resolutions at 32 bits per pixel and to accommodate multi-component USB HID input stacks. Fixes #3784
This commit is contained in:
@ -16,3 +16,5 @@ terminal_session
|
||||
timer_session
|
||||
usb_session
|
||||
vfs
|
||||
nitpicker_gfx
|
||||
blit
|
||||
|
@ -16,3 +16,5 @@ timer_session
|
||||
usb_session
|
||||
vfs
|
||||
vm_session
|
||||
nitpicker_gfx
|
||||
blit
|
||||
|
@ -48,8 +48,8 @@ install_config {
|
||||
<provides><service name="Timer"/></provides>
|
||||
</start>
|
||||
|
||||
<start name="drivers" caps="1000">
|
||||
<resource name="RAM" quantum="32M" constrain_phys="yes"/>
|
||||
<start name="drivers" caps="1500">
|
||||
<resource name="RAM" quantum="64M" constrain_phys="yes"/>
|
||||
<binary name="init"/>
|
||||
<route>
|
||||
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>
|
||||
|
@ -65,8 +65,8 @@ install_config {
|
||||
</config>
|
||||
</start>
|
||||
|
||||
<start name="drivers" caps="1000">
|
||||
<resource name="RAM" quantum="32M" constrain_phys="yes"/>
|
||||
<start name="drivers" caps="1500">
|
||||
<resource name="RAM" quantum="64M" constrain_phys="yes"/>
|
||||
<binary name="init"/>
|
||||
<route>
|
||||
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>
|
||||
|
@ -37,7 +37,7 @@ set vcpus_to_be_used 1
|
||||
|
||||
set multiboot_files {
|
||||
<rom name="munich"/>
|
||||
<rom name="bzImage-3.1" cmdline="root=/dev/ram0 earlyprintk=ttyS0 vga=0x314"/>
|
||||
<rom name="bzImage-3.1" cmdline="root=/dev/ram0 earlyprintk=ttyS0 vga=0x338"/>
|
||||
<rom name="tc-browser.gz"/>
|
||||
}
|
||||
|
||||
|
@ -351,7 +351,7 @@ append_if [expr $use_nic_session && $use_nic_bridge] config {
|
||||
append_if $use_framebuffer config {
|
||||
<start name="fb_drv" priority="-1" caps="130">
|
||||
<binary name="vesa_fb_drv"/>
|
||||
<resource name="RAM" quantum="8M"/>
|
||||
<resource name="RAM" quantum="16M"/>
|
||||
<provides><service name="Framebuffer"/></provides>
|
||||
<route>
|
||||
<service name="Timer"><child name="timer"/></service>
|
||||
@ -359,7 +359,7 @@ append_if $use_framebuffer config {
|
||||
<any-service><parent/></any-service>
|
||||
</route>}
|
||||
append_if [expr $use_framebuffer && [have_include "power_on/qemu"]] config {
|
||||
<config width="1280" height="960" depth="16" buffered="yes"/>}
|
||||
<config width="1280" height="960" depth="32" buffered="yes"/>}
|
||||
append_if [expr $use_framebuffer && ![have_include "power_on/qemu"]] config {
|
||||
<config buffered="yes"/>}
|
||||
append_if $use_framebuffer config {
|
||||
|
@ -145,8 +145,9 @@ append config {
|
||||
|
||||
<start name="fb_drv" priority="-1">
|
||||
<binary name="vesa_fb_drv"/>
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<resource name="RAM" quantum="16M"/>
|
||||
<provides><service name="Framebuffer"/></provides>
|
||||
<config buffered="yes"/>
|
||||
</start>
|
||||
|
||||
<start name="nitpicker" priority="-1">
|
||||
|
@ -41,8 +41,8 @@ install_config {
|
||||
<provides><service name="Timer"/></provides>
|
||||
</start>
|
||||
|
||||
<start name="drivers" caps="1000">
|
||||
<resource name="RAM" quantum="32M" constrain_phys="yes"/>
|
||||
<start name="drivers" caps="1500">
|
||||
<resource name="RAM" quantum="64M" constrain_phys="yes"/>
|
||||
<binary name="init"/>
|
||||
<route>
|
||||
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>
|
||||
|
@ -102,10 +102,10 @@ append_if [expr $use_usb] config {
|
||||
append_if [have_spec framebuffer] config {
|
||||
<start name="fb_drv" priority="-1" caps="150">
|
||||
<binary name="vesa_fb_drv"/>
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<resource name="RAM" quantum="8M"/>
|
||||
<provides><service name="Framebuffer"/></provides>}
|
||||
append_if [expr [have_spec framebuffer] && [have_include power_on/qemu]] config {
|
||||
<config width="1280" height="1024" depth="16" buffered="yes"/>}
|
||||
<config width="1280" height="1024" buffered="yes"/>}
|
||||
append_if [expr [have_spec framebuffer] && [have_include power_on/qemu]] config {
|
||||
<config buffered="yes"/>}
|
||||
append_if [have_spec framebuffer] config {
|
||||
|
@ -351,7 +351,7 @@ append_if [expr $use_usb] config {
|
||||
append_if [have_spec framebuffer] config {
|
||||
<start name="fb_drv" priority="-1" caps="150">
|
||||
<binary name="vesa_fb_drv"/>
|
||||
<resource name="RAM" quantum="8M"/>
|
||||
<resource name="RAM" quantum="16M"/>
|
||||
<provides><service name="Framebuffer"/></provides>
|
||||
<config buffered="yes"/>
|
||||
</start>}
|
||||
|
@ -1388,20 +1388,19 @@ void Component::construct(Genode::Env &env)
|
||||
|
||||
/* setup framebuffer memory for guest */
|
||||
static Gui::Connection gui { env };
|
||||
gui.buffer(Framebuffer::Mode(width, height, Framebuffer::Mode::RGB565), false);
|
||||
gui.buffer(Framebuffer::Mode { .area = { width, height } }, false);
|
||||
|
||||
static Framebuffer::Session &framebuffer { *gui.framebuffer() };
|
||||
Framebuffer::Mode const fb_mode { framebuffer.mode() };
|
||||
static Framebuffer::Session &framebuffer { *gui.framebuffer() };
|
||||
Framebuffer::Mode const fb_mode { framebuffer.mode() };
|
||||
|
||||
size_t const fb_size = Genode::align_addr(fb_mode.width() *
|
||||
fb_mode.height() *
|
||||
size_t const fb_size = Genode::align_addr(fb_mode.area.count() *
|
||||
fb_mode.bytes_per_pixel(), 12);
|
||||
|
||||
typedef Gui::Session::View_handle View_handle;
|
||||
typedef Gui::Session::Command Command;
|
||||
|
||||
View_handle view = gui.create_view();
|
||||
Gui::Rect rect(Gui::Point(0, 0), Gui::Area(fb_mode.width(), fb_mode.height()));
|
||||
Gui::Rect rect(Gui::Point(0, 0), fb_mode.area);
|
||||
|
||||
gui.enqueue<Command::Geometry>(view, rect);
|
||||
gui.enqueue<Command::To_front>(view, View_handle());
|
||||
|
@ -192,25 +192,26 @@ bool Seoul::Console::receive(MessageConsole &msg)
|
||||
* It's important to set the _vesa_mode field, otherwise the
|
||||
* device model is going to ignore this mode.
|
||||
*/
|
||||
msg.info->_vesa_mode = 0x114;
|
||||
unsigned const bpp = _fb_mode.bytes_per_pixel();
|
||||
msg.info->_vesa_mode = 0x138;
|
||||
msg.info->attr = 0x39f;
|
||||
msg.info->resolution[0] = _fb_mode.width();
|
||||
msg.info->resolution[1] = _fb_mode.height();
|
||||
msg.info->bytes_per_scanline = _fb_mode.width()*2;
|
||||
msg.info->bytes_scanline = _fb_mode.width()*2;
|
||||
msg.info->bpp = 16;
|
||||
msg.info->resolution[0] = _fb_mode.area.w();
|
||||
msg.info->resolution[1] = _fb_mode.area.h();
|
||||
msg.info->bytes_per_scanline = _fb_mode.area.w()*bpp;
|
||||
msg.info->bytes_scanline = _fb_mode.area.w()*bpp;
|
||||
msg.info->bpp = 32;
|
||||
msg.info->memory_model = MEMORY_MODEL_DIRECT_COLOR;
|
||||
msg.info->vbe1[0] = 0x5; /* red mask size */
|
||||
msg.info->vbe1[1] = 0xb; /* red field position */
|
||||
msg.info->vbe1[2] = 0x6; /* green mask size */
|
||||
msg.info->vbe1[3] = 0x5; /* green field position */
|
||||
msg.info->vbe1[4] = 0x5; /* blue mask size */
|
||||
msg.info->vbe1[5] = 0x0; /* blue field position */
|
||||
msg.info->vbe1[6] = 0x0; /* reserved mask size */
|
||||
msg.info->vbe1[7] = 0x0; /* reserved field position */
|
||||
msg.info->vbe1[0] = 0x8; /* red mask size */
|
||||
msg.info->vbe1[1] = 0x10; /* red field position */
|
||||
msg.info->vbe1[2] = 0x8; /* green mask size */
|
||||
msg.info->vbe1[3] = 0x8; /* green field position */
|
||||
msg.info->vbe1[4] = 0x8; /* blue mask size */
|
||||
msg.info->vbe1[5] = 0x0; /* blue field position */
|
||||
msg.info->vbe1[6] = 0x0; /* reserved mask size */
|
||||
msg.info->vbe1[7] = 0x0; /* reserved field position */
|
||||
msg.info->colormode = 0x0; /* direct color mode info */
|
||||
msg.info->phys_base = 0xe0000000;
|
||||
msg.info->_phys_size = _fb_mode.width()*_fb_mode.height()*2;
|
||||
msg.info->_phys_size = _fb_mode.area.count()*bpp;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -306,7 +307,7 @@ unsigned Seoul::Console::_handle_fb()
|
||||
/* compare checksums to detect changed buffer */
|
||||
if (fb_state.checksum1 != fb_state.checksum2) {
|
||||
fb_state.unchanged = 0;
|
||||
_framebuffer.refresh(0, 0, _fb_mode.width(), _fb_mode.height());
|
||||
_framebuffer.refresh(0, 0, _fb_mode.area.w(), _fb_mode.area.h());
|
||||
return 100;
|
||||
}
|
||||
|
||||
@ -320,7 +321,7 @@ unsigned Seoul::Console::_handle_fb()
|
||||
fb_state.vga_revoked = true;
|
||||
fb_state.unchanged = 0;
|
||||
|
||||
_framebuffer.refresh(0, 0, _fb_mode.width(), _fb_mode.height());
|
||||
_framebuffer.refresh(0, 0, _fb_mode.area.w(), _fb_mode.area.h());
|
||||
//Logging::printf("Deactivated text buffer loop.\n");
|
||||
|
||||
return 0;
|
||||
@ -338,7 +339,7 @@ unsigned Seoul::Console::_handle_fb()
|
||||
return 0;
|
||||
}
|
||||
|
||||
_framebuffer.refresh(0, 0, _fb_mode.width(), _fb_mode.height());
|
||||
_framebuffer.refresh(0, 0, _fb_mode.area.w(), _fb_mode.area.h());
|
||||
|
||||
fb_state.unchanged++;
|
||||
|
||||
@ -422,9 +423,7 @@ Seoul::Console::Console(Genode::Env &env, Genode::Allocator &alloc,
|
||||
_fb_vm_mapping(_env.rm().attach(_fb_vm_ds)),
|
||||
_vm_phys_fb(guest_memory.alloc_io_memory(_fb_size)),
|
||||
_pixels(_env.rm().attach(_fb_ds)),
|
||||
_surface(reinterpret_cast<Genode::Pixel_rgb565 *>(_pixels),
|
||||
Genode::Surface_base::Area(_fb_mode.width(),
|
||||
_fb_mode.height()))
|
||||
_surface(reinterpret_cast<Genode::Pixel_rgb888 *>(_pixels), _fb_mode.area)
|
||||
{
|
||||
guest_memory.add_region(alloc, PHYS_FRAME_VGA << 12,
|
||||
_fb_vm_mapping, _fb_vm_ds, _fb_size);
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include <gui_session/connection.h>
|
||||
#include <timer_session/connection.h>
|
||||
|
||||
#include <os/pixel_rgb565.h>
|
||||
#include <os/pixel_rgb888.h>
|
||||
|
||||
/* local includes */
|
||||
#include "keyboard.h"
|
||||
@ -43,7 +43,7 @@
|
||||
|
||||
namespace Seoul {
|
||||
class Console;
|
||||
using Genode::Pixel_rgb565;
|
||||
using Genode::Pixel_rgb888;
|
||||
using Genode::Dataspace_capability;
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ class Seoul::Console : public StaticReceiver<Seoul::Console>
|
||||
Genode::addr_t const _fb_vm_mapping;
|
||||
Genode::addr_t const _vm_phys_fb;
|
||||
short *_pixels;
|
||||
Genode::Surface<Pixel_rgb565> _surface;
|
||||
Genode::Surface<Pixel_rgb888> _surface;
|
||||
unsigned _timer { 0 };
|
||||
Keyboard _vkeyb { _motherboard };
|
||||
char *_guest_fb { nullptr };
|
||||
|
@ -17,9 +17,8 @@
|
||||
#include <gui_session/connection.h>
|
||||
#undef Framebuffer
|
||||
|
||||
#include <os/texture_rgb565.h>
|
||||
#include <os/texture_rgb888.h>
|
||||
#include <os/dither_painter.h>
|
||||
#include <nitpicker_gfx/texture_painter.h>
|
||||
|
||||
/* VirtualBox includes */
|
||||
|
||||
@ -37,7 +36,7 @@ class Genodefb :
|
||||
Gui::Connection &_gui;
|
||||
Fb_Genode::Session &_fb;
|
||||
View_handle _view;
|
||||
Fb_Genode::Mode _fb_mode { 1024, 768, Fb_Genode::Mode::RGB565 };
|
||||
Fb_Genode::Mode _fb_mode { .area = { 1024, 768 } };
|
||||
|
||||
/*
|
||||
* The mode currently used by the VM. Can be smaller than the
|
||||
@ -52,21 +51,19 @@ class Genodefb :
|
||||
{
|
||||
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;
|
||||
size_t const max_h = Genode::min(_fb_mode.area.h(), _virtual_fb_mode.area.h());
|
||||
size_t const num_pixels = _fb_mode.area.w() * max_h;
|
||||
memset(_fb_base, 0, num_pixels * _fb_mode.bytes_per_pixel());
|
||||
_fb.refresh(0, 0, _virtual_fb_mode.width(), _virtual_fb_mode.height());
|
||||
_fb.refresh(0, 0, _virtual_fb_mode.area.w(), _virtual_fb_mode.area.h());
|
||||
}
|
||||
|
||||
void _adjust_buffer()
|
||||
{
|
||||
_gui.buffer(Fb_Genode::Mode(_fb_mode.width(), _fb_mode.height(),
|
||||
Fb_Genode::Mode::RGB565), false);
|
||||
_gui.buffer(_fb_mode, false);
|
||||
|
||||
typedef Gui::Session::Command Command;
|
||||
|
||||
Gui::Rect rect(Gui::Point(0, 0),
|
||||
Gui::Area(_fb_mode.width(), _fb_mode.height()));
|
||||
Gui::Rect rect(Gui::Point(0, 0), _fb_mode.area);
|
||||
|
||||
_gui.enqueue<Command::Geometry>(_view, rect);
|
||||
_gui.execute();
|
||||
@ -100,8 +97,8 @@ class Genodefb :
|
||||
Assert(rc == VINF_SUCCESS);
|
||||
}
|
||||
|
||||
int w() const { return _fb_mode.width(); }
|
||||
int h() const { return _fb_mode.height(); }
|
||||
int w() const { return _fb_mode.area.w(); }
|
||||
int h() const { return _fb_mode.area.h(); }
|
||||
|
||||
void update_mode(Fb_Genode::Mode mode)
|
||||
{
|
||||
@ -140,33 +137,29 @@ class Genodefb :
|
||||
|
||||
Lock();
|
||||
|
||||
bool ok = (w <= (ULONG)_fb_mode.width()) &&
|
||||
(h <= (ULONG)_fb_mode.height());
|
||||
bool ok = (w <= (ULONG)_fb_mode.area.w()) &&
|
||||
(h <= (ULONG)_fb_mode.area.h());
|
||||
|
||||
if (ok) {
|
||||
Genode::log("fb resize : [", screen, "] ",
|
||||
_virtual_fb_mode.width(), "x",
|
||||
_virtual_fb_mode.height(), " -> ",
|
||||
_virtual_fb_mode.area, " -> ",
|
||||
w, "x", h,
|
||||
" (host: ", _fb_mode.width(), "x",
|
||||
_fb_mode.height(), ")");
|
||||
" (host: ", _fb_mode.area, ")");
|
||||
|
||||
if ((w < (ULONG)_fb_mode.width()) ||
|
||||
(h < (ULONG)_fb_mode.height())) {
|
||||
if ((w < (ULONG)_fb_mode.area.w()) ||
|
||||
(h < (ULONG)_fb_mode.area.h())) {
|
||||
/* clear the old content around the new, smaller area. */
|
||||
_clear_screen();
|
||||
}
|
||||
|
||||
_virtual_fb_mode = Fb_Genode::Mode(w, h, Fb_Genode::Mode::RGB565);
|
||||
_virtual_fb_mode = Fb_Genode::Mode { .area = { w, h } };
|
||||
|
||||
result = S_OK;
|
||||
} else
|
||||
Genode::log("fb resize : [", screen, "] ",
|
||||
_virtual_fb_mode.width(), "x",
|
||||
_virtual_fb_mode.height(), " -> ",
|
||||
_virtual_fb_mode.area, " -> ",
|
||||
w, "x", h, " ignored"
|
||||
" (host: ", _fb_mode.width(), "x",
|
||||
_fb_mode.height(), ")");
|
||||
" (host: ", _fb_mode.area, ")");
|
||||
|
||||
Unlock();
|
||||
|
||||
@ -205,19 +198,23 @@ class Genodefb :
|
||||
|
||||
Lock();
|
||||
|
||||
Gui::Area const area_fb = Gui::Area(_fb_mode.width(),
|
||||
_fb_mode.height());
|
||||
Gui::Area const area_fb = _fb_mode.area;
|
||||
Gui::Area const area_vm = Gui::Area(width, height);
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
typedef Pixel_rgb888 Pixel_src;
|
||||
typedef Pixel_rgb565 Pixel_dst;
|
||||
typedef Pixel_rgb888 Pixel_dst;
|
||||
|
||||
Texture<Pixel_src> texture((Pixel_src *)image, nullptr, area_vm);
|
||||
Surface<Pixel_dst> surface((Pixel_dst *)_fb_base, area_fb);
|
||||
|
||||
Dither_painter::paint(surface, texture, Surface_base::Point(o_x, o_y));
|
||||
Texture_painter::paint(surface,
|
||||
texture,
|
||||
Genode::Color(0, 0, 0),
|
||||
Gui::Point(o_x, o_y),
|
||||
Texture_painter::SOLID,
|
||||
false);
|
||||
|
||||
_fb.refresh(o_x, o_y, area_vm.w(), area_vm.h());
|
||||
|
||||
@ -240,8 +237,8 @@ class Genodefb :
|
||||
if (!supported)
|
||||
return E_POINTER;
|
||||
|
||||
*supported = ((width <= (ULONG)_fb_mode.width()) &&
|
||||
(height <= (ULONG)_fb_mode.height()));
|
||||
*supported = ((width <= (ULONG)_fb_mode.area.w()) &&
|
||||
(height <= (ULONG)_fb_mode.area.h()));
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ TARGET = virtualbox5-nova
|
||||
REQUIRES = nova
|
||||
|
||||
LIBS += virtualbox5-nova
|
||||
LIBS += blit
|
||||
|
||||
include $(REP_DIR)/src/virtualbox5/target.inc
|
||||
|
||||
|
@ -3,6 +3,7 @@ TARGET = virtualbox5
|
||||
include $(REP_DIR)/src/virtualbox5/target.inc
|
||||
|
||||
LIBS += virtualbox5
|
||||
LIBS += blit
|
||||
|
||||
vpath frontend/% $(REP_DIR)/src/virtualbox5/
|
||||
vpath %.cc $(REP_DIR)/src/virtualbox5/
|
||||
|
Reference in New Issue
Block a user