summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShuzhen Wang <shuzhenw@codeaurora.org>2013-09-04 22:40:39 -0700
committerAli B <abittin@gmail.com>2018-06-17 19:19:23 +0300
commit4b20c606bba620bb780ca483c1b0841d8ed5eb0c (patch)
treeb1abbe44311bf85e23fddb8816fd1cf408a2af3a
parente1fab5a4b19c2e77d1f32ad2dd02dca9658a0c53 (diff)
Camera3: Set extra usage flags for video stream buffers
For video stream buffers, set READ_RARELY and WRITE_RARELY usage flags so that gralloc may make them uncached. Code cleanup Bug: 10328870 Change-Id: If3bbbbb0976266f69962db7df568c763dad488aa Signed-off-by: Daniel Jarai <jaraidaniel@gmail.com>
-rwxr-xr-xcamera/QCamera2/HAL3/QCamera3Channel.cpp5
-rwxr-xr-xcamera/QCamera2/HAL3/QCamera3HWI.cpp76
-rwxr-xr-xcamera/QCamera2/HAL3/QCamera3HWI.h2
3 files changed, 72 insertions, 11 deletions
diff --git a/camera/QCamera2/HAL3/QCamera3Channel.cpp b/camera/QCamera2/HAL3/QCamera3Channel.cpp
index b9141fa..c15ae12 100755
--- a/camera/QCamera2/HAL3/QCamera3Channel.cpp
+++ b/camera/QCamera2/HAL3/QCamera3Channel.cpp
@@ -774,7 +774,7 @@ int32_t QCamera3MetadataChannel::registerBuffers(uint32_t /*num_buffers*/,
void QCamera3MetadataChannel::streamCbRoutine(
mm_camera_super_buf_t *super_frame,
- QCamera3Stream *stream)
+ QCamera3Stream * /*stream*/)
{
uint32_t requestNumber = 0;
if (super_frame == NULL || super_frame->num_bufs != 1) {
@@ -1976,7 +1976,8 @@ QCamera3ReprocessChannel::QCamera3ReprocessChannel() :
*
* RETURN : none
*==========================================================================*/
-int32_t QCamera3ReprocessChannel::registerBuffers(uint32_t num_buffers, buffer_handle_t **buffers)
+int32_t QCamera3ReprocessChannel::registerBuffers(
+ uint32_t /*num_buffers*/, buffer_handle_t ** /*buffers*/)
{
return 0;
}
diff --git a/camera/QCamera2/HAL3/QCamera3HWI.cpp b/camera/QCamera2/HAL3/QCamera3HWI.cpp
index 74c8a56..30e8407 100755
--- a/camera/QCamera2/HAL3/QCamera3HWI.cpp
+++ b/camera/QCamera2/HAL3/QCamera3HWI.cpp
@@ -130,13 +130,15 @@ const int32_t available_thumbnail_sizes[] = {512, 288, 480, 288, 256, 154, 432,
320, 240, 176, 144, 0, 0};
camera3_device_ops_t QCamera3HardwareInterface::mCameraOps = {
- initialize: QCamera3HardwareInterface::initialize,
- configure_streams: QCamera3HardwareInterface::configure_streams,
- register_stream_buffers: QCamera3HardwareInterface::register_stream_buffers,
- construct_default_request_settings: QCamera3HardwareInterface::construct_default_request_settings,
- process_capture_request: QCamera3HardwareInterface::process_capture_request,
- get_metadata_vendor_tag_ops: QCamera3HardwareInterface::get_metadata_vendor_tag_ops,
- dump: QCamera3HardwareInterface::dump,
+ .initialize = QCamera3HardwareInterface::initialize,
+ .configure_streams = QCamera3HardwareInterface::configure_streams,
+ .register_stream_buffers = QCamera3HardwareInterface::register_stream_buffers,
+ .construct_default_request_settings = QCamera3HardwareInterface::construct_default_request_settings,
+ .process_capture_request = QCamera3HardwareInterface::process_capture_request,
+ .get_metadata_vendor_tag_ops = QCamera3HardwareInterface::get_metadata_vendor_tag_ops,
+ .dump = QCamera3HardwareInterface::dump,
+ .flush = QCamera3HardwareInterface::flush,
+ .reserved = {0},
};
@@ -549,7 +551,15 @@ int QCamera3HardwareInterface::configureStreams(
GRALLOC_USAGE_HW_CAMERA_WRITE;
break;
case CAMERA3_STREAM_OUTPUT:
- newStream->usage = GRALLOC_USAGE_HW_CAMERA_WRITE;
+ /* For video encoding stream, set read/write rarely
+ * flag so that they may be set to un-cached */
+ if (newStream->usage & GRALLOC_USAGE_HW_VIDEO_ENCODER)
+ newStream->usage =
+ (GRALLOC_USAGE_SW_READ_RARELY |
+ GRALLOC_USAGE_SW_WRITE_RARELY |
+ GRALLOC_USAGE_HW_CAMERA_WRITE);
+ else
+ newStream->usage = GRALLOC_USAGE_HW_CAMERA_WRITE;
break;
default:
ALOGE("%s: Invalid stream_type %d", __func__, newStream->stream_type);
@@ -1049,6 +1059,26 @@ void QCamera3HardwareInterface::dump(int /*fd*/)
return;
}
+/*===========================================================================
+ * FUNCTION : flush
+ *
+ * DESCRIPTION:
+ *
+ * PARAMETERS :
+ *
+ *
+ * RETURN :
+ *==========================================================================*/
+int QCamera3HardwareInterface::flush()
+{
+ /*Enable lock when we implement this function*/
+ /*
+ pthread_mutex_lock(&mMutex);
+
+ pthread_mutex_unlock(&mMutex);
+ */
+ return 0;
+}
/*===========================================================================
* FUNCTION : captureResultCb
@@ -2537,7 +2567,7 @@ int QCamera3HardwareInterface::getCamInfo(int cameraId,
info->orientation = gCamCapability[cameraId]->sensor_mount_angle;
- info->device_version = HARDWARE_DEVICE_API_VERSION(3, 0);
+ info->device_version = CAMERA_DEVICE_API_VERSION_3_0;
info->static_camera_characteristics = gStaticMetadata[cameraId];
return rc;
@@ -3601,6 +3631,34 @@ void QCamera3HardwareInterface::dump(
}
/*===========================================================================
+ * FUNCTION : flush
+ *
+ * DESCRIPTION:
+ *
+ * PARAMETERS :
+ *
+ *
+ * RETURN :
+ *==========================================================================*/
+
+int QCamera3HardwareInterface::flush(
+ const struct camera3_device *device)
+{
+ int rc;
+ ALOGV("%s: E", __func__);
+ QCamera3HardwareInterface *hw =
+ reinterpret_cast<QCamera3HardwareInterface *>(device->priv);
+ if (!hw) {
+ ALOGE("%s: NULL camera device", __func__);
+ return -EINVAL;
+ }
+
+ rc = hw->flush();
+ ALOGV("%s: X", __func__);
+ return rc;
+}
+
+/*===========================================================================
* FUNCTION : close_camera_device
*
* DESCRIPTION:
diff --git a/camera/QCamera2/HAL3/QCamera3HWI.h b/camera/QCamera2/HAL3/QCamera3HWI.h
index 0e014a8..dec07af 100755
--- a/camera/QCamera2/HAL3/QCamera3HWI.h
+++ b/camera/QCamera2/HAL3/QCamera3HWI.h
@@ -85,6 +85,7 @@ public:
static void get_metadata_vendor_tag_ops(const struct camera3_device *,
vendor_tag_query_ops_t* ops);
static void dump(const struct camera3_device *, int fd);
+ static int flush(const struct camera3_device *);
static int close_camera_device(struct hw_device_t* device);
public:
QCamera3HardwareInterface(int cameraId);
@@ -120,6 +121,7 @@ public:
int processCaptureRequest(camera3_capture_request_t *request);
void getMetadataVendorTagOps(vendor_tag_query_ops_t* ops);
void dump(int fd);
+ int flush();
int setFrameParameters(int frame_id, const camera_metadata_t *settings,
uint32_t streamTypeMask, cam_trigger_t &aeTrigger);