From patchwork Tue Sep 22 09:50:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 9695 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 79556C3B5B for ; Tue, 22 Sep 2020 09:50:36 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3DD9B62FDD; Tue, 22 Sep 2020 11:50:36 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="goJ6IrYb"; dkim-atps=neutral Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id ADFE362FD6 for ; Tue, 22 Sep 2020 11:50:33 +0200 (CEST) Received: by mail-wr1-x435.google.com with SMTP id x14so16289428wrl.12 for ; Tue, 22 Sep 2020 02:50:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=W3B1SEh6B3BMPJIWyNG83jbhUKHNFkXZCUMYp2s0V4A=; b=goJ6IrYbLF/80hJLDPQxgVDoW9uv9j6Uv/nJrgn5sdty8eBWPNFmMYq+1RW2lsEcrB nM0+3vhXBmQvWSVfGeQmaTFcZQfKcxFDlLdElSV1+SgnLtX2Rj2uhzsyHjZ91t2vR6qB Wyd0iL7i26ew3++9EcP1J0K46QJE1NCnkVkBmYxvbrq4iW4g6fuwCCVsLWYeMzCqvKvd XZN4QNE94ubU2kp9OE4vgIr16qIAejASxCjwExcSbbH6LihcdHQZlKQJE/3/ETjJigf+ qSuzrk3+Q6oh8lU9nqlUpBfijURuFEfrYarL12jqO0AhtzhfH6cXmCFw1/C04bIMGBgD jLqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=W3B1SEh6B3BMPJIWyNG83jbhUKHNFkXZCUMYp2s0V4A=; b=PLy4H3t+dvgqtsFVzbTI0k+Zl1MlzlEbCKaqjBIG57KUVzLMp+cGY6YAdb8OxChb7d 5qekyPvLffhBbFh3DdUWX2pXQpnFK2GvqEvlIx+W3hp+6Mr2rOYCG6a/z+iLXgyxwzl3 JtzqfnELiSUDMo/o0qAum72sX4S9fQeP4Wgdea4ZKFuVtlwwxKpTwHhxEkiozV8bct5E 7DRVNshZty8xSX82fw74IKjLKTDz7dkDp4XmjJDbbLNx9JHR3OdXH+ekd/6r1IEmKXBM SPoAEFpxtsRTMHyTHn8g3c/lAxeOWMRlfCZXDMwNd2tKv5Wyk7EcjMi4Uo7F3FWFTDbc RwBA== X-Gm-Message-State: AOAM530cW7Wzh56s5V/8qijB7r9AL5qyWZGXRl+0my7ntXtdhRDKPjeu jo9U7Y676pXF6oyloTlRF3dFm6PNmTarYA== X-Google-Smtp-Source: ABdhPJyby6ShfvFfSpvGzoWnRQefd/3ioWqS0/skvBShFeULPfWEll0nXSkHTt0YqvzSmAjEKx0mww== X-Received: by 2002:adf:f5c7:: with SMTP id k7mr4526270wrp.246.1600768232552; Tue, 22 Sep 2020 02:50:32 -0700 (PDT) Received: from naushir-VirtualBox.pitowers.org ([2a00:1098:3142:14:a00:27ff:fe4d:f6a2]) by smtp.gmail.com with ESMTPSA id h204sm3776187wmf.35.2020.09.22.02.50.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2020 02:50:31 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Tue, 22 Sep 2020 10:50:16 +0100 Message-Id: <20200922095018.68434-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200922095018.68434-1-naush@raspberrypi.com> References: <20200922095018.68434-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/4] ipa: raspberrypi: Move IPA parameters to the RPi namespace X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" All IPA related types/params are now moved to the RPi namespace. There are no functional changes in this commit. Signed-off-by: Naushir Patuck Reviewed-by: Jacopo Mondi --- include/libcamera/ipa/raspberrypi.h | 40 +++++---- src/ipa/raspberrypi/raspberrypi.cpp | 82 +++++++++---------- .../pipeline/raspberrypi/raspberrypi.cpp | 40 ++++----- .../pipeline/raspberrypi/rpi_stream.cpp | 4 +- .../pipeline/raspberrypi/rpi_stream.h | 4 +- 5 files changed, 87 insertions(+), 83 deletions(-) diff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h index dd6ebeac..c9d4aa81 100644 --- a/include/libcamera/ipa/raspberrypi.h +++ b/include/libcamera/ipa/raspberrypi.h @@ -10,25 +10,29 @@ #include #include -enum RPiConfigParameters { - RPI_IPA_CONFIG_LS_TABLE = (1 << 0), - RPI_IPA_CONFIG_STAGGERED_WRITE = (1 << 1), - RPI_IPA_CONFIG_SENSOR = (1 << 2), - RPI_IPA_CONFIG_DROP_FRAMES = (1 << 3), +namespace libcamera { + +namespace RPi { + +enum ConfigParameters { + IPA_CONFIG_LS_TABLE = (1 << 0), + IPA_CONFIG_STAGGERED_WRITE = (1 << 1), + IPA_CONFIG_SENSOR = (1 << 2), + IPA_CONFIG_DROP_FRAMES = (1 << 3), }; -enum RPiOperations { - RPI_IPA_ACTION_V4L2_SET_STAGGERED = 1, - RPI_IPA_ACTION_V4L2_SET_ISP, - RPI_IPA_ACTION_STATS_METADATA_COMPLETE, - RPI_IPA_ACTION_RUN_ISP, - RPI_IPA_ACTION_EMBEDDED_COMPLETE, - RPI_IPA_EVENT_SIGNAL_STAT_READY, - RPI_IPA_EVENT_SIGNAL_ISP_PREPARE, - RPI_IPA_EVENT_QUEUE_REQUEST, +enum Operations { + IPA_ACTION_V4L2_SET_STAGGERED = 1, + IPA_ACTION_V4L2_SET_ISP, + IPA_ACTION_STATS_METADATA_COMPLETE, + IPA_ACTION_RUN_ISP, + IPA_ACTION_EMBEDDED_COMPLETE, + IPA_EVENT_SIGNAL_STAT_READY, + IPA_EVENT_SIGNAL_ISP_PREPARE, + IPA_EVENT_QUEUE_REQUEST, }; -enum RPiBufferMask { +enum BufferMask { ID = 0x00ffff, STATS = 0x010000, EMBEDDED_DATA = 0x020000, @@ -39,10 +43,8 @@ enum RPiBufferMask { /* Size of the LS grid allocation. */ #define MAX_LS_GRID_SIZE (32 << 10) -namespace libcamera { - /* List of controls handled by the Raspberry Pi IPA */ -static const ControlInfoMap RPiControls = { +static const ControlInfoMap Controls = { { &controls::AeEnable, ControlInfo(false, true) }, { &controls::ExposureTime, ControlInfo(0, 999999) }, { &controls::AnalogueGain, ControlInfo(1.0f, 32.0f) }, @@ -60,6 +62,8 @@ static const ControlInfoMap RPiControls = { { &controls::ColourCorrectionMatrix, ControlInfo(-16.0f, 16.0f) }, }; +} /* namespace RPi */ + } /* namespace libcamera */ #endif /* __LIBCAMERA_IPA_INTERFACE_RASPBERRYPI_H__ */ diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 0555cc4e..28f81824 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -125,10 +125,10 @@ private: CameraMode lastMode_; /* Raspberry Pi controller specific defines. */ - std::unique_ptr helper_; - RPi::Controller controller_; + std::unique_ptr<::RPi::CamHelper> helper_; + ::RPi::Controller controller_; bool controllerInit_; - RPi::Metadata rpiMetadata_; + ::RPi::Metadata rpiMetadata_; /* * We count frames to decide if the frame must be hidden (e.g. from @@ -211,7 +211,7 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, */ std::string cameraName(sensorInfo.model); if (!helper_) { - helper_ = std::unique_ptr(RPi::CamHelper::Create(cameraName)); + helper_ = std::unique_ptr<::RPi::CamHelper>(::RPi::CamHelper::Create(cameraName)); /* * Pass out the sensor config to the pipeline handler in order * to setup the staggered writer class. @@ -224,7 +224,7 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, result->data.push_back(exposureDelay); result->data.push_back(sensorMetadata); - result->operation |= RPI_IPA_CONFIG_STAGGERED_WRITE; + result->operation |= RPi::IPA_CONFIG_STAGGERED_WRITE; } /* Re-assemble camera mode using the sensor info. */ @@ -250,7 +250,7 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, } result->data.push_back(drop_frame); - result->operation |= RPI_IPA_CONFIG_DROP_FRAMES; + result->operation |= RPi::IPA_CONFIG_DROP_FRAMES; struct AgcStatus agcStatus; /* These zero values mean not program anything (unless overwritten). */ @@ -268,7 +268,7 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, agcStatus.analogue_gain = DEFAULT_ANALOGUE_GAIN; } - RPi::Metadata metadata; + ::RPi::Metadata metadata; controller_.SwitchMode(mode_, &metadata); /* SwitchMode may supply updated exposure/gain values to use. */ @@ -278,13 +278,13 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, applyAGC(&agcStatus, ctrls); result->controls.push_back(ctrls); - result->operation |= RPI_IPA_CONFIG_SENSOR; + result->operation |= RPi::IPA_CONFIG_SENSOR; } lastMode_ = mode_; /* Store the lens shading table pointer and handle if available. */ - if (ipaConfig.operation & RPI_IPA_CONFIG_LS_TABLE) { + if (ipaConfig.operation & RPi::IPA_CONFIG_LS_TABLE) { /* Remove any previous table, if there was one. */ if (lsTable_) { munmap(lsTable_, MAX_LS_GRID_SIZE); @@ -340,7 +340,7 @@ void IPARPi::unmapBuffers(const std::vector &ids) void IPARPi::processEvent(const IPAOperationData &event) { switch (event.operation) { - case RPI_IPA_EVENT_SIGNAL_STAT_READY: { + case RPi::IPA_EVENT_SIGNAL_STAT_READY: { unsigned int bufferId = event.data[0]; if (++check_count_ != frame_count_) /* assert here? */ @@ -351,14 +351,14 @@ void IPARPi::processEvent(const IPAOperationData &event) reportMetadata(); IPAOperationData op; - op.operation = RPI_IPA_ACTION_STATS_METADATA_COMPLETE; - op.data = { bufferId & RPiBufferMask::ID }; + op.operation = RPi::IPA_ACTION_STATS_METADATA_COMPLETE; + op.data = { bufferId & RPi::BufferMask::ID }; op.controls = { libcameraMetadata_ }; queueFrameAction.emit(0, op); break; } - case RPI_IPA_EVENT_SIGNAL_ISP_PREPARE: { + case RPi::IPA_EVENT_SIGNAL_ISP_PREPARE: { unsigned int embeddedbufferId = event.data[0]; unsigned int bayerbufferId = event.data[1]; @@ -372,13 +372,13 @@ void IPARPi::processEvent(const IPAOperationData &event) /* Ready to push the input buffer into the ISP. */ IPAOperationData op; - op.operation = RPI_IPA_ACTION_RUN_ISP; - op.data = { bayerbufferId & RPiBufferMask::ID }; + op.operation = RPi::IPA_ACTION_RUN_ISP; + op.data = { bayerbufferId & RPi::BufferMask::ID }; queueFrameAction.emit(0, op); break; } - case RPI_IPA_EVENT_QUEUE_REQUEST: { + case RPi::IPA_EVENT_QUEUE_REQUEST: { queueRequest(event.controls[0]); break; } @@ -391,7 +391,7 @@ void IPARPi::processEvent(const IPAOperationData &event) void IPARPi::reportMetadata() { - std::unique_lock lock(rpiMetadata_); + std::unique_lock<::RPi::Metadata> lock(rpiMetadata_); /* * Certain information about the current frame and how it will be @@ -496,7 +496,7 @@ void IPARPi::queueRequest(const ControlList &controls) switch (ctrl.first) { case controls::AE_ENABLE: { - RPi::Algorithm *agc = controller_.GetAlgorithm("agc"); + ::RPi::Algorithm *agc = controller_.GetAlgorithm("agc"); ASSERT(agc); if (ctrl.second.get() == false) agc->Pause(); @@ -508,7 +508,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::EXPOSURE_TIME: { - RPi::AgcAlgorithm *agc = dynamic_cast( + ::RPi::AgcAlgorithm *agc = dynamic_cast<::RPi::AgcAlgorithm *>( controller_.GetAlgorithm("agc")); ASSERT(agc); /* This expects units of micro-seconds. */ @@ -522,7 +522,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::ANALOGUE_GAIN: { - RPi::AgcAlgorithm *agc = dynamic_cast( + ::RPi::AgcAlgorithm *agc = dynamic_cast<::RPi::AgcAlgorithm *>( controller_.GetAlgorithm("agc")); ASSERT(agc); agc->SetFixedAnalogueGain(ctrl.second.get()); @@ -536,7 +536,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::AE_METERING_MODE: { - RPi::AgcAlgorithm *agc = dynamic_cast( + ::RPi::AgcAlgorithm *agc = dynamic_cast<::RPi::AgcAlgorithm *>( controller_.GetAlgorithm("agc")); ASSERT(agc); @@ -552,7 +552,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::AE_CONSTRAINT_MODE: { - RPi::AgcAlgorithm *agc = dynamic_cast( + ::RPi::AgcAlgorithm *agc = dynamic_cast<::RPi::AgcAlgorithm *>( controller_.GetAlgorithm("agc")); ASSERT(agc); @@ -568,7 +568,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::AE_EXPOSURE_MODE: { - RPi::AgcAlgorithm *agc = dynamic_cast( + ::RPi::AgcAlgorithm *agc = dynamic_cast<::RPi::AgcAlgorithm *>( controller_.GetAlgorithm("agc")); ASSERT(agc); @@ -584,7 +584,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::EXPOSURE_VALUE: { - RPi::AgcAlgorithm *agc = dynamic_cast( + ::RPi::AgcAlgorithm *agc = dynamic_cast<::RPi::AgcAlgorithm *>( controller_.GetAlgorithm("agc")); ASSERT(agc); @@ -600,7 +600,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::AWB_ENABLE: { - RPi::Algorithm *awb = controller_.GetAlgorithm("awb"); + ::RPi::Algorithm *awb = controller_.GetAlgorithm("awb"); ASSERT(awb); if (ctrl.second.get() == false) @@ -614,7 +614,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::AWB_MODE: { - RPi::AwbAlgorithm *awb = dynamic_cast( + ::RPi::AwbAlgorithm *awb = dynamic_cast<::RPi::AwbAlgorithm *>( controller_.GetAlgorithm("awb")); ASSERT(awb); @@ -631,7 +631,7 @@ void IPARPi::queueRequest(const ControlList &controls) case controls::COLOUR_GAINS: { auto gains = ctrl.second.get>(); - RPi::AwbAlgorithm *awb = dynamic_cast( + ::RPi::AwbAlgorithm *awb = dynamic_cast<::RPi::AwbAlgorithm *>( controller_.GetAlgorithm("awb")); ASSERT(awb); @@ -644,7 +644,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::BRIGHTNESS: { - RPi::ContrastAlgorithm *contrast = dynamic_cast( + ::RPi::ContrastAlgorithm *contrast = dynamic_cast<::RPi::ContrastAlgorithm *>( controller_.GetAlgorithm("contrast")); ASSERT(contrast); @@ -655,7 +655,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::CONTRAST: { - RPi::ContrastAlgorithm *contrast = dynamic_cast( + ::RPi::ContrastAlgorithm *contrast = dynamic_cast<::RPi::ContrastAlgorithm *>( controller_.GetAlgorithm("contrast")); ASSERT(contrast); @@ -666,7 +666,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::SATURATION: { - RPi::CcmAlgorithm *ccm = dynamic_cast( + ::RPi::CcmAlgorithm *ccm = dynamic_cast<::RPi::CcmAlgorithm *>( controller_.GetAlgorithm("ccm")); ASSERT(ccm); @@ -677,7 +677,7 @@ void IPARPi::queueRequest(const ControlList &controls) } case controls::SHARPNESS: { - RPi::SharpenAlgorithm *sharpen = dynamic_cast( + ::RPi::SharpenAlgorithm *sharpen = dynamic_cast<::RPi::SharpenAlgorithm *>( controller_.GetAlgorithm("sharpen")); ASSERT(sharpen); @@ -699,8 +699,8 @@ void IPARPi::queueRequest(const ControlList &controls) void IPARPi::returnEmbeddedBuffer(unsigned int bufferId) { IPAOperationData op; - op.operation = RPI_IPA_ACTION_EMBEDDED_COMPLETE; - op.data = { bufferId & RPiBufferMask::ID }; + op.operation = RPi::IPA_ACTION_EMBEDDED_COMPLETE; + op.data = { bufferId & RPi::BufferMask::ID }; queueFrameAction.emit(0, op); } @@ -720,7 +720,7 @@ void IPARPi::prepareISP(unsigned int bufferId) controller_.Prepare(&rpiMetadata_); /* Lock the metadata buffer to avoid constant locks/unlocks. */ - std::unique_lock lock(rpiMetadata_); + std::unique_lock<::RPi::Metadata> lock(rpiMetadata_); AwbStatus *awbStatus = rpiMetadata_.GetLocked("awb.status"); if (awbStatus) @@ -764,7 +764,7 @@ void IPARPi::prepareISP(unsigned int bufferId) if (!ctrls.empty()) { IPAOperationData op; - op.operation = RPI_IPA_ACTION_V4L2_SET_ISP; + op.operation = RPi::IPA_ACTION_V4L2_SET_ISP; op.controls.push_back(ctrls); queueFrameAction.emit(0, op); } @@ -781,18 +781,18 @@ bool IPARPi::parseEmbeddedData(unsigned int bufferId, struct DeviceStatus &devic int size = buffers_.find(bufferId)->second.planes()[0].length; helper_->Parser().SetBufferSize(size); - RPi::MdParser::Status status = helper_->Parser().Parse(it->second); - if (status != RPi::MdParser::Status::OK) { + ::RPi::MdParser::Status status = helper_->Parser().Parse(it->second); + if (status != ::RPi::MdParser::Status::OK) { LOG(IPARPI, Error) << "Embedded Buffer parsing failed, error " << status; } else { uint32_t exposure_lines, gain_code; - if (helper_->Parser().GetExposureLines(exposure_lines) != RPi::MdParser::Status::OK) { + if (helper_->Parser().GetExposureLines(exposure_lines) != ::RPi::MdParser::Status::OK) { LOG(IPARPI, Error) << "Exposure time failed"; return false; } deviceStatus.shutter_speed = helper_->Exposure(exposure_lines); - if (helper_->Parser().GetGainCode(gain_code) != RPi::MdParser::Status::OK) { + if (helper_->Parser().GetGainCode(gain_code) != ::RPi::MdParser::Status::OK) { LOG(IPARPI, Error) << "Gain failed"; return false; } @@ -815,7 +815,7 @@ void IPARPi::processStats(unsigned int bufferId) } bcm2835_isp_stats *stats = static_cast(it->second); - RPi::StatisticsPtr statistics = std::make_shared(*stats); + ::RPi::StatisticsPtr statistics = std::make_shared(*stats); controller_.Process(statistics, &rpiMetadata_); struct AgcStatus agcStatus; @@ -824,7 +824,7 @@ void IPARPi::processStats(unsigned int bufferId) applyAGC(&agcStatus, ctrls); IPAOperationData op; - op.operation = RPI_IPA_ACTION_V4L2_SET_STAGGERED; + op.operation = RPi::IPA_ACTION_V4L2_SET_STAGGERED; op.controls.push_back(ctrls); queueFrameAction.emit(0, op); } diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 5ed74d51..35dbe0fb 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -837,7 +837,7 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator) } /* Register the controls that the Raspberry Pi IPA can handle. */ - data->controlInfo_ = RPiControls; + data->controlInfo_ = RPi::Controls; /* Initialize the camera properties. */ data->properties_ = data->sensor_->properties(); @@ -925,8 +925,8 @@ int PipelineHandlerRPi::prepareBuffers(Camera *camera) * Pass the stats and embedded data buffers to the IPA. No other * buffers need to be passed. */ - mapBuffers(camera, data->isp_[Isp::Stats].getBuffers(), RPiBufferMask::STATS); - mapBuffers(camera, data->unicam_[Unicam::Embedded].getBuffers(), RPiBufferMask::EMBEDDED_DATA); + mapBuffers(camera, data->isp_[Isp::Stats].getBuffers(), RPi::BufferMask::STATS); + mapBuffers(camera, data->unicam_[Unicam::Embedded].getBuffers(), RPi::BufferMask::EMBEDDED_DATA); return 0; } @@ -1017,7 +1017,7 @@ int RPiCameraData::configureIPA() return -ENOMEM; /* Allow the IPA to mmap the LS table via the file descriptor. */ - ipaConfig.operation = RPI_IPA_CONFIG_LS_TABLE; + ipaConfig.operation = RPi::IPA_CONFIG_LS_TABLE; ipaConfig.data = { static_cast(lsTable_.fd()) }; } @@ -1035,7 +1035,7 @@ int RPiCameraData::configureIPA() &result); unsigned int resultIdx = 0; - if (result.operation & RPI_IPA_CONFIG_STAGGERED_WRITE) { + if (result.operation & RPi::IPA_CONFIG_STAGGERED_WRITE) { /* * Setup our staggered control writer with the sensor default * gain and exposure delays. @@ -1048,13 +1048,13 @@ int RPiCameraData::configureIPA() } } - if (result.operation & RPI_IPA_CONFIG_SENSOR) { + if (result.operation & RPi::IPA_CONFIG_SENSOR) { const ControlList &ctrls = result.controls[0]; if (!staggeredCtrl_.set(ctrls)) LOG(RPI, Error) << "V4L2 staggered set failed"; } - if (result.operation & RPI_IPA_CONFIG_DROP_FRAMES) { + if (result.operation & RPi::IPA_CONFIG_DROP_FRAMES) { /* Configure the number of dropped frames required on startup. */ dropFrameCount_ = result.data[resultIdx++]; } @@ -1070,14 +1070,14 @@ void RPiCameraData::queueFrameAction([[maybe_unused]] unsigned int frame, * a stopped state. */ switch (action.operation) { - case RPI_IPA_ACTION_V4L2_SET_STAGGERED: { + case RPi::IPA_ACTION_V4L2_SET_STAGGERED: { const ControlList &controls = action.controls[0]; if (!staggeredCtrl_.set(controls)) LOG(RPI, Error) << "V4L2 staggered set failed"; goto done; } - case RPI_IPA_ACTION_V4L2_SET_ISP: { + case RPi::IPA_ACTION_V4L2_SET_ISP: { ControlList controls = action.controls[0]; isp_[Isp::Input].dev()->setControls(&controls); goto done; @@ -1092,7 +1092,7 @@ void RPiCameraData::queueFrameAction([[maybe_unused]] unsigned int frame, * is in a stopped state. */ switch (action.operation) { - case RPI_IPA_ACTION_STATS_METADATA_COMPLETE: { + case RPi::IPA_ACTION_STATS_METADATA_COMPLETE: { unsigned int bufferId = action.data[0]; FrameBuffer *buffer = isp_[Isp::Stats].getBuffers().at(bufferId); @@ -1103,14 +1103,14 @@ void RPiCameraData::queueFrameAction([[maybe_unused]] unsigned int frame, break; } - case RPI_IPA_ACTION_EMBEDDED_COMPLETE: { + case RPi::IPA_ACTION_EMBEDDED_COMPLETE: { unsigned int bufferId = action.data[0]; FrameBuffer *buffer = unicam_[Unicam::Embedded].getBuffers().at(bufferId); handleStreamBuffer(buffer, &unicam_[Unicam::Embedded]); break; } - case RPI_IPA_ACTION_RUN_ISP: { + case RPi::IPA_ACTION_RUN_ISP: { unsigned int bufferId = action.data[0]; FrameBuffer *buffer = unicam_[Unicam::Image].getBuffers().at(bufferId); @@ -1228,8 +1228,8 @@ void RPiCameraData::ispOutputDequeue(FrameBuffer *buffer) */ if (stream == &isp_[Isp::Stats]) { IPAOperationData op; - op.operation = RPI_IPA_EVENT_SIGNAL_STAT_READY; - op.data = { RPiBufferMask::STATS | static_cast(index) }; + op.operation = RPi::IPA_EVENT_SIGNAL_STAT_READY; + op.data = { RPi::BufferMask::STATS | static_cast(index) }; ipa_->processEvent(op); } else { /* Any other ISP output can be handed back to the application now. */ @@ -1334,7 +1334,7 @@ void RPiCameraData::handleExternalBuffer(FrameBuffer *buffer, RPi::Stream *strea { unsigned int id = stream->getBufferId(buffer); - if (!(id & RPiBufferMask::EXTERNAL_BUFFER)) + if (!(id & RPi::BufferMask::EXTERNAL_BUFFER)) return; /* Stop the Stream object from tracking the buffer. */ @@ -1454,7 +1454,7 @@ void RPiCameraData::tryRunPipeline() * queue the ISP output buffer listed in the request to start the HW * pipeline. */ - op.operation = RPI_IPA_EVENT_QUEUE_REQUEST; + op.operation = RPi::IPA_EVENT_QUEUE_REQUEST; op.controls = { request->controls() }; ipa_->processEvent(op); @@ -1468,13 +1468,13 @@ void RPiCameraData::tryRunPipeline() unsigned int bayerId = unicam_[Unicam::Image].getBufferId(bayerBuffer); unsigned int embeddedId = unicam_[Unicam::Embedded].getBufferId(embeddedBuffer); - LOG(RPI, Debug) << "Signalling RPI_IPA_EVENT_SIGNAL_ISP_PREPARE:" + LOG(RPI, Debug) << "Signalling RPi::IPA_EVENT_SIGNAL_ISP_PREPARE:" << " Bayer buffer id: " << bayerId << " Embedded buffer id: " << embeddedId; - op.operation = RPI_IPA_EVENT_SIGNAL_ISP_PREPARE; - op.data = { RPiBufferMask::EMBEDDED_DATA | embeddedId, - RPiBufferMask::BAYER_DATA | bayerId }; + op.operation = RPi::IPA_EVENT_SIGNAL_ISP_PREPARE; + op.data = { RPi::BufferMask::EMBEDDED_DATA | embeddedId, + RPi::BufferMask::BAYER_DATA | bayerId }; ipa_->processEvent(op); } diff --git a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp index 3ee859e9..1a42cc17 100644 --- a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp +++ b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp @@ -70,7 +70,7 @@ int Stream::getBufferId(FrameBuffer *buffer) const void Stream::setExternalBuffer(FrameBuffer *buffer) { - bufferMap_.emplace(RPiBufferMask::EXTERNAL_BUFFER | id_.get(), buffer); + bufferMap_.emplace(RPi::BufferMask::EXTERNAL_BUFFER | id_.get(), buffer); } void Stream::removeExternalBuffer(FrameBuffer *buffer) @@ -78,7 +78,7 @@ void Stream::removeExternalBuffer(FrameBuffer *buffer) int id = getBufferId(buffer); /* Ensure we have this buffer in the stream, and it is marked external. */ - ASSERT(id != -1 && (id & RPiBufferMask::EXTERNAL_BUFFER)); + ASSERT(id != -1 && (id & RPi::BufferMask::EXTERNAL_BUFFER)); bufferMap_.erase(id); } diff --git a/src/libcamera/pipeline/raspberrypi/rpi_stream.h b/src/libcamera/pipeline/raspberrypi/rpi_stream.h index cb097e1c..0b502f64 100644 --- a/src/libcamera/pipeline/raspberrypi/rpi_stream.h +++ b/src/libcamera/pipeline/raspberrypi/rpi_stream.h @@ -31,13 +31,13 @@ class Stream : public libcamera::Stream { public: Stream() - : id_(RPiBufferMask::ID) + : id_(RPi::BufferMask::ID) { } Stream(const char *name, MediaEntity *dev, bool importOnly = false) : external_(false), importOnly_(importOnly), name_(name), - dev_(std::make_unique(dev)), id_(RPiBufferMask::ID) + dev_(std::make_unique(dev)), id_(RPi::BufferMask::ID) { }