ui: destroy egl_images in main thread (#30253)

* call eglDestroyImageKHR in ui thread

* assert
old-commit-hash: dbda641cee
pull/32199/head
Dean Lee 2 years ago committed by GitHub
parent a625ca55e7
commit 5ada7c007b
  1. 22
      selfdrive/ui/qt/widgets/cameraview.cc
  2. 1
      selfdrive/ui/qt/widgets/cameraview.h

@ -187,12 +187,23 @@ void CameraWidget::showEvent(QShowEvent *event) {
}
void CameraWidget::stopVipcThread() {
makeCurrent();
if (vipc_thread) {
vipc_thread->requestInterruption();
vipc_thread->quit();
vipc_thread->wait();
vipc_thread = nullptr;
}
#ifdef QCOM2
EGLDisplay egl_display = eglGetCurrentDisplay();
assert(egl_display != EGL_NO_DISPLAY);
for (auto &pair : egl_images) {
eglDestroyImageKHR(egl_display, pair.second);
assert(eglGetError() == EGL_SUCCESS);
}
egl_images.clear();
#endif
}
void CameraWidget::availableStreamsUpdated(std::set<VisionStreamType> streams) {
@ -323,8 +334,8 @@ void CameraWidget::vipcConnected(VisionIpcClient *vipc_client) {
stream_stride = vipc_client->buffers[0].stride;
#ifdef QCOM2
egl_display = eglGetCurrentDisplay();
EGLDisplay egl_display = eglGetCurrentDisplay();
assert(egl_display != EGL_NO_DISPLAY);
for (auto &pair : egl_images) {
eglDestroyImageKHR(egl_display, pair.second);
}
@ -415,13 +426,6 @@ void CameraWidget::vipcThread() {
}
}
}
#ifdef QCOM2
for (auto &pair : egl_images) {
eglDestroyImageKHR(egl_display, pair.second);
}
egl_images.clear();
#endif
}
void CameraWidget::clearFrames() {

@ -70,7 +70,6 @@ protected:
QColor bg = QColor("#000000");
#ifdef QCOM2
EGLDisplay egl_display;
std::map<int, EGLImageKHR> egl_images;
#endif

Loading…
Cancel
Save