blob: 7bc7ada7eafa8252796463e91bac6bb71339d1ac [file] [log] [blame]
Chris Wilsonb98bade2013-08-20 21:39:27 +01001/*
2 * Copyright © 2013 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 *
23 */
24
25#ifndef OVERLAY_H
26#define OVERLAY_H
27
Chris Wilson34e47802013-08-18 21:10:26 +010028#include"config.h"
Chris Wilson34e47802013-08-18 21:10:26 +010029
Chris Wilsonf9a50de2013-08-17 11:12:07 +010030#include <cairo.h>
31
32enum position {
33 POS_UNSET = -1,
34
35 POS_LEFT = 0,
36 POS_CENTRE = 1,
37 POS_RIGHT = 2,
38
39 POS_TOP = 0 << 4,
40 POS_MIDDLE = 1 << 4,
41 POS_BOTTOM = 2 << 4,
42
43 POS_TOP_LEFT = POS_TOP | POS_LEFT,
44 POS_TOP_CENTRE = POS_TOP | POS_CENTRE,
45 POS_TOP_RIGHT = POS_TOP | POS_RIGHT,
46
47 POS_MIDDLE_LEFT = POS_MIDDLE | POS_LEFT,
48 POS_MIDDLE_CENTRE = POS_MIDDLE | POS_CENTRE,
49 POS_MIDDLE_RIGHT = POS_MIDDLE | POS_RIGHT,
50
51 POS_BOTTOM_LEFT = POS_BOTTOM | POS_LEFT,
52 POS_BOTTOM_CENTRE = POS_BOTTOM | POS_CENTRE,
53 POS_BOTTOM_RIGHT = POS_BOTTOM | POS_RIGHT,
54};
55
56struct overlay {
57 cairo_surface_t *surface;
58 void (*show)(struct overlay *);
Chris Wilsonf9a50de2013-08-17 11:12:07 +010059 void (*hide)(struct overlay *);
60};
61
62extern const cairo_user_data_key_t overlay_key;
63
Chris Wilson7c52a3c2013-08-22 15:07:48 +010064struct config {
65 struct config_section {
66 struct config_section *next;
67 struct config_value {
68 struct config_value *next;
69 char *name;
70 char *value;
71 } *values;
72 char name[0];
73 } *sections;
74};
75
76void config_init(struct config *config);
77void config_parse_string(struct config *config, const char *str);
78void config_set_value(struct config *config,
79 const char *section,
80 const char *name,
81 const char *value);
82const char *config_get_value(struct config *config,
83 const char *section,
84 const char *name);
85
Chris Wilson34e47802013-08-18 21:10:26 +010086#ifdef HAVE_OVERLAY_XVLIB
Chris Wilson7c52a3c2013-08-22 15:07:48 +010087cairo_surface_t *x11_overlay_create(struct config *config, int *width, int *height);
Chris Wilsonf9a50de2013-08-17 11:12:07 +010088void x11_overlay_stop(void);
Chris Wilson34e47802013-08-18 21:10:26 +010089#else
Chris Wilson7c52a3c2013-08-22 15:07:48 +010090static inline cairo_surface_t *x11_overlay_create(struct config *config, int *width, int *height) { return NULL; }
Chris Wilson34e47802013-08-18 21:10:26 +010091static inline void x11_overlay_stop(void) { }
92#endif
93
94#ifdef HAVE_OVERLAY_XLIB
Chris Wilson7c52a3c2013-08-22 15:07:48 +010095cairo_surface_t *x11_window_create(struct config *config, int *width, int *height);
Chris Wilson34e47802013-08-18 21:10:26 +010096#else
Chris Wilson7c52a3c2013-08-22 15:07:48 +010097static inline cairo_surface_t *x11_window_create(struct config *config, int *width, int *height) { return NULL; }
Chris Wilson34e47802013-08-18 21:10:26 +010098#endif
Chris Wilsonb98bade2013-08-20 21:39:27 +010099
Chris Wilsond9291022013-08-25 13:15:55 +0100100cairo_surface_t *kms_overlay_create(struct config *config, int *width, int *height);
101
Chris Wilsonb98bade2013-08-20 21:39:27 +0100102#endif /* OVERLAY_H */