mirror of
https://gitlab.freedesktop.org/plymouth/plymouth.git
synced 2026-05-08 18:18:05 +02:00
renderer: provide way to override renderer plugin
This will allow us to force e.g. frame-buffer even if drm would work.
This commit is contained in:
parent
7b1a16579b
commit
f16ba574a2
3 changed files with 47 additions and 28 deletions
|
|
@ -49,6 +49,7 @@ struct _ply_renderer
|
|||
const ply_renderer_plugin_interface_t *plugin_interface;
|
||||
ply_renderer_backend_t *backend;
|
||||
|
||||
char *plugin_path;
|
||||
char *device_name;
|
||||
ply_terminal_t *terminal;
|
||||
|
||||
|
|
@ -62,13 +63,17 @@ typedef const ply_renderer_plugin_interface_t *
|
|||
static void ply_renderer_unload_plugin (ply_renderer_t *renderer);
|
||||
|
||||
ply_renderer_t *
|
||||
ply_renderer_new (const char * device_name,
|
||||
ply_renderer_new (const char *plugin_path,
|
||||
const char *device_name,
|
||||
ply_terminal_t *terminal)
|
||||
{
|
||||
ply_renderer_t *renderer;
|
||||
|
||||
renderer = calloc (1, sizeof (struct _ply_renderer));
|
||||
|
||||
if (plugin_path != NULL)
|
||||
renderer->plugin_path = strdup (plugin_path);
|
||||
|
||||
if (device_name != NULL)
|
||||
renderer->device_name = strdup (device_name);
|
||||
|
||||
|
|
@ -90,6 +95,7 @@ ply_renderer_free (ply_renderer_t *renderer)
|
|||
}
|
||||
|
||||
free (renderer->device_name);
|
||||
free (renderer->plugin_path);
|
||||
free (renderer);
|
||||
}
|
||||
|
||||
|
|
@ -217,6 +223,36 @@ ply_renderer_unmap_from_device (ply_renderer_t *renderer)
|
|||
renderer->is_mapped = false;
|
||||
}
|
||||
|
||||
static bool
|
||||
ply_renderer_open_plugin (ply_renderer_t *renderer,
|
||||
const char *plugin_path)
|
||||
{
|
||||
ply_trace ("trying to open renderer plugin %s", plugin_path);
|
||||
|
||||
if (!ply_renderer_load_plugin (renderer, plugin_path))
|
||||
return false;
|
||||
|
||||
if (!ply_renderer_open_device (renderer))
|
||||
{
|
||||
ply_trace ("could not open rendering device for plugin %s",
|
||||
plugin_path);
|
||||
ply_renderer_unload_plugin (renderer);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ply_renderer_query_device (renderer))
|
||||
{
|
||||
ply_trace ("could not query rendering device for plugin %s",
|
||||
plugin_path);
|
||||
ply_renderer_close_device (renderer);
|
||||
ply_renderer_unload_plugin (renderer);
|
||||
return false;
|
||||
}
|
||||
|
||||
ply_trace ("opened renderer plugin %s", plugin_path);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ply_renderer_open (ply_renderer_t *renderer)
|
||||
{
|
||||
|
|
@ -234,33 +270,15 @@ ply_renderer_open (ply_renderer_t *renderer)
|
|||
NULL
|
||||
};
|
||||
|
||||
if (renderer->plugin_path != NULL)
|
||||
{
|
||||
return ply_renderer_open_plugin (renderer, renderer->plugin_path);
|
||||
}
|
||||
|
||||
for (i = 0; known_plugins[i] != NULL; i++)
|
||||
{
|
||||
const char *plugin_path;
|
||||
|
||||
plugin_path = known_plugins[i];
|
||||
|
||||
if (!ply_renderer_load_plugin (renderer, plugin_path))
|
||||
continue;
|
||||
|
||||
if (!ply_renderer_open_device (renderer))
|
||||
{
|
||||
ply_trace ("could not open rendering device for plugin %s",
|
||||
plugin_path);
|
||||
ply_renderer_unload_plugin (renderer);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!ply_renderer_query_device (renderer))
|
||||
{
|
||||
ply_trace ("could not query rendering device for plugin %s",
|
||||
plugin_path);
|
||||
ply_renderer_close_device (renderer);
|
||||
ply_renderer_unload_plugin (renderer);
|
||||
continue;
|
||||
}
|
||||
|
||||
return true;
|
||||
if (ply_renderer_open_plugin (renderer, known_plugins[i]))
|
||||
return true;
|
||||
}
|
||||
|
||||
ply_trace ("could not find suitable rendering plugin");
|
||||
|
|
|
|||
|
|
@ -40,7 +40,8 @@ typedef void (* ply_renderer_input_source_handler_t) (void
|
|||
ply_renderer_input_source_t *input_source);
|
||||
|
||||
#ifndef PLY_HIDE_FUNCTION_DECLARATIONS
|
||||
ply_renderer_t *ply_renderer_new (const char * device_name,
|
||||
ply_renderer_t *ply_renderer_new (const char *plugin_path,
|
||||
const char *device_name,
|
||||
ply_terminal_t *terminal);
|
||||
void ply_renderer_free (ply_renderer_t *renderer);
|
||||
bool ply_renderer_open (ply_renderer_t *renderer);
|
||||
|
|
|
|||
|
|
@ -1443,7 +1443,7 @@ add_default_displays_and_keyboard (state_t *state)
|
|||
|
||||
terminal = ply_terminal_new (state->default_tty);
|
||||
|
||||
renderer = ply_renderer_new (NULL, terminal);
|
||||
renderer = ply_renderer_new (NULL, NULL, terminal);
|
||||
|
||||
if (!ply_renderer_open (renderer))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue