diff --git a/include/libcamera/internal/egl.h b/include/libcamera/internal/egl.h
index e18bb91f4d..a3218af9ef 100644
--- a/include/libcamera/internal/egl.h
+++ b/include/libcamera/internal/egl.h
@@ -116,7 +116,7 @@ public:
 	void activateBindTexture(eGLImage &eglImage);
 
 	void pushEnv(std::vector<std::string> &shaderEnv, const char *str);
-	void makeCurrent();
+	void makeCurrent(bool make);
 
 	int compileVertexShader(GLuint &shaderId, Span<const unsigned char> shaderData,
 				Span<const std::string> shaderEnv);
diff --git a/src/libcamera/egl.cpp b/src/libcamera/egl.cpp
index 5e75c3a6d2..f351bcf52c 100644
--- a/src/libcamera/egl.cpp
+++ b/src/libcamera/egl.cpp
@@ -427,7 +427,7 @@ int eGL::initEGLContext()
 	tid_ = Thread::currentId();
 	vtable_ = vtable;
 
-	makeCurrent();
+	makeCurrent(true);
 
 	LOG(eGL, Info) << "EGL: GL_RENDERER: " << glGetString(GL_RENDERER);
 	LOG(eGL, Info) << "EGL: GL_VERSION: " << glGetString(GL_VERSION);
@@ -454,16 +454,17 @@ void eGL::resetEGLContext()
 
 /**
  * \brief Make the EGL context current for the calling thread
+ * \param[in] make Whether to make/unmake the EGL context
  *
  * Binds the EGL context to the current thread, allowing OpenGL ES
  * operations to be performed. Must be called from the thread that
  * will perform rendering operations.
  */
-void eGL::makeCurrent()
+void eGL::makeCurrent(bool make)
 {
 	ASSERT(tid_ == Thread::currentId());
 
-	if (eglMakeCurrent(display_, EGL_NO_SURFACE, EGL_NO_SURFACE, context_) != EGL_TRUE) {
+	if (eglMakeCurrent(display_, EGL_NO_SURFACE, EGL_NO_SURFACE, make ? context_ : EGL_NO_CONTEXT) != EGL_TRUE) {
 		LOG(eGL, Error) << "eglMakeCurrent fail";
 	}
 }
