libcamera: software_isp: gbm: Add a GBM helper class for GPU surface access

A helper class to interact with GBM. This will allow us to specify the
internal storage format of the GPU when making a texture for the Debayer
vertex/fragment shaders and thus ensure we receive an uncompressed and
untiled output buffer.

Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Robert Mader <robert.mader@collabora.com>
Tested-by: Robert Mader <robert.mader@collabora.com>
Tested-by: Hans de Goede <johannes.goede@oss.qualcomm.com> # ThinkPad T14s gen 6 (arm64) ov02c10 + X1c gen 12 ov08x40
Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com> # Lenovo X13s
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Bryan O'Donoghue
2026-01-06 17:00:37 +00:00
committed by Kieran Bingham
parent a1a6253ff9
commit c60b1ce819
4 changed files with 173 additions and 0 deletions
+55
View File
@@ -0,0 +1,55 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2024, Linaro Ltd.
*
* Authors:
* Bryan O'Donoghue <bryan.odonoghue@linaro.org>
*
* Helper class for managing GBM interactions
*/
#pragma once
#include <gbm.h>
#include <libcamera/base/log.h>
#include <libcamera/base/unique_fd.h>
#include <libcamera/formats.h>
namespace libcamera {
LOG_DECLARE_CATEGORY(GBM)
class GBM
{
public:
GBM();
~GBM();
int createDevice();
/**
* \brief Retrieve the GBM device handle
*
* \return Pointer to the gbm_device structure, or nullptr if the device
* has not been created
*/
struct gbm_device *device() const { return gbmDevice_; }
/**
* \brief Retrieve the pixel format
*
* \return The PixelFormat used by this GBM instance (ARGB8888)
*/
PixelFormat format() const { return format_; }
private:
LIBCAMERA_DISABLE_COPY_AND_MOVE(GBM)
UniqueFD fd_;
struct gbm_device *gbmDevice_ = nullptr;
PixelFormat format_;
};
} /* namespace libcamera */
+1
View File
@@ -23,6 +23,7 @@ libcamera_internal_headers = files([
'dma_buf_allocator.h',
'formats.h',
'framebuffer.h',
'gbm.h',
'global_configuration.h',
'ipa_data_serializer.h',
'ipa_manager.h',