Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6be6717

Browse files
committed
Fixes seg fault running Unix port using Nvidia graphics.
1 parentec53644 commit6be6717

File tree

2 files changed

+7
-40
lines changed

2 files changed

+7
-40
lines changed

‎ext_mod/lcd_bus/sdl_bus/sdl_bus.c‎

Lines changed: 7 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
mp_lcd_sdl_bus_obj_t*instances[10]= {NULL };
2525

2626
uint8_tinstance_count=0;
27-
boolexit_thread= false;
2827
boolsdl_inited= false;
2928

3029
mp_lcd_err_tsdl_tx_param(mp_obj_tobj,intlcd_cmd,void*param,size_tparam_size);
@@ -112,10 +111,13 @@
112111
LCD_UNUSED(color_size);
113112

114113
mp_lcd_sdl_bus_obj_t*self=MP_OBJ_TO_PTR(obj);
115-
while (!self->trans_done) {}
116-
self->trans_done= false;
117-
self->panel_io_config.buf_to_flush=color;
118-
SDL_UnlockMutex(self->panel_io_config.mutex);
114+
115+
intpitch=self->panel_io_config.width*self->panel_io_config.bytes_per_pixel;
116+
117+
SDL_UpdateTexture(self->texture,NULL,color,pitch);
118+
SDL_RenderClear(self->renderer);
119+
SDL_RenderCopy(self->renderer,self->texture,NULL,NULL);
120+
SDL_RenderPresent(self->renderer);
119121

120122
if (self->callback!=mp_const_none&&mp_obj_is_callable(self->callback)) {
121123
mp_call_function_n_kw(self->callback,0,0,NULL);
@@ -128,15 +130,9 @@
128130
{
129131
mp_lcd_sdl_bus_obj_t*self=MP_OBJ_TO_PTR(obj);
130132

131-
self->panel_io_config.buf_to_flush=NULL;
132-
self->panel_io_config.exit_thread= true;
133-
SDL_UnlockMutex(self->panel_io_config.mutex);
134-
SDL_WaitThread(self->panel_io_config.thread,NULL);
135-
136133
SDL_DestroyTexture(self->texture);
137134
SDL_DestroyRenderer(self->renderer);
138135
SDL_DestroyWindow(self->window);
139-
SDL_DestroyMutex(self->panel_io_config.mutex);
140136

141137
uint8_ti=0;
142138

@@ -156,7 +152,6 @@
156152
}
157153

158154
if (instance_count==0) {
159-
exit_thread= true;
160155
SDL_Quit();
161156
}
162157

@@ -176,8 +171,6 @@
176171

177172
SDL_StartTextInput();
178173

179-
self->panel_io_config.mutex=SDL_CreateMutex();
180-
SDL_LockMutex(self->panel_io_config.mutex);
181174
self->window=SDL_CreateWindow(
182175
"LVGL MP\0",
183176
SDL_WINDOWPOS_UNDEFINED,
@@ -195,7 +188,6 @@
195188
SDL_SetWindowSize(self->window,width,height);
196189

197190
self->rgb565_byte_swap= false;
198-
self->panel_io_config.thread=SDL_CreateThread(flush_thread,"LVGL_MP_RENDERER\0", (void*)self);
199191
self->trans_done= true;
200192

201193
instance_count+=1;
@@ -216,28 +208,6 @@
216208
returnLCD_OK;
217209
}
218210

219-
intflush_thread(void*self_in) {
220-
mp_lcd_sdl_bus_obj_t*self= (mp_lcd_sdl_bus_obj_t*)self_in;
221-
void*buf;
222-
intpitch;
223-
224-
while (!self->panel_io_config.exit_thread) {
225-
SDL_LockMutex(self->panel_io_config.mutex);
226-
227-
if (self->panel_io_config.buf_to_flush!=NULL) {
228-
pitch=self->panel_io_config.width*self->panel_io_config.bytes_per_pixel;
229-
buf=self->panel_io_config.buf_to_flush;
230-
SDL_UpdateTexture(self->texture,NULL,buf,pitch);
231-
SDL_RenderClear(self->renderer);
232-
SDL_RenderCopy(self->renderer,self->texture,NULL,NULL);
233-
SDL_RenderPresent(self->renderer);
234-
}
235-
236-
self->trans_done= true;
237-
}
238-
return0;
239-
}
240-
241211
staticmp_obj_tmp_lcd_sdl_poll_events(mp_obj_tself_in)
242212
{
243213
LCD_UNUSED(self_in);

‎ext_mod/lcd_bus/sdl_bus/sdl_bus.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,8 @@
2222
uint16_twidth;
2323
uint16_theight;
2424
uint32_twin_id;
25-
boolexit_thread;
2625
void*buf_to_flush;
27-
SDL_Thread*thread;
2826
uint8_tbytes_per_pixel;
29-
SDL_mutex*mutex;
3027
intflags;
3128
}panel_io_config_t;
3229

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp