Remove a bunch of useless asserts

This commit is contained in:
Cameron Gutman 2024-02-19 20:49:25 -06:00
parent 883498d642
commit 0e12282311

View File

@ -158,22 +158,18 @@ void *display_thread(void *param) {
while (!frm_eos) { while (!frm_eos) {
int _fb_id; int _fb_id;
ret = pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
assert(!ret);
while (fb_id == 0) { while (fb_id == 0) {
pthread_cond_wait(&cond, &mutex); pthread_cond_wait(&cond, &mutex);
assert(!ret);
if (fb_id == 0 && frm_eos) { if (fb_id == 0 && frm_eos) {
ret = pthread_mutex_unlock(&mutex); pthread_mutex_unlock(&mutex);
assert(!ret);
return NULL; return NULL;
} }
} }
_fb_id = fb_id; _fb_id = fb_id;
fb_id = 0; fb_id = 0;
ret = pthread_mutex_unlock(&mutex); pthread_mutex_unlock(&mutex);
assert(!ret);
if (atomic) { if (atomic) {
// We may need to modeset to apply colorspace changes when toggling HDR // We may need to modeset to apply colorspace changes when toggling HDR
@ -313,14 +309,10 @@ void *frame_thread(void *param) {
} }
assert(i != MAX_FRAMES); assert(i != MAX_FRAMES);
// send DRM FB to display thread // send DRM FB to display thread
ret = pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
assert(!ret);
fb_id = frame_to_drm[i].fb_id; fb_id = frame_to_drm[i].fb_id;
ret = pthread_cond_signal(&cond); pthread_cond_signal(&cond);
assert(!ret); pthread_mutex_unlock(&mutex);
ret = pthread_mutex_unlock(&mutex);
assert(!ret);
} else { } else {
fprintf(stderr, "Frame no buff\n"); fprintf(stderr, "Frame no buff\n");
} }
@ -551,15 +543,11 @@ int rk_setup(int videoFormat, int width, int height, int redrawRate, void* conte
ret = mpi_api->control(mpi_ctx, MPP_SET_OUTPUT_BLOCK, &param); ret = mpi_api->control(mpi_ctx, MPP_SET_OUTPUT_BLOCK, &param);
assert(!ret); assert(!ret);
ret = pthread_mutex_init(&mutex, NULL); pthread_mutex_init(&mutex, NULL);
assert(!ret); pthread_cond_init(&cond, NULL);
ret = pthread_cond_init(&cond, NULL);
assert(!ret);
ret = pthread_create(&tid_frame, NULL, frame_thread, NULL); pthread_create(&tid_frame, NULL, frame_thread, NULL);
assert(!ret); pthread_create(&tid_display, NULL, display_thread, NULL);
ret = pthread_create(&tid_display, NULL, display_thread, NULL);
assert(!ret);
return 0; return 0;
} }
@ -570,26 +558,19 @@ void rk_cleanup() {
int ret; int ret;
frm_eos = 1; frm_eos = 1;
ret = pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
assert(!ret); pthread_cond_signal(&cond);
ret = pthread_cond_signal(&cond); pthread_mutex_unlock(&mutex);
assert(!ret);
ret = pthread_mutex_unlock(&mutex);
assert(!ret);
ret = pthread_join(tid_display, NULL); pthread_join(tid_display, NULL);
assert(!ret);
ret = pthread_cond_destroy(&cond); pthread_cond_destroy(&cond);
assert(!ret); pthread_mutex_destroy(&mutex);
ret = pthread_mutex_destroy(&mutex);
assert(!ret);
ret = mpi_api->reset(mpi_ctx); ret = mpi_api->reset(mpi_ctx);
assert(!ret); assert(!ret);
ret = pthread_join(tid_frame, NULL); pthread_join(tid_frame, NULL);
assert(!ret);
if (mpi_frm_grp) { if (mpi_frm_grp) {
ret = mpp_buffer_group_put(mpi_frm_grp); ret = mpp_buffer_group_put(mpi_frm_grp);