@@ -16,8 +16,6 @@
#include <libcamera/base/span.h>
#include <libcamera/base/utils.h>
-#include "libcamera/internal/gbm.h"
-
#define EGL_EGLEXT_PROTOTYPES
#include <EGL/egl.h>
#include <EGL/eglext.h>
@@ -96,7 +94,7 @@ public:
eGL();
~eGL();
- int initEGLContext(GBM *gbmContext);
+ int initEGLContext();
int createInputDMABufTexture2D(eGLImage &eglImage, int fd);
int createOutputDMABufTexture2D(eGLImage &eglImage, int fd);
@@ -256,24 +256,22 @@ void eGL::createTexture2D(eGLImage &eglImage, GLint format, uint32_t width, uint
/**
* \brief Initialise the EGL context
- * \param[in] gbmContext Pointer to initialised GBM context
*
- * Sets up the EGL display from the GBM device, creates an OpenGL ES 2.0
- * context, and retrieves function pointers for required extensions
- * including:
+ * Sets up the EGL display, creates an OpenGL ES 2.0 context, and retrieves
+ * function pointers for required extensions including:
* - eglCreateImageKHR / eglDestroyImageKHR
* - glEGLImageTargetTexture2DOES
*
* \return 0 on success, or -ENODEV on failure
*/
-int eGL::initEGLContext(GBM *gbmContext)
+int eGL::initEGLContext()
{
EGLint configAttribs[] = {
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 8,
- EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
+ EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_NONE
};
@@ -291,7 +289,9 @@ int eGL::initEGLContext(GBM *gbmContext)
goto fail;
}
- display_ = eglGetDisplay(gbmContext->device());
+ display_ = eglGetPlatformDisplay(EGL_PLATFORM_SURFACELESS_MESA,
+ EGL_DEFAULT_DISPLAY,
+ nullptr);
if (display_ == EGL_NO_DISPLAY) {
LOG(eGL, Error) << "Unable to get EGL display";
goto fail;
@@ -141,8 +141,8 @@ int DebayerEGL::initBayerShaders(PixelFormat inputFormat, PixelFormat outputForm
egl_.pushEnv(shaderEnv, "#extension GL_OES_EGL_image_external: enable");
/*
- * Tell shaders how to re-order output taking account of how the
- * pixels are actually stored by GBM
+ * Tell shaders how to re-order output taking account of how the pixels
+ * are actually stored by EGL.
*/
switch (outputFormat) {
case formats::ARGB8888:
@@ -586,10 +586,7 @@ int DebayerEGL::start()
{
GLint maxTextureImageUnits;
- if (gbmSurface_.createDevice())
- return -ENODEV;
-
- if (egl_.initEGLContext(&gbmSurface_))
+ if (egl_.initEGLContext())
return -ENODEV;
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &maxTextureImageUnits);
@@ -113,7 +113,6 @@ private:
Rectangle window_;
std::unique_ptr<SwStatsCpu> stats_;
eGL egl_;
- GBM gbmSurface_;
uint32_t width_;
uint32_t height_;
GLint glFormat_;