mirror of
https://github.com/genodelabs/genode.git
synced 2025-03-23 04:25:21 +00:00
mesa_demo: adjust to Mesa 21.0.0
* support argc/argv + double buffering (Alexander Boettcher) * Route intel/gpu driver to platform driver * Use Gui session instead of framebuffer session (Josef Söntgen) issue #4254
This commit is contained in:
parent
e4ae817e82
commit
46be4f1145
@ -1,7 +1,7 @@
|
||||
set demo_component test/mesa_demo/gears
|
||||
set demo_binary gears
|
||||
set demo_ram_quota 256M
|
||||
set demo_caps 1500
|
||||
set demo_ram_quota 32M
|
||||
set demo_caps 300
|
||||
|
||||
set demo_config {
|
||||
<config ld_verbose="true">
|
||||
|
@ -20,15 +20,12 @@ lappend imports [depot_user]/pkg/drivers_interactive-[board]
|
||||
}
|
||||
|
||||
lappend imports [depot_user]/src/nitpicker
|
||||
lappend imports [depot_user]/src/gui_fb
|
||||
lappend imports [depot_user]/src/demo
|
||||
lappend imports [depot_user]/src/report_rom
|
||||
|
||||
import_from_depot $imports
|
||||
|
||||
set build_components {
|
||||
drivers/gpu/intel
|
||||
drivers/framebuffer/intel
|
||||
lib/mesa/softpipe
|
||||
core init timer
|
||||
}
|
||||
@ -107,58 +104,23 @@ set backend_library egl_swrast.lib.so
|
||||
if {$use_iris} { set backend_library egl_iris.lib.so }
|
||||
if {$use_etnaviv} { set backend_library egl_etnaviv.lib.so }
|
||||
|
||||
set launchpad_config {
|
||||
<config>
|
||||
<launcher name="init" ram_quota="1G" caps="2000">
|
||||
<config verbose="yes">
|
||||
<parent-provides>
|
||||
<service name="ROM"/>
|
||||
<service name="IRQ"/>
|
||||
<service name="IO_MEM"/>
|
||||
<service name="IO_PORT"/>
|
||||
<service name="PD"/>
|
||||
<service name="RM"/>
|
||||
<service name="CPU"/>
|
||||
<service name="LOG"/>
|
||||
<service name="Gui"/>
|
||||
<service name="Timer"/>
|
||||
<service name="Gpu"/>
|
||||
</parent-provides>
|
||||
append config "
|
||||
<start name=\"$demo_binary\" caps=\"$demo_caps\">
|
||||
<resource name=\"RAM\" quantum=\"$demo_ram_quota\"/>"
|
||||
|
||||
<start name="liquid_fb" caps="200">
|
||||
<resource name="RAM" quantum="16M"/>
|
||||
<provides> <service name="Framebuffer"/> <service name="Input"/> </provides>
|
||||
<config resize_handle="off" animate="off" title="gears" width="600" height="600" xpos="100" ypos="100"/>
|
||||
<route>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</route>
|
||||
</start>}
|
||||
|
||||
append launchpad_config "
|
||||
<start name=\"$demo_binary\" caps=\"$demo_caps\">
|
||||
<resource name=\"RAM\" quantum=\"$demo_ram_quota\"/>"
|
||||
|
||||
append launchpad_config $demo_config
|
||||
|
||||
append launchpad_config "
|
||||
<route>
|
||||
<service name=\"ROM\" label=\"egl_drv.lib.so\">
|
||||
<parent label=\"$backend_library\"/>
|
||||
</service>"
|
||||
append launchpad_config {
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
</config>
|
||||
</launcher>
|
||||
</config>}
|
||||
append config $demo_config
|
||||
|
||||
append config "
|
||||
<route>
|
||||
<service name=\"ROM\" label=\"egl_drv.lib.so\">
|
||||
<parent label=\"$backend_library\"/>
|
||||
</service>"
|
||||
append config {
|
||||
<start name="launchpad" caps="3000">
|
||||
<resource name="RAM" quantum="512M"/>}
|
||||
append config $launchpad_config
|
||||
append config {
|
||||
</start>}
|
||||
<service name="Gui"> <child name="nitpicker"/> </service>
|
||||
<any-service> <parent/> <any-child/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
}
|
||||
|
||||
append_if $use_iris config {
|
||||
<start name="intel_gpu_drv" caps="2000">
|
||||
@ -172,13 +134,7 @@ append_if $use_iris config {
|
||||
<any-service> <parent /> <any-child/> </any-service>
|
||||
</route>
|
||||
</start>
|
||||
<start name="intel_fb_drv" caps="1000">
|
||||
<resource name="RAM" quantum="96M"/>
|
||||
<route>
|
||||
<service name="Platform"> <child name="intel_gpu_drv"/> </service>
|
||||
<any-service> <parent/> <any-child /> </any-service>
|
||||
</route>
|
||||
</start>}
|
||||
}
|
||||
|
||||
append_if $use_etnaviv config {
|
||||
<start name="imx8q_gpu_drv" caps="200">
|
||||
@ -206,7 +162,7 @@ set boot_modules {
|
||||
|
||||
append_if $use_iris boot_modules {
|
||||
egl_iris.lib.so libdrm.lib.so
|
||||
intel_gpu_drv intel_fb_drv
|
||||
intel_gpu_drv
|
||||
}
|
||||
|
||||
append_if $use_etnaviv boot_modules {
|
||||
|
@ -26,10 +26,12 @@
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <base/attached_dataspace.h>
|
||||
#include <base/heap.h>
|
||||
#include <base/debug.h>
|
||||
#include <framebuffer_session/connection.h>
|
||||
#include <gui_session/connection.h>
|
||||
#include <libc/component.h>
|
||||
#include <libc/args.h>
|
||||
|
||||
extern "C" {
|
||||
#include "eglutint.h"
|
||||
@ -49,66 +51,59 @@ Genode::Entrypoint &genode_entrypoint()
|
||||
|
||||
struct Window : Genode_egl_window
|
||||
{
|
||||
Genode::Env &env;
|
||||
Genode::Constructible<Framebuffer::Connection> framebuffer;
|
||||
Genode::Io_signal_handler<Window> mode_dispatcher;
|
||||
bool mode_change_pending = false;
|
||||
using View_handle = Gui::Session::View_handle;
|
||||
using Command = Gui::Session::Command;
|
||||
|
||||
Genode::Env &env;
|
||||
Framebuffer::Mode mode;
|
||||
Gui::Connection gui { env };
|
||||
Genode::Constructible<Genode::Attached_dataspace> ds { };
|
||||
View_handle view { };
|
||||
|
||||
Genode::addr_t fb_addr { 0 };
|
||||
Genode::addr_t fb_size { 0 };
|
||||
Genode::Ram_dataspace_capability buffer_cap { };
|
||||
|
||||
Window(Genode::Env &env, int w, int h)
|
||||
:
|
||||
env(env),
|
||||
mode_dispatcher(*signal_ep, *this, &Window::mode_handler)
|
||||
env(env), mode { .area = Gui::Area(w, h) }
|
||||
{
|
||||
width = w;
|
||||
height = h;
|
||||
type = WINDOW;
|
||||
|
||||
Framebuffer::Mode const mode { .area = { (unsigned)width, (unsigned)height } };
|
||||
|
||||
framebuffer.construct(env, mode);
|
||||
addr = env.rm().attach(framebuffer->dataspace());
|
||||
|
||||
framebuffer->mode_sigh(mode_dispatcher);
|
||||
gui.buffer(mode, false);
|
||||
view = gui.create_view();
|
||||
|
||||
mode_change();
|
||||
}
|
||||
|
||||
void mode_handler()
|
||||
{
|
||||
mode_change_pending = true;
|
||||
}
|
||||
|
||||
void update()
|
||||
{
|
||||
env.rm().detach(addr);
|
||||
addr = env.rm().attach(framebuffer->dataspace());
|
||||
gui.enqueue<Command::Title>(view, "eglut");
|
||||
gui.enqueue<Command::To_front>(view, View_handle());
|
||||
gui.execute();
|
||||
}
|
||||
|
||||
void mode_change()
|
||||
{
|
||||
Framebuffer::Mode mode = framebuffer->mode();
|
||||
if (ds.constructed())
|
||||
ds.destruct();
|
||||
|
||||
eglut_window *win = _eglut->current;
|
||||
if (win) {
|
||||
win->native.width = mode.area.w();
|
||||
win->native.height = mode.area.h();
|
||||
width = mode.area.w();
|
||||
height = mode.area.h();
|
||||
ds.construct(env.rm(), gui.framebuffer()->dataspace());
|
||||
|
||||
if (win->reshape_cb)
|
||||
win->reshape_cb(win->native.width, win->native.height);
|
||||
}
|
||||
|
||||
update();
|
||||
mode_change_pending = false;
|
||||
addr = ds->local_addr<unsigned char>();
|
||||
|
||||
Gui::Rect rect { Gui::Point { 0, 0 }, mode.area };
|
||||
gui.enqueue<Command::Geometry>(view, rect);
|
||||
gui.execute();
|
||||
}
|
||||
|
||||
void refresh()
|
||||
{
|
||||
framebuffer->refresh(0, 0, width, height);
|
||||
gui.framebuffer()->refresh(0, 0, mode.area.w(), mode.area.h());
|
||||
}
|
||||
};
|
||||
|
||||
Genode::Constructible<Window> eglut_win;
|
||||
|
||||
static Genode::Constructible<Window> eglut_win;
|
||||
|
||||
|
||||
void _eglutNativeInitDisplay()
|
||||
@ -145,10 +140,6 @@ void _eglutNativeEventLoop()
|
||||
while (true) {
|
||||
struct eglut_window *win =_eglut->current;
|
||||
|
||||
if (eglut_win->mode_change_pending) {
|
||||
eglut_win->mode_change();
|
||||
}
|
||||
|
||||
if (_eglut->idle_cb)
|
||||
_eglut->idle_cb();
|
||||
|
||||
@ -171,10 +162,28 @@ void _eglutNativeEventLoop()
|
||||
extern "C" int eglut_main(int argc, char *argv[]);
|
||||
|
||||
|
||||
/* initial environment for the FreeBSD libc implementation */
|
||||
extern char **environ;
|
||||
|
||||
|
||||
static void construct_component(Libc::Env &env)
|
||||
{
|
||||
int argc = 0;
|
||||
char **argv = nullptr;
|
||||
char **envp = nullptr;
|
||||
|
||||
populate_args_and_env(env, argc, argv, envp);
|
||||
|
||||
environ = envp;
|
||||
|
||||
exit(eglut_main(argc, argv));
|
||||
}
|
||||
|
||||
|
||||
void Libc::Component::construct(Libc::Env &env)
|
||||
{
|
||||
genode_env = &env;
|
||||
signal_ep.construct(env, 1024*sizeof(long), "eglut_signal_ep",
|
||||
Genode::Affinity::Location());
|
||||
Libc::with_libc([] () { eglut_main(1, nullptr); });
|
||||
Libc::with_libc([&] () { construct_component(env); });
|
||||
}
|
||||
|
@ -16,6 +16,9 @@
|
||||
|
||||
<default caps="60"/>
|
||||
|
||||
<service name="Platform">
|
||||
<default-policy> <child name="platform_drv"/> </default-policy> </service>
|
||||
|
||||
<start name="acpi_drv" caps="250">
|
||||
<resource name="RAM" quantum="4M"/>
|
||||
<route>
|
||||
@ -69,12 +72,19 @@
|
||||
<policy label_prefix="ps2_drv"> <device name="PS2"/> </policy>
|
||||
<policy label_prefix="fb_drv"> <pci class="VGA"/> </policy>
|
||||
<policy label_prefix="usb_drv"> <pci class="USB"/> </policy>
|
||||
<policy label_prefix="nic_drv"> <pci class="ETHERNET"/> </policy>
|
||||
<policy label_prefix="wifi_drv"> <pci class="WIFI"/> </policy>
|
||||
<policy label_prefix="intel_gpu_drv">
|
||||
<pci class="VGA"/>
|
||||
<pci bus="0" device="0" function="0"/>
|
||||
<pci class="ISABRIDGE"/>
|
||||
</policy>
|
||||
</config>
|
||||
</start>
|
||||
|
||||
<start name="fb_drv" caps="120">
|
||||
<binary name="vesa_fb_drv"/>
|
||||
<resource name="RAM" quantum="16M"/>
|
||||
<resource name="RAM" quantum="24M"/>
|
||||
<route>
|
||||
<service name="ROM" label="config"> <parent label="fb_drv.config"/> </service>
|
||||
<service name="Platform"> <child name="platform_drv"/> </service>
|
||||
|
Loading…
x
Reference in New Issue
Block a user