@@ -47,6 +47,7 @@ struct sdl_display_task {
4747struct sdl_display_config {
4848 uint16_t height ;
4949 uint16_t width ;
50+ const char * title ;
5051};
5152
5253struct sdl_display_data {
@@ -116,14 +117,13 @@ static void sdl_task_thread(void *p1, void *p2, void *p3)
116117 sdl_display_zoom_pct = CONFIG_SDL_DISPLAY_ZOOM_PCT ;
117118 }
118119
119- int rc = sdl_display_init_bottom (config -> height , config -> width , sdl_display_zoom_pct ,
120- use_accelerator , & disp_data -> window , dev ,
121- & disp_data -> renderer , & disp_data -> mutex ,
122- & disp_data -> texture , & disp_data -> read_texture ,
123- & disp_data -> background_texture ,
124- CONFIG_SDL_DISPLAY_TRANSPARENCY_GRID_CELL_COLOR_1 ,
125- CONFIG_SDL_DISPLAY_TRANSPARENCY_GRID_CELL_COLOR_2 ,
126- CONFIG_SDL_DISPLAY_TRANSPARENCY_GRID_CELL_SIZE );
120+ int rc = sdl_display_init_bottom (
121+ config -> height , config -> width , sdl_display_zoom_pct , use_accelerator ,
122+ & disp_data -> window , dev , config -> title , & disp_data -> renderer , & disp_data -> mutex ,
123+ & disp_data -> texture , & disp_data -> read_texture , & disp_data -> background_texture ,
124+ CONFIG_SDL_DISPLAY_TRANSPARENCY_GRID_CELL_COLOR_1 ,
125+ CONFIG_SDL_DISPLAY_TRANSPARENCY_GRID_CELL_COLOR_2 ,
126+ CONFIG_SDL_DISPLAY_TRANSPARENCY_GRID_CELL_SIZE );
127127
128128 k_sem_give (& disp_data -> task_sem );
129129
@@ -734,35 +734,30 @@ static DEVICE_API(display, sdl_display_api) = {
734734 .set_pixel_format = sdl_display_set_pixel_format ,
735735};
736736
737- #define DISPLAY_SDL_DEFINE (n ) \
738- static const struct sdl_display_config sdl_config_##n = { \
739- .height = DT_INST_PROP(n, height), \
740- .width = DT_INST_PROP(n, width), \
741- }; \
742- \
743- static uint8_t sdl_buf_##n[4 * DT_INST_PROP(n, height) \
744- * DT_INST_PROP(n, width)]; \
745- static uint8_t sdl_read_buf_##n[4 * DT_INST_PROP(n, height) \
746- * DT_INST_PROP(n, width)]; \
747- K_MSGQ_DEFINE(sdl_task_msgq_##n, sizeof(struct sdl_display_task), 1, 4); \
748- static struct sdl_display_data sdl_data_##n = { \
749- .buf = sdl_buf_##n, \
750- .read_buf = sdl_read_buf_##n, \
751- .task_msgq = &sdl_task_msgq_##n, \
752- }; \
753- \
754- DEVICE_DT_INST_DEFINE(n, &sdl_display_init, NULL, \
755- &sdl_data_##n, \
756- &sdl_config_##n, \
757- POST_KERNEL, \
758- CONFIG_DISPLAY_INIT_PRIORITY, \
759- &sdl_display_api); \
760- \
761- static void sdl_display_cleanup_##n(void) \
762- { \
763- sdl_display_cleanup(&sdl_data_##n); \
764- } \
765- \
737+ #define DISPLAY_SDL_DEFINE (n ) \
738+ static const struct sdl_display_config sdl_config_##n = { \
739+ .height = DT_INST_PROP(n, height), \
740+ .width = DT_INST_PROP(n, width), \
741+ .title = DT_INST_PROP_OR(n, title, "Zephyr Display"), \
742+ }; \
743+ \
744+ static uint8_t sdl_buf_##n[4 * DT_INST_PROP(n, height) * DT_INST_PROP(n, width)]; \
745+ static uint8_t sdl_read_buf_##n[4 * DT_INST_PROP(n, height) * DT_INST_PROP(n, width)]; \
746+ K_MSGQ_DEFINE(sdl_task_msgq_##n, sizeof(struct sdl_display_task), 1, 4); \
747+ static struct sdl_display_data sdl_data_##n = { \
748+ .buf = sdl_buf_##n, \
749+ .read_buf = sdl_read_buf_##n, \
750+ .task_msgq = &sdl_task_msgq_##n, \
751+ }; \
752+ \
753+ DEVICE_DT_INST_DEFINE(n, &sdl_display_init, NULL, &sdl_data_##n, &sdl_config_##n, \
754+ POST_KERNEL, CONFIG_DISPLAY_INIT_PRIORITY, &sdl_display_api); \
755+ \
756+ static void sdl_display_cleanup_##n(void) \
757+ { \
758+ sdl_display_cleanup(&sdl_data_##n); \
759+ } \
760+ \
766761 NATIVE_TASK(sdl_display_cleanup_##n, ON_EXIT, 1);
767762
768763DT_INST_FOREACH_STATUS_OKAY (DISPLAY_SDL_DEFINE )
0 commit comments