From bda90f63c1194a312426eb2528f37f505672d8f9 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Thu, 8 Oct 2009 15:59:15 -0400 Subject: [PATCH 1/2] [renderer] make map and unmap idempotent --- src/libplybootsplash/ply-renderer.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/src/libplybootsplash/ply-renderer.c b/src/libplybootsplash/ply-renderer.c index 0966418..7c6695f 100644 --- a/src/libplybootsplash/ply-renderer.c +++ b/src/libplybootsplash/ply-renderer.c @@ -54,6 +54,7 @@ struct _ply_renderer ply_console_t *console; uint32_t input_source_is_open : 1; + uint32_t is_mapped : 1; }; typedef const ply_renderer_plugin_interface_t * @@ -199,7 +200,12 @@ ply_renderer_map_to_device (ply_renderer_t *renderer) assert (renderer != NULL); assert (renderer->plugin_interface != NULL); - return renderer->plugin_interface->map_to_device (renderer->backend); + if (renderer->is_mapped) + return true; + + renderer->is_mapped = renderer->plugin_interface->map_to_device (renderer->backend); + + return renderer->is_mapped; } static void @@ -208,7 +214,11 @@ ply_renderer_unmap_from_device (ply_renderer_t *renderer) assert (renderer != NULL); assert (renderer->plugin_interface != NULL); + if (!renderer->is_mapped) + return; + renderer->plugin_interface->unmap_from_device (renderer->backend); + renderer->is_mapped = false; } bool -- 1.6.5.rc2 From 89f07b8f81da2eddf31758d990d9cb262f2ba0ae Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Thu, 8 Oct 2009 16:01:56 -0400 Subject: [PATCH 2/2] [renderer] map buffer lazily This is to prevent screen clears on plugins that don't use the renderers (text plugins) --- src/libplybootsplash/ply-renderer.c | 11 +++-------- 1 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/libplybootsplash/ply-renderer.c b/src/libplybootsplash/ply-renderer.c index 7c6695f..591af2c 100644 --- a/src/libplybootsplash/ply-renderer.c +++ b/src/libplybootsplash/ply-renderer.c @@ -264,14 +264,6 @@ ply_renderer_open (ply_renderer_t *renderer) continue; } - if (!ply_renderer_map_to_device (renderer)) - { - ply_trace ("could not map renderer to device for plugin %s", - plugin_path); - ply_renderer_close_device (renderer); - ply_renderer_unload_plugin (renderer); - continue; - } return true; } @@ -314,6 +306,9 @@ ply_renderer_flush_head (ply_renderer_t *renderer, assert (renderer->plugin_interface != NULL); assert (head != NULL); + if (!ply_renderer_map_to_device (renderer)) + return; + renderer->plugin_interface->flush_head (renderer->backend, head); } -- 1.6.5.rc2 From 5d631743d6b4ef0ab861d9dd83719390af7fdab0 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Fri, 9 Oct 2009 17:38:17 -0400 Subject: [PATCH] [frame-buffer] initialize head on query not map That's the "right" thing to do and now that we map lazily, doing it the old way is broken. --- src/plugins/renderers/frame-buffer/plugin.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/renderers/frame-buffer/plugin.c b/src/plugins/renderers/frame-buffer/plugin.c index 0163daa..ce42eb3 100644 --- a/src/plugins/renderers/frame-buffer/plugin.c +++ b/src/plugins/renderers/frame-buffer/plugin.c @@ -338,6 +338,8 @@ close_device (ply_renderer_backend_t *backend) (ply_console_active_vt_changed_handler_t) on_active_vt_changed, backend); + uninitialize_head (backend, &backend->head); + close (backend->device_fd); backend->device_fd = -1; @@ -468,6 +470,8 @@ query_device (ply_renderer_backend_t *backend) else backend->flush_area = flush_area_to_any_device; + initialize_head (backend, &backend->head); + return true; } @@ -489,8 +493,6 @@ map_to_device (ply_renderer_backend_t *backend) if (head->map_address == MAP_FAILED) return false; - initialize_head (backend, head); - ply_console_set_active_vt (backend->console, ply_terminal_get_vt_number (backend->terminal)); @@ -504,8 +506,6 @@ unmap_from_device (ply_renderer_backend_t *backend) head = &backend->head; - uninitialize_head (backend, head); - if (head->map_address != MAP_FAILED) { munmap (head->map_address, head->size); -- 1.6.5.rc2