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:
Norman Feske
2020-06-16 15:46:59 +02:00
parent 6119e03081
commit ef741ef80d
112 changed files with 500 additions and 696 deletions

View File

@@ -1,5 +1,6 @@
base
os
blit
platform_session
timer_session
report_session

View File

@@ -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);
}
};

View File

@@ -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

View File

@@ -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; }

View File

@@ -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;