1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
4 This file is part of systemd.
6 Copyright (C) 2014 David Herrmann <dh.herrmann@gmail.com>
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
27 #include <systemd/sd-bus.h>
28 #include <systemd/sd-event.h>
34 typedef struct grdev_tile grdev_tile;
35 typedef struct grdev_display_cache grdev_display_cache;
37 typedef struct grdev_pipe_vtable grdev_pipe_vtable;
38 typedef struct grdev_pipe grdev_pipe;
39 typedef struct grdev_card_vtable grdev_card_vtable;
40 typedef struct grdev_card grdev_card;
53 LIST_FIELDS(grdev_tile, childs_by_node);
55 grdev_display *display;
73 LIST_HEAD(grdev_tile, child_list);
78 int grdev_tile_new_leaf(grdev_tile **out, grdev_pipe *pipe);
79 int grdev_tile_new_node(grdev_tile **out);
80 grdev_tile *grdev_tile_free(grdev_tile *tile);
82 DEFINE_TRIVIAL_CLEANUP_FUNC(grdev_tile*, grdev_tile_free);
84 struct grdev_display {
85 grdev_session *session;
97 struct grdev_display_cache {
99 grdev_display_target target;
110 grdev_display *grdev_find_display(grdev_session *session, const char *name);
112 int grdev_display_new(grdev_display **out, grdev_session *session, const char *name);
113 grdev_display *grdev_display_free(grdev_display *display);
115 DEFINE_TRIVIAL_CLEANUP_FUNC(grdev_display*, grdev_display_free);
121 struct grdev_pipe_vtable {
122 void (*free) (grdev_pipe *pipe);
123 void (*enable) (grdev_pipe *pipe);
124 void (*disable) (grdev_pipe *pipe);
125 grdev_fb *(*target) (grdev_pipe *pipe);
129 const grdev_pipe_vtable *vtable;
134 grdev_display_cache *cache;
150 #define GRDEV_PIPE_INIT(_vtable, _card) ((grdev_pipe){ \
151 .vtable = (_vtable), \
155 grdev_pipe *grdev_find_pipe(grdev_card *card, const char *name);
157 int grdev_pipe_add(grdev_pipe *pipe, const char *name, size_t n_fbs);
158 grdev_pipe *grdev_pipe_free(grdev_pipe *pipe);
160 DEFINE_TRIVIAL_CLEANUP_FUNC(grdev_pipe*, grdev_pipe_free);
162 void grdev_pipe_ready(grdev_pipe *pipe, bool running);
163 void grdev_pipe_frame(grdev_pipe *pipe);
169 struct grdev_card_vtable {
170 void (*free) (grdev_card *card);
171 void (*enable) (grdev_card *card);
172 void (*disable) (grdev_card *card);
173 void (*commit) (grdev_card *card);
174 void (*restore) (grdev_card *card);
178 const grdev_card_vtable *vtable;
179 grdev_session *session;
188 #define GRDEV_CARD_INIT(_vtable, _session) ((grdev_card){ \
189 .vtable = (_vtable), \
190 .session = (_session), \
193 grdev_card *grdev_find_card(grdev_session *session, const char *name);
195 int grdev_card_add(grdev_card *card, const char *name);
196 grdev_card *grdev_card_free(grdev_card *card);
198 DEFINE_TRIVIAL_CLEANUP_FUNC(grdev_card*, grdev_card_free);
204 struct grdev_session {
205 grdev_context *context;
208 grdev_event_fn event_fn;
211 unsigned long n_pins;
214 Hashmap *display_map;
222 grdev_session *grdev_session_pin(grdev_session *session);
223 grdev_session *grdev_session_unpin(grdev_session *session);
225 DEFINE_TRIVIAL_CLEANUP_FUNC(grdev_session*, grdev_session_unpin);
231 struct grdev_context {
236 Hashmap *session_map;