summaryrefslogtreecommitdiff
path: root/src/ipa/vimc/data/vimc.conf
diff options
context:
space:
mode:
authorElias Naur <mail@eliasnaur.com>2023-05-05 10:18:43 -0600
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2023-05-08 11:56:14 +0300
commit4c71ec00c2ea5c6acc75e436bf6d24e6861cb66f (patch)
treec0feaaae557a5f1968c2f84bc4d6249a69e251b0 /src/ipa/vimc/data/vimc.conf
parent1c512d406536d72a393c38c3f6a75fe0fdb9ecb2 (diff)
libcamera: v4l2_videodevice: Use O_CLOEXEC when exporting DMA buffers
Files opened internally in libcamera without the O_CLOEXEC file will remain open upon a call to one of the exec(3) functions. As exec() doesn't destroy local or global objects, this can lead to various side effects. Avoid this by opening file descriptors with O_CLOEXEC for all internal files. The O_CLOEXEC flag should also be set when obtaining file handles from the V4L2 VIDIOC_EXPBUF operation, but was missed during the updates to both d942bdc913c5 ("libcamera: v4l2_device: openat(2) with O_CLOEXEC to cleanup after exec(3)") and 436b38fd89fe ("libcamera: Open files with O_CLOEXEC"). Set the O_CLOEXEC flag on calls to ioctl(VIDIOC_EXPBUF). Fixes: 436b38fd89fe ("libcamera: Open files with O_CLOEXEC") Signed-off-by: Elias Naur <mail@eliasnaur.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/ipa/vimc/data/vimc.conf')
0 files changed, 0 insertions, 0 deletions
='#n137'>137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
 * Copyright (C) 2021, Google Inc.
 *
 * cros_camera_buffer.cpp - Chromium OS buffer backend using CameraBufferManager
 */

#include "../camera_buffer.h"

#include <libcamera/base/log.h>

#include "cros-camera/camera_buffer_manager.h"

using namespace libcamera;

LOG_DECLARE_CATEGORY(HAL)

class CameraBuffer::Private : public Extensible::Private
{
	LIBCAMERA_DECLARE_PUBLIC(CameraBuffer)

public:
	Private(CameraBuffer *cameraBuffer, buffer_handle_t camera3Buffer,
		PixelFormat pixelFormat, const Size &size,
		int flags);
	~Private();

	bool isValid() const { return registered_; }

	unsigned int numPlanes() const;

	Span<uint8_t> plane(unsigned int plane);

	unsigned int stride(unsigned int plane) const;
	unsigned int offset(unsigned int plane) const;
	unsigned int size(unsigned int plane) const;