1 /*
2 * Copyright (c) 2018 Jan Van Winkel <jan.van_winkel@dxplore.eu>
3 * Copyright (c) 2021 Nordic Semiconductor
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8 #define DT_DRV_COMPAT zephyr_sdl_dc
9
10 #include <zephyr/drivers/display.h>
11
12 #include <string.h>
13 #include <stdlib.h>
14 #include <soc.h>
15 #include <zephyr/sys/byteorder.h>
16 #include "display_sdl_bottom.h"
17 #include "cmdline.h"
18
19 #define LOG_LEVEL CONFIG_DISPLAY_LOG_LEVEL
20 #include <zephyr/logging/log.h>
21 LOG_MODULE_REGISTER(display_sdl);
22
23 static uint32_t sdl_display_zoom_pct;
24
25 struct sdl_display_config {
26 uint16_t height;
27 uint16_t width;
28 };
29
30 struct sdl_display_data {
31 void *window;
32 void *renderer;
33 void *mutex;
34 void *texture;
35 void *read_texture;
36 void *background_texture;
37 bool display_on;
38 enum display_pixel_format current_pixel_format;
39 uint8_t *buf;
40 uint8_t *read_buf;
41 };
42
mono_pixel_order(uint32_t order)43 static inline uint32_t mono_pixel_order(uint32_t order)
44 {
45 if (IS_ENABLED(CONFIG_SDL_DISPLAY_MONO_MSB_FIRST)) {
46 return BIT(7 - order);
47 } else {
48 return BIT(order);
49 }
50 }
51
sdl_display_init(const struct device * dev)52 static int sdl_display_init(const struct device *dev)
53 {
54 const struct sdl_display_config *config = dev->config;
55 struct sdl_display_data *disp_data = dev->data;
56 bool use_accelerator = true;
57 LOG_DBG("Initializing display driver");
58
59 IF_DISABLED(CONFIG_SDL_DISPLAY_USE_HARDWARE_ACCELERATOR, (use_accelerator = false));
60
61 disp_data->current_pixel_format =
62 #if defined(CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_RGB_888)
63 PIXEL_FORMAT_RGB_888
64 #elif defined(CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_MONO01)
65 PIXEL_FORMAT_MONO01
66 #elif defined(CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_MONO10)
67 PIXEL_FORMAT_MONO10
68 #elif defined(CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_RGB_565)
69 PIXEL_FORMAT_RGB_565
70 #elif defined(CONFIG_SDL_DISPLAY_DEFAULT_PIXEL_FORMAT_BGR_565)
71 PIXEL_FORMAT_BGR_565
72 #else /* SDL_DISPLAY_DEFAULT_PIXEL_FORMAT */
73 PIXEL_FORMAT_ARGB_8888
74 #endif /* SDL_DISPLAY_DEFAULT_PIXEL_FORMAT */
75 ;
76
77 if (sdl_display_zoom_pct == UINT32_MAX) {
78 sdl_display_zoom_pct = CONFIG_SDL_DISPLAY_ZOOM_PCT;
79 }
80
81 int rc = sdl_display_init_bottom(config->height, config->width, sdl_display_zoom_pct,
82 use_accelerator, &disp_data->window, &disp_data->renderer,
83 &disp_data->mutex, &disp_data->texture,
84 &disp_data->read_texture, &disp_data->background_texture,
85 CONFIG_SDL_DISPLAY_TRANSPARENCY_GRID_CELL_COLOR_1,
86 CONFIG_SDL_DISPLAY_TRANSPARENCY_GRID_CELL_COLOR_2,
87 CONFIG_SDL_DISPLAY_TRANSPARENCY_GRID_CELL_SIZE);
88
89 if (rc != 0) {
90 LOG_ERR("Failed to create SDL display");
91 return -EIO;
92 }
93
94 disp_data->display_on = false;
95
96 return 0;
97 }
98
sdl_display_write_argb8888(void * disp_buf,const struct display_buffer_descriptor * desc,const void * buf)99 static void sdl_display_write_argb8888(void *disp_buf,
100 const struct display_buffer_descriptor *desc, const void *buf)
101 {
102 __ASSERT((desc->pitch * 4U * desc->height) <= desc->buf_size,
103 "Input buffer too small");
104
105 memcpy(disp_buf, buf, desc->pitch * 4U * desc->height);
106 }
107
sdl_display_write_rgb888(uint8_t * disp_buf,const struct display_buffer_descriptor * desc,const void * buf)108 static void sdl_display_write_rgb888(uint8_t *disp_buf,
109 const struct display_buffer_descriptor *desc, const void *buf)
110 {
111 uint32_t w_idx;
112 uint32_t h_idx;
113 uint32_t pixel;
114 const uint8_t *byte_ptr;
115
116 __ASSERT((desc->pitch * 3U * desc->height) <= desc->buf_size,
117 "Input buffer too small");
118
119 for (h_idx = 0U; h_idx < desc->height; ++h_idx) {
120 for (w_idx = 0U; w_idx < desc->width; ++w_idx) {
121 byte_ptr = (const uint8_t *)buf +
122 ((h_idx * desc->pitch) + w_idx) * 3U;
123 pixel = *byte_ptr << 16;
124 pixel |= *(byte_ptr + 1) << 8;
125 pixel |= *(byte_ptr + 2);
126 *((uint32_t *)disp_buf) = pixel | 0xFF000000;
127 disp_buf += 4;
128 }
129 }
130 }
131
sdl_display_write_rgb565(uint8_t * disp_buf,const struct display_buffer_descriptor * desc,const void * buf)132 static void sdl_display_write_rgb565(uint8_t *disp_buf,
133 const struct display_buffer_descriptor *desc, const void *buf)
134 {
135 uint32_t w_idx;
136 uint32_t h_idx;
137 uint32_t pixel;
138 const uint16_t *pix_ptr;
139 uint16_t rgb565;
140
141 __ASSERT((desc->pitch * 2U * desc->height) <= desc->buf_size,
142 "Input buffer too small");
143
144 for (h_idx = 0U; h_idx < desc->height; ++h_idx) {
145 for (w_idx = 0U; w_idx < desc->width; ++w_idx) {
146 pix_ptr = (const uint16_t *)buf +
147 ((h_idx * desc->pitch) + w_idx);
148 rgb565 = sys_be16_to_cpu(*pix_ptr);
149 pixel = (((rgb565 >> 11) & 0x1F) * 255 / 31) << 16;
150 pixel |= (((rgb565 >> 5) & 0x3F) * 255 / 63) << 8;
151 pixel |= (rgb565 & 0x1F) * 255 / 31;
152 *((uint32_t *)disp_buf) = pixel | 0xFF000000;
153 disp_buf += 4;
154 }
155 }
156 }
157
sdl_display_write_bgr565(uint8_t * disp_buf,const struct display_buffer_descriptor * desc,const void * buf)158 static void sdl_display_write_bgr565(uint8_t *disp_buf,
159 const struct display_buffer_descriptor *desc, const void *buf)
160 {
161 uint32_t w_idx;
162 uint32_t h_idx;
163 uint32_t pixel;
164 const uint16_t *pix_ptr;
165
166 __ASSERT((desc->pitch * 2U * desc->height) <= desc->buf_size,
167 "Input buffer too small");
168
169 for (h_idx = 0U; h_idx < desc->height; ++h_idx) {
170 for (w_idx = 0U; w_idx < desc->width; ++w_idx) {
171 pix_ptr = (const uint16_t *)buf +
172 ((h_idx * desc->pitch) + w_idx);
173 pixel = (((*pix_ptr >> 11) & 0x1F) * 255 / 31) << 16;
174 pixel |= (((*pix_ptr >> 5) & 0x3F) * 255 / 63) << 8;
175 pixel |= (*pix_ptr & 0x1F) * 255 / 31;
176 *((uint32_t *)disp_buf) = pixel | 0xFF000000;
177 disp_buf += 4;
178 }
179 }
180 }
181
sdl_display_write_mono(uint8_t * disp_buf,const struct display_buffer_descriptor * desc,const void * buf,const bool one_is_black)182 static void sdl_display_write_mono(uint8_t *disp_buf,
183 const struct display_buffer_descriptor *desc, const void *buf,
184 const bool one_is_black)
185 {
186 uint32_t w_idx;
187 uint32_t h_idx;
188 uint32_t tile_idx;
189 uint32_t pixel;
190 const uint8_t *byte_ptr;
191 uint32_t one_color;
192 uint8_t *disp_buf_start;
193
194 __ASSERT((desc->pitch * desc->height) <= (desc->buf_size * 8U),
195 "Input buffer too small");
196 __ASSERT((desc->height % 8) == 0U,
197 "Input buffer height not aligned per 8 pixels");
198
199 if (one_is_black) {
200 one_color = 0U;
201 } else {
202 one_color = 0x00FFFFFF;
203 }
204
205 for (tile_idx = 0U; tile_idx < desc->height/8U; ++tile_idx) {
206 for (w_idx = 0U; w_idx < desc->width; ++w_idx) {
207 byte_ptr = (const uint8_t *)buf +
208 ((tile_idx * desc->pitch) + w_idx);
209 disp_buf_start = disp_buf;
210 for (h_idx = 0U; h_idx < 8; ++h_idx) {
211 if ((*byte_ptr & mono_pixel_order(h_idx)) != 0U) {
212 pixel = one_color;
213 } else {
214 pixel = ~one_color;
215 }
216 *((uint32_t *)disp_buf) = pixel | 0xFF000000;
217 disp_buf += (desc->width * 4U);
218 }
219 disp_buf = disp_buf_start;
220 disp_buf += 4;
221 }
222 disp_buf += 7 * (desc->width * 4U);
223 }
224 }
225
sdl_display_write(const struct device * dev,const uint16_t x,const uint16_t y,const struct display_buffer_descriptor * desc,const void * buf)226 static int sdl_display_write(const struct device *dev, const uint16_t x,
227 const uint16_t y,
228 const struct display_buffer_descriptor *desc,
229 const void *buf)
230 {
231 const struct sdl_display_config *config = dev->config;
232 struct sdl_display_data *disp_data = dev->data;
233
234 LOG_DBG("Writing %dx%d (w,h) bitmap @ %dx%d (x,y)", desc->width,
235 desc->height, x, y);
236
237 __ASSERT(desc->width <= desc->pitch, "Pitch is smaller than width");
238 __ASSERT(desc->pitch <= config->width,
239 "Pitch in descriptor is larger than screen size");
240 __ASSERT(desc->height <= config->height,
241 "Height in descriptor is larger than screen size");
242 __ASSERT(x + desc->width <= config->width,
243 "Writing outside screen boundaries in horizontal direction");
244 __ASSERT(y + desc->height <= config->height,
245 "Writing outside screen boundaries in vertical direction");
246
247 if (desc->width > desc->pitch ||
248 x + desc->width > config->width ||
249 y + desc->height > config->height) {
250 return -EINVAL;
251 }
252
253 if (disp_data->current_pixel_format == PIXEL_FORMAT_ARGB_8888) {
254 sdl_display_write_argb8888(disp_data->buf, desc, buf);
255 } else if (disp_data->current_pixel_format == PIXEL_FORMAT_RGB_888) {
256 sdl_display_write_rgb888(disp_data->buf, desc, buf);
257 } else if (disp_data->current_pixel_format == PIXEL_FORMAT_MONO10) {
258 sdl_display_write_mono(disp_data->buf, desc, buf, true);
259 } else if (disp_data->current_pixel_format == PIXEL_FORMAT_MONO01) {
260 sdl_display_write_mono(disp_data->buf, desc, buf, false);
261 } else if (disp_data->current_pixel_format == PIXEL_FORMAT_RGB_565) {
262 sdl_display_write_rgb565(disp_data->buf, desc, buf);
263 } else if (disp_data->current_pixel_format == PIXEL_FORMAT_BGR_565) {
264 sdl_display_write_bgr565(disp_data->buf, desc, buf);
265 }
266
267 sdl_display_write_bottom(desc->height, desc->width, x, y, disp_data->renderer,
268 disp_data->mutex, disp_data->texture,
269 disp_data->background_texture, disp_data->buf,
270 disp_data->display_on, desc->frame_incomplete);
271
272 return 0;
273 }
274
sdl_display_read_argb8888(const uint8_t * read_buf,const struct display_buffer_descriptor * desc,void * buf)275 static void sdl_display_read_argb8888(const uint8_t *read_buf,
276 const struct display_buffer_descriptor *desc, void *buf)
277 {
278 __ASSERT((desc->pitch * 4U * desc->height) <= desc->buf_size, "Read buffer is too small");
279
280 memcpy(buf, read_buf, desc->pitch * 4U * desc->height);
281 }
282
sdl_display_read_rgb888(const uint8_t * read_buf,const struct display_buffer_descriptor * desc,void * buf)283 static void sdl_display_read_rgb888(const uint8_t *read_buf,
284 const struct display_buffer_descriptor *desc, void *buf)
285 {
286 uint32_t w_idx;
287 uint32_t h_idx;
288 uint8_t *buf8;
289 const uint32_t *pix_ptr;
290
291 __ASSERT((desc->pitch * 3U * desc->height) <= desc->buf_size, "Read buffer is too small");
292
293 for (h_idx = 0U; h_idx < desc->height; ++h_idx) {
294 buf8 = ((uint8_t *)buf) + desc->pitch * 3U * h_idx;
295
296 for (w_idx = 0U; w_idx < desc->width; ++w_idx) {
297 pix_ptr = (const uint32_t *)read_buf + ((h_idx * desc->pitch) + w_idx);
298 *buf8 = (*pix_ptr & 0xFF0000) >> 16;
299 buf8 += 1;
300 *buf8 = (*pix_ptr & 0xFF00) >> 8;
301 buf8 += 1;
302 *buf8 = (*pix_ptr & 0xFF);
303 buf8 += 1;
304 }
305 }
306 }
307
sdl_display_read_rgb565(const uint8_t * read_buf,const struct display_buffer_descriptor * desc,void * buf)308 static void sdl_display_read_rgb565(const uint8_t *read_buf,
309 const struct display_buffer_descriptor *desc, void *buf)
310 {
311 uint32_t w_idx;
312 uint32_t h_idx;
313 uint16_t pixel;
314 uint16_t *buf16;
315 const uint32_t *pix_ptr;
316
317 __ASSERT((desc->pitch * 2U * desc->height) <= desc->buf_size, "Read buffer is too small");
318
319 for (h_idx = 0U; h_idx < desc->height; ++h_idx) {
320 buf16 = (void *)(((uint8_t *)buf) + desc->pitch * 2U * h_idx);
321
322 for (w_idx = 0U; w_idx < desc->width; ++w_idx) {
323 pix_ptr = (const uint32_t *)read_buf + ((h_idx * desc->pitch) + w_idx);
324 pixel = (*pix_ptr & 0xF80000) >> 8;
325 pixel |= (*pix_ptr & 0x00FC00) >> 5;
326 pixel |= (*pix_ptr & 0x0000F8) >> 3;
327 *buf16 = sys_be16_to_cpu(pixel);
328 buf16 += 1;
329 }
330 }
331 }
332
sdl_display_read_bgr565(const uint8_t * read_buf,const struct display_buffer_descriptor * desc,void * buf)333 static void sdl_display_read_bgr565(const uint8_t *read_buf,
334 const struct display_buffer_descriptor *desc, void *buf)
335 {
336 uint32_t w_idx;
337 uint32_t h_idx;
338 uint16_t pixel;
339 uint16_t *buf16;
340 const uint32_t *pix_ptr;
341
342 __ASSERT((desc->pitch * 2U * desc->height) <= desc->buf_size, "Read buffer is too small");
343
344 for (h_idx = 0U; h_idx < desc->height; ++h_idx) {
345 buf16 = (void *)(((uint8_t *)buf) + desc->pitch * 2U * h_idx);
346
347 for (w_idx = 0U; w_idx < desc->width; ++w_idx) {
348 pix_ptr = (const uint32_t *)read_buf + ((h_idx * desc->pitch) + w_idx);
349 pixel = (*pix_ptr & 0xF80000) >> 8;
350 pixel |= (*pix_ptr & 0x00FC00) >> 5;
351 pixel |= (*pix_ptr & 0x0000F8) >> 3;
352 *buf16 = pixel;
353 buf16 += 1;
354 }
355 }
356 }
357
sdl_display_read_mono(const uint8_t * read_buf,const struct display_buffer_descriptor * desc,void * buf,const bool one_is_black)358 static void sdl_display_read_mono(const uint8_t *read_buf,
359 const struct display_buffer_descriptor *desc, void *buf,
360 const bool one_is_black)
361 {
362 uint32_t w_idx;
363 uint32_t h_idx;
364 uint32_t tile_idx;
365 uint8_t tile;
366 const uint32_t *pix_ptr;
367 uint8_t *buf8;
368
369 __ASSERT((desc->pitch * desc->height) <= (desc->buf_size * 8U), "Read buffer is too small");
370 __ASSERT((desc->height % 8U) == 0U, "Read buffer height not aligned per 8 pixels");
371
372 for (tile_idx = 0U; tile_idx < (desc->height / 8U); ++tile_idx) {
373 buf8 = (void *)(((uint8_t *)buf) + desc->pitch * tile_idx);
374
375 for (w_idx = 0U; w_idx < desc->width; ++w_idx) {
376 tile = 0;
377
378 for (h_idx = 0U; h_idx < 8; ++h_idx) {
379 pix_ptr = (const uint32_t *)read_buf +
380 ((tile_idx * 8 + h_idx) * desc->pitch + w_idx);
381 if ((*pix_ptr)) {
382 tile |= mono_pixel_order(h_idx);
383 }
384 }
385 *buf8 = one_is_black ? ~tile : tile;
386 buf8 += 1;
387 }
388 }
389 }
390
sdl_display_read(const struct device * dev,const uint16_t x,const uint16_t y,const struct display_buffer_descriptor * desc,void * buf)391 static int sdl_display_read(const struct device *dev, const uint16_t x,
392 const uint16_t y,
393 const struct display_buffer_descriptor *desc,
394 void *buf)
395 {
396 struct sdl_display_data *disp_data = dev->data;
397 int err;
398
399 LOG_DBG("Reading %dx%d (w,h) bitmap @ %dx%d (x,y)", desc->width,
400 desc->height, x, y);
401
402 __ASSERT(desc->width <= desc->pitch, "Pitch is smaller than width");
403
404 memset(disp_data->read_buf, 0, desc->pitch * desc->height * 4);
405
406 err = sdl_display_read_bottom(desc->height, desc->width, x, y, disp_data->renderer,
407 disp_data->read_buf, desc->pitch, disp_data->mutex,
408 disp_data->texture, disp_data->read_texture);
409
410 if (err) {
411 return err;
412 }
413
414 if (disp_data->current_pixel_format == PIXEL_FORMAT_ARGB_8888) {
415 sdl_display_read_argb8888(disp_data->read_buf, desc, buf);
416 } else if (disp_data->current_pixel_format == PIXEL_FORMAT_RGB_888) {
417 sdl_display_read_rgb888(disp_data->read_buf, desc, buf);
418 } else if (disp_data->current_pixel_format == PIXEL_FORMAT_MONO10) {
419 sdl_display_read_mono(disp_data->read_buf, desc, buf, true);
420 } else if (disp_data->current_pixel_format == PIXEL_FORMAT_MONO01) {
421 sdl_display_read_mono(disp_data->read_buf, desc, buf, false);
422 } else if (disp_data->current_pixel_format == PIXEL_FORMAT_RGB_565) {
423 sdl_display_read_rgb565(disp_data->read_buf, desc, buf);
424 } else if (disp_data->current_pixel_format == PIXEL_FORMAT_BGR_565) {
425 sdl_display_read_bgr565(disp_data->read_buf, desc, buf);
426 }
427
428 return 0;
429 }
430
sdl_display_blanking_off(const struct device * dev)431 static int sdl_display_blanking_off(const struct device *dev)
432 {
433 struct sdl_display_data *disp_data = dev->data;
434
435 LOG_DBG("Turning display blacking off");
436
437 disp_data->display_on = true;
438
439 sdl_display_blanking_off_bottom(disp_data->renderer, disp_data->texture,
440 disp_data->background_texture);
441
442 return 0;
443 }
444
sdl_display_blanking_on(const struct device * dev)445 static int sdl_display_blanking_on(const struct device *dev)
446 {
447 struct sdl_display_data *disp_data = dev->data;
448
449 LOG_DBG("Turning display blanking on");
450
451 disp_data->display_on = false;
452
453 sdl_display_blanking_on_bottom(disp_data->renderer);
454 return 0;
455 }
456
sdl_display_get_capabilities(const struct device * dev,struct display_capabilities * capabilities)457 static void sdl_display_get_capabilities(
458 const struct device *dev, struct display_capabilities *capabilities)
459 {
460 const struct sdl_display_config *config = dev->config;
461 struct sdl_display_data *disp_data = dev->data;
462
463 memset(capabilities, 0, sizeof(struct display_capabilities));
464 capabilities->x_resolution = config->width;
465 capabilities->y_resolution = config->height;
466 capabilities->supported_pixel_formats = PIXEL_FORMAT_ARGB_8888 |
467 PIXEL_FORMAT_RGB_888 |
468 PIXEL_FORMAT_MONO01 |
469 PIXEL_FORMAT_MONO10 |
470 PIXEL_FORMAT_RGB_565 |
471 PIXEL_FORMAT_BGR_565;
472 capabilities->current_pixel_format = disp_data->current_pixel_format;
473 capabilities->screen_info = SCREEN_INFO_MONO_VTILED |
474 (IS_ENABLED(CONFIG_SDL_DISPLAY_MONO_MSB_FIRST) ? SCREEN_INFO_MONO_MSB_FIRST : 0);
475 }
476
sdl_display_set_pixel_format(const struct device * dev,const enum display_pixel_format pixel_format)477 static int sdl_display_set_pixel_format(const struct device *dev,
478 const enum display_pixel_format pixel_format)
479 {
480 struct sdl_display_data *disp_data = dev->data;
481
482 switch (pixel_format) {
483 case PIXEL_FORMAT_ARGB_8888:
484 case PIXEL_FORMAT_RGB_888:
485 case PIXEL_FORMAT_MONO01:
486 case PIXEL_FORMAT_MONO10:
487 case PIXEL_FORMAT_RGB_565:
488 case PIXEL_FORMAT_BGR_565:
489 disp_data->current_pixel_format = pixel_format;
490 return 0;
491 default:
492 LOG_ERR("Pixel format not supported");
493 return -ENOTSUP;
494 }
495 }
496
sdl_display_cleanup(struct sdl_display_data * disp_data)497 static void sdl_display_cleanup(struct sdl_display_data *disp_data)
498 {
499 sdl_display_cleanup_bottom(&disp_data->window, &disp_data->renderer, &disp_data->mutex,
500 &disp_data->texture, &disp_data->read_texture,
501 &disp_data->background_texture);
502 }
503
504 static DEVICE_API(display, sdl_display_api) = {
505 .blanking_on = sdl_display_blanking_on,
506 .blanking_off = sdl_display_blanking_off,
507 .write = sdl_display_write,
508 .read = sdl_display_read,
509 .get_capabilities = sdl_display_get_capabilities,
510 .set_pixel_format = sdl_display_set_pixel_format,
511 };
512
513 #define DISPLAY_SDL_DEFINE(n) \
514 static const struct sdl_display_config sdl_config_##n = { \
515 .height = DT_INST_PROP(n, height), \
516 .width = DT_INST_PROP(n, width), \
517 }; \
518 \
519 static uint8_t sdl_buf_##n[4 * DT_INST_PROP(n, height) \
520 * DT_INST_PROP(n, width)]; \
521 static uint8_t sdl_read_buf_##n[4 * DT_INST_PROP(n, height) \
522 * DT_INST_PROP(n, width)]; \
523 static struct sdl_display_data sdl_data_##n = { \
524 .buf = sdl_buf_##n, \
525 .read_buf = sdl_read_buf_##n, \
526 }; \
527 \
528 DEVICE_DT_INST_DEFINE(n, &sdl_display_init, NULL, \
529 &sdl_data_##n, \
530 &sdl_config_##n, \
531 POST_KERNEL, \
532 CONFIG_DISPLAY_INIT_PRIORITY, \
533 &sdl_display_api); \
534 \
535 static void sdl_display_cleanup_##n(void) \
536 { \
537 sdl_display_cleanup(&sdl_data_##n); \
538 } \
539 \
540 NATIVE_TASK(sdl_display_cleanup_##n, ON_EXIT, 1);
541
DT_INST_FOREACH_STATUS_OKAY(DISPLAY_SDL_DEFINE)542 DT_INST_FOREACH_STATUS_OKAY(DISPLAY_SDL_DEFINE)
543
544 static void display_sdl_options(void)
545 {
546 static struct args_struct_t sdl_display_options[] = {
547 { .option = "display_zoom_pct",
548 .name = "pct",
549 .type = 'u',
550 .dest = (void *)&sdl_display_zoom_pct,
551 .descript = "Display zoom percentage (100 == 1:1 scale), "
552 "by default " STRINGIFY(CONFIG_SDL_DISPLAY_ZOOM_PCT)
553 " = CONFIG_SDL_DISPLAY_ZOOM_PCT"
554 },
555 ARG_TABLE_ENDMARKER
556 };
557
558 native_add_command_line_opts(sdl_display_options);
559 }
560
561 NATIVE_TASK(display_sdl_options, PRE_BOOT_1, 1);
562