mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-18 07:08:18 +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:
@ -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); }
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user