Camera: cleanup some dead code

We no longer have code path running non-HIDL interface.
This cleanup also simplifies some logic needed for fixing
b/132594861

Bug: 132594861
Test: Camera CTS
Change-Id: If15ea359a1a59c5a8e7a59818ce4db8120000bc4
gugelfrei
Yin-Chia Yeh 5 years ago
parent e445c2817a
commit 11648852d7

@ -4032,10 +4032,6 @@ void Camera3Device::HalInterface::clear() {
mHidlSession.clear();
}
bool Camera3Device::HalInterface::supportBatchRequest() {
return mHidlSession != nullptr;
}
status_t Camera3Device::HalInterface::constructDefaultRequestSettings(
camera3_request_template_t templateId,
/*out*/ camera_metadata_t **requestTemplate) {
@ -4608,20 +4604,6 @@ status_t Camera3Device::HalInterface::processBatchCaptureRequests(
return CameraProviderManager::mapToStatusT(status);
}
status_t Camera3Device::HalInterface::processCaptureRequest(
camera3_capture_request_t *request) {
ATRACE_NAME("CameraHal::processCaptureRequest");
if (!valid()) return INVALID_OPERATION;
status_t res = OK;
uint32_t numRequestProcessed = 0;
std::vector<camera3_capture_request_t*> requests(1);
requests[0] = request;
res = processBatchCaptureRequests(requests, &numRequestProcessed);
return res;
}
status_t Camera3Device::HalInterface::flush() {
ATRACE_NAME("CameraHal::flush");
if (!valid()) return INVALID_OPERATION;
@ -5172,43 +5154,6 @@ bool Camera3Device::RequestThread::sendRequestsBatch() {
return true;
}
bool Camera3Device::RequestThread::sendRequestsOneByOne() {
status_t res;
for (auto& nextRequest : mNextRequests) {
// Submit request and block until ready for next one
ATRACE_ASYNC_BEGIN("frame capture", nextRequest.halRequest.frame_number);
res = mInterface->processCaptureRequest(&nextRequest.halRequest);
if (res != OK) {
// Should only get a failure here for malformed requests or device-level
// errors, so consider all errors fatal. Bad metadata failures should
// come through notify.
SET_ERR("RequestThread: Unable to submit capture request %d to HAL"
" device: %s (%d)", nextRequest.halRequest.frame_number, strerror(-res),
res);
cleanUpFailedRequests(/*sendRequestError*/ false);
return false;
}
// Mark that the request has be submitted successfully.
nextRequest.submitted = true;
updateNextRequest(nextRequest);
// Remove any previously queued triggers (after unlock)
res = removeTriggers(mPrevRequest);
if (res != OK) {
SET_ERR("RequestThread: Unable to remove triggers "
"(capture request %d, HAL device: %s (%d)",
nextRequest.halRequest.frame_number, strerror(-res), res);
cleanUpFailedRequests(/*sendRequestError*/ false);
return false;
}
}
return true;
}
nsecs_t Camera3Device::RequestThread::calculateMaxExpectedDuration(const camera_metadata_t *request) {
nsecs_t maxExpectedDuration = kDefaultExpectedDuration;
camera_metadata_ro_entry_t e = camera_metadata_ro_entry_t();
@ -5462,11 +5407,8 @@ bool Camera3Device::RequestThread::threadLoop() {
bool submitRequestSuccess = false;
nsecs_t tRequestStart = systemTime(SYSTEM_TIME_MONOTONIC);
if (mInterface->supportBatchRequest()) {
submitRequestSuccess = sendRequestsBatch();
} else {
submitRequestSuccess = sendRequestsOneByOne();
}
submitRequestSuccess = sendRequestsBatch();
nsecs_t tRequestEnd = systemTime(SYSTEM_TIME_MONOTONIC);
mRequestLatency.add(tRequestStart, tRequestEnd);

@ -289,9 +289,6 @@ class Camera3Device :
// Reset this HalInterface object (does not call close())
void clear();
// Check if HalInterface support sending requests in batch
bool supportBatchRequest();
// Calls into the HAL interface
// Caller takes ownership of requestTemplate
@ -300,7 +297,11 @@ class Camera3Device :
status_t configureStreams(const camera_metadata_t *sessionParams,
/*inout*/ camera3_stream_configuration *config,
const std::vector<uint32_t>& bufferSizes);
status_t processCaptureRequest(camera3_capture_request_t *request);
// When the call succeeds, the ownership of acquire fences in requests is transferred to
// HalInterface. More specifically, the current implementation will send the fence to
// HAL process and close the FD in cameraserver process. When the call fails, the ownership
// of the acquire fence still belongs to the caller.
status_t processBatchCaptureRequests(
std::vector<camera3_capture_request_t*>& requests,
/*out*/uint32_t* numRequestProcessed);
@ -895,9 +896,6 @@ class Camera3Device :
// Clear repeating requests. Must be called with mRequestLock held.
status_t clearRepeatingRequestsLocked(/*out*/ int64_t *lastFrameNumber = NULL);
// send request in mNextRequests to HAL one by one. Return true = sucssess
bool sendRequestsOneByOne();
// send request in mNextRequests to HAL in a batch. Return true = sucssess
bool sendRequestsBatch();

Loading…
Cancel
Save