| Message ID | 20260804101949.353266-8-barnabas.pocze@ideasonboard.com |
|---|---|
| State | Superseded |
| Headers | show |
| Series |
|
| Related | show |
Barnabás Pőcze <barnabas.pocze@ideasonboard.com> writes: > If the initialization is already done, reject further attempts, > otherwise resources would be leaked. > > Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> > --- > src/libcamera/egl.cpp | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp > index 6b50e7bb77..5e75c3a6d2 100644 > --- a/src/libcamera/egl.cpp > +++ b/src/libcamera/egl.cpp > @@ -359,7 +359,7 @@ void eGL::createOutputTexture2D(eGLImage &eglImage) > * - eglCreateImageKHR / eglDestroyImageKHR > * - glEGLImageTargetTexture2DOES > * > - * \return 0 on success, or -ENODEV on failure > + * \return 0 on success, or negative error code on failure > */ > int eGL::initEGLContext() > { > @@ -382,6 +382,9 @@ int eGL::initEGLContext() > EGLint numConfigs; > EGLConfig config; > > + if (context_ != EGL_NO_CONTEXT) > + return -EEXIST; > + > if (!eglBindAPI(EGL_OPENGL_ES_API)) { > LOG(eGL, Error) << "API bind fail"; > goto fail;
diff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp index 6b50e7bb77..5e75c3a6d2 100644 --- a/src/libcamera/egl.cpp +++ b/src/libcamera/egl.cpp @@ -359,7 +359,7 @@ void eGL::createOutputTexture2D(eGLImage &eglImage) * - eglCreateImageKHR / eglDestroyImageKHR * - glEGLImageTargetTexture2DOES * - * \return 0 on success, or -ENODEV on failure + * \return 0 on success, or negative error code on failure */ int eGL::initEGLContext() { @@ -382,6 +382,9 @@ int eGL::initEGLContext() EGLint numConfigs; EGLConfig config; + if (context_ != EGL_NO_CONTEXT) + return -EEXIST; + if (!eglBindAPI(EGL_OPENGL_ES_API)) { LOG(eGL, Error) << "API bind fail"; goto fail;
If the initialization is already done, reject further attempts, otherwise resources would be leaked. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> --- src/libcamera/egl.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)