1
2 /*
3 * No copyright claimed, Public Domain
4 */
5
6 #include <stdlib.h>
7 #include <stdint.h>
8 #include <stdbool.h>
9 #include <math.h>
10 #include <unistd.h>
11 #include <dlfcn.h>
12 #include <stdio.h>
13
14 #include "arcan_math.h"
15 #include "arcan_general.h"
16 #include "arcan_video.h"
17 #include "arcan_videoint.h"
18 #include "arcan_shmif.h"
19 #include "arcan_event.h"
20
21 #include "../platform.h"
22
23 static size_t g_width;
24 static size_t g_height;
25
26 static char* envopts[] = {
27 NULL
28 };
29
platform_video_shutdown()30 void platform_video_shutdown()
31 {
32 }
33
platform_video_decay()34 size_t platform_video_decay()
35 {
36 return 0;
37 }
38
platform_video_prepare_external()39 void platform_video_prepare_external()
40 {
41 }
42
platform_video_map_buffer(struct agp_vstore * vs,struct agp_buffer_plane * planes,size_t n)43 bool platform_video_map_buffer(
44 struct agp_vstore* vs, struct agp_buffer_plane* planes, size_t n)
45 {
46 return false;
47 }
48
platform_video_restore_external()49 void platform_video_restore_external()
50 {
51 }
platform_video_display_edid(platform_display_id did,char ** out,size_t * sz)52 bool platform_video_display_edid(
53 platform_display_id did, char** out, size_t* sz)
54 {
55 *out = NULL;
56 *sz = 0;
57 return false;
58 }
59
platform_video_dpms(platform_display_id disp,enum dpms_state state)60 enum dpms_state platform_video_dpms(
61 platform_display_id disp, enum dpms_state state)
62 {
63 return ADPMS_IGNORE;
64 }
65
platform_video_recovery()66 void platform_video_recovery()
67 {
68 }
69
platform_video_set_display_gamma(platform_display_id did,size_t n_ramps,uint16_t * r,uint16_t * g,uint16_t * b)70 bool platform_video_set_display_gamma(platform_display_id did,
71 size_t n_ramps, uint16_t* r, uint16_t* g, uint16_t* b)
72 {
73 return false;
74 }
75
platform_video_get_display_gamma(platform_display_id did,size_t * n_ramps,uint16_t ** outb)76 bool platform_video_get_display_gamma(platform_display_id did,
77 size_t* n_ramps, uint16_t** outb)
78 {
79 return false;
80 }
81
platform_video_gfxsym(const char * sym)82 void* platform_video_gfxsym(const char* sym)
83 {
84 return dlsym(RTLD_DEFAULT, sym);
85 }
86
platform_video_minimize()87 void platform_video_minimize()
88 {
89 }
90
platform_video_reset(int id,int swap)91 void platform_video_reset(int id, int swap)
92 {
93 }
94
platform_video_specify_mode(platform_display_id disp,struct monitor_mode mode)95 bool platform_video_specify_mode(platform_display_id disp, struct monitor_mode mode)
96 {
97 return false;
98 }
99
platform_video_synch(uint64_t tick_count,float fract,video_synchevent pre,video_synchevent post)100 void platform_video_synch(uint64_t tick_count, float fract,
101 video_synchevent pre, video_synchevent post)
102 {
103 if (pre)
104 pre();
105
106 /*
107 * normal refresh cycle, then leave the next possible deadline to the conductor
108 */
109 size_t nd;
110 arcan_bench_register_cost( arcan_vint_refresh(fract, &nd) );
111
112 agp_activate_rendertarget(NULL);
113
114 arcan_vint_drawcursor(true);
115 arcan_vint_drawcursor(false);
116
117 if (post)
118 post();
119 }
120
platform_video_auth(int cardn,unsigned token)121 bool platform_video_auth(int cardn, unsigned token)
122 {
123 return false;
124 }
125
platform_video_cardhandle(int cardn,int * buffer_method,size_t * metadata_sz,uint8_t ** metadata)126 int platform_video_cardhandle(int cardn,
127 int* buffer_method, size_t* metadata_sz, uint8_t** metadata)
128 {
129 return -1;
130 }
131
platform_video_envopts()132 const char** platform_video_envopts()
133 {
134 return (const char**) envopts;
135 }
136
platform_video_query_displays()137 void platform_video_query_displays()
138 {
139 }
140
platform_video_set_mode(platform_display_id disp,platform_mode_id mode,struct platform_mode_opts opts)141 bool platform_video_set_mode(platform_display_id disp,
142 platform_mode_id mode, struct platform_mode_opts opts)
143 {
144 return disp == 0 && mode == 0;
145 }
146
platform_video_displays(platform_display_id * dids,size_t * lim)147 size_t platform_video_displays(platform_display_id* dids, size_t* lim)
148 {
149 if (dids && lim && *lim > 0){
150 dids[0] = 0;
151 }
152
153 if (lim)
154 *lim = 1;
155
156 return 1;
157 }
158
platform_video_map_handle(struct agp_vstore * dst,int64_t handle)159 bool platform_video_map_handle(struct agp_vstore* dst, int64_t handle)
160 {
161 return false;
162 }
163
platform_video_dimensions()164 struct monitor_mode platform_video_dimensions()
165 {
166 return (struct monitor_mode){
167 .width = g_width,
168 .height = g_height
169 };
170 }
171
platform_video_query_modes(platform_display_id id,size_t * count)172 struct monitor_mode* platform_video_query_modes(
173 platform_display_id id, size_t* count)
174 {
175 static struct monitor_mode mode = {};
176
177 mode.width = g_width;
178 mode.height = g_height;
179 mode.depth = sizeof(av_pixel) * 8;
180 mode.refresh = 60; /* should be queried */
181
182 *count = 1;
183 return &mode;
184 }
185
platform_video_invalidate_map(struct agp_vstore * vstore,struct agp_region region)186 void platform_video_invalidate_map(
187 struct agp_vstore* vstore, struct agp_region region)
188 {
189 /* NOP for the time being - might change for direct forwarding of client */
190 }
191
platform_video_map_display(arcan_vobj_id id,platform_display_id disp,enum blitting_hint hint)192 bool platform_video_map_display(
193 arcan_vobj_id id, platform_display_id disp, enum blitting_hint hint)
194 {
195 return false; /* no multidisplay /redirectable output support */
196 }
197
platform_video_map_display_layer(arcan_vobj_id vid,platform_display_id id,size_t layer_index,struct display_layer_cfg cfg)198 ssize_t platform_video_map_display_layer(arcan_vobj_id vid,
199 platform_display_id id, size_t layer_index, struct display_layer_cfg cfg)
200 {
201 return -1;
202 }
203
platform_video_capstr()204 const char* platform_video_capstr()
205 {
206 return "skeleton driver, no capabilities";
207 }
208
platform_video_preinit()209 void platform_video_preinit()
210 {
211 }
212
platform_video_init(uint16_t width,uint16_t height,uint8_t bpp,bool fs,bool frames,const char * capt)213 bool platform_video_init(uint16_t width,
214 uint16_t height, uint8_t bpp, bool fs, bool frames, const char* capt)
215 {
216 g_width = width;
217 g_height = height;
218 return true;
219 }
220