libcamera: software_isp: debayer_egl: Make DebayerEGL an environment option

If GPUISP support is available make it so an environment variable can
switch it on.

Given we don't have full feature parity with CPUISP just yet on pixel
format output, we should default to CPUISP mode giving the user the option
to switch on GPUISP by setting LIBCAMERA_SOFTISP_MODE=gpu

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
This commit is contained in:
Bryan O'Donoghue 2024-06-12 02:08:02 +01:00
parent eba3920091
commit a9fa1ff3c6

View file

@ -15,6 +15,7 @@
#include <libcamera/base/log.h> #include <libcamera/base/log.h>
#include <libcamera/base/thread.h> #include <libcamera/base/thread.h>
#include <libcamera/base/utils.h>
#include <libcamera/controls.h> #include <libcamera/controls.h>
#include <libcamera/formats.h> #include <libcamera/formats.h>
@ -25,6 +26,9 @@
#include "libcamera/internal/software_isp/debayer_params.h" #include "libcamera/internal/software_isp/debayer_params.h"
#include "debayer_cpu.h" #include "debayer_cpu.h"
#if HAVE_DEBAYER_EGL
#include "debayer_egl.h"
#endif
/** /**
* \file software_isp.cpp * \file software_isp.cpp
@ -114,7 +118,20 @@ SoftwareIsp::SoftwareIsp(PipelineHandler *pipe, const CameraSensor *sensor,
} }
stats->statsReady.connect(this, &SoftwareIsp::statsReady); stats->statsReady.connect(this, &SoftwareIsp::statsReady);
#if HAVE_DEBAYER_EGL
const char *softISPMode = utils::secure_getenv("LIBCAMERA_SOFTISP_MODE");
if (softISPMode && !strcmp(softISPMode, "gpu"))
debayer_ = std::make_unique<DebayerEGL>(std::move(stats));
#endif
if (!debayer_)
debayer_ = std::make_unique<DebayerCpu>(std::move(stats)); debayer_ = std::make_unique<DebayerCpu>(std::move(stats));
if (!debayer_) {
LOG(SoftwareIsp, Error) << "Failed to create Debayer object";
return;
}
debayer_->inputBufferReady.connect(this, &SoftwareIsp::inputReady); debayer_->inputBufferReady.connect(this, &SoftwareIsp::inputReady);
debayer_->outputBufferReady.connect(this, &SoftwareIsp::outputReady); debayer_->outputBufferReady.connect(this, &SoftwareIsp::outputReady);