mirror of
https://github.com/genodelabs/genode.git
synced 2025-03-25 13:28:28 +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:
parent
6119e03081
commit
ef741ef80d
@ -1,5 +1,6 @@
|
||||
base
|
||||
os
|
||||
blit
|
||||
platform_session
|
||||
timer_session
|
||||
report_session
|
||||
|
@ -27,9 +27,8 @@
|
||||
#include <base/attached_ram_dataspace.h>
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <os/reporter.h>
|
||||
#include <os/pixel_rgb565.h>
|
||||
#include <os/pixel_rgb888.h>
|
||||
#include <os/dither_painter.h>
|
||||
#include <blit/blit.h>
|
||||
|
||||
#include <lx_emul_c.h>
|
||||
|
||||
@ -158,13 +157,13 @@ class Framebuffer::Session_component : public Genode::Rpc_object<Session>
|
||||
Genode::Dataspace_capability dataspace() override
|
||||
{
|
||||
_ds.realloc(&_ram, _driver.width() * _driver.height() *
|
||||
Mode::bytes_per_pixel(Mode::RGB565));
|
||||
mode().bytes_per_pixel());
|
||||
_in_mode_change = false;
|
||||
return _ds.cap();
|
||||
}
|
||||
|
||||
Mode mode() const override {
|
||||
return Mode(_driver.width(), _driver.height(), Mode::RGB565); }
|
||||
return Mode { .area = { _driver.width(), _driver.height() } }; }
|
||||
|
||||
void mode_sigh(Genode::Signal_context_capability sigh) override {
|
||||
_mode_sigh = sigh; }
|
||||
@ -179,12 +178,13 @@ class Framebuffer::Session_component : public Genode::Rpc_object<Session>
|
||||
{
|
||||
using namespace Genode;
|
||||
|
||||
if (!_driver.fb_addr() ||
|
||||
!_ds.local_addr<void>() ||
|
||||
_in_mode_change) return;
|
||||
if (!_driver.fb_addr() || !_ds.local_addr<void>() || _in_mode_change)
|
||||
return;
|
||||
|
||||
int width = _driver.width();
|
||||
int height = _driver.height();
|
||||
int width = _driver.width();
|
||||
int height = _driver.height();
|
||||
unsigned bpp = 4;
|
||||
unsigned pitch = _driver.width();
|
||||
|
||||
/* clip specified coordinates against screen boundaries */
|
||||
int x2 = min(x + w - 1, width - 1),
|
||||
@ -194,18 +194,11 @@ class Framebuffer::Session_component : public Genode::Rpc_object<Session>
|
||||
if (x1 > x2 || y1 > y2) return;
|
||||
|
||||
/* copy pixels from back buffer to physical frame buffer */
|
||||
Genode::Pixel_rgb565 * src = _ds.local_addr<Genode::Pixel_rgb565>();
|
||||
Genode::Pixel_rgb888 * dst = (Genode::Pixel_rgb888*)_driver.fb_addr();
|
||||
char *src = _ds.local_addr<char>() + bpp*(width*y1 + x1),
|
||||
*dst = (char*)_driver.fb_addr() + bpp*(pitch*y1 + x1);
|
||||
|
||||
for (int row = y1; row <= y2; row++) {
|
||||
int line_offset = width * row;
|
||||
Genode::Pixel_rgb565 const * s = src + line_offset + x1;
|
||||
Genode::Pixel_rgb888 * d = dst + line_offset + x1;
|
||||
for (int col = x1; col <= x2; col++) {
|
||||
Genode::Pixel_rgb565 const px = *s++;
|
||||
*d++ = Genode::Pixel_rgb888(px.r(), px.g(), px.b(), px.a());
|
||||
}
|
||||
}
|
||||
blit(src, bpp*width, dst, bpp*pitch,
|
||||
bpp*(x2 - x1 + 1), y2 - y1 + 1);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
REQUIRES = arm_v8a
|
||||
|
||||
TARGET = imx8_fb_drv
|
||||
LIBS = base imx8_fb_include lx_kit_setjmp imx8_fb_drv
|
||||
LIBS = base imx8_fb_include lx_kit_setjmp imx8_fb_drv blit
|
||||
SRC_CC = main.cc platform.cc lx_emul.cc
|
||||
SRC_C = dummies.c lx_emul_c.c
|
||||
|
||||
|
@ -43,8 +43,13 @@ class Framebuffer::Driver
|
||||
|
||||
struct Configuration
|
||||
{
|
||||
struct lx_c_fb_config _lx = { 16, 64, 64, 2,
|
||||
nullptr, 0, nullptr };
|
||||
struct lx_c_fb_config _lx = { .height = 16,
|
||||
.width = 64,
|
||||
.pitch = 64,
|
||||
.bpp = 4,
|
||||
.addr = nullptr,
|
||||
.size = 0,
|
||||
.lx_fb = nullptr };
|
||||
} _config;
|
||||
|
||||
Session_component &_session;
|
||||
@ -168,8 +173,10 @@ class Framebuffer::Session_component : public Genode::Rpc_object<Session>
|
||||
return _ds.cap();
|
||||
}
|
||||
|
||||
Mode mode() const override {
|
||||
return Mode(_driver.width(), _driver.height(), Mode::RGB565); }
|
||||
Mode mode() const override
|
||||
{
|
||||
return Mode { .area { _driver.width(), _driver.height() } };
|
||||
}
|
||||
|
||||
void mode_sigh(Genode::Signal_context_capability sigh) override {
|
||||
_mode_sigh = sigh; }
|
||||
|
@ -47,7 +47,7 @@ void lx_c_allocate_framebuffer(struct drm_device * dev,
|
||||
if (!r) goto err2;
|
||||
r->width = c->width;
|
||||
r->height = c->height;
|
||||
r->pixel_format = DRM_FORMAT_RGB565;
|
||||
r->pixel_format = DRM_FORMAT_XRGB8888;
|
||||
r->pitches[0] = c->pitch;
|
||||
c->lx_fb = intel_framebuffer_create(obj, r);
|
||||
if (IS_ERR(c->lx_fb)) goto err2;
|
||||
|
@ -71,7 +71,7 @@ struct Scout::Canvas_base : Texture_allocator
|
||||
};
|
||||
|
||||
|
||||
#include <os/texture_rgb565.h>
|
||||
#include <os/texture_rgb888.h>
|
||||
#include <base/env.h>
|
||||
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
/* Genode includes */
|
||||
#include <gui_session/connection.h>
|
||||
#include <os/pixel_rgb565.h>
|
||||
#include <os/pixel_rgb888.h>
|
||||
#include <base/attached_dataspace.h>
|
||||
|
||||
/* Scout includes */
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
|
||||
namespace Scout {
|
||||
using Genode::Pixel_rgb565;
|
||||
using Genode::Pixel_rgb888;
|
||||
class Graphics_backend_impl;
|
||||
}
|
||||
|
||||
@ -45,8 +45,10 @@ class Scout::Graphics_backend_impl : public Graphics_backend
|
||||
|
||||
Genode::Dataspace_capability _init_fb_ds(Area max_size)
|
||||
{
|
||||
_gui.buffer(Framebuffer::Mode(max_size.w(), max_size.h()*2,
|
||||
Framebuffer::Mode::RGB565), false);
|
||||
Framebuffer::Mode const mode { .area = { max_size.w(), max_size.h()*2 }};
|
||||
|
||||
_gui.buffer(mode, false);
|
||||
|
||||
return _gui.framebuffer()->dataspace();
|
||||
}
|
||||
|
||||
@ -111,7 +113,7 @@ class Scout::Graphics_backend_impl : public Graphics_backend
|
||||
{
|
||||
bring_to_front();
|
||||
|
||||
typedef Genode::Pixel_rgb565 PT;
|
||||
typedef Genode::Pixel_rgb888 PT;
|
||||
static Canvas<PT> canvas_0(_base<PT>(0), max_size, alloc);
|
||||
static Canvas<PT> canvas_1(_base<PT>(1), max_size, alloc);
|
||||
|
||||
@ -130,7 +132,7 @@ class Scout::Graphics_backend_impl : public Graphics_backend
|
||||
void copy_back_to_front(Rect rect) override
|
||||
{
|
||||
|
||||
typedef Genode::Pixel_rgb565 PT;
|
||||
typedef Genode::Pixel_rgb888 PT;
|
||||
|
||||
PT const *src = _base<PT>( _back_idx());
|
||||
PT *dst = _base<PT>(_front_idx());
|
||||
|
@ -175,4 +175,4 @@ void Launchpad_window<PT>::handle_scroll(int view_pos)
|
||||
ypos_sb(-view_pos, 0);
|
||||
}
|
||||
|
||||
template class Launchpad_window<Genode::Pixel_rgb565>;
|
||||
template class Launchpad_window<Genode::Pixel_rgb888>;
|
||||
|
@ -105,7 +105,7 @@ struct Main : Scout::Event_handler
|
||||
_graphics_backend { _env.rm(), _gui, _heap, _max_size,
|
||||
_initial_position, _initial_size };
|
||||
|
||||
Launchpad_window<Pixel_rgb565>
|
||||
Launchpad_window<Pixel_rgb888>
|
||||
_launchpad { _env, _graphics_backend, _initial_position, _initial_size,
|
||||
_max_size, _env.pd().avail_ram().value };
|
||||
|
||||
|
@ -477,4 +477,4 @@ void Browser_window<PT>::handle_scroll(int view_pos)
|
||||
ypos_sb(-view_pos, 0);
|
||||
}
|
||||
|
||||
template class Browser_window<Genode::Pixel_rgb565>;
|
||||
template class Browser_window<Genode::Pixel_rgb888>;
|
||||
|
@ -149,7 +149,7 @@ Document *create_document()
|
||||
b0->append_plaintext("that can be started by clicking on the application's name. Before starting an", &plain_style);
|
||||
b0->append_plaintext("application, the user can define the amount of memory quota to donate to the", &plain_style);
|
||||
b0->append_plaintext("new application by adjusting the red bar using the mouse.", &plain_style);
|
||||
Launcher *l0 = new Launcher("launchpad", 1, 100000, 22*1024*1024);
|
||||
Launcher *l0 = new Launcher("launchpad", 1, 100000, 36*1024*1024);
|
||||
b0->append_launchertext("Start the launchpad by clicking on this link...", &link_style, l0);
|
||||
chapter->append(b0);
|
||||
|
||||
|
@ -82,7 +82,7 @@ struct Scout::Main : Scout::Event_handler
|
||||
void _init_navicons()
|
||||
{
|
||||
for (unsigned int i = 0; i < sizeof(navicons)/sizeof(void *); i++) {
|
||||
Fade_icon<Pixel_rgb565, 64, 64> *icon = new Fade_icon<Pixel_rgb565, 64, 64>;
|
||||
Fade_icon<Pixel_rgb888, 64, 64> *icon = new Fade_icon<Pixel_rgb888, 64, 64>;
|
||||
icon->rgba(navicons_rgba[i]);
|
||||
icon->alpha(100);
|
||||
*navicons[i] = icon;
|
||||
@ -94,12 +94,12 @@ struct Scout::Main : Scout::Event_handler
|
||||
Document &_doc = *create_document();
|
||||
|
||||
/* create instance of browser window */
|
||||
Browser_window<Pixel_rgb565> _browser { &_doc, _graphics_backend,
|
||||
Browser_window<Pixel_rgb888> _browser { &_doc, _graphics_backend,
|
||||
_initial_position, _initial_size,
|
||||
_max_size, _config };
|
||||
|
||||
/* initialize mouse cursor */
|
||||
Icon<Pixel_rgb565, 32, 32> _mcursor { };
|
||||
Icon<Pixel_rgb888, 32, 32> _mcursor { };
|
||||
|
||||
void _init_mouse_cursor()
|
||||
{
|
||||
|
@ -131,6 +131,7 @@ void Png_image::fill_cache(Canvas_base &canvas)
|
||||
row_ptr = (png_byte *)alloc().alloc(needed_row_size);
|
||||
curr_row_size = needed_row_size;
|
||||
}
|
||||
memset(row_ptr, 0, curr_row_size);
|
||||
|
||||
/* fill texture */
|
||||
for (unsigned j = 0; j < _min_size.h(); j++) {
|
||||
|
@ -327,4 +327,4 @@ Element *Scrollbar<PT>::find(Point position)
|
||||
}
|
||||
|
||||
|
||||
template class Scrollbar<Genode::Pixel_rgb565>;
|
||||
template class Scrollbar<Genode::Pixel_rgb888>;
|
||||
|
@ -198,8 +198,8 @@ Element *Icon<PT, W, H>::find(Point position)
|
||||
return 0;
|
||||
}
|
||||
|
||||
template class Horizontal_shadow<Genode::Pixel_rgb565, 40>;
|
||||
template class Horizontal_shadow<Genode::Pixel_rgb565, 160>;
|
||||
template class Icon<Genode::Pixel_rgb565, 16, 16>;
|
||||
template class Icon<Genode::Pixel_rgb565, 32, 32>;
|
||||
template class Icon<Genode::Pixel_rgb565, 64, 64>;
|
||||
template class Horizontal_shadow<Genode::Pixel_rgb888, 40>;
|
||||
template class Horizontal_shadow<Genode::Pixel_rgb888, 160>;
|
||||
template class Icon<Genode::Pixel_rgb888, 16, 16>;
|
||||
template class Icon<Genode::Pixel_rgb888, 32, 32>;
|
||||
template class Icon<Genode::Pixel_rgb888, 64, 64>;
|
||||
|
@ -35,7 +35,7 @@ class Background_animator : public Scout::Tick
|
||||
{
|
||||
private:
|
||||
|
||||
Framebuffer_window<Scout::Pixel_rgb565> &_fb_win;
|
||||
Framebuffer_window<Scout::Pixel_rgb888> &_fb_win;
|
||||
|
||||
int _bg_offset = 0;
|
||||
|
||||
@ -44,7 +44,7 @@ class Background_animator : public Scout::Tick
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Background_animator(Framebuffer_window<Scout::Pixel_rgb565> &fb_win)
|
||||
Background_animator(Framebuffer_window<Scout::Pixel_rgb888> &fb_win)
|
||||
: _fb_win(fb_win) { schedule(20); }
|
||||
|
||||
/**
|
||||
@ -169,7 +169,7 @@ class Liquid_fb::Main : public Scout::Event_handler
|
||||
(init_window_content(_env.ram(), _env.rm(), _heap, _input_session_component,
|
||||
config_fb_width, config_fb_height, config_alpha), true);
|
||||
|
||||
Framebuffer_window<Pixel_rgb565>
|
||||
Framebuffer_window<Pixel_rgb888>
|
||||
_fb_win { _graphics_backend, window_content(),
|
||||
_initial_position, _initial_size, _max_size,
|
||||
config_title.string(), config_alpha,
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <framebuffer_session/framebuffer_session.h>
|
||||
#include <input/root.h>
|
||||
#include <nitpicker_gfx/texture_painter.h>
|
||||
#include <os/pixel_rgb565.h>
|
||||
#include <os/pixel_rgb888.h>
|
||||
#include <os/static_root.h>
|
||||
#include <timer_session/connection.h>
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
#include "services.h"
|
||||
|
||||
|
||||
typedef Genode::Texture<Genode::Pixel_rgb565> Texture_rgb565;
|
||||
typedef Genode::Texture<Genode::Pixel_rgb888> Texture_rgb888;
|
||||
|
||||
|
||||
class Window_content : public Scout::Element
|
||||
@ -81,17 +81,17 @@ class Window_content : public Scout::Element
|
||||
Genode::Allocator &alloc;
|
||||
unsigned w, h;
|
||||
Genode::Attached_ram_dataspace ds;
|
||||
Genode::Pixel_rgb565 *pixel;
|
||||
Genode::Pixel_rgb888 *pixel;
|
||||
unsigned char *alpha;
|
||||
Genode::Texture<Genode::Pixel_rgb565> texture;
|
||||
Genode::Texture<Genode::Pixel_rgb888> texture;
|
||||
|
||||
Fb_texture(Genode::Ram_allocator &ram, Genode::Region_map &local_rm,
|
||||
Genode::Allocator &alloc,
|
||||
unsigned w, unsigned h, bool config_alpha)
|
||||
:
|
||||
alloc(alloc), w(w), h(h),
|
||||
ds(ram, local_rm, w*h*sizeof(Genode::Pixel_rgb565)),
|
||||
pixel(ds.local_addr<Genode::Pixel_rgb565>()),
|
||||
ds(ram, local_rm, w*h*sizeof(Genode::Pixel_rgb888)),
|
||||
pixel(ds.local_addr<Genode::Pixel_rgb888>()),
|
||||
alpha((unsigned char *)alloc.alloc(w*h)),
|
||||
texture(pixel, alpha, Scout::Area(w, h))
|
||||
{
|
||||
@ -250,8 +250,7 @@ class Framebuffer::Session_component : public Genode::Rpc_object<Session>
|
||||
|
||||
Mode mode() const override
|
||||
{
|
||||
return Mode(_window_content.mode_size().w(),
|
||||
_window_content.mode_size().h(), Mode::RGB565);
|
||||
return Mode { .area = _window_content.mode_size() };
|
||||
}
|
||||
|
||||
void mode_sigh(Genode::Signal_context_capability sigh) override {
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <gui_session/connection.h>
|
||||
#include <timer_session/connection.h>
|
||||
#include <input/event.h>
|
||||
#include <os/pixel_rgb565.h>
|
||||
#include <os/pixel_rgb888.h>
|
||||
|
||||
/*
|
||||
* Nitpicker's graphics backend
|
||||
@ -409,8 +409,7 @@ struct Nitlog::Main
|
||||
|
||||
void _init_gui_buffer()
|
||||
{
|
||||
_gui.buffer(Framebuffer::Mode(_win_w, _win_h,
|
||||
Framebuffer::Mode::RGB565), false);
|
||||
_gui.buffer(Framebuffer::Mode { .area = { _win_w, _win_h } }, false);
|
||||
}
|
||||
|
||||
bool const _gui_buffer_initialized = (_init_gui_buffer(), true);
|
||||
@ -420,7 +419,7 @@ struct Nitlog::Main
|
||||
/* create log window */
|
||||
Attached_dataspace _fb_ds { _env.rm(), _gui.framebuffer()->dataspace() };
|
||||
|
||||
Canvas<Pixel_rgb565> _canvas { _fb_ds.local_addr<Pixel_rgb565>(),
|
||||
Canvas<Pixel_rgb888> _canvas { _fb_ds.local_addr<Pixel_rgb888>(),
|
||||
::Area(_win_w, _win_h) };
|
||||
|
||||
Log_window _log_window { _canvas, _font };
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include <base/attached_dataspace.h>
|
||||
#include <base/attached_ram_dataspace.h>
|
||||
#include <os/surface.h>
|
||||
#include <os/pixel_rgb565.h>
|
||||
#include <os/pixel_alpha8.h>
|
||||
#include <os/pixel_rgb888.h>
|
||||
|
||||
@ -31,7 +30,6 @@
|
||||
struct Gui_buffer
|
||||
{
|
||||
typedef Genode::Pixel_rgb888 Pixel_rgb888;
|
||||
typedef Genode::Pixel_rgb565 Pixel_rgb565;
|
||||
typedef Genode::Pixel_alpha8 Pixel_alpha8;
|
||||
|
||||
typedef Genode::Surface<Pixel_rgb888> Pixel_surface;
|
||||
@ -58,11 +56,6 @@ struct Gui_buffer
|
||||
/* setup virtual framebuffer mode */
|
||||
gui.buffer(mode, true);
|
||||
|
||||
if (mode.format() != Framebuffer::Mode::RGB565) {
|
||||
Genode::warning("color mode ", mode, " not supported");
|
||||
return Genode::Dataspace_capability();
|
||||
}
|
||||
|
||||
return gui.framebuffer()->dataspace();
|
||||
}
|
||||
|
||||
@ -88,8 +81,8 @@ struct Gui_buffer
|
||||
Genode::Ram_allocator &ram, Genode::Region_map &rm)
|
||||
:
|
||||
ram(ram), rm(rm), gui(gui),
|
||||
mode(Genode::max(1UL, size.w()), Genode::max(1UL, size.h()),
|
||||
gui.mode().format())
|
||||
mode({ .area = { Genode::max(1U, size.w()),
|
||||
Genode::max(1U, size.h()) } })
|
||||
{
|
||||
reset_surface();
|
||||
}
|
||||
@ -97,7 +90,7 @@ struct Gui_buffer
|
||||
/**
|
||||
* Return size of virtual framebuffer
|
||||
*/
|
||||
Area size() const { return Area(mode.width(), mode.height()); }
|
||||
Area size() const { return mode.area; }
|
||||
|
||||
template <typename FN>
|
||||
void apply_to_surface(FN const &fn)
|
||||
@ -175,7 +168,7 @@ struct Gui_buffer
|
||||
// XXX track dirty rectangles
|
||||
Rect const clip_rect(Genode::Surface_base::Point(0, 0), size());
|
||||
|
||||
Pixel_rgb565 *pixel_base = fb_ds.local_addr<Pixel_rgb565>();
|
||||
Pixel_rgb888 *pixel_base = fb_ds.local_addr<Pixel_rgb888>();
|
||||
Pixel_alpha8 *alpha_base = fb_ds.local_addr<Pixel_alpha8>()
|
||||
+ mode.bytes_per_pixel()*size().count();
|
||||
|
||||
|
@ -81,12 +81,6 @@ class Nano3d::Scene
|
||||
_init_framebuffer(Gui::Connection &gui,
|
||||
Gui::Area const size)
|
||||
{
|
||||
Framebuffer::Mode::Format const format = gui.mode().format();
|
||||
if (format != Framebuffer::Mode::RGB565) {
|
||||
Genode::error("framebuffer mode ", (int)format, " is not supported");
|
||||
throw Unsupported_color_depth();
|
||||
}
|
||||
|
||||
/*
|
||||
* Dimension the virtual framebuffer 3 times as high as the
|
||||
* visible view because it contains the visible buffer, the
|
||||
@ -94,7 +88,7 @@ class Nano3d::Scene
|
||||
*/
|
||||
bool const use_alpha = true;
|
||||
unsigned const height = size.h()*NUM_BUFFERS;
|
||||
gui.buffer(Framebuffer::Mode(size.w(), height, format),
|
||||
gui.buffer(Framebuffer::Mode { .area = { size.w(), height } },
|
||||
use_alpha);
|
||||
|
||||
return *gui.framebuffer();
|
||||
@ -109,7 +103,7 @@ class Nano3d::Scene
|
||||
*/
|
||||
Gui::Area size() const
|
||||
{
|
||||
return Gui::Area(mode.width(), mode.height()/NUM_BUFFERS);
|
||||
return Gui::Area(mode.area.w(), mode.area.h()/NUM_BUFFERS);
|
||||
}
|
||||
|
||||
Genode::Attached_dataspace ds { rm, framebuffer.dataspace() };
|
||||
|
@ -32,8 +32,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>
|
||||
|
@ -34,8 +34,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>
|
||||
|
@ -36,8 +36,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>
|
||||
|
@ -45,8 +45,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>
|
||||
|
@ -31,8 +31,8 @@ install_config {
|
||||
<provides><service name="Timer"/></provides>
|
||||
</start>
|
||||
|
||||
<start name="drivers" caps="2000">
|
||||
<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>
|
||||
@ -91,7 +91,7 @@ install_config {
|
||||
</start>
|
||||
|
||||
<start name="gui_fader">
|
||||
<resource name="RAM" quantum="5M"/>
|
||||
<resource name="RAM" quantum="8M"/>
|
||||
<provides><service name="Gui"/></provides>
|
||||
<route>
|
||||
<service name="ROM" label="config">
|
||||
@ -103,7 +103,7 @@ install_config {
|
||||
</start>
|
||||
|
||||
<start name="scout">
|
||||
<resource name="RAM" quantum="10M"/>
|
||||
<resource name="RAM" quantum="16M"/>
|
||||
<route>
|
||||
<service name="Gui"> <child name="gui_fader" /> </service>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
@ -112,7 +112,7 @@ install_config {
|
||||
|
||||
<start name="scout2">
|
||||
<binary name="scout" />
|
||||
<resource name="RAM" quantum="10M"/>
|
||||
<resource name="RAM" quantum="16M"/>
|
||||
<route>
|
||||
<service name="Gui"> <child name="nitpicker" /> </service>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
|
@ -65,8 +65,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>
|
||||
|
@ -35,8 +35,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>
|
||||
|
@ -26,8 +26,8 @@ append config {
|
||||
</default-route>
|
||||
<default caps="100"/>
|
||||
|
||||
<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>
|
||||
|
@ -29,8 +29,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>
|
||||
|
@ -35,8 +35,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>
|
||||
|
@ -35,8 +35,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>
|
||||
|
@ -31,8 +31,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>
|
||||
|
@ -38,8 +38,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>
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include <nitpicker_gfx/texture_painter.h>
|
||||
#include <base/attached_dataspace.h>
|
||||
#include <util/reconstructible.h>
|
||||
#include <os/texture_rgb565.h>
|
||||
#include <os/texture_rgb888.h>
|
||||
|
||||
/* gems includes */
|
||||
@ -63,11 +62,6 @@ struct Backdrop::Main
|
||||
/* setup virtual framebuffer mode */
|
||||
gui.buffer(mode, false);
|
||||
|
||||
if (mode.format() != Framebuffer::Mode::RGB565) {
|
||||
Genode::warning("Color mode %d not supported\n", (int)mode.format());
|
||||
return Dataspace_capability();
|
||||
}
|
||||
|
||||
return gui.framebuffer()->dataspace();
|
||||
}
|
||||
|
||||
@ -92,10 +86,7 @@ struct Backdrop::Main
|
||||
/**
|
||||
* Return size of virtual framebuffer
|
||||
*/
|
||||
Surface_base::Area size() const
|
||||
{
|
||||
return Surface_base::Area(mode.width(), mode.height());
|
||||
}
|
||||
Surface_base::Area size() const { return mode.area; }
|
||||
|
||||
/**
|
||||
* Return back buffer as painting surface
|
||||
@ -251,13 +242,12 @@ void Backdrop::Main::_apply_image(Xml_node operation)
|
||||
Png_image png_image(_env.ram(), _env.rm(), _heap, file.data<void>());
|
||||
|
||||
Area const scaled_size = calc_scaled_size(operation, png_image.size(),
|
||||
Area(_buffer->mode.width(),
|
||||
_buffer->mode.height()));
|
||||
_buffer->mode.area);
|
||||
/*
|
||||
* Determine parameters of graphics operation
|
||||
*/
|
||||
int const h_gap = (int)_buffer->mode.width() - scaled_size.w(),
|
||||
v_gap = (int)_buffer->mode.height() - scaled_size.h();
|
||||
int const h_gap = (int)_buffer->mode.area.w() - scaled_size.w(),
|
||||
v_gap = (int)_buffer->mode.area.h() - scaled_size.h();
|
||||
|
||||
int const anchored_xpos = anchor.horizontal == Anchor::LOW ? 0
|
||||
: anchor.horizontal == Anchor::CENTER ? h_gap/2
|
||||
@ -291,7 +281,7 @@ void Backdrop::Main::_apply_image(Xml_node operation)
|
||||
*/
|
||||
|
||||
/* create texture with down-sampled scaled image */
|
||||
typedef Pixel_rgb565 PT;
|
||||
typedef Pixel_rgb888 PT;
|
||||
Chunky_texture<PT> texture(_env.ram(), _env.rm(), scaled_size);
|
||||
convert_pixel_format(scaled_texture, texture, alpha, _heap);
|
||||
|
||||
@ -309,7 +299,7 @@ void Backdrop::Main::_apply_fill(Xml_node operation)
|
||||
*/
|
||||
|
||||
/* create texture with down-sampled scaled image */
|
||||
typedef Pixel_rgb565 PT;
|
||||
typedef Pixel_rgb888 PT;
|
||||
|
||||
Color const color = operation.attribute_value("color", Color(0, 0, 0));
|
||||
|
||||
@ -326,9 +316,8 @@ void Backdrop::Main::_handle_config()
|
||||
|
||||
Framebuffer::Mode const phys_mode = _gui.mode();
|
||||
Framebuffer::Mode const
|
||||
mode(_config.xml().attribute_value("width", (unsigned)phys_mode.width()),
|
||||
_config.xml().attribute_value("height", (unsigned)phys_mode.height()),
|
||||
phys_mode.format());
|
||||
mode { .area = { _config.xml().attribute_value("width", phys_mode.area.w()),
|
||||
_config.xml().attribute_value("height", phys_mode.area.h()) } };
|
||||
|
||||
_buffer.construct(_env, _gui, mode);
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <base/heap.h>
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <polygon_gfx/shaded_polygon_painter.h>
|
||||
#include <polygon_gfx/interpolate_rgb565.h>
|
||||
#include <os/pixel_rgb888.h>
|
||||
#include <os/pixel_alpha8.h>
|
||||
#include <nano3d/scene.h>
|
||||
#include <nano3d/sincos_frac16.h>
|
||||
@ -469,7 +469,7 @@ void Component::construct(Genode::Env &env)
|
||||
{
|
||||
enum { UPDATE_RATE_MS = 250 };
|
||||
|
||||
static Cpu_load_display::Scene<Genode::Pixel_rgb565>
|
||||
static Cpu_load_display::Scene<Genode::Pixel_rgb888>
|
||||
scene(env, UPDATE_RATE_MS,
|
||||
Gui::Point(0, 0), Gui::Area(400, 400));
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <base/heap.h>
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <gui_session/connection.h>
|
||||
#include <os/pixel_rgb565.h>
|
||||
#include <os/pixel_rgb888.h>
|
||||
#include <os/reporter.h>
|
||||
|
||||
/* decorator includes */
|
||||
@ -45,16 +45,14 @@ struct Decorator::Main : Window_factory_base
|
||||
{
|
||||
Framebuffer::Mode const mode;
|
||||
Attached_dataspace fb_ds;
|
||||
Decorator::Canvas<Pixel_rgb565> canvas;
|
||||
Decorator::Canvas<Pixel_rgb888> canvas;
|
||||
|
||||
Canvas(Env &env, Gui::Connection &nitpicker)
|
||||
:
|
||||
mode(nitpicker.mode()),
|
||||
fb_ds(env.rm(),
|
||||
(nitpicker.buffer(mode, false), nitpicker.framebuffer()->dataspace())),
|
||||
canvas(fb_ds.local_addr<Pixel_rgb565>(),
|
||||
Area(mode.width(), mode.height()),
|
||||
env.ram(), env.rm())
|
||||
canvas(fb_ds.local_addr<Pixel_rgb888>(), mode.area, env.ram(), env.rm())
|
||||
{ }
|
||||
};
|
||||
|
||||
@ -66,9 +64,7 @@ struct Decorator::Main : Window_factory_base
|
||||
{
|
||||
_canvas.construct(_env, _nitpicker);
|
||||
|
||||
_window_stack.mark_as_dirty(Rect(Point(0, 0),
|
||||
Area(_canvas->mode.width(),
|
||||
_canvas->mode.height())));
|
||||
_window_stack.mark_as_dirty(Rect(Point(0, 0), _canvas->mode.area));
|
||||
|
||||
Dirty_rect dirty = _window_stack.draw(_canvas->canvas);
|
||||
|
||||
|
@ -14,8 +14,8 @@
|
||||
/* Genode includes */
|
||||
#include <gems/chunky_texture.h>
|
||||
#include <base/env.h>
|
||||
#include <os/pixel_rgb565.h>
|
||||
#include <os/texture_rgb565.h>
|
||||
#include <os/pixel_rgb888.h>
|
||||
#include <os/texture_rgb888.h>
|
||||
|
||||
/* local includes */
|
||||
#include "canvas.h"
|
||||
@ -62,7 +62,7 @@ extern unsigned char _binary_windowed_rgba_start[];
|
||||
Texture_base const &
|
||||
Decorator::texture_by_id(Texture_id id, Ram_allocator &ram, Region_map &rm)
|
||||
{
|
||||
static Icon_texture<Pixel_rgb565> const icons[4] {
|
||||
static Icon_texture<Pixel_rgb888> const icons[4] {
|
||||
{ ram, rm, _binary_closer_rgba_start },
|
||||
{ ram, rm, _binary_minimize_rgba_start },
|
||||
{ ram, rm, _binary_maximize_rgba_start },
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include <nitpicker_gfx/texture_painter.h>
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <base/heap.h>
|
||||
#include <os/pixel_rgb565.h>
|
||||
#include <os/pixel_alpha8.h>
|
||||
#include <os/texture_rgb888.h>
|
||||
#include <util/reconstructible.h>
|
||||
|
@ -16,8 +16,8 @@
|
||||
#include <base/component.h>
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <polygon_gfx/shaded_polygon_painter.h>
|
||||
#include <polygon_gfx/interpolate_rgb565.h>
|
||||
#include <polygon_gfx/textured_polygon_painter.h>
|
||||
#include <os/pixel_rgb888.h>
|
||||
#include <nano3d/dodecahedron_shape.h>
|
||||
#include <nano3d/cube_shape.h>
|
||||
#include <nano3d/scene.h>
|
||||
@ -229,7 +229,7 @@ void Component::construct(Genode::Env &env)
|
||||
{
|
||||
enum { UPDATE_RATE_MS = 20 };
|
||||
|
||||
static Scene<Genode::Pixel_rgb565>
|
||||
static Scene<Genode::Pixel_rgb888>
|
||||
scene(env, UPDATE_RATE_MS,
|
||||
Gui::Point(-200, -200), Gui::Area(400, 400));
|
||||
}
|
||||
|
@ -1162,11 +1162,11 @@ void Sculpt::Main::_handle_window_layout()
|
||||
Framebuffer::Mode const mode = _gui->mode();
|
||||
|
||||
/* area reserved for the panel */
|
||||
Rect const panel(Point(0, 0), Area(mode.width(), panel_height));
|
||||
Rect const panel(Point(0, 0), Area(mode.area.w(), panel_height));
|
||||
|
||||
/* available space on the right of the menu */
|
||||
Rect avail(Point(0, panel.h()),
|
||||
Point(mode.width() - 1, mode.height() - 1));
|
||||
Point(mode.area.w() - 1, mode.area.h() - 1));
|
||||
|
||||
Point const log_offset = _log_visible
|
||||
? Point(0, 0)
|
||||
@ -1174,8 +1174,8 @@ void Sculpt::Main::_handle_window_layout()
|
||||
|
||||
Point const log_p1(avail.x2() - log_min_w - margins.right + 1 + log_offset.x(),
|
||||
avail.y1() + margins.top);
|
||||
Point const log_p2(mode.width() - margins.right - 1 + log_offset.x(),
|
||||
mode.height() - margins.bottom - 1);
|
||||
Point const log_p2(mode.area.w() - margins.right - 1 + log_offset.x(),
|
||||
mode.area.h() - margins.bottom - 1);
|
||||
|
||||
/* position of the inspect window */
|
||||
Point const inspect_p1(avail.x1() + margins.left, avail.y1() + margins.top);
|
||||
@ -1225,7 +1225,7 @@ void Sculpt::Main::_handle_window_layout()
|
||||
Area const size = win_size(win);
|
||||
Point const pos = _network_visible
|
||||
? Point(log_p1.x() - size.w(), avail.y1())
|
||||
: Point(mode.width(), avail.y1());
|
||||
: Point(mode.area.w(), avail.y1());
|
||||
gen_window(win, Rect(pos, size));
|
||||
});
|
||||
|
||||
@ -1301,7 +1301,7 @@ void Sculpt::Main::_handle_window_layout()
|
||||
|
||||
_with_window(window_list, logo_label, [&] (Xml_node win) {
|
||||
Area const size = win_size(win);
|
||||
Point const pos(mode.width() - size.w(), mode.height() - size.h());
|
||||
Point const pos(mode.area.w() - size.w(), mode.area.h() - size.h());
|
||||
gen_window(win, Rect(pos, size));
|
||||
});
|
||||
});
|
||||
@ -1334,12 +1334,12 @@ void Sculpt::Main::_handle_gui_mode()
|
||||
|
||||
if (!_fonts_config.try_generate_manually_managed()) {
|
||||
|
||||
_font_size_px = (float)mode.height() / 60.0;
|
||||
_font_size_px = (float)mode.area.h() / 60.0;
|
||||
|
||||
if (_font_size == Font_size::SMALL) _font_size_px *= 0.85;
|
||||
if (_font_size == Font_size::LARGE) _font_size_px *= 1.35;
|
||||
|
||||
Area const size(mode.width(), mode.height());
|
||||
Area const size(mode.area.w(), mode.area.h());
|
||||
_screen_size = size;
|
||||
_panel_menu_view.min_width = size.w();
|
||||
unsigned const menu_width = max(_font_size_px*21, 320.0);
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
/* Genode includes */
|
||||
#include <os/texture.h>
|
||||
#include <os/pixel_rgb565.h>
|
||||
#include <os/pixel_alpha8.h>
|
||||
#include <os/pixel_rgb888.h>
|
||||
|
||||
@ -25,7 +24,6 @@ namespace Decorator {
|
||||
class Theme;
|
||||
|
||||
typedef Genode::Pixel_rgb888 Pixel_rgb888;
|
||||
typedef Genode::Pixel_rgb565 Pixel_rgb565;
|
||||
typedef Genode::Pixel_alpha8 Pixel_alpha8;
|
||||
|
||||
typedef Genode::Surface<Pixel_rgb888> Pixel_surface;
|
||||
|
@ -324,9 +324,8 @@ class Decorator::Window : public Window_base, public Animator::Item
|
||||
|| size_top_bottom.h() > _size_top_bottom.h()
|
||||
|| !_buffer_top_bottom.constructed()) {
|
||||
|
||||
_gui_top_bottom.buffer(Framebuffer::Mode(size_top_bottom.w(),
|
||||
size_top_bottom.h(),
|
||||
Framebuffer::Mode::RGB565),
|
||||
_gui_top_bottom.buffer(Framebuffer::Mode { .area = { size_top_bottom.w(),
|
||||
size_top_bottom.h() } },
|
||||
use_alpha);
|
||||
|
||||
_buffer_top_bottom.construct(_gui_top_bottom, size_top_bottom,
|
||||
@ -341,9 +340,8 @@ class Decorator::Window : public Window_base, public Animator::Item
|
||||
|| size_left_right.h() > _size_left_right.h()
|
||||
|| !_buffer_left_right.constructed()) {
|
||||
|
||||
_gui_left_right.buffer(Framebuffer::Mode(size_left_right.w(),
|
||||
size_left_right.h(),
|
||||
Framebuffer::Mode::RGB565),
|
||||
_gui_left_right.buffer(Framebuffer::Mode { .area = { size_left_right.w(),
|
||||
size_left_right.h() } },
|
||||
use_alpha);
|
||||
|
||||
_buffer_left_right.construct(_gui_left_right, size_left_right,
|
||||
|
@ -329,7 +329,7 @@ struct Window_layouter::Main : Operations,
|
||||
/* determine maximized window geometry */
|
||||
Framebuffer::Mode const mode = _gui.mode();
|
||||
|
||||
_screen_size = Area(mode.width(), mode.height());
|
||||
_screen_size = mode.area;
|
||||
|
||||
_update_window_layout();
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <base/attached_ram_dataspace.h>
|
||||
#include <os/texture.h>
|
||||
#include <os/surface.h>
|
||||
#include <os/pixel_rgb565.h>
|
||||
#include <os/pixel_rgb888.h>
|
||||
#include <os/pixel_alpha8.h>
|
||||
#include <os/static_root.h>
|
||||
#include <util/reconstructible.h>
|
||||
@ -50,7 +50,7 @@ namespace Gui_fader {
|
||||
using Genode::Reconstructible;
|
||||
using Genode::Constructible;
|
||||
|
||||
typedef Genode::Pixel_rgb565 Pixel_rgb565;
|
||||
typedef Genode::Pixel_rgb888 Pixel_rgb888;
|
||||
typedef Genode::Pixel_alpha8 Pixel_alpha8;
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ class Gui_fader::Src_buffer
|
||||
{
|
||||
private:
|
||||
|
||||
typedef Pixel_rgb565 Pixel;
|
||||
typedef Pixel_rgb888 Pixel;
|
||||
|
||||
bool const _use_alpha;
|
||||
Attached_ram_dataspace _ds;
|
||||
@ -103,11 +103,11 @@ class Gui_fader::Dst_buffer
|
||||
Genode::Attached_dataspace _ds;
|
||||
Area _size;
|
||||
|
||||
Surface<Pixel_rgb565> _pixel_surface { _ds.local_addr<Pixel_rgb565>(), _size };
|
||||
Surface<Pixel_rgb888> _pixel_surface { _ds.local_addr<Pixel_rgb888>(), _size };
|
||||
|
||||
Surface<Pixel_alpha8> _alpha_surface
|
||||
{
|
||||
_ds.local_addr<Pixel_alpha8>() + _size.count()*sizeof(Pixel_rgb565),
|
||||
_ds.local_addr<Pixel_alpha8>() + _size.count()*sizeof(Pixel_rgb888),
|
||||
_size
|
||||
};
|
||||
|
||||
@ -119,12 +119,12 @@ class Gui_fader::Dst_buffer
|
||||
{
|
||||
/* initialize input-mask buffer */
|
||||
unsigned char *input_mask_buffer = _ds.local_addr<unsigned char>()
|
||||
+ _size.count()*(1 + sizeof(Pixel_rgb565));
|
||||
+ _size.count()*(1 + sizeof(Pixel_rgb888));
|
||||
|
||||
Genode::memset(input_mask_buffer, 0xff, _size.count());
|
||||
}
|
||||
|
||||
Surface<Pixel_rgb565> &pixel_surface() { return _pixel_surface; }
|
||||
Surface<Pixel_rgb888> &pixel_surface() { return _pixel_surface; }
|
||||
Surface<Pixel_alpha8> &alpha_surface() { return _alpha_surface; }
|
||||
};
|
||||
|
||||
@ -415,7 +415,7 @@ class Gui_fader::Gui_session_component
|
||||
|
||||
void buffer(Framebuffer::Mode mode, bool use_alpha) override
|
||||
{
|
||||
Area const size(mode.width(), mode.height());
|
||||
Area const size = mode.area;
|
||||
|
||||
_src_buffer.construct(_env, size, use_alpha);
|
||||
|
||||
|
@ -28,7 +28,7 @@ class Terminal::Framebuffer
|
||||
|
||||
Env &_env;
|
||||
|
||||
::Framebuffer::Connection _fb { _env, ::Framebuffer::Mode() };
|
||||
::Framebuffer::Connection _fb { _env, ::Framebuffer::Mode { } };
|
||||
|
||||
Constructible<Attached_dataspace> _ds { };
|
||||
|
||||
@ -47,8 +47,8 @@ class Terminal::Framebuffer
|
||||
_fb.mode_sigh(mode_sigh);
|
||||
}
|
||||
|
||||
unsigned w() const { return _mode.width(); }
|
||||
unsigned h() const { return _mode.height(); }
|
||||
unsigned w() const { return _mode.area.w(); }
|
||||
unsigned h() const { return _mode.area.h(); }
|
||||
|
||||
template <typename PT>
|
||||
PT *pixel() { return _ds->local_addr<PT>(); }
|
||||
@ -64,10 +64,7 @@ class Terminal::Framebuffer
|
||||
*/
|
||||
bool mode_changed() const
|
||||
{
|
||||
::Framebuffer::Mode _new_mode = _fb.mode();
|
||||
|
||||
return _new_mode.width() != _mode.width()
|
||||
|| _new_mode.height() != _mode.height();
|
||||
return _fb.mode().area != _mode.area;
|
||||
}
|
||||
|
||||
void switch_to_new_mode()
|
||||
@ -83,7 +80,7 @@ class Terminal::Framebuffer
|
||||
* the old (possibly too small) dataspace.
|
||||
*/
|
||||
_mode = _fb.mode();
|
||||
if (_mode.width() && _mode.height())
|
||||
if (_mode.area.count() > 0)
|
||||
_ds.construct(_env.rm(), _fb.dataspace());
|
||||
}
|
||||
};
|
||||
|
@ -96,7 +96,7 @@ struct Terminal::Main : Character_consumer
|
||||
|
||||
struct Paste_buffer { char buffer[READ_BUFFER_SIZE]; } _paste_buffer { };
|
||||
|
||||
typedef Pixel_rgb565 PT;
|
||||
typedef Pixel_rgb888 PT;
|
||||
|
||||
Constructible<Text_screen_surface<PT>> _text_screen_surface { };
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
#define _TEXT_SCREEN_SURFACE_H_
|
||||
|
||||
/* Genode includes */
|
||||
#include <os/pixel_rgb565.h>
|
||||
#include <os/pixel_rgb888.h>
|
||||
|
||||
/* terminal includes */
|
||||
#include <terminal/char_cell_array_character_screen.h>
|
||||
|
@ -980,9 +980,7 @@ class Wm::Gui::Session_component : public Rpc_object<Gui::Session>,
|
||||
* mode
|
||||
*/
|
||||
if (_resize_requested)
|
||||
return Framebuffer::Mode(_requested_size.w(),
|
||||
_requested_size.h(),
|
||||
real_mode.format());
|
||||
return Framebuffer::Mode { .area = _requested_size };
|
||||
|
||||
/*
|
||||
* If the first top-level view has a defined size, use it
|
||||
@ -990,9 +988,7 @@ class Wm::Gui::Session_component : public Rpc_object<Gui::Session>,
|
||||
*/
|
||||
if (Top_level_view const *v = _top_level_views.first())
|
||||
if (v->size().valid())
|
||||
return Framebuffer::Mode(v->size().w(),
|
||||
v->size().h(),
|
||||
real_mode.format());
|
||||
return Framebuffer::Mode { .area = v->size() };
|
||||
|
||||
/*
|
||||
* If top-level view has yet been defined, return the real mode.
|
||||
|
@ -123,7 +123,7 @@ struct Test::Main
|
||||
{
|
||||
if (_config.xml().has_sub_node("check_framebuffer")) {
|
||||
log("connect to framebuffer driver");
|
||||
Framebuffer::Mode mode(640, 480, Framebuffer::Mode::RGB565);
|
||||
Framebuffer::Mode mode { .area = { 640, 480 } };
|
||||
Framebuffer::Connection fb(_env, mode);
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <base/log.h>
|
||||
#include <base/heap.h>
|
||||
#include <os/pixel_rgb565.h>
|
||||
#include <os/pixel_rgb888.h>
|
||||
#include <os/surface.h>
|
||||
#include <nitpicker_gfx/tff_font.h>
|
||||
#include <nitpicker_gfx/box_painter.h>
|
||||
@ -51,14 +51,13 @@ struct Test::Main
|
||||
{
|
||||
Env &_env;
|
||||
|
||||
Framebuffer::Connection _fb { _env, Framebuffer::Mode() };
|
||||
Framebuffer::Connection _fb { _env, Framebuffer::Mode { } };
|
||||
|
||||
Attached_dataspace _fb_ds { _env.rm(), _fb.dataspace() };
|
||||
|
||||
typedef Pixel_rgb565 PT;
|
||||
typedef Pixel_rgb888 PT;
|
||||
|
||||
Surface_base::Area const _size { (unsigned)_fb.mode().width(),
|
||||
(unsigned)_fb.mode().height() };
|
||||
Surface_base::Area const _size = _fb.mode().area;
|
||||
|
||||
Surface<PT> _surface { _fb_ds.local_addr<PT>(), _size };
|
||||
|
||||
|
@ -48,8 +48,8 @@ set 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>
|
||||
|
@ -34,8 +34,8 @@ set config {
|
||||
<resource name="RAM" quantum="1M"/>
|
||||
<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>
|
||||
|
@ -224,7 +224,7 @@ proc qt5_start_nodes { feature_arg } {
|
||||
|
||||
<start name="decorator" caps="300">
|
||||
<binary name="} [qt5_decorator_binary] {"/>
|
||||
<resource name="RAM" quantum="16M"/>} [qt5_decorator_config] {
|
||||
<resource name="RAM" quantum="32M"/>} [qt5_decorator_config] {
|
||||
<route>
|
||||
<service name="ROM" label="window_layout"> <child name="wm_report_rom"/> </service>
|
||||
<service name="ROM" label="pointer"> <child name="wm_report_rom"/> </service>
|
||||
|
@ -178,7 +178,7 @@ proc drivers_start_nodes { feature_arg } {
|
||||
append_if [use_fb_drv feature] start_nodes {
|
||||
<start name="fb_drv">
|
||||
<binary name="} [fb_drv_binary] {"/>
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<resource name="RAM" quantum="18M"/>
|
||||
<provides><service name="Framebuffer"/></provides>
|
||||
</start>
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <input/event.h>
|
||||
#include <input/keycodes.h>
|
||||
#include <gui_session/connection.h>
|
||||
#include <os/pixel_rgb888.h>
|
||||
|
||||
/* MuPDF includes */
|
||||
extern "C" {
|
||||
@ -37,71 +38,19 @@ extern "C" {
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
/***************
|
||||
** Dithering **
|
||||
***************/
|
||||
|
||||
/*
|
||||
* XXX blatantly copied from 'demo/src/app/backdrop/main.cc'
|
||||
*
|
||||
* We should factor-out the dithering support into a separate header file.
|
||||
* But where is a good place to put it?
|
||||
*/
|
||||
|
||||
enum { DITHER_SIZE = 16, DITHER_MASK = DITHER_SIZE - 1 };
|
||||
|
||||
static const int dither_matrix[DITHER_SIZE][DITHER_SIZE] = {
|
||||
{ 0,192, 48,240, 12,204, 60,252, 3,195, 51,243, 15,207, 63,255 },
|
||||
{ 128, 64,176,112,140, 76,188,124,131, 67,179,115,143, 79,191,127 },
|
||||
{ 32,224, 16,208, 44,236, 28,220, 35,227, 19,211, 47,239, 31,223 },
|
||||
{ 160, 96,144, 80,172,108,156, 92,163, 99,147, 83,175,111,159, 95 },
|
||||
{ 8,200, 56,248, 4,196, 52,244, 11,203, 59,251, 7,199, 55,247 },
|
||||
{ 136, 72,184,120,132, 68,180,116,139, 75,187,123,135, 71,183,119 },
|
||||
{ 40,232, 24,216, 36,228, 20,212, 43,235, 27,219, 39,231, 23,215 },
|
||||
{ 168,104,152, 88,164,100,148, 84,171,107,155, 91,167,103,151, 87 },
|
||||
{ 2,194, 50,242, 14,206, 62,254, 1,193, 49,241, 13,205, 61,253 },
|
||||
{ 130, 66,178,114,142, 78,190,126,129, 65,177,113,141, 77,189,125 },
|
||||
{ 34,226, 18,210, 46,238, 30,222, 33,225, 17,209, 45,237, 29,221 },
|
||||
{ 162, 98,146, 82,174,110,158, 94,161, 97,145, 81,173,109,157, 93 },
|
||||
{ 10,202, 58,250, 6,198, 54,246, 9,201, 57,249, 5,197, 53,245 },
|
||||
{ 138, 74,186,122,134, 70,182,118,137, 73,185,121,133, 69,181,117 },
|
||||
{ 42,234, 26,218, 38,230, 22,214, 41,233, 25,217, 37,229, 21,213 },
|
||||
{ 170,106,154, 90,166,102,150, 86,169,105,153, 89,165,101,149, 85 }
|
||||
};
|
||||
typedef Genode::Pixel_rgb888 pixel_t;
|
||||
|
||||
|
||||
static inline uint16_t rgb565(int r, int g, int b)
|
||||
static void copy_line_rgba(const unsigned char *rgba_src,
|
||||
pixel_t *dst, int num_pixels)
|
||||
{
|
||||
enum {
|
||||
R_MASK = 0xf800, R_LSHIFT = 8,
|
||||
G_MASK = 0x07e0, G_LSHIFT = 3,
|
||||
B_MASK = 0x001f, B_RSHIFT = 3
|
||||
};
|
||||
return ((r << R_LSHIFT) & R_MASK)
|
||||
| ((g << G_LSHIFT) & G_MASK)
|
||||
| ((b >> B_RSHIFT) & B_MASK);
|
||||
}
|
||||
|
||||
|
||||
static void convert_line_rgba_to_rgb565(const unsigned char *rgba_src,
|
||||
uint16_t *dst, int num_pixels, int line)
|
||||
{
|
||||
using namespace Genode;
|
||||
|
||||
enum { CHANNEL_MAX = 255 };
|
||||
|
||||
int const *dm = dither_matrix[line & DITHER_MASK];
|
||||
|
||||
for (int i = 0; i < num_pixels; i++) {
|
||||
int v = dm[i & DITHER_MASK] >> 5;
|
||||
unsigned const r = *rgba_src++;
|
||||
unsigned const g = *rgba_src++;
|
||||
unsigned const b = *rgba_src++;
|
||||
rgba_src++; /* ignore alpha */
|
||||
|
||||
*dst++ = rgb565(min(v + (int)rgba_src[0], (int)CHANNEL_MAX),
|
||||
min(v + (int)rgba_src[1], (int)CHANNEL_MAX),
|
||||
min(v + (int)rgba_src[2], (int)CHANNEL_MAX));
|
||||
|
||||
/* we ignore the alpha channel */
|
||||
|
||||
rgba_src += 4; /* next pixel */
|
||||
*dst++ = pixel_t(r, g, b);
|
||||
}
|
||||
}
|
||||
|
||||
@ -130,7 +79,6 @@ class Pdf_view
|
||||
class Non_supported_framebuffer_mode { };
|
||||
class Unexpected_document_color_depth { };
|
||||
|
||||
typedef uint16_t pixel_t;
|
||||
typedef Framebuffer::Mode Mode;
|
||||
|
||||
private:
|
||||
@ -167,19 +115,19 @@ class Pdf_view
|
||||
|
||||
_nit_mode = _gui.mode();
|
||||
|
||||
int max_x = Genode::max(_nit_mode.width(), _fb_mode.width());
|
||||
int max_y = Genode::max(_nit_mode.height(), _fb_mode.height());
|
||||
unsigned max_x = Genode::max(_nit_mode.area.w(), _fb_mode.area.w());
|
||||
unsigned max_y = Genode::max(_nit_mode.area.h(), _fb_mode.area.h());
|
||||
|
||||
if (max_x > _fb_mode.width() || max_y > _fb_mode.height()) {
|
||||
_fb_mode = Mode(max_x, max_y, _nit_mode.format());
|
||||
if (max_x > _fb_mode.area.w() || max_y > _fb_mode.area.h()) {
|
||||
_fb_mode = Mode { .area = { max_x, max_y } };
|
||||
_gui.buffer(_fb_mode, NO_ALPHA);
|
||||
if (_fb_ds.constructed())
|
||||
_fb_ds.destruct();
|
||||
_fb_ds.construct(_env.rm(), _framebuffer.dataspace());
|
||||
}
|
||||
|
||||
_pdfapp.scrw = _nit_mode.width();
|
||||
_pdfapp.scrh = _nit_mode.height();
|
||||
_pdfapp.scrw = _nit_mode.area.w();
|
||||
_pdfapp.scrh = _nit_mode.area.h();
|
||||
|
||||
/*
|
||||
* XXX replace heuristics with a meaningful computation
|
||||
@ -187,12 +135,11 @@ class Pdf_view
|
||||
* The magic values are hand-tweaked manually to accommodating the
|
||||
* use case of showing slides.
|
||||
*/
|
||||
_pdfapp.resolution = Genode::min(_nit_mode.width()/5,
|
||||
_nit_mode.height()/3.8);
|
||||
_pdfapp.resolution = Genode::min(_nit_mode.area.w()/5,
|
||||
_nit_mode.area.h()/3.8);
|
||||
|
||||
typedef Gui::Session::Command Command;
|
||||
_gui.enqueue<Command::Geometry>(
|
||||
_view, Rect(Point(), Area(_nit_mode.width(), _nit_mode.height())));
|
||||
_gui.enqueue<Command::Geometry>(_view, Rect(Point(), _nit_mode.area));
|
||||
_gui.enqueue<Command::To_front>(_view, Gui::Session::View_handle());
|
||||
_gui.execute();
|
||||
}
|
||||
@ -200,7 +147,7 @@ class Pdf_view
|
||||
void _handle_nit_mode()
|
||||
{
|
||||
_rebuffer();
|
||||
pdfapp_onresize(&_pdfapp, _nit_mode.width(), _nit_mode.height());
|
||||
pdfapp_onresize(&_pdfapp, _nit_mode.area.w(), _nit_mode.area.h());
|
||||
}
|
||||
|
||||
pdfapp_t _pdfapp { };
|
||||
@ -268,7 +215,7 @@ class Pdf_view
|
||||
|
||||
void _refresh()
|
||||
{
|
||||
_framebuffer.refresh(0, 0, _nit_mode.width(), _nit_mode.height());
|
||||
_framebuffer.refresh(0, 0, _nit_mode.area.w(), _nit_mode.area.h());
|
||||
|
||||
/* handle one sync signal only */
|
||||
_framebuffer.sync_sigh(Genode::Signal_context_capability());
|
||||
@ -335,12 +282,12 @@ class Pdf_view
|
||||
|
||||
void Pdf_view::show()
|
||||
{
|
||||
Genode::Area<> const fb_size(_fb_mode.width(), _fb_mode.height());
|
||||
Framebuffer::Area const fb_size = _fb_mode.area;
|
||||
int const x_max = Genode::min((int)fb_size.w(), _pdfapp.image->w);
|
||||
int const y_max = Genode::min((int)fb_size.h(), _pdfapp.image->h);
|
||||
|
||||
/* clear framebuffer */
|
||||
memset(_fb_base(), 0, _fb_ds->size());
|
||||
::memset((void *)_fb_base(), 0, _fb_ds->size());
|
||||
|
||||
Genode::size_t src_line_bytes = _pdfapp.image->n * _pdfapp.image->w;
|
||||
unsigned char *src_line = _pdfapp.image->samples;
|
||||
@ -354,15 +301,15 @@ void Pdf_view::show()
|
||||
int const tweaked_y_max = y_max - 2;
|
||||
|
||||
/* center vertically if the dst buffer is higher than the image */
|
||||
if (_pdfapp.image->h < _nit_mode.height())
|
||||
dst_line += dst_line_width*((_nit_mode.height() - _pdfapp.image->h)/2);
|
||||
if ((unsigned)_pdfapp.image->h < _nit_mode.area.h())
|
||||
dst_line += dst_line_width*((_nit_mode.area.h() - _pdfapp.image->h)/2);
|
||||
|
||||
/* center horizontally if the dst buffer is wider than the image */
|
||||
if (_pdfapp.image->w < _nit_mode.width())
|
||||
dst_line += (_nit_mode.width() - _pdfapp.image->w)/2;
|
||||
if ((unsigned)_pdfapp.image->w < _nit_mode.area.w())
|
||||
dst_line += (_nit_mode.area.w() - _pdfapp.image->w)/2;
|
||||
|
||||
for (int y = 0; y < tweaked_y_max; y++) {
|
||||
convert_line_rgba_to_rgb565(src_line, dst_line, x_max, y);
|
||||
copy_line_rgba(src_line, dst_line, x_max);
|
||||
src_line += src_line_bytes;
|
||||
dst_line += dst_line_width;
|
||||
}
|
||||
|
@ -35,35 +35,7 @@ be set to '"yes"' to prevent the driver from changing the mode. This way,
|
||||
the driver will just query the current mode and make the already
|
||||
initialized framebuffer available to its client.
|
||||
|
||||
|
||||
Options and usage from clients
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
:Example:
|
||||
|
||||
! #include <framebuffer_session/connection.h>
|
||||
!
|
||||
! ...
|
||||
!
|
||||
! /* create session to frame-buffer service */
|
||||
! Framebuffer::Connection framebuffer(1024, 768, Framebuffer::Session::RGB565);
|
||||
!
|
||||
! /* retrieve frame buffer dataspace */
|
||||
! Dataspace_capability fb_ds_cap = framebuffer.dataspace();
|
||||
!
|
||||
! /* map dataspace to local address space */
|
||||
! void *local_addr = env()->rm_session()->attach(fb_ds_cap);
|
||||
|
||||
:Session-creation arguments:
|
||||
|
||||
:'fb_width': resolution width in pixel
|
||||
|
||||
:'fb_height': resolution height in pixel
|
||||
|
||||
:'fb_mode ': bits per pixel
|
||||
|
||||
:Supported modes:
|
||||
|
||||
'640x480', '800x600', '1024x786', '1280x1024' at 15, 16, 24, 32 bits per pixel
|
||||
Buffered output is only supported for modes using 16 bits per pixel.
|
||||
'640x480', '800x600', '1024x786', '1280x1024' at 32 bits per pixel.
|
||||
|
||||
|
@ -71,7 +71,7 @@ class Framebuffer::Session_component : public Genode::Rpc_object<Session>
|
||||
|
||||
/* determine bytes per pixel */
|
||||
int bypp = 0;
|
||||
if (_scr_depth == 16) bypp = 2;
|
||||
if (_scr_depth == 32) bypp = 4;
|
||||
if (!bypp) return;
|
||||
|
||||
/* copy pixels from back buffer to physical frame buffer */
|
||||
@ -99,11 +99,6 @@ class Framebuffer::Session_component : public Genode::Rpc_object<Session>
|
||||
{
|
||||
if (!buffered) return;
|
||||
|
||||
if (_scr_depth != 16) {
|
||||
Genode::warning("buffered mode not supported for depth ", _scr_depth);
|
||||
return;
|
||||
}
|
||||
|
||||
size_t const bb_size = _scr_width*_scr_height*_scr_depth/8;
|
||||
try { _bb.construct(env.ram(), env.rm(), bb_size); }
|
||||
catch (...) {
|
||||
@ -140,8 +135,7 @@ class Framebuffer::Session_component : public Genode::Rpc_object<Session>
|
||||
|
||||
Mode mode() const override
|
||||
{
|
||||
return Mode(_scr_width, _scr_height,
|
||||
_scr_depth == 16 ? Mode::RGB565 : Mode::INVALID);
|
||||
return Mode { .area = { _scr_width, _scr_height } };
|
||||
}
|
||||
|
||||
void mode_sigh(Genode::Signal_context_capability) override { }
|
||||
@ -191,9 +185,9 @@ class Framebuffer::Root : public Root_component
|
||||
{
|
||||
unsigned scr_width = _session_arg("width", args, "fb_width", 0);
|
||||
unsigned scr_height = _session_arg("height", args, "fb_height", 0);
|
||||
unsigned const scr_depth = _session_arg("depth", args, "fb_mode", 16);
|
||||
unsigned const scr_depth = 32;
|
||||
|
||||
bool const buffered = _config.xml().attribute_value("buffered", false);
|
||||
bool const buffered = _config.xml().attribute_value("buffered", true);
|
||||
|
||||
if (Framebuffer::set_mode(scr_width, scr_height, scr_depth) != 0) {
|
||||
Genode::warning("Could not set vesa mode ",
|
||||
@ -233,6 +227,7 @@ struct Framebuffer::Main
|
||||
|
||||
Main(Genode::Env &env) : env(env)
|
||||
{
|
||||
Genode::log("modified");
|
||||
try { Framebuffer::init(env, heap); } catch (...) {
|
||||
Genode::error("H/W driver init failed");
|
||||
throw;
|
||||
|
@ -32,8 +32,8 @@
|
||||
|
||||
static int stride(int value)
|
||||
{
|
||||
/* RGB556 */
|
||||
return value * 2;
|
||||
/* 32-bit RGB888 */
|
||||
return value * 4;
|
||||
}
|
||||
|
||||
typedef void *(*mem_copy_fn)(void *dest, const void *src, size_t n);
|
||||
@ -189,7 +189,7 @@ EGLBoolean
|
||||
dri2_initialize_genode_backend(_EGLDriver *drv, _EGLDisplay *disp)
|
||||
{
|
||||
struct dri2_egl_display *dri2_dpy;
|
||||
static unsigned rgb565_masks[4] = { 0xf800, 0x07e0, 0x001f, 0 };
|
||||
static unsigned rgb888_masks[4] = { 0xff0000, 0xff00, 0xff, 0 };
|
||||
int i;
|
||||
|
||||
/* initialize DRM back end */
|
||||
@ -227,21 +227,19 @@ dri2_initialize_genode_backend(_EGLDriver *drv, _EGLDisplay *disp)
|
||||
if (!dri2_create_screen(disp))
|
||||
goto close_screen;
|
||||
|
||||
|
||||
/* add RGB565 only */
|
||||
EGLint attrs[] = {
|
||||
EGL_DEPTH_SIZE, 0, /* set in loop below (from DRI config) */
|
||||
EGL_NATIVE_VISUAL_TYPE, 0,
|
||||
EGL_NATIVE_VISUAL_ID, 0,
|
||||
EGL_RED_SIZE, 5,
|
||||
EGL_GREEN_SIZE, 6,
|
||||
EGL_BLUE_SIZE, 5,
|
||||
EGL_RED_SIZE, 8,
|
||||
EGL_GREEN_SIZE, 8,
|
||||
EGL_BLUE_SIZE, 8,
|
||||
EGL_NONE };
|
||||
|
||||
for (i = 1; dri2_dpy->driver_configs[i]; i++) {
|
||||
/* set depth size in attrs */
|
||||
attrs[1] = dri2_dpy->driver_configs[i]->modes.depthBits;
|
||||
dri2_add_config(disp, dri2_dpy->driver_configs[i], i, EGL_WINDOW_BIT, attrs, rgb565_masks);
|
||||
dri2_add_config(disp, dri2_dpy->driver_configs[i], i, EGL_WINDOW_BIT, attrs, rgb888_masks);
|
||||
}
|
||||
|
||||
return EGL_TRUE;
|
||||
|
@ -30,8 +30,8 @@
|
||||
|
||||
static int stride(int value)
|
||||
{
|
||||
/* RGB556 */
|
||||
return value * 2;
|
||||
/* 32-bit RGB888 */
|
||||
return value * 4;
|
||||
}
|
||||
|
||||
|
||||
@ -152,7 +152,7 @@ static EGLBoolean
|
||||
dri2_initialize_genode_swrast(_EGLDriver *drv, _EGLDisplay *disp)
|
||||
{
|
||||
struct dri2_egl_display *dri2_dpy;
|
||||
static unsigned rgb565_masks[4] = { 0xf800, 0x07e0, 0x001f, 0 };
|
||||
static unsigned rgb888_masks[4] = { 0xff0000, 0xff00, 0xff, 0 };
|
||||
int i;
|
||||
|
||||
dri2_dpy = calloc(1, sizeof *dri2_dpy);
|
||||
@ -180,14 +180,13 @@ dri2_initialize_genode_swrast(_EGLDriver *drv, _EGLDisplay *disp)
|
||||
if (!dri2_create_screen(disp))
|
||||
goto close_screen;
|
||||
|
||||
/* add RGB565 only */
|
||||
EGLint attrs[] = {
|
||||
EGL_DEPTH_SIZE, 0, /* set in loop below (from DRI config) */
|
||||
EGL_NATIVE_VISUAL_TYPE, 0,
|
||||
EGL_NATIVE_VISUAL_ID, 0,
|
||||
EGL_RED_SIZE, 5,
|
||||
EGL_GREEN_SIZE, 6,
|
||||
EGL_BLUE_SIZE, 5,
|
||||
EGL_RED_SIZE, 8,
|
||||
EGL_GREEN_SIZE, 8,
|
||||
EGL_BLUE_SIZE, 8,
|
||||
EGL_NONE };
|
||||
|
||||
for (i = 1; dri2_dpy->driver_configs[i]; i++) {
|
||||
@ -195,7 +194,7 @@ dri2_initialize_genode_swrast(_EGLDriver *drv, _EGLDisplay *disp)
|
||||
attrs[1] = dri2_dpy->driver_configs[i]->modes.depthBits;
|
||||
dri2_add_config(disp, dri2_dpy->driver_configs[i], i,
|
||||
EGL_WINDOW_BIT | EGL_PBUFFER_BIT, attrs,
|
||||
rgb565_masks);
|
||||
rgb888_masks);
|
||||
}
|
||||
|
||||
return EGL_TRUE;
|
||||
|
@ -381,20 +381,18 @@ void QGenodePlatformWindow::_handle_mode_changed()
|
||||
{
|
||||
Framebuffer::Mode mode(_gui_session.mode());
|
||||
|
||||
if ((mode.width() == 0) && (mode.height() == 0)) {
|
||||
if ((mode.area.w() == 0) && (mode.area.h() == 0)) {
|
||||
/* interpret a size of 0x0 as indication to close the window */
|
||||
QWindowSystemInterface::handleCloseEvent(window(), 0);
|
||||
/* don't actually set geometry to 0x0; either close or remain open */
|
||||
return;
|
||||
}
|
||||
|
||||
if ((mode.width() != _current_mode.width()) ||
|
||||
(mode.height() != _current_mode.height()) ||
|
||||
(mode.format() != _current_mode.format())) {
|
||||
if (mode.area != _current_mode.area) {
|
||||
|
||||
QRect geo(geometry());
|
||||
geo.setWidth(mode.width());
|
||||
geo.setHeight(mode.height());
|
||||
geo.setWidth (mode.area.w());
|
||||
geo.setHeight(mode.area.h());
|
||||
|
||||
QWindowSystemInterface::handleGeometryChange(window(), geo);
|
||||
|
||||
@ -449,8 +447,8 @@ void QGenodePlatformWindow::_adjust_and_set_geometry(const QRect &rect)
|
||||
|
||||
QPlatformWindow::setGeometry(adjusted_rect);
|
||||
|
||||
Framebuffer::Mode mode(adjusted_rect.width(), adjusted_rect.height(),
|
||||
Framebuffer::Mode::RGB565);
|
||||
Framebuffer::Mode const mode { .area = { (unsigned)adjusted_rect.width(),
|
||||
(unsigned)adjusted_rect.height() } };
|
||||
_gui_session.buffer(mode, false);
|
||||
|
||||
_current_mode = mode;
|
||||
|
@ -42,16 +42,13 @@ class QGenodeScreen : public QPlatformScreen
|
||||
|
||||
Framebuffer::Mode const scr_mode = _gui.mode();
|
||||
|
||||
if (scr_mode.format() != Framebuffer::Mode::RGB565)
|
||||
qCritical() << "GUI screen format is not RGB565";
|
||||
|
||||
_geometry.setRect(0, 0, scr_mode.width(),
|
||||
scr_mode.height());
|
||||
_geometry.setRect(0, 0, scr_mode.area.w(),
|
||||
scr_mode.area.h());
|
||||
}
|
||||
|
||||
QRect geometry() const { return _geometry; }
|
||||
int depth() const { return 16; }
|
||||
QImage::Format format() const { return QImage::Format_RGB16; }
|
||||
int depth() const { return 32; }
|
||||
QImage::Format format() const { return QImage::Format_ARGB32; }
|
||||
QDpi logicalDpi() const { return QDpi(80, 80); };
|
||||
|
||||
QPlatformCursor *cursor() const
|
||||
|
@ -57,12 +57,14 @@ struct Window : Genode_egl_window
|
||||
Window(Genode::Env &env, int w, int h)
|
||||
:
|
||||
env(env),
|
||||
mode_dispatcher(*signal_ep, *this, &Window::mode_handler)
|
||||
mode_dispatcher(*signal_ep, *this, &Window::mode_handler)
|
||||
{
|
||||
width = w;
|
||||
height = h;
|
||||
|
||||
framebuffer.construct(env, Framebuffer::Mode(width, height, Framebuffer::Mode::RGB565));
|
||||
Framebuffer::Mode const mode { .area = { (unsigned)width, (unsigned)height } };
|
||||
|
||||
framebuffer.construct(env, mode);
|
||||
addr = env.rm().attach(framebuffer->dataspace());
|
||||
|
||||
framebuffer->mode_sigh(mode_dispatcher);
|
||||
@ -87,10 +89,10 @@ struct Window : Genode_egl_window
|
||||
|
||||
eglut_window *win = _eglut->current;
|
||||
if (win) {
|
||||
win->native.width = mode.width();
|
||||
win->native.height = mode.height();
|
||||
width = mode.width();
|
||||
height = mode.height();
|
||||
win->native.width = mode.area.w();
|
||||
win->native.height = mode.area.h();
|
||||
width = mode.area.w();
|
||||
height = mode.area.h();
|
||||
|
||||
if (win->reshape_cb)
|
||||
win->reshape_cb(win->native.width, win->native.height);
|
||||
|
@ -33,9 +33,7 @@ class Framebuffer::Connection : public Genode::Connection<Session>,
|
||||
/**
|
||||
* Create session and return typed session capability
|
||||
*/
|
||||
Session_capability _connect(Genode::Parent &parent,
|
||||
unsigned width, unsigned height,
|
||||
Mode::Format format)
|
||||
Session_capability _connect(Genode::Parent &parent, Area area)
|
||||
{
|
||||
using namespace Genode;
|
||||
|
||||
@ -48,12 +46,10 @@ class Framebuffer::Connection : public Genode::Connection<Session>,
|
||||
Arg_string::set_arg(argbuf, sizeof(argbuf), "cap_quota", CAP_QUOTA);
|
||||
|
||||
/* set optional session-constructor arguments */
|
||||
if (width)
|
||||
Arg_string::set_arg(argbuf, sizeof(argbuf), "fb_width", width);
|
||||
if (height)
|
||||
Arg_string::set_arg(argbuf, sizeof(argbuf), "fb_height", height);
|
||||
if (format != Mode::INVALID)
|
||||
Arg_string::set_arg(argbuf, sizeof(argbuf), "fb_format", format);
|
||||
if (area.w())
|
||||
Arg_string::set_arg(argbuf, sizeof(argbuf), "fb_width", area.w());
|
||||
if (area.h())
|
||||
Arg_string::set_arg(argbuf, sizeof(argbuf), "fb_height", area.h());
|
||||
|
||||
return session(parent, argbuf);
|
||||
}
|
||||
@ -72,8 +68,7 @@ class Framebuffer::Connection : public Genode::Connection<Session>,
|
||||
Connection(Genode::Env &env, Framebuffer::Mode mode)
|
||||
:
|
||||
Genode::Connection<Session>(env, _connect(env.parent(),
|
||||
mode.width(), mode.height(),
|
||||
mode.format())),
|
||||
mode.area)),
|
||||
Session_client(cap())
|
||||
{ }
|
||||
};
|
||||
|
@ -18,12 +18,15 @@
|
||||
#include <base/signal.h>
|
||||
#include <dataspace/capability.h>
|
||||
#include <session/session.h>
|
||||
#include <os/surface.h>
|
||||
|
||||
namespace Framebuffer {
|
||||
|
||||
struct Mode;
|
||||
struct Session;
|
||||
struct Session_client;
|
||||
|
||||
using Area = Genode::Surface_base::Area;
|
||||
}
|
||||
|
||||
|
||||
@ -32,57 +35,11 @@ namespace Framebuffer {
|
||||
*/
|
||||
struct Framebuffer::Mode
|
||||
{
|
||||
public:
|
||||
Area area;
|
||||
|
||||
/**
|
||||
* Pixel formats
|
||||
*/
|
||||
enum Format { INVALID, RGB565 };
|
||||
Genode::size_t bytes_per_pixel() const { return 4; }
|
||||
|
||||
static Genode::size_t bytes_per_pixel(Format format)
|
||||
{
|
||||
if (format == RGB565) return 2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
int _width = 0, _height = 0;
|
||||
|
||||
Format _format = INVALID;
|
||||
|
||||
/*
|
||||
* Helpers for sanitized access. The sanitizing is needed whenever
|
||||
* a 'Mode' object is transferred via RPC from an untrusted client.
|
||||
*/
|
||||
static Format _sanitized(Format f) { return f == RGB565 ? RGB565 : INVALID; }
|
||||
static int _sanitized(int v) { return v >= 0 ? v : 0; }
|
||||
|
||||
public:
|
||||
|
||||
Mode() { }
|
||||
|
||||
Mode(int width, int height, Format format)
|
||||
: _width(width), _height(height), _format(format) { }
|
||||
|
||||
int width() const { return _sanitized(_width); }
|
||||
int height() const { return _sanitized(_height); }
|
||||
Format format() const { return _sanitized(_format); }
|
||||
|
||||
/**
|
||||
* Return number of bytes per pixel
|
||||
*/
|
||||
Genode::size_t bytes_per_pixel() const {
|
||||
return bytes_per_pixel(format()); }
|
||||
|
||||
void print(Genode::Output &out) const
|
||||
{
|
||||
Genode::print(out, width(), "x", height(), "@");
|
||||
switch (format()) {
|
||||
case RGB565: Genode::print(out, "RGB565"); break;
|
||||
default: Genode::print(out, "INVALID"); break;
|
||||
}
|
||||
}
|
||||
void print(Genode::Output &out) const { Genode::print(out, area); }
|
||||
};
|
||||
|
||||
|
||||
|
@ -325,7 +325,7 @@ struct Gui::Session : Genode::Session
|
||||
* If alpha blending is used, each pixel requires an additional byte
|
||||
* for the alpha value and a byte holding the input mask.
|
||||
*/
|
||||
return (mode.bytes_per_pixel() + 2*use_alpha)*mode.width()*mode.height();
|
||||
return (mode.bytes_per_pixel() + 2*use_alpha)*mode.area.count();
|
||||
}
|
||||
|
||||
|
||||
|
@ -22,6 +22,15 @@ namespace Genode {
|
||||
0xff0000, 16, 0xff00, 8, 0xff, 0, 0, 0>
|
||||
Pixel_rgb888;
|
||||
|
||||
template <>
|
||||
inline Pixel_rgb888 Pixel_rgb888::avr(Pixel_rgb888 p1, Pixel_rgb888 p2)
|
||||
{
|
||||
Pixel_rgb888 res;
|
||||
res.pixel = (((p1.pixel&0xfe00fe00)>>1) + ((p2.pixel&0xfe00fe00)>>1))
|
||||
| (((p1.pixel&0x00fe00fe)>>1) + ((p2.pixel&0x00fe00fe)>>1));
|
||||
return res;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline Pixel_rgb888 Pixel_rgb888::blend(Pixel_rgb888 src, int alpha)
|
||||
{
|
||||
@ -37,7 +46,7 @@ namespace Genode {
|
||||
{
|
||||
Pixel_rgb888 res;
|
||||
|
||||
res.pixel = blend(p1, 255 - alpha).pixel + blend(p2, alpha).pixel;
|
||||
res.pixel = blend(p1, 256 - alpha).pixel + blend(p2, alpha).pixel;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
<default-policy> <child name="input_filter"/> </default-policy> </service>
|
||||
|
||||
<start name="fb_sdl" caps="100" ld="no">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<resource name="RAM" quantum="10M"/>
|
||||
<provides>
|
||||
<service name="Input"/>
|
||||
<service name="Framebuffer"/>
|
||||
|
@ -44,7 +44,7 @@
|
||||
|
||||
<start name="fb_drv" caps="120">
|
||||
<binary name="vesa_fb_drv"/>
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<resource name="RAM" quantum="8M"/>
|
||||
<provides><service name="Framebuffer"/></provides>
|
||||
<route>
|
||||
<service name="ROM" label="config"> <parent label="fb_drv.config"/> </service>
|
||||
@ -87,7 +87,7 @@
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="input_filter" caps="80">
|
||||
<start name="input_filter" caps="90">
|
||||
<resource name="RAM" quantum="1280K"/>
|
||||
<provides> <service name="Input"/> </provides>
|
||||
<route>
|
||||
|
@ -77,7 +77,7 @@
|
||||
|
||||
<start name="fb_drv" caps="120">
|
||||
<binary name="vesa_fb_drv"/>
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<resource name="RAM" quantum="8M"/>
|
||||
<provides><service name="Framebuffer"/></provides>
|
||||
<route>
|
||||
<service name="ROM" label="config"> <parent label="fb_drv.config"/> </service>
|
||||
|
@ -1,4 +1,5 @@
|
||||
base
|
||||
os
|
||||
blit
|
||||
framebuffer_session
|
||||
timer_session
|
||||
|
@ -42,7 +42,7 @@ install_config {
|
||||
</start>
|
||||
|
||||
<start name="drivers" caps="1500">
|
||||
<resource name="RAM" quantum="32M" constrain_phys="yes"/>
|
||||
<resource name="RAM" quantum="64M" constrain_phys="yes"/>
|
||||
<binary name="init"/>
|
||||
<route>
|
||||
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>
|
||||
@ -147,7 +147,7 @@ install_config {
|
||||
</route>
|
||||
</start>
|
||||
|
||||
<start name="nitpicker" caps="110">
|
||||
<start name="nitpicker" caps="120">
|
||||
<resource name="RAM" quantum="1216K"/>
|
||||
<provides> <service name="Gui"/> </provides>
|
||||
<route>
|
||||
@ -185,7 +185,7 @@ install_config {
|
||||
</start>
|
||||
|
||||
<start name="scout" caps="10000">
|
||||
<resource name="RAM" quantum="64M" />
|
||||
<resource name="RAM" quantum="80M" />
|
||||
</start>
|
||||
</config>}
|
||||
|
||||
@ -199,11 +199,11 @@ puts $launchpad_config_fd {<config>
|
||||
<launcher name="launchpad" ram_quota="6M" caps="1000">
|
||||
<configfile name="launchpad.config" />
|
||||
</launcher>
|
||||
<launcher name="nitlog" ram_quota="1M" caps="70"/>
|
||||
<launcher name="liquid_fb" ram_quota="7M" caps="70">
|
||||
<launcher name="nitlog" ram_quota="1M" caps="100"/>
|
||||
<launcher name="liquid_fb" ram_quota="9M" caps="100">
|
||||
<config resize_handle="on" />
|
||||
</launcher>
|
||||
<launcher name="nitpicker" ram_quota="1M" caps="70">
|
||||
<launcher name="nitpicker" ram_quota="1M" caps="100">
|
||||
<config>
|
||||
<domain name="" layer="3" conten="client" label="no" focus="click"/>
|
||||
<default-policy domain="" />
|
||||
|
@ -40,7 +40,7 @@ install_config {
|
||||
<provides><service name="Timer"/></provides>
|
||||
</start>
|
||||
|
||||
<start name="drivers" caps="1000">
|
||||
<start name="drivers" caps="1500">
|
||||
<resource name="RAM" quantum="120M" constrain_phys="yes"/>
|
||||
<binary name="init"/>
|
||||
<route>
|
||||
|
@ -27,8 +27,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>
|
||||
|
@ -31,8 +31,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>
|
||||
|
@ -18,8 +18,8 @@
|
||||
#include <base/heap.h>
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <os/pixel_alpha8.h>
|
||||
#include <os/pixel_rgb565.h>
|
||||
#include <os/pixel_rgb888.h>
|
||||
#include <os/pixel_rgb565.h>
|
||||
#include <os/surface.h>
|
||||
#include <os/texture_rgb888.h>
|
||||
#include <gui_session/connection.h>
|
||||
@ -42,7 +42,7 @@ void convert_default_pointer_data_to_pixels(PT *pixel, Gui::Area size)
|
||||
for (unsigned y = 0; y < size.h(); y++) {
|
||||
for (unsigned x = 0; x < size.w(); x++) {
|
||||
|
||||
/* the source is known to be in RGB565 format */
|
||||
/* the source is known to be in RGB888 format */
|
||||
Genode::Pixel_rgb565 src =
|
||||
*(Genode::Pixel_rgb565 *)(&big_mouse.pixels[y][x]);
|
||||
|
||||
@ -139,9 +139,7 @@ void Pointer::Main::_resize_gui_buffer_if_needed(Gui::Area pointer_size)
|
||||
if (pointer_size == _current_pointer_size)
|
||||
return;
|
||||
|
||||
Framebuffer::Mode const mode { (int)pointer_size.w(),
|
||||
(int)pointer_size.h(),
|
||||
Framebuffer::Mode::RGB565 };
|
||||
Framebuffer::Mode const mode { .area = pointer_size };
|
||||
|
||||
_gui.buffer(mode, true /* use alpha */);
|
||||
|
||||
@ -169,7 +167,7 @@ void Pointer::Main::_show_default_pointer()
|
||||
|
||||
Genode::Attached_dataspace ds { _env.rm(), _pointer_ds };
|
||||
|
||||
convert_default_pointer_data_to_pixels(ds.local_addr<Genode::Pixel_rgb565>(),
|
||||
convert_default_pointer_data_to_pixels(ds.local_addr<Genode::Pixel_rgb888>(),
|
||||
pointer_size);
|
||||
_gui.framebuffer()->refresh(0, 0, pointer_size.w(), pointer_size.h());
|
||||
|
||||
@ -220,12 +218,12 @@ void Pointer::Main::_show_shape_pointer(Shape_report &shape_report)
|
||||
|
||||
Attached_dataspace ds { _env.rm(), _pointer_ds };
|
||||
|
||||
Pixel_rgb565 *pixel = ds.local_addr<Pixel_rgb565>();
|
||||
Pixel_rgb888 *pixel = ds.local_addr<Pixel_rgb888>();
|
||||
|
||||
Pixel_alpha8 *alpha =
|
||||
reinterpret_cast<Pixel_alpha8 *>(pixel + shape_size.count());
|
||||
|
||||
Surface<Pixel_rgb565> pixel_surface(pixel, shape_size);
|
||||
Surface<Pixel_rgb888> pixel_surface(pixel, shape_size);
|
||||
Surface<Pixel_alpha8> alpha_surface(alpha, shape_size);
|
||||
|
||||
Dither_painter::paint(pixel_surface, texture);
|
||||
@ -341,8 +339,7 @@ Pointer::Main::Main(Genode::Env &env) : _env(env)
|
||||
* pointer size to let the user know right from the start if the
|
||||
* RAM quota is too low.
|
||||
*/
|
||||
Framebuffer::Mode const mode { Pointer::MAX_WIDTH, Pointer::MAX_HEIGHT,
|
||||
Framebuffer::Mode::RGB565 };
|
||||
Framebuffer::Mode const mode { .area = { Pointer::MAX_WIDTH, Pointer::MAX_HEIGHT } };
|
||||
|
||||
_gui.buffer(mode, true /* use alpha */);
|
||||
|
||||
@ -353,7 +350,7 @@ Pointer::Main::Main(Genode::Env &env) : _env(env)
|
||||
_handle_hover();
|
||||
} catch (Genode::Rom_connection::Rom_connection_failed) {
|
||||
Genode::warning("Could not open ROM session for \"hover\".",
|
||||
" This ROM is used for custom pointer shape support.");
|
||||
" This ROM is used for custom pointer shape support.");
|
||||
}
|
||||
|
||||
try {
|
||||
@ -362,7 +359,7 @@ Pointer::Main::Main(Genode::Env &env) : _env(env)
|
||||
_handle_xray();
|
||||
} catch (Genode::Rom_connection::Rom_connection_failed) {
|
||||
Genode::warning("Could not open ROM session for \"xray\".",
|
||||
" This ROM is used for custom pointer shape support.");
|
||||
" This ROM is used for custom pointer shape support.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <util/color.h>
|
||||
#include <base/component.h>
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <os/pixel_rgb565.h>
|
||||
#include <os/pixel_rgb888.h>
|
||||
#include <gui_session/connection.h>
|
||||
#include <nitpicker_gfx/box_painter.h>
|
||||
#include <nitpicker_gfx/tff_font.h>
|
||||
@ -51,7 +51,7 @@ struct Status_bar::Buffer
|
||||
* The status bar is as wide as nitpicker's screen and has a fixed
|
||||
* height.
|
||||
*/
|
||||
Framebuffer::Mode const _mode { _nit_mode.width(), HEIGHT, _nit_mode.format() };
|
||||
Framebuffer::Mode const _mode { .area = { _nit_mode.area.w(), HEIGHT } };
|
||||
|
||||
Dataspace_capability _init_buffer()
|
||||
{
|
||||
@ -120,14 +120,9 @@ void Status_bar::Buffer::draw(Domain_name const &domain_name,
|
||||
Label const &label,
|
||||
Color color)
|
||||
{
|
||||
if (_mode.format() != Framebuffer::Mode::RGB565) {
|
||||
error("pixel format not supported");
|
||||
return;
|
||||
}
|
||||
typedef Pixel_rgb888 PT;
|
||||
|
||||
typedef Pixel_rgb565 PT;
|
||||
|
||||
Area const area(_mode.width(), _mode.height());
|
||||
Area const area = _mode.area;
|
||||
|
||||
Surface<PT> surface(_fb_ds.local_addr<PT>(), area);
|
||||
|
||||
@ -248,8 +243,7 @@ void Status_bar::Main::_handle_mode()
|
||||
|
||||
_draw_status_bar();
|
||||
|
||||
Rect const geometry(Point(0, 0), Area(_buffer->mode().width(),
|
||||
_buffer->mode().height()));
|
||||
Rect const geometry(Point(0, 0), _buffer->mode().area);
|
||||
|
||||
_gui.enqueue<Gui::Session::Command::Geometry>(_view, geometry);
|
||||
_gui.execute();
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include <framebuffer.h>
|
||||
#include <base/component.h>
|
||||
#include <blit/blit.h>
|
||||
|
||||
using namespace Framebuffer;
|
||||
|
||||
@ -50,7 +51,7 @@ Session_component::Session_component(Genode::Env &env,
|
||||
_fb_mem.construct(_env, _core_fb.addr, _core_fb.pitch * _core_fb.height,
|
||||
true);
|
||||
|
||||
_fb_mode = Mode(_core_fb.width, _core_fb.height, Mode::RGB565);
|
||||
_fb_mode = Mode { .area = { _core_fb.width, _core_fb.height } };
|
||||
|
||||
_fb_ram.construct(_env.ram(), _env.rm(), _core_fb.width * _core_fb.height *
|
||||
_fb_mode.bytes_per_pixel());
|
||||
@ -70,28 +71,24 @@ void Session_component::refresh(int const x, int const y, int const w, int const
|
||||
{
|
||||
using namespace Genode;
|
||||
|
||||
uint32_t const c_x = x < 0 ? 0U : x;
|
||||
uint32_t const c_y = y < 0 ? 0U : y;
|
||||
uint32_t const c_w = w < 0 ? 0U : w;
|
||||
uint32_t const c_h = h < 0 ? 0U : h;
|
||||
int const width = _core_fb.width;
|
||||
int const height = _core_fb.height;
|
||||
unsigned const bpp = 4;
|
||||
unsigned const pitch = _core_fb.pitch;
|
||||
|
||||
uint32_t const u_x = min(_core_fb.width, max(c_x, 0U));
|
||||
uint32_t const u_y = min(_core_fb.height, max(c_y, 0U));
|
||||
uint32_t const u_w = min(_core_fb.width, max(c_w, 0U) + u_x);
|
||||
uint32_t const u_h = min(_core_fb.height, max(c_h, 0U) + u_y);
|
||||
/* clip specified coordinates against screen boundaries */
|
||||
int const x2 = min(x + w - 1, width - 1),
|
||||
y2 = min(y + h - 1, height - 1);
|
||||
int const x1 = max(x, 0),
|
||||
y1 = max(y, 0);
|
||||
if (x1 > x2 || y1 > y2)
|
||||
return;
|
||||
|
||||
Pixel_rgb888 * const pixel_32 = _fb_mem->local_addr<Pixel_rgb888>();
|
||||
Pixel_rgb565 const * const pixel_16 = _fb_ram->local_addr<Pixel_rgb565>();
|
||||
/* copy pixels from back buffer to physical frame buffer */
|
||||
char const *src = _fb_ram->local_addr<char>() + bpp*width*y1 + bpp*x1;
|
||||
char *dst = _fb_mem->local_addr<char>() + pitch*y1 + bpp*x1;
|
||||
|
||||
for (uint32_t r = u_y; r < u_h; ++r) {
|
||||
for (uint32_t c = u_x; c < u_w; ++c) {
|
||||
uint32_t const s = c + r * _core_fb.width;
|
||||
uint32_t const d = c + r * (_core_fb.pitch / (_core_fb.bpp / 8));
|
||||
|
||||
pixel_32[d].rgba(pixel_16[s].r(), pixel_16[s].g(),
|
||||
pixel_16[s].b(), 0);
|
||||
}
|
||||
}
|
||||
blit(src, bpp*width, dst, pitch, bpp*(x2 - x1 + 1), y2 - y1 + 1);
|
||||
}
|
||||
|
||||
Genode::Dataspace_capability Session_component::dataspace()
|
||||
|
@ -1,4 +1,4 @@
|
||||
TARGET = fb_boot_drv
|
||||
LIBS = base
|
||||
LIBS = base blit
|
||||
SRC_CC = main.cc framebuffer.cc
|
||||
INC_DIR += $(PRG_DIR)/include
|
||||
|
@ -41,7 +41,7 @@ namespace Framebuffer
|
||||
HSYNC_LEN = 64,
|
||||
VSYNC_LEN = 25,
|
||||
|
||||
BYTES_PER_PIXEL = 2,
|
||||
BYTES_PER_PIXEL = 4,
|
||||
FRAMEBUFFER_SIZE = SCR_WIDTH*SCR_HEIGHT*BYTES_PER_PIXEL,
|
||||
};
|
||||
|
||||
@ -65,13 +65,12 @@ class Framebuffer::Session_component :
|
||||
/**
|
||||
* Bit definitions of the lcd control register
|
||||
*/
|
||||
CTRL_ENABLED = 1 << 0,
|
||||
CTRL_BPP16 = 4 << 1,
|
||||
CTRL_BPP16_565 = 6 << 1,
|
||||
CTRL_TFT = 1 << 5,
|
||||
CTRL_BGR = 1 << 8,
|
||||
CTRL_POWER = 1 << 11,
|
||||
CTRL_VCOMP = 1 << 12,
|
||||
CTRL_ENABLED = 1 << 0,
|
||||
CTRL_BPP_24 = 5 << 1,
|
||||
CTRL_TFT = 1 << 5,
|
||||
CTRL_BGR = 1 << 8,
|
||||
CTRL_POWER = 1 << 11,
|
||||
CTRL_VCOMP = 1 << 12,
|
||||
|
||||
/**
|
||||
* Bit definitions for CLCDC timing.
|
||||
@ -151,7 +150,7 @@ class Framebuffer::Session_component :
|
||||
_timer.msleep(100);
|
||||
}
|
||||
|
||||
ctrl = CTRL_BGR | CTRL_ENABLED | CTRL_TFT | CTRL_VCOMP | CTRL_BPP16_565;
|
||||
ctrl = CTRL_BGR | CTRL_ENABLED | CTRL_TFT | CTRL_VCOMP | CTRL_BPP_24;
|
||||
|
||||
/* init color-lcd oscillator */
|
||||
sys_reg_write(SP810_REG_LOCK, 0xa05f);
|
||||
@ -177,7 +176,7 @@ class Framebuffer::Session_component :
|
||||
|
||||
Genode::Dataspace_capability dataspace() override { return _fb_ds_cap; }
|
||||
|
||||
Mode mode() const override { return Mode(SCR_WIDTH, SCR_HEIGHT, Mode::RGB565); }
|
||||
Mode mode() const override { return Mode { .area { SCR_WIDTH, SCR_HEIGHT } }; }
|
||||
|
||||
void mode_sigh(Genode::Signal_context_capability) override { }
|
||||
|
||||
|
@ -66,7 +66,7 @@ class Framebuffer::Driver
|
||||
return true;
|
||||
}
|
||||
|
||||
Mode mode() { return Mode(_width, _height, Mode::RGB565); }
|
||||
Mode mode() { return Mode { .area = { _width, _height } }; }
|
||||
Ipu &ipu() { return _ipu; }
|
||||
};
|
||||
|
||||
|
@ -225,24 +225,25 @@ class Ipu : Genode::Mmio
|
||||
cpmem.sly = stride - 1;
|
||||
cpmem.eba0 = phys_base >> 3;
|
||||
cpmem.eba1 = phys_base >> 3;
|
||||
cpmem.bpp = 3; /* corresponds to 16BPP */
|
||||
cpmem.bpp = 0; /* corresponds to 32BPP */
|
||||
cpmem.pfs = 7; /* corresponds to RGB */
|
||||
cpmem.npb = 31; /* 32 pixel per burst access */
|
||||
cpmem.npb = 15;
|
||||
|
||||
/* red */
|
||||
cpmem.wid0 = 4;
|
||||
cpmem.off0 = 0;
|
||||
cpmem.wid0 = 7;
|
||||
cpmem.off0 = 8;
|
||||
|
||||
/* green */
|
||||
cpmem.wid1 = 5;
|
||||
cpmem.off1 = 5;
|
||||
cpmem.wid1 = 7;
|
||||
cpmem.off1 = 16;
|
||||
|
||||
/* blue */
|
||||
cpmem.wid2 = 4; cpmem.off2 = 11;
|
||||
cpmem.wid2 = 7;
|
||||
cpmem.off2 = 24;
|
||||
|
||||
/* alpha */
|
||||
cpmem.wid3 = 7;
|
||||
cpmem.off3 = 16;
|
||||
cpmem.off3 = 0;
|
||||
|
||||
Genode::memcpy(dst, (void*)&cpmem, sizeof(Cp_mem));
|
||||
}
|
||||
|
@ -57,8 +57,8 @@ class Framebuffer::Session_component :
|
||||
void _refresh_buffered(int x, int y, int w, int h)
|
||||
{
|
||||
/* clip specified coordinates against screen boundaries */
|
||||
int x2 = min(x + w - 1, (int)_mode.width() - 1),
|
||||
y2 = min(y + h - 1, (int)_mode.height() - 1);
|
||||
int x2 = min(x + w - 1, (int)_mode.area.w() - 1),
|
||||
y2 = min(y + h - 1, (int)_mode.area.h() - 1);
|
||||
int x1 = max(x, 0),
|
||||
y1 = max(y, 0);
|
||||
if (x1 > x2 || y1 > y2) return;
|
||||
@ -66,10 +66,10 @@ class Framebuffer::Session_component :
|
||||
int bypp = _mode.bytes_per_pixel();
|
||||
|
||||
/* copy pixels from back buffer to physical frame buffer */
|
||||
char *src = (char *)_bb_addr + bypp*(_mode.width()*y1 + x1),
|
||||
*dst = (char *)_fb_addr + bypp*(_mode.width()*y1 + x1);
|
||||
char *src = (char *)_bb_addr + bypp*(_mode.area.w()*y1 + x1),
|
||||
*dst = (char *)_fb_addr + bypp*(_mode.area.h()*y1 + x1);
|
||||
|
||||
blit(src, bypp*_mode.width(), dst, bypp*_mode.width(),
|
||||
blit(src, bypp*_mode.area.w(), dst, bypp*_mode.area.w(),
|
||||
bypp*(x2 - x1 + 1), y2 - y1 + 1);
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ class Framebuffer::Session_component :
|
||||
: _env(env),
|
||||
_buffered(buffered),
|
||||
_mode(driver.mode()),
|
||||
_size(_mode.bytes_per_pixel() * _mode.width() * _mode.height()),
|
||||
_size(_mode.bytes_per_pixel()*_mode.area.count()),
|
||||
_bb_ds(buffered ? _env.ram().alloc(_size)
|
||||
: Genode::Ram_dataspace_capability()),
|
||||
_bb_addr(buffered ? (void*)_env.rm().attach(_bb_ds) : 0),
|
||||
|
2
repos/os/src/drivers/framebuffer/spec/rpi/README
Normal file
2
repos/os/src/drivers/framebuffer/spec/rpi/README
Normal file
@ -0,0 +1,2 @@
|
||||
If you find the red and blue color channels swapped, you may need to specify
|
||||
the option 'framebuffer_swap=1' in you Raspberry Pi's config.txt.
|
@ -45,8 +45,8 @@ class Framebuffer::Session_component : public Genode::Rpc_object<Framebuffer::Se
|
||||
Mode _mode = mode();
|
||||
|
||||
/* clip specified coordinates against screen boundaries */
|
||||
int x2 = min(x + w - 1, (int)_mode.width() - 1),
|
||||
y2 = min(y + h - 1, (int)_mode.height() - 1);
|
||||
int x2 = min(x + w - 1, (int)_mode.area.w() - 1),
|
||||
y2 = min(y + h - 1, (int)_mode.area.h() - 1);
|
||||
int x1 = max(x, 0),
|
||||
y1 = max(y, 0);
|
||||
if (x1 > x2 || y1 > y2) return;
|
||||
@ -89,7 +89,7 @@ class Framebuffer::Session_component : public Genode::Rpc_object<Framebuffer::Se
|
||||
|
||||
Mode mode() const override
|
||||
{
|
||||
return Mode(_width, _height, Mode::RGB565);
|
||||
return Mode { .area = { _width, _height } };
|
||||
}
|
||||
|
||||
void mode_sigh(Genode::Signal_context_capability) override { }
|
||||
@ -123,7 +123,7 @@ struct Framebuffer::Main
|
||||
|
||||
Platform::Connection _platform { _env };
|
||||
|
||||
Platform::Framebuffer_info _fb_info {1024, 768, 16 };
|
||||
Platform::Framebuffer_info _fb_info { 1024, 768, 32 };
|
||||
|
||||
Constructible<Framebuffer::Session_component> _fb_session { };
|
||||
Constructible<Static_root<Framebuffer::Session>> _fb_root { };
|
||||
|
@ -95,8 +95,8 @@ class Framebuffer::Session_component : public Rpc_object<Session>
|
||||
{
|
||||
unsigned const bpp = _requested_mode.bytes_per_pixel();
|
||||
unsigned const flags = SDL_SWSURFACE | SDL_RESIZABLE;
|
||||
unsigned const w = _requested_mode.width();
|
||||
unsigned const h = _requested_mode.height();
|
||||
unsigned const w = _requested_mode.area.w();
|
||||
unsigned const h = _requested_mode.area.h();
|
||||
|
||||
if (SDL_VideoModeOK(w, h, bpp*8, flags))
|
||||
_screen = SDL_SetVideoMode(w, h, bpp*8, flags);
|
||||
@ -153,8 +153,8 @@ class Framebuffer::Session_component : public Rpc_object<Session>
|
||||
/* clip refresh area to screen boundaries */
|
||||
int const x1 = max(x, 0);
|
||||
int const y1 = max(y, 0);
|
||||
int const x2 = min(x + w - 1, min(_mode.width(), _screen->w) - 1);
|
||||
int const y2 = min(y + h - 1, min(_mode.height(), _screen->h) - 1);
|
||||
int const x2 = min(x + w - 1, min((int)_mode.area.w(), _screen->w) - 1);
|
||||
int const y2 = min(y + h - 1, min((int)_mode.area.h(), _screen->h) - 1);
|
||||
|
||||
if (x1 > x2 || y1 > y2)
|
||||
return;
|
||||
@ -163,7 +163,7 @@ class Framebuffer::Session_component : public Rpc_object<Session>
|
||||
unsigned const bpp = _mode.bytes_per_pixel();
|
||||
|
||||
char const * const src_base = _fb_ds->local_addr<char>();
|
||||
unsigned const src_pitch = bpp*_mode.width();
|
||||
unsigned const src_pitch = bpp*_mode.area.w();
|
||||
char const * const src = src_base + y1*src_pitch + bpp*x1;
|
||||
|
||||
unsigned const dst_pitch = _screen->pitch;
|
||||
@ -186,10 +186,10 @@ struct Fb_sdl::Main
|
||||
|
||||
Timer::Connection _timer { _env };
|
||||
|
||||
int _fb_width = _config.xml().attribute_value("width", 1024UL);
|
||||
int _fb_height = _config.xml().attribute_value("height", 768UL);
|
||||
unsigned const _fb_width = _config.xml().attribute_value("width", 1024UL);
|
||||
unsigned const _fb_height = _config.xml().attribute_value("height", 768UL);
|
||||
|
||||
Framebuffer::Mode _fb_mode { _fb_width, _fb_height, Framebuffer::Mode::RGB565 };
|
||||
Framebuffer::Mode _fb_mode { .area = { _fb_width, _fb_height } };
|
||||
|
||||
Framebuffer::Session_component _fb_session { _env, _fb_mode };
|
||||
|
||||
@ -250,9 +250,13 @@ void Fb_sdl::Main::_handle_sdl_event(SDL_Event const &event)
|
||||
|
||||
if (event.type == SDL_VIDEORESIZE) {
|
||||
|
||||
Framebuffer::Mode const mode(event.resize.w, event.resize.h,
|
||||
Framebuffer::Mode::RGB565);
|
||||
if (event.resize.w < 0 || event.resize.h < 0) {
|
||||
warning("attempt to resize to negative size");
|
||||
return;
|
||||
}
|
||||
|
||||
Framebuffer::Mode const mode { .area = { (unsigned)event.resize.w,
|
||||
(unsigned)event.resize.h } };
|
||||
_fb_session.submit_mode_change(mode);
|
||||
return;
|
||||
}
|
||||
|
@ -97,8 +97,6 @@ struct Framebuffer::Session_component : Genode::Rpc_object<Framebuffer::Session>
|
||||
|
||||
View_updater &_view_updater;
|
||||
|
||||
Framebuffer::Mode::Format _format = _gui.mode().format();
|
||||
|
||||
/*
|
||||
* Mode as requested by the configuration or by a mode change of our
|
||||
* GUI session.
|
||||
@ -150,10 +148,10 @@ struct Framebuffer::Session_component : Genode::Rpc_object<Framebuffer::Session>
|
||||
void size(Gui::Area size)
|
||||
{
|
||||
/* ignore calls that don't change the size */
|
||||
if (Gui::Area(_next_mode.width(), _next_mode.height()) == size)
|
||||
if (Gui::Area(_next_mode.area.w(), _next_mode.area.h()) == size)
|
||||
return;
|
||||
|
||||
Framebuffer::Mode const mode(size.w(), size.h(), _next_mode.format());
|
||||
Framebuffer::Mode const mode { .area = size };
|
||||
|
||||
if (!_ram_suffices_for_mode(mode)) {
|
||||
Genode::warning("insufficient RAM for mode ", mode);
|
||||
@ -168,7 +166,7 @@ struct Framebuffer::Session_component : Genode::Rpc_object<Framebuffer::Session>
|
||||
|
||||
Gui::Area size() const
|
||||
{
|
||||
return Gui::Area(_active_mode.width(), _active_mode.height());
|
||||
return _active_mode.area;
|
||||
}
|
||||
|
||||
|
||||
@ -268,15 +266,15 @@ struct Nit_fb::Main : View_updater
|
||||
unsigned width(Framebuffer::Mode const &mode) const
|
||||
{
|
||||
if (_width > 0) return _width;
|
||||
if (_width < 0) return mode.width() + _width;
|
||||
return mode.width();
|
||||
if (_width < 0) return mode.area.w() + _width;
|
||||
return mode.area.w();
|
||||
}
|
||||
|
||||
unsigned height(Framebuffer::Mode const &mode) const
|
||||
{
|
||||
if (_height > 0) return _height;
|
||||
if (_height < 0) return mode.height() + _height;
|
||||
return mode.height();
|
||||
if (_height < 0) return mode.area.h() + _height;
|
||||
return mode.area.h();
|
||||
}
|
||||
|
||||
bool valid() const { return _width != 0 && _height != 0; }
|
||||
@ -285,9 +283,8 @@ struct Nit_fb::Main : View_updater
|
||||
|
||||
Framebuffer::Mode _initial_mode()
|
||||
{
|
||||
return Framebuffer::Mode(_initial_size.width (gui.mode()),
|
||||
_initial_size.height(gui.mode()),
|
||||
gui.mode().format());
|
||||
return Framebuffer::Mode { .area = { _initial_size.width (gui.mode()),
|
||||
_initial_size.height(gui.mode()) } };
|
||||
}
|
||||
|
||||
/*
|
||||
@ -327,9 +324,9 @@ struct Nit_fb::Main : View_updater
|
||||
Value const value = config.attribute_value(attr, Value());
|
||||
|
||||
if (value == "top_left") return Point(0, 0);
|
||||
if (value == "top_right") return Point(mode.width(), 0);
|
||||
if (value == "bottom_left") return Point(0, mode.height());
|
||||
if (value == "bottom_right") return Point(mode.width(), mode.height());
|
||||
if (value == "top_right") return Point(mode.area.w(), 0);
|
||||
if (value == "bottom_left") return Point(0, mode.area.h());
|
||||
if (value == "bottom_right") return Point(mode.area.w(), mode.area.h());
|
||||
|
||||
warning("unsupported ", attr, " attribute value '", value, "'");
|
||||
return Point(0, 0);
|
||||
@ -339,9 +336,9 @@ struct Nit_fb::Main : View_updater
|
||||
{
|
||||
Xml_node const config = config_rom.xml();
|
||||
|
||||
Framebuffer::Mode const nit_mode = gui.mode();
|
||||
Framebuffer::Mode const gui_mode = gui.mode();
|
||||
|
||||
position = _coordinate_origin(nit_mode, config)
|
||||
position = _coordinate_origin(gui_mode, config)
|
||||
+ Point(config.attribute_value("xpos", 0L),
|
||||
config.attribute_value("ypos", 0L));
|
||||
|
||||
@ -354,15 +351,15 @@ struct Nit_fb::Main : View_updater
|
||||
_initial_size.set = true;
|
||||
}
|
||||
|
||||
unsigned const nit_width = nit_mode.width();
|
||||
unsigned const nit_height = nit_mode.height();
|
||||
unsigned const gui_width = gui_mode.area.w();
|
||||
unsigned const gui_height = gui_mode.area.h();
|
||||
|
||||
long width = config.attribute_value("width", (long)nit_mode.width()),
|
||||
height = config.attribute_value("height", (long)nit_mode.height());
|
||||
long width = config.attribute_value("width", (long)gui_mode.area.w()),
|
||||
height = config.attribute_value("height", (long)gui_mode.area.h());
|
||||
|
||||
if (!_initial_size.set && _initial_size.valid()) {
|
||||
width = _initial_size.width (nit_mode);
|
||||
height = _initial_size.height(nit_mode);
|
||||
width = _initial_size.width (gui_mode);
|
||||
height = _initial_size.height(gui_mode);
|
||||
|
||||
_initial_size.set = true;
|
||||
} else {
|
||||
@ -371,8 +368,8 @@ struct Nit_fb::Main : View_updater
|
||||
* If configured width / height values are negative, the effective
|
||||
* width / height is deduced from the screen size.
|
||||
*/
|
||||
if (width < 0) width = nit_width + width;
|
||||
if (height < 0) height = nit_height + height;
|
||||
if (width < 0) width = gui_width + width;
|
||||
if (height < 0) height = gui_height + height;
|
||||
}
|
||||
|
||||
fb_session.size(Area(width, height));
|
||||
|
@ -230,16 +230,15 @@ class Gui::Session_component : public Rpc_object<Session>
|
||||
|
||||
Framebuffer::Mode mode() override
|
||||
{
|
||||
int mode_width = _max_size.valid() ?
|
||||
_max_size.w() :
|
||||
_gui.mode().width();
|
||||
unsigned const mode_width = _max_size.valid() ?
|
||||
_max_size.w() :
|
||||
_gui.mode().area.w();
|
||||
|
||||
int mode_height = _max_size.valid() ?
|
||||
_max_size.h() :
|
||||
_gui.mode().height();
|
||||
unsigned const mode_height = _max_size.valid() ?
|
||||
_max_size.h() :
|
||||
_gui.mode().area.h();
|
||||
|
||||
return Framebuffer::Mode(mode_width, mode_height,
|
||||
_gui.mode().format());
|
||||
return Framebuffer::Mode { .area = { mode_width, mode_height } };
|
||||
}
|
||||
|
||||
void mode_sigh(Signal_context_capability) override { }
|
||||
|
@ -29,9 +29,8 @@ class Nitpicker::Buffer
|
||||
{
|
||||
private:
|
||||
|
||||
Area _size;
|
||||
Framebuffer::Mode::Format _format;
|
||||
Attached_ram_dataspace _ram_ds;
|
||||
Area _size;
|
||||
Attached_ram_dataspace _ram_ds;
|
||||
|
||||
public:
|
||||
|
||||
@ -42,19 +41,17 @@ class Nitpicker::Buffer
|
||||
* \throw Out_of_caps
|
||||
* \throw Region_map::Region_conflict
|
||||
*/
|
||||
Buffer(Ram_allocator &ram, Region_map &rm,
|
||||
Area size, Framebuffer::Mode::Format format, size_t bytes)
|
||||
Buffer(Ram_allocator &ram, Region_map &rm, Area size, size_t bytes)
|
||||
:
|
||||
_size(size), _format(format), _ram_ds(ram, rm, bytes)
|
||||
_size(size), _ram_ds(ram, rm, bytes)
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Accessors
|
||||
*/
|
||||
Ram_dataspace_capability ds_cap() const { return _ram_ds.cap(); }
|
||||
Area size() const { return _size; }
|
||||
Framebuffer::Mode::Format format() const { return _format; }
|
||||
void *local_addr() const { return _ram_ds.local_addr<void>(); }
|
||||
Ram_dataspace_capability ds_cap() const { return _ram_ds.cap(); }
|
||||
Area size() const { return _size; }
|
||||
void *local_addr() const { return _ram_ds.local_addr<void>(); }
|
||||
};
|
||||
|
||||
|
||||
|
@ -25,9 +25,6 @@ class Nitpicker::Chunky_texture : public Buffer, public Texture<PT>
|
||||
{
|
||||
private:
|
||||
|
||||
Framebuffer::Mode::Format _format() {
|
||||
return Framebuffer::Mode::RGB565; }
|
||||
|
||||
/**
|
||||
* Return base address of alpha channel or 0 if no alpha channel exists
|
||||
*/
|
||||
@ -46,7 +43,7 @@ class Nitpicker::Chunky_texture : public Buffer, public Texture<PT>
|
||||
*/
|
||||
Chunky_texture(Ram_allocator &ram, Region_map &rm, Area size, bool use_alpha)
|
||||
:
|
||||
Buffer(ram, rm, size, _format(), calc_num_bytes(size, use_alpha)),
|
||||
Buffer(ram, rm, size, calc_num_bytes(size, use_alpha)),
|
||||
Texture<PT>((PT *)local_addr(),
|
||||
_alpha_base(size, use_alpha), size) { }
|
||||
|
||||
|
@ -197,13 +197,13 @@ struct Nitpicker::Main : Focus_updater
|
||||
{
|
||||
Env &_env;
|
||||
|
||||
Framebuffer::Connection _framebuffer { _env, Framebuffer::Mode() };
|
||||
Framebuffer::Connection _framebuffer { _env, Framebuffer::Mode { } };
|
||||
|
||||
Input::Connection _input { _env };
|
||||
|
||||
Attached_dataspace _ev_ds { _env.rm(), _input.dataspace() };
|
||||
|
||||
typedef Pixel_rgb565 PT; /* physical pixel type */
|
||||
typedef Pixel_rgb888 PT; /* physical pixel type */
|
||||
|
||||
/*
|
||||
* Initialize framebuffer
|
||||
@ -219,7 +219,7 @@ struct Nitpicker::Main : Focus_updater
|
||||
|
||||
Attached_dataspace fb_ds;
|
||||
|
||||
Canvas<PT> screen = { fb_ds.local_addr<PT>(), Area(mode.width(), mode.height()) };
|
||||
Canvas<PT> screen = { fb_ds.local_addr<PT>(), mode.area };
|
||||
|
||||
Area size = screen.size();
|
||||
|
||||
@ -608,7 +608,7 @@ void Nitpicker::Main::_handle_fb_mode()
|
||||
_fb_screen.construct(_env.rm(), _framebuffer);
|
||||
|
||||
/* let the view stack use the new size */
|
||||
_view_stack.size(Area(_fb_screen->mode.width(), _fb_screen->mode.height()));
|
||||
_view_stack.size(_fb_screen->mode.area);
|
||||
|
||||
/* redraw */
|
||||
_view_stack.update_all_views();
|
||||
|
@ -21,7 +21,7 @@ void Session_component::_release_buffer()
|
||||
if (!_texture)
|
||||
return;
|
||||
|
||||
typedef Pixel_rgb565 PT;
|
||||
typedef Pixel_rgb888 PT;
|
||||
|
||||
Chunky_texture<PT> const *cdt = static_cast<Chunky_texture<PT> const *>(_texture);
|
||||
|
||||
@ -412,15 +412,10 @@ void Session_component::execute()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Framebuffer::Mode Session_component::mode()
|
||||
{
|
||||
Area const phys_area(_framebuffer.mode().width(),
|
||||
_framebuffer.mode().height());
|
||||
|
||||
Area const session_area = screen_area(phys_area);
|
||||
|
||||
return Framebuffer::Mode(session_area.w(), session_area.h(),
|
||||
_framebuffer.mode().format());
|
||||
return Framebuffer::Mode { .area = screen_area(_framebuffer.mode().area) };
|
||||
}
|
||||
|
||||
|
||||
@ -473,11 +468,9 @@ void Session_component::session_control(Label suffix, Session_control control)
|
||||
|
||||
Buffer *Session_component::realloc_buffer(Framebuffer::Mode mode, bool use_alpha)
|
||||
{
|
||||
typedef Pixel_rgb565 PT;
|
||||
typedef Pixel_rgb888 PT;
|
||||
|
||||
Area const size(mode.width(), mode.height());
|
||||
|
||||
_buffer_size = Chunky_texture<PT>::calc_num_bytes(size, use_alpha);
|
||||
_buffer_size = Chunky_texture<PT>::calc_num_bytes(mode.area, use_alpha);
|
||||
|
||||
/*
|
||||
* Preserve the content of the original buffer if nitpicker has
|
||||
@ -504,7 +497,7 @@ Buffer *Session_component::realloc_buffer(Framebuffer::Mode mode, bool use_alpha
|
||||
{
|
||||
try {
|
||||
return new (&_session_alloc)
|
||||
Chunky_texture<PT>(_env.ram(), _env.rm(), size, use_alpha);
|
||||
Chunky_texture<PT>(_env.ram(), _env.rm(), mode.area, use_alpha);
|
||||
} catch (...) {
|
||||
return (Chunky_texture<PT>*)nullptr;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <base/heap.h>
|
||||
#include <os/session_policy.h>
|
||||
#include <os/reporter.h>
|
||||
#include <os/pixel_rgb565.h>
|
||||
#include <os/pixel_rgb888.h>
|
||||
#include <gui_session/gui_session.h>
|
||||
|
||||
/* local includes */
|
||||
|
@ -11,7 +11,7 @@
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
#include <os/pixel_rgb565.h>
|
||||
#include <os/pixel_rgb888.h>
|
||||
|
||||
#include <nitpicker_gfx/texture_painter.h>
|
||||
#include <nitpicker_gfx/box_painter.h>
|
||||
|
@ -30,7 +30,7 @@ struct Test
|
||||
int id;
|
||||
Timer::Connection timer { env };
|
||||
Heap heap { env.ram(), env.rm() };
|
||||
Framebuffer::Connection fb { env, Framebuffer::Mode() };
|
||||
Framebuffer::Connection fb { env, Framebuffer::Mode { } };
|
||||
Attached_dataspace fb_ds { env.rm(), fb.dataspace() };
|
||||
Framebuffer::Mode const fb_mode { fb.mode() };
|
||||
char *buf[2];
|
||||
@ -100,8 +100,8 @@ struct Blit_test : Test
|
||||
{
|
||||
unsigned kib = 0;
|
||||
uint64_t const start_ms = timer.elapsed_ms();
|
||||
unsigned const w = fb_mode.width() * fb_mode.bytes_per_pixel();
|
||||
unsigned const h = fb_mode.height();
|
||||
unsigned const w = fb_mode.area.w() * fb_mode.bytes_per_pixel();
|
||||
unsigned const h = fb_mode.area.h();
|
||||
for (unsigned i = 0; timer.elapsed_ms() - start_ms < DURATION_MS; i++) {
|
||||
blit(buf[i % 2], w, fb_ds.local_addr<char>(), w, w, h);
|
||||
kib += (w * h) / 1024;
|
||||
@ -118,8 +118,8 @@ struct Unaligned_blit_test : Test
|
||||
{
|
||||
unsigned kib = 0;
|
||||
uint64_t const start_ms = timer.elapsed_ms();
|
||||
unsigned const w = fb_mode.width() * fb_mode.bytes_per_pixel();
|
||||
unsigned const h = fb_mode.height();
|
||||
unsigned const w = fb_mode.area.w() * fb_mode.bytes_per_pixel();
|
||||
unsigned const h = fb_mode.area.h();
|
||||
for (unsigned i = 0; timer.elapsed_ms() - start_ms < DURATION_MS; i++) {
|
||||
blit(buf[i % 2] + 2, w, fb_ds.local_addr<char>() + 2, w, w - 2, h);
|
||||
kib += (w * h) / 1024;
|
||||
|
@ -18,10 +18,13 @@
|
||||
#include <base/log.h>
|
||||
#include <framebuffer_session/connection.h>
|
||||
#include <base/attached_dataspace.h>
|
||||
#include <os/surface.h>
|
||||
#include <os/pixel_rgb888.h>
|
||||
#include <util/reconstructible.h>
|
||||
|
||||
|
||||
using Genode::uint16_t;
|
||||
using Area = Genode::Surface_base::Area;
|
||||
using Pixel = Genode::Pixel_rgb888;
|
||||
|
||||
class Test_environment
|
||||
{
|
||||
@ -29,13 +32,11 @@ class Test_environment
|
||||
|
||||
using Ds = Genode::Constructible<Genode::Attached_dataspace>;
|
||||
|
||||
enum Color {
|
||||
BLACK = 0x0,
|
||||
BLUE = 0x1f,
|
||||
GREEN = 0x7e0,
|
||||
RED = 0xf800,
|
||||
WHITE = 0xffff,
|
||||
};
|
||||
Pixel const BLACK = { 0, 0, 0 };
|
||||
Pixel const BLUE = { 0, 0, 255 };
|
||||
Pixel const GREEN = { 0, 255, 0 };
|
||||
Pixel const RED = { 255, 0, 0 };
|
||||
Pixel const WHITE = { 255, 255, 255 };
|
||||
|
||||
enum State { STRIPES, ALL_BLUE, ALL_GREEN, ALL_RED, COLORED };
|
||||
|
||||
@ -57,7 +58,7 @@ class Test_environment
|
||||
void _sync_handle() {
|
||||
if (_sync_cnt++ % FRAME_CNT == 0) _draw(); }
|
||||
|
||||
void _draw_frame(uint16_t volatile *, uint16_t, unsigned, unsigned);
|
||||
void _draw_frame(Pixel *, Pixel, Area);
|
||||
|
||||
Genode::size_t _fb_bpp() { return _mode.bytes_per_pixel(); }
|
||||
Genode::size_t _fb_size() { return _fb_ds->size(); }
|
||||
@ -79,9 +80,10 @@ class Test_environment
|
||||
};
|
||||
|
||||
|
||||
void Test_environment::_draw_frame(uint16_t volatile *p, uint16_t c,
|
||||
unsigned const w, unsigned const h)
|
||||
void Test_environment::_draw_frame(Pixel *p, Pixel c, Area area)
|
||||
{
|
||||
unsigned const w = area.w(), h = area.h();
|
||||
|
||||
/* top and bottom */
|
||||
for (unsigned i = 0; i < w; ++i)
|
||||
p[i] = p[(h - 1)*w + i] = c;
|
||||
@ -100,7 +102,7 @@ void Test_environment::_draw()
|
||||
case STRIPES:
|
||||
{
|
||||
Genode::log("black & white stripes");
|
||||
addr_t const stripe_width = _mode.width() / 4;
|
||||
addr_t const stripe_width = _mode.area.w() / 4;
|
||||
addr_t stripe_o = 0;
|
||||
bool stripe = 0;
|
||||
for (addr_t o = 0; o < _fb_size(); o += _fb_bpp()) {
|
||||
@ -109,11 +111,10 @@ void Test_environment::_draw()
|
||||
stripe_o = 0;
|
||||
stripe = !stripe;
|
||||
}
|
||||
*(uint16_t volatile *)(_fb_base() + o) = stripe ? BLACK : WHITE;
|
||||
*(Pixel *)(_fb_base() + o) = stripe ? BLACK : WHITE;
|
||||
}
|
||||
|
||||
_draw_frame((uint16_t volatile *)_fb_base(), RED,
|
||||
_mode.width(), _mode.height());
|
||||
_draw_frame((Pixel *)_fb_base(), RED, _mode.area);
|
||||
_state = ALL_BLUE;
|
||||
break;
|
||||
}
|
||||
@ -121,10 +122,9 @@ void Test_environment::_draw()
|
||||
{
|
||||
Genode::log("blue");
|
||||
for (addr_t o = 0; o < _fb_size(); o += _fb_bpp())
|
||||
*(uint16_t volatile *)(_fb_base() + o) = BLUE;
|
||||
*(Pixel *)(_fb_base() + o) = BLUE;
|
||||
|
||||
_draw_frame((uint16_t volatile *)_fb_base(), RED,
|
||||
_mode.width(), _mode.height());
|
||||
_draw_frame((Pixel *)_fb_base(), RED, _mode.area);
|
||||
_state = ALL_GREEN;
|
||||
break;
|
||||
}
|
||||
@ -132,10 +132,9 @@ void Test_environment::_draw()
|
||||
{
|
||||
Genode::log("green");
|
||||
for (addr_t o = 0; o < _fb_size(); o += _fb_bpp())
|
||||
*(uint16_t volatile *)(_fb_base() + o) = GREEN;
|
||||
*(Pixel *)(_fb_base() + o) = GREEN;
|
||||
|
||||
_draw_frame((uint16_t volatile *)_fb_base(), RED,
|
||||
_mode.width(), _mode.height());
|
||||
_draw_frame((Pixel *)_fb_base(), RED, _mode.area);
|
||||
_state = ALL_RED;
|
||||
break;
|
||||
}
|
||||
@ -143,10 +142,9 @@ void Test_environment::_draw()
|
||||
{
|
||||
Genode::log("red");
|
||||
for (addr_t o = 0; o < _fb_size(); o += _fb_bpp())
|
||||
*(uint16_t volatile *)(_fb_base() + o) = RED;
|
||||
*(Pixel *)(_fb_base() + o) = RED;
|
||||
|
||||
_draw_frame((uint16_t volatile *)_fb_base(), WHITE,
|
||||
_mode.width(), _mode.height());
|
||||
_draw_frame((Pixel *)_fb_base(), WHITE, _mode.area);
|
||||
_state = COLORED;
|
||||
break;
|
||||
}
|
||||
@ -155,14 +153,13 @@ void Test_environment::_draw()
|
||||
Genode::log("all colors mixed");
|
||||
unsigned i = 0;
|
||||
for (addr_t o = 0; o < _fb_size(); o += _fb_bpp(), i++)
|
||||
*(uint16_t volatile *)(_fb_base() + o) = i;
|
||||
*(Pixel *)(_fb_base() + o) = Pixel(i>>16, i>>8, i);
|
||||
|
||||
_draw_frame((uint16_t volatile *)_fb_base(), WHITE,
|
||||
_mode.width(), _mode.height());
|
||||
_draw_frame((Pixel *)_fb_base(), WHITE, _mode.area);
|
||||
_state = STRIPES;
|
||||
}
|
||||
};
|
||||
_fb.refresh(0, 0, _mode.width(), _mode.height());
|
||||
_fb.refresh(0, 0, _mode.area.w(), _mode.area.h());
|
||||
}
|
||||
|
||||
|
||||
@ -176,11 +173,6 @@ void Test_environment::_mode_handle()
|
||||
|
||||
Genode::log("framebuffer is ", _mode);
|
||||
|
||||
if (_mode.bytes_per_pixel() != 2) {
|
||||
Genode::error("pixel format not supported");
|
||||
throw -1;
|
||||
}
|
||||
|
||||
_draw();
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <gui_session/connection.h>
|
||||
#include <timer_session/connection.h>
|
||||
#include <input/event.h>
|
||||
#include <os/pixel_rgb888.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
@ -150,10 +151,10 @@ void Component::construct(Genode::Env &env)
|
||||
static Gui::Connection gui { env, "testnit" };
|
||||
static Timer::Connection timer { env };
|
||||
|
||||
Framebuffer::Mode const mode(256, 256, Framebuffer::Mode::RGB565);
|
||||
Framebuffer::Mode const mode { .area = { 256, 256 } };
|
||||
gui.buffer(mode, false);
|
||||
|
||||
int const scr_w = mode.width(), scr_h = mode.height();
|
||||
int const scr_w = mode.area.w(), scr_h = mode.area.h();
|
||||
|
||||
log("screen is ", mode);
|
||||
if (!scr_w || !scr_h) {
|
||||
@ -172,7 +173,8 @@ void Component::construct(Genode::Env &env)
|
||||
Genode::Attached_dataspace fb_ds(
|
||||
env.rm(), gui.framebuffer()->dataspace());
|
||||
|
||||
short *pixels = fb_ds.local_addr<short>();
|
||||
typedef Genode::Pixel_rgb888 PT;
|
||||
PT *pixels = fb_ds.local_addr<PT>();
|
||||
unsigned char *alpha = (unsigned char *)&pixels[scr_w*scr_h];
|
||||
unsigned char *input_mask = CONFIG_ALPHA ? alpha + scr_w*scr_h : 0;
|
||||
|
||||
@ -183,7 +185,7 @@ void Component::construct(Genode::Env &env)
|
||||
*/
|
||||
for (int i = 0; i < scr_h; i++)
|
||||
for (int j = 0; j < scr_w; j++) {
|
||||
pixels[i*scr_w + j] = (i/8)*32*64 + (j/4)*32 + i*j/256;
|
||||
pixels[i*scr_w + j] = PT((3*i)/8, j, i*j/32);
|
||||
if (CONFIG_ALPHA) {
|
||||
alpha[i*scr_w + j] = (i*2) ^ (j*2);
|
||||
input_mask[i*scr_w + j] = alpha[i*scr_w + j] > 127;
|
||||
|
@ -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>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user