Files
external_libcamera/include/libcamera/internal/gbm.h
Bryan O'Donoghue c60b1ce819 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>
2026-01-07 17:02:57 +00:00

56 lines
988 B
C++

/* 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 */