Loading camera/tests/fuzzer/camera_c2CaptureRequest_fuzzer.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <gui/Surface.h> #include <gui/SurfaceComposerClient.h> #include <gui/view/Surface.h> #include <gui/Flags.h> // remove with WB_LIBCAMERASERVICE_WITH_DEPENDENCIES #include "camera2common.h" using namespace std; Loading Loading @@ -90,9 +91,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { sp<Surface> surface = surfaceControl->getSurface(); captureRequest->mSurfaceList.push_back(surface); if (fdp.ConsumeBool()) { #if WB_LIBCAMERASERVICE_WITH_DEPENDENCIES view::Surface surfaceShim = view::Surface::fromSurface(surface); #else view::Surface surfaceShim; surfaceShim.name = String16((fdp.ConsumeRandomLengthString()).c_str()); surfaceShim.graphicBufferProducer = surface->getIGraphicBufferProducer(); #endif surfaceShim.name = String16((fdp.ConsumeRandomLengthString()).c_str()); surfaceShim.writeToParcel(&parcelCamCaptureReq); } surface.clear(); Loading services/camera/libcameraservice/api2/CameraDeviceClient.cpp +9 −21 Original line number Diff line number Diff line Loading @@ -1019,12 +1019,9 @@ binder::Status CameraDeviceClient::createStream( int mirrorMode = outputConfiguration.getMirrorMode(surface); sp<Surface> outSurface; res = SessionConfigurationUtils::createSurfaceFromGbp(streamInfo, isStreamInfoValid, outSurface, surface #if WB_LIBCAMERASERVICE_WITH_DEPENDENCIES .graphicBufferProducer #endif , mCameraIdStr, res = SessionConfigurationUtils::createConfiguredSurface(streamInfo, isStreamInfoValid, outSurface, flagtools::convertParcelableSurfaceTypeToSurface(surface), mCameraIdStr, mDevice->infoPhysical(physicalCameraId), sensorPixelModesUsed, dynamicRangeProfile, streamUseCase, timestampBase, mirrorMode, colorSpace, /*respectSurfaceSize*/false); Loading Loading @@ -1410,15 +1407,10 @@ binder::Status CameraDeviceClient::updateOutputConfiguration(int streamId, OutputStreamInfo outInfo; sp<Surface> outSurface; int mirrorMode = outputConfiguration.getMirrorMode(newOutputsMap.valueAt(i)); res = SessionConfigurationUtils::createSurfaceFromGbp( res = SessionConfigurationUtils::createConfiguredSurface( outInfo, /*isStreamInfoValid*/ false, outSurface, newOutputsMap .valueAt(i) #if WB_LIBCAMERASERVICE_WITH_DEPENDENCIES .graphicBufferProducer #endif , flagtools::convertParcelableSurfaceTypeToSurface(newOutputsMap.valueAt(i)), mCameraIdStr, mDevice->infoPhysical(physicalCameraId), sensorPixelModesUsed, dynamicRangeProfile, streamUseCase, timestampBase, mirrorMode, colorSpace, /*respectSurfaceSize*/ false); Loading Loading @@ -1815,15 +1807,11 @@ binder::Status CameraDeviceClient::finalizeOutputConfigurations(int32_t streamId sp<Surface> outSurface; int mirrorMode = outputConfiguration.getMirrorMode(surface); res = SessionConfigurationUtils::createSurfaceFromGbp( res = SessionConfigurationUtils::createConfiguredSurface( mStreamInfoMap[streamId], true /*isStreamInfoValid*/, outSurface, surface #if WB_LIBCAMERASERVICE_WITH_DEPENDENCIES .graphicBufferProducer #endif , mCameraIdStr, mDevice->infoPhysical(physicalId), sensorPixelModesUsed, dynamicRangeProfile, streamUseCase, timestampBase, mirrorMode, colorSpace, /*respectSurfaceSize*/ false); flagtools::convertParcelableSurfaceTypeToSurface(surface), mCameraIdStr, mDevice->infoPhysical(physicalId), sensorPixelModesUsed, dynamicRangeProfile, streamUseCase, timestampBase, mirrorMode, colorSpace, /*respectSurfaceSize*/ false); if (!res.isOk()) return res; Loading services/camera/libcameraservice/utils/SessionConfigurationUtils.cpp +12 −15 Original line number Diff line number Diff line Loading @@ -444,15 +444,15 @@ bool isStreamUseCaseSupported(int64_t streamUseCase, return false; } binder::Status createSurfaceFromGbp( binder::Status createConfiguredSurface( OutputStreamInfo& streamInfo, bool isStreamInfoValid, sp<Surface>& surface, const sp<IGraphicBufferProducer>& gbp, sp<Surface>& out_surface, const sp<SurfaceType>& surface, const std::string &logicalCameraId, const CameraMetadata &physicalCameraMetadata, const std::vector<int32_t> &sensorPixelModesUsed, int64_t dynamicRangeProfile, int64_t streamUseCase, int timestampBase, int mirrorMode, int32_t colorSpace, bool respectSurfaceSize) { // bufferProducer must be non-null if (gbp == nullptr) { if ( flagtools::isSurfaceTypeValid(surface) == false ) { std::string msg = fmt::sprintf("Camera %s: Surface is NULL", logicalCameraId.c_str()); ALOGW("%s: %s", __FUNCTION__, msg.c_str()); return STATUS_ERROR(CameraService::ERROR_ILLEGAL_ARGUMENT, msg.c_str()); Loading @@ -463,7 +463,7 @@ binder::Status createSurfaceFromGbp( bool useAsync = false; uint64_t consumerUsage = 0; status_t err; if ((err = gbp->getConsumerUsage(&consumerUsage)) != OK) { if ((err = surface->getConsumerUsage(&consumerUsage)) != OK) { std::string msg = fmt::sprintf("Camera %s: Failed to query Surface consumer usage: %s (%d)", logicalCameraId.c_str(), strerror(-err), err); ALOGE("%s: %s", __FUNCTION__, msg.c_str()); Loading @@ -483,8 +483,9 @@ binder::Status createSurfaceFromGbp( bool flexibleConsumer = (consumerUsage & disallowedFlags) == 0 && (consumerUsage & allowedFlags) != 0; surface = new Surface(gbp, useAsync); ANativeWindow *anw = surface.get(); out_surface = new Surface(flagtools::surfaceTypeToIGBP(surface), useAsync); ANativeWindow *anw = out_surface.get(); int width, height, format; android_dataspace dataSpace; Loading Loading @@ -923,15 +924,11 @@ convertToHALStreamCombination( for (auto& surface_type : surfaces) { sp<Surface> surface; int mirrorMode = it.getMirrorMode(surface_type); res = createSurfaceFromGbp(streamInfo, isStreamInfoValid, surface, surface_type #if WB_LIBCAMERASERVICE_WITH_DEPENDENCIES .graphicBufferProducer #endif , logicalCameraId, metadataChosen, sensorPixelModesUsed, dynamicRangeProfile, streamUseCase, timestampBase, mirrorMode, colorSpace, /*respectSurfaceSize*/ true); res = createConfiguredSurface(streamInfo, isStreamInfoValid, surface, flagtools::convertParcelableSurfaceTypeToSurface(surface_type), logicalCameraId, metadataChosen, sensorPixelModesUsed, dynamicRangeProfile, streamUseCase, timestampBase, mirrorMode, colorSpace, /*respectSurfaceSize*/ true); if (!res.isOk()) return res; Loading services/camera/libcameraservice/utils/SessionConfigurationUtils.h +4 −4 Original line number Diff line number Diff line Loading @@ -104,11 +104,11 @@ bool roundBufferDimensionNearest(int32_t width, int32_t height, int32_t format, // check if format is not custom format bool isPublicFormat(int32_t format); // Create a Surface from an IGraphicBufferProducer. Returns error if // IGraphicBufferProducer's property doesn't match with streamInfo binder::Status createSurfaceFromGbp( // Recreates a Surface from another Surface setting the controlledByApp correctly. Returns error if // previous Surface property doesn't match with streamInfo binder::Status createConfiguredSurface( camera3::OutputStreamInfo& streamInfo, bool isStreamInfoValid, sp<Surface>& surface, const sp<IGraphicBufferProducer>& gbp, sp<Surface>& out_surface, const sp<SurfaceType>& surface, const std::string &logicalCameraId, const CameraMetadata &physicalCameraMetadata, const std::vector<int32_t> &sensorPixelModesUsed, int64_t dynamicRangeProfile, int64_t streamUseCase, int timestampBase, int mirrorMode, Loading Loading
camera/tests/fuzzer/camera_c2CaptureRequest_fuzzer.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <gui/Surface.h> #include <gui/SurfaceComposerClient.h> #include <gui/view/Surface.h> #include <gui/Flags.h> // remove with WB_LIBCAMERASERVICE_WITH_DEPENDENCIES #include "camera2common.h" using namespace std; Loading Loading @@ -90,9 +91,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { sp<Surface> surface = surfaceControl->getSurface(); captureRequest->mSurfaceList.push_back(surface); if (fdp.ConsumeBool()) { #if WB_LIBCAMERASERVICE_WITH_DEPENDENCIES view::Surface surfaceShim = view::Surface::fromSurface(surface); #else view::Surface surfaceShim; surfaceShim.name = String16((fdp.ConsumeRandomLengthString()).c_str()); surfaceShim.graphicBufferProducer = surface->getIGraphicBufferProducer(); #endif surfaceShim.name = String16((fdp.ConsumeRandomLengthString()).c_str()); surfaceShim.writeToParcel(&parcelCamCaptureReq); } surface.clear(); Loading
services/camera/libcameraservice/api2/CameraDeviceClient.cpp +9 −21 Original line number Diff line number Diff line Loading @@ -1019,12 +1019,9 @@ binder::Status CameraDeviceClient::createStream( int mirrorMode = outputConfiguration.getMirrorMode(surface); sp<Surface> outSurface; res = SessionConfigurationUtils::createSurfaceFromGbp(streamInfo, isStreamInfoValid, outSurface, surface #if WB_LIBCAMERASERVICE_WITH_DEPENDENCIES .graphicBufferProducer #endif , mCameraIdStr, res = SessionConfigurationUtils::createConfiguredSurface(streamInfo, isStreamInfoValid, outSurface, flagtools::convertParcelableSurfaceTypeToSurface(surface), mCameraIdStr, mDevice->infoPhysical(physicalCameraId), sensorPixelModesUsed, dynamicRangeProfile, streamUseCase, timestampBase, mirrorMode, colorSpace, /*respectSurfaceSize*/false); Loading Loading @@ -1410,15 +1407,10 @@ binder::Status CameraDeviceClient::updateOutputConfiguration(int streamId, OutputStreamInfo outInfo; sp<Surface> outSurface; int mirrorMode = outputConfiguration.getMirrorMode(newOutputsMap.valueAt(i)); res = SessionConfigurationUtils::createSurfaceFromGbp( res = SessionConfigurationUtils::createConfiguredSurface( outInfo, /*isStreamInfoValid*/ false, outSurface, newOutputsMap .valueAt(i) #if WB_LIBCAMERASERVICE_WITH_DEPENDENCIES .graphicBufferProducer #endif , flagtools::convertParcelableSurfaceTypeToSurface(newOutputsMap.valueAt(i)), mCameraIdStr, mDevice->infoPhysical(physicalCameraId), sensorPixelModesUsed, dynamicRangeProfile, streamUseCase, timestampBase, mirrorMode, colorSpace, /*respectSurfaceSize*/ false); Loading Loading @@ -1815,15 +1807,11 @@ binder::Status CameraDeviceClient::finalizeOutputConfigurations(int32_t streamId sp<Surface> outSurface; int mirrorMode = outputConfiguration.getMirrorMode(surface); res = SessionConfigurationUtils::createSurfaceFromGbp( res = SessionConfigurationUtils::createConfiguredSurface( mStreamInfoMap[streamId], true /*isStreamInfoValid*/, outSurface, surface #if WB_LIBCAMERASERVICE_WITH_DEPENDENCIES .graphicBufferProducer #endif , mCameraIdStr, mDevice->infoPhysical(physicalId), sensorPixelModesUsed, dynamicRangeProfile, streamUseCase, timestampBase, mirrorMode, colorSpace, /*respectSurfaceSize*/ false); flagtools::convertParcelableSurfaceTypeToSurface(surface), mCameraIdStr, mDevice->infoPhysical(physicalId), sensorPixelModesUsed, dynamicRangeProfile, streamUseCase, timestampBase, mirrorMode, colorSpace, /*respectSurfaceSize*/ false); if (!res.isOk()) return res; Loading
services/camera/libcameraservice/utils/SessionConfigurationUtils.cpp +12 −15 Original line number Diff line number Diff line Loading @@ -444,15 +444,15 @@ bool isStreamUseCaseSupported(int64_t streamUseCase, return false; } binder::Status createSurfaceFromGbp( binder::Status createConfiguredSurface( OutputStreamInfo& streamInfo, bool isStreamInfoValid, sp<Surface>& surface, const sp<IGraphicBufferProducer>& gbp, sp<Surface>& out_surface, const sp<SurfaceType>& surface, const std::string &logicalCameraId, const CameraMetadata &physicalCameraMetadata, const std::vector<int32_t> &sensorPixelModesUsed, int64_t dynamicRangeProfile, int64_t streamUseCase, int timestampBase, int mirrorMode, int32_t colorSpace, bool respectSurfaceSize) { // bufferProducer must be non-null if (gbp == nullptr) { if ( flagtools::isSurfaceTypeValid(surface) == false ) { std::string msg = fmt::sprintf("Camera %s: Surface is NULL", logicalCameraId.c_str()); ALOGW("%s: %s", __FUNCTION__, msg.c_str()); return STATUS_ERROR(CameraService::ERROR_ILLEGAL_ARGUMENT, msg.c_str()); Loading @@ -463,7 +463,7 @@ binder::Status createSurfaceFromGbp( bool useAsync = false; uint64_t consumerUsage = 0; status_t err; if ((err = gbp->getConsumerUsage(&consumerUsage)) != OK) { if ((err = surface->getConsumerUsage(&consumerUsage)) != OK) { std::string msg = fmt::sprintf("Camera %s: Failed to query Surface consumer usage: %s (%d)", logicalCameraId.c_str(), strerror(-err), err); ALOGE("%s: %s", __FUNCTION__, msg.c_str()); Loading @@ -483,8 +483,9 @@ binder::Status createSurfaceFromGbp( bool flexibleConsumer = (consumerUsage & disallowedFlags) == 0 && (consumerUsage & allowedFlags) != 0; surface = new Surface(gbp, useAsync); ANativeWindow *anw = surface.get(); out_surface = new Surface(flagtools::surfaceTypeToIGBP(surface), useAsync); ANativeWindow *anw = out_surface.get(); int width, height, format; android_dataspace dataSpace; Loading Loading @@ -923,15 +924,11 @@ convertToHALStreamCombination( for (auto& surface_type : surfaces) { sp<Surface> surface; int mirrorMode = it.getMirrorMode(surface_type); res = createSurfaceFromGbp(streamInfo, isStreamInfoValid, surface, surface_type #if WB_LIBCAMERASERVICE_WITH_DEPENDENCIES .graphicBufferProducer #endif , logicalCameraId, metadataChosen, sensorPixelModesUsed, dynamicRangeProfile, streamUseCase, timestampBase, mirrorMode, colorSpace, /*respectSurfaceSize*/ true); res = createConfiguredSurface(streamInfo, isStreamInfoValid, surface, flagtools::convertParcelableSurfaceTypeToSurface(surface_type), logicalCameraId, metadataChosen, sensorPixelModesUsed, dynamicRangeProfile, streamUseCase, timestampBase, mirrorMode, colorSpace, /*respectSurfaceSize*/ true); if (!res.isOk()) return res; Loading
services/camera/libcameraservice/utils/SessionConfigurationUtils.h +4 −4 Original line number Diff line number Diff line Loading @@ -104,11 +104,11 @@ bool roundBufferDimensionNearest(int32_t width, int32_t height, int32_t format, // check if format is not custom format bool isPublicFormat(int32_t format); // Create a Surface from an IGraphicBufferProducer. Returns error if // IGraphicBufferProducer's property doesn't match with streamInfo binder::Status createSurfaceFromGbp( // Recreates a Surface from another Surface setting the controlledByApp correctly. Returns error if // previous Surface property doesn't match with streamInfo binder::Status createConfiguredSurface( camera3::OutputStreamInfo& streamInfo, bool isStreamInfoValid, sp<Surface>& surface, const sp<IGraphicBufferProducer>& gbp, sp<Surface>& out_surface, const sp<SurfaceType>& surface, const std::string &logicalCameraId, const CameraMetadata &physicalCameraMetadata, const std::vector<int32_t> &sensorPixelModesUsed, int64_t dynamicRangeProfile, int64_t streamUseCase, int timestampBase, int mirrorMode, Loading