mirror of
https://github.com/genodelabs/genode.git
synced 2025-03-24 21:15:35 +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_component test/mesa_demo/gears
|
||||||
set demo_binary gears
|
set demo_binary gears
|
||||||
set demo_ram_quota 256M
|
set demo_ram_quota 32M
|
||||||
set demo_caps 1500
|
set demo_caps 300
|
||||||
|
|
||||||
set demo_config {
|
set demo_config {
|
||||||
<config ld_verbose="true">
|
<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/nitpicker
|
||||||
lappend imports [depot_user]/src/gui_fb
|
|
||||||
lappend imports [depot_user]/src/demo
|
|
||||||
lappend imports [depot_user]/src/report_rom
|
lappend imports [depot_user]/src/report_rom
|
||||||
|
|
||||||
import_from_depot $imports
|
import_from_depot $imports
|
||||||
|
|
||||||
set build_components {
|
set build_components {
|
||||||
drivers/gpu/intel
|
drivers/gpu/intel
|
||||||
drivers/framebuffer/intel
|
|
||||||
lib/mesa/softpipe
|
lib/mesa/softpipe
|
||||||
core init timer
|
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_iris} { set backend_library egl_iris.lib.so }
|
||||||
if {$use_etnaviv} { set backend_library egl_etnaviv.lib.so }
|
if {$use_etnaviv} { set backend_library egl_etnaviv.lib.so }
|
||||||
|
|
||||||
set launchpad_config {
|
append config "
|
||||||
<config>
|
<start name=\"$demo_binary\" caps=\"$demo_caps\">
|
||||||
<launcher name="init" ram_quota="1G" caps="2000">
|
<resource name=\"RAM\" quantum=\"$demo_ram_quota\"/>"
|
||||||
<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>
|
|
||||||
|
|
||||||
<start name="liquid_fb" caps="200">
|
append config $demo_config
|
||||||
<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 "
|
||||||
|
<route>
|
||||||
|
<service name=\"ROM\" label=\"egl_drv.lib.so\">
|
||||||
|
<parent label=\"$backend_library\"/>
|
||||||
|
</service>"
|
||||||
append config {
|
append config {
|
||||||
<start name="launchpad" caps="3000">
|
<service name="Gui"> <child name="nitpicker"/> </service>
|
||||||
<resource name="RAM" quantum="512M"/>}
|
<any-service> <parent/> <any-child/> </any-service>
|
||||||
append config $launchpad_config
|
</route>
|
||||||
append config {
|
</start>
|
||||||
</start>}
|
}
|
||||||
|
|
||||||
append_if $use_iris config {
|
append_if $use_iris config {
|
||||||
<start name="intel_gpu_drv" caps="2000">
|
<start name="intel_gpu_drv" caps="2000">
|
||||||
@ -172,13 +134,7 @@ append_if $use_iris config {
|
|||||||
<any-service> <parent /> <any-child/> </any-service>
|
<any-service> <parent /> <any-child/> </any-service>
|
||||||
</route>
|
</route>
|
||||||
</start>
|
</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 {
|
append_if $use_etnaviv config {
|
||||||
<start name="imx8q_gpu_drv" caps="200">
|
<start name="imx8q_gpu_drv" caps="200">
|
||||||
@ -206,7 +162,7 @@ set boot_modules {
|
|||||||
|
|
||||||
append_if $use_iris boot_modules {
|
append_if $use_iris boot_modules {
|
||||||
egl_iris.lib.so libdrm.lib.so
|
egl_iris.lib.so libdrm.lib.so
|
||||||
intel_gpu_drv intel_fb_drv
|
intel_gpu_drv
|
||||||
}
|
}
|
||||||
|
|
||||||
append_if $use_etnaviv boot_modules {
|
append_if $use_etnaviv boot_modules {
|
||||||
|
@ -26,10 +26,12 @@
|
|||||||
* DEALINGS IN THE SOFTWARE.
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <base/attached_dataspace.h>
|
||||||
#include <base/heap.h>
|
#include <base/heap.h>
|
||||||
#include <base/debug.h>
|
#include <base/debug.h>
|
||||||
#include <framebuffer_session/connection.h>
|
#include <gui_session/connection.h>
|
||||||
#include <libc/component.h>
|
#include <libc/component.h>
|
||||||
|
#include <libc/args.h>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "eglutint.h"
|
#include "eglutint.h"
|
||||||
@ -49,66 +51,59 @@ Genode::Entrypoint &genode_entrypoint()
|
|||||||
|
|
||||||
struct Window : Genode_egl_window
|
struct Window : Genode_egl_window
|
||||||
{
|
{
|
||||||
Genode::Env &env;
|
using View_handle = Gui::Session::View_handle;
|
||||||
Genode::Constructible<Framebuffer::Connection> framebuffer;
|
using Command = Gui::Session::Command;
|
||||||
Genode::Io_signal_handler<Window> mode_dispatcher;
|
|
||||||
bool mode_change_pending = false;
|
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)
|
Window(Genode::Env &env, int w, int h)
|
||||||
:
|
:
|
||||||
env(env),
|
env(env), mode { .area = Gui::Area(w, h) }
|
||||||
mode_dispatcher(*signal_ep, *this, &Window::mode_handler)
|
|
||||||
{
|
{
|
||||||
width = w;
|
width = w;
|
||||||
height = h;
|
height = h;
|
||||||
|
type = WINDOW;
|
||||||
|
|
||||||
Framebuffer::Mode const mode { .area = { (unsigned)width, (unsigned)height } };
|
gui.buffer(mode, false);
|
||||||
|
view = gui.create_view();
|
||||||
framebuffer.construct(env, mode);
|
|
||||||
addr = env.rm().attach(framebuffer->dataspace());
|
|
||||||
|
|
||||||
framebuffer->mode_sigh(mode_dispatcher);
|
|
||||||
|
|
||||||
mode_change();
|
mode_change();
|
||||||
}
|
|
||||||
|
|
||||||
void mode_handler()
|
gui.enqueue<Command::Title>(view, "eglut");
|
||||||
{
|
gui.enqueue<Command::To_front>(view, View_handle());
|
||||||
mode_change_pending = true;
|
gui.execute();
|
||||||
}
|
|
||||||
|
|
||||||
void update()
|
|
||||||
{
|
|
||||||
env.rm().detach(addr);
|
|
||||||
addr = env.rm().attach(framebuffer->dataspace());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void mode_change()
|
void mode_change()
|
||||||
{
|
{
|
||||||
Framebuffer::Mode mode = framebuffer->mode();
|
if (ds.constructed())
|
||||||
|
ds.destruct();
|
||||||
|
|
||||||
eglut_window *win = _eglut->current;
|
ds.construct(env.rm(), gui.framebuffer()->dataspace());
|
||||||
if (win) {
|
|
||||||
win->native.width = mode.area.w();
|
|
||||||
win->native.height = mode.area.h();
|
|
||||||
width = mode.area.w();
|
|
||||||
height = mode.area.h();
|
|
||||||
|
|
||||||
if (win->reshape_cb)
|
addr = ds->local_addr<unsigned char>();
|
||||||
win->reshape_cb(win->native.width, win->native.height);
|
|
||||||
}
|
Gui::Rect rect { Gui::Point { 0, 0 }, mode.area };
|
||||||
|
gui.enqueue<Command::Geometry>(view, rect);
|
||||||
update();
|
gui.execute();
|
||||||
mode_change_pending = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void refresh()
|
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()
|
void _eglutNativeInitDisplay()
|
||||||
@ -145,10 +140,6 @@ void _eglutNativeEventLoop()
|
|||||||
while (true) {
|
while (true) {
|
||||||
struct eglut_window *win =_eglut->current;
|
struct eglut_window *win =_eglut->current;
|
||||||
|
|
||||||
if (eglut_win->mode_change_pending) {
|
|
||||||
eglut_win->mode_change();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_eglut->idle_cb)
|
if (_eglut->idle_cb)
|
||||||
_eglut->idle_cb();
|
_eglut->idle_cb();
|
||||||
|
|
||||||
@ -171,10 +162,28 @@ void _eglutNativeEventLoop()
|
|||||||
extern "C" int eglut_main(int argc, char *argv[]);
|
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)
|
void Libc::Component::construct(Libc::Env &env)
|
||||||
{
|
{
|
||||||
genode_env = &env;
|
genode_env = &env;
|
||||||
signal_ep.construct(env, 1024*sizeof(long), "eglut_signal_ep",
|
signal_ep.construct(env, 1024*sizeof(long), "eglut_signal_ep",
|
||||||
Genode::Affinity::Location());
|
Genode::Affinity::Location());
|
||||||
Libc::with_libc([] () { eglut_main(1, nullptr); });
|
Libc::with_libc([&] () { construct_component(env); });
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,9 @@
|
|||||||
|
|
||||||
<default caps="60"/>
|
<default caps="60"/>
|
||||||
|
|
||||||
|
<service name="Platform">
|
||||||
|
<default-policy> <child name="platform_drv"/> </default-policy> </service>
|
||||||
|
|
||||||
<start name="acpi_drv" caps="250">
|
<start name="acpi_drv" caps="250">
|
||||||
<resource name="RAM" quantum="4M"/>
|
<resource name="RAM" quantum="4M"/>
|
||||||
<route>
|
<route>
|
||||||
@ -69,12 +72,19 @@
|
|||||||
<policy label_prefix="ps2_drv"> <device name="PS2"/> </policy>
|
<policy label_prefix="ps2_drv"> <device name="PS2"/> </policy>
|
||||||
<policy label_prefix="fb_drv"> <pci class="VGA"/> </policy>
|
<policy label_prefix="fb_drv"> <pci class="VGA"/> </policy>
|
||||||
<policy label_prefix="usb_drv"> <pci class="USB"/> </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>
|
</config>
|
||||||
</start>
|
</start>
|
||||||
|
|
||||||
<start name="fb_drv" caps="120">
|
<start name="fb_drv" caps="120">
|
||||||
<binary name="vesa_fb_drv"/>
|
<binary name="vesa_fb_drv"/>
|
||||||
<resource name="RAM" quantum="16M"/>
|
<resource name="RAM" quantum="24M"/>
|
||||||
<route>
|
<route>
|
||||||
<service name="ROM" label="config"> <parent label="fb_drv.config"/> </service>
|
<service name="ROM" label="config"> <parent label="fb_drv.config"/> </service>
|
||||||
<service name="Platform"> <child name="platform_drv"/> </service>
|
<service name="Platform"> <child name="platform_drv"/> </service>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user