Skip to content

Commit 71b8811

Browse files
committed
Corrected which_fb behavior when frames are dropped
1 parent cff01af commit 71b8811

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

jni/hw/dji_display.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,14 +276,16 @@ void dji_display_open_framebuffer_injected(dji_display_state_t *display_state, d
276276
}
277277
}
278278

279-
void dji_display_push_frame(dji_display_state_t *display_state, uint8_t which_fb) {
279+
uint8_t dji_display_push_frame(dji_display_state_t *display_state, uint8_t which_fb) {
280280
duss_frame_buffer_t *fb = which_fb ? display_state->fb_1 : display_state->fb_0;
281281
duss_hal_mem_sync(fb->buffer, 1);
282282
if (display_state->frame_waiting == 0) {
283283
display_state->frame_waiting = 1;
284284
duss_hal_display_push_frame(display_state->disp_instance_handle, display_state->plane_id, fb);
285+
return !which_fb;
285286
} else {
286287
DEBUG_PRINT("!!! Dropped frame due to pending frame push!\n");
288+
return which_fb;
287289
}
288290
}
289291

jni/hw/dji_display.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ typedef struct dji_display_state_s {
2020
uint8_t frame_waiting;
2121
} dji_display_state_t;
2222

23-
void dji_display_push_frame(dji_display_state_t *display_state, uint8_t which_fb);
23+
uint8_t dji_display_push_frame(dji_display_state_t *display_state, uint8_t which_fb);
2424
void dji_display_open_framebuffer(dji_display_state_t *display_state, duss_disp_plane_id_t plane_id);
2525
void dji_display_open_framebuffer_injected(dji_display_state_t *display_state, duss_disp_instance_handle_t *disp, duss_hal_obj_handle_t ion_handle, duss_disp_plane_id_t plane_id);
2626
void dji_display_close_framebuffer(dji_display_state_t *display_state);

jni/osd_dji_overlay_udp.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,7 @@ static void render_screen() {
252252
if (display_mode == DISPLAY_DISABLED) {
253253
clear_framebuffer();
254254
}
255-
dji_display_push_frame(dji_display, which_fb);
256-
which_fb = !which_fb;
255+
which_fb = dji_display_push_frame(dji_display, which_fb);
257256
DEBUG_PRINT("drew a frame\n");
258257
clock_gettime(CLOCK_MONOTONIC, &last_render);
259258
}

0 commit comments

Comments
 (0)