From 6e687a50a93ae780b5a7cbc03193f40f6e80eaa6 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sun, 18 Feb 2018 11:53:17 -0800 Subject: *: embrace new generic settings paradigm This should probably be split into multiple commits, but for simplicity sake it's all cut over at once. drm_fb.c sees major changes, migrating the remaining drm-specific bits from drmsetup into it, behind the settings API. rototiller.c sees a bunch of scaffolding surrounding the settings API and wiring it up into the commandline handling and renderers and video backends. fb.[ch] see minor changes as settings get plumbed to the backend drmsetup.[ch] goes bye bye --- src/fb.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/fb.c') diff --git a/src/fb.c b/src/fb.c index a23bce5..f398d43 100644 --- a/src/fb.c +++ b/src/fb.c @@ -5,6 +5,7 @@ #include #include "fb.h" +#include "settings.h" #include "util.h" /* Copyright (C) 2016-2017 Vito Caputo */ @@ -240,6 +241,9 @@ void fb_free(fb_t *fb) /* TODO: free all the pages */ + if (fb->ops->shutdown && fb->ops_context) + fb->ops->shutdown(fb->ops_context); + pthread_mutex_destroy(&fb->ready_mutex); pthread_cond_destroy(&fb->ready_cond); pthread_mutex_destroy(&fb->inactive_mutex); @@ -250,7 +254,7 @@ void fb_free(fb_t *fb) /* create a new fb instance */ -fb_t * fb_new(const fb_ops_t *ops, void *context, int n_pages) +fb_t * fb_new(const fb_ops_t *ops, settings_t *settings, int n_pages) { _fb_page_t *page; fb_t *fb; @@ -271,7 +275,11 @@ fb_t * fb_new(const fb_ops_t *ops, void *context, int n_pages) return NULL; fb->ops = ops; - fb->ops_context = context; + if (ops->init) { + fb->ops_context = ops->init(settings); + if (!fb->ops_context) + goto fail; + } for (i = 0; i < n_pages; i++) fb_page_new(fb); -- cgit v1.2.1