summaryrefslogtreecommitdiff
path: root/camera/camera2/OutputConfiguration.cpp
diff options
context:
space:
mode:
authorZhijun He <zhijunhe@google.com>2016-05-29 16:52:39 -0700
committerZhijun He <zhijunhe@google.com>2016-06-02 15:42:57 -0700
commit5d677d1f0879d5101e38df480a38228a64d63959 (patch)
treeeb8724a33f7f422d4dd0914e206c19948fc4da68 /camera/camera2/OutputConfiguration.cpp
parent827388ba4fd8d5e859858dbb29ced986b9ed77f4 (diff)
Camera3: add deferred surface support
Initial native implementation and aidl changes for surfaceless support. Bug: 28323863 Change-Id: Id6634c3ef2ecc84422a88f63de0a19a0cb496e96
Diffstat (limited to 'camera/camera2/OutputConfiguration.cpp')
-rw-r--r--camera/camera2/OutputConfiguration.cpp64
1 files changed, 59 insertions, 5 deletions
diff --git a/camera/camera2/OutputConfiguration.cpp b/camera/camera2/OutputConfiguration.cpp
index 3247d0dee9..38e1c017f0 100644
--- a/camera/camera2/OutputConfiguration.cpp
+++ b/camera/camera2/OutputConfiguration.cpp
@@ -42,9 +42,24 @@ int OutputConfiguration::getSurfaceSetID() const {
return mSurfaceSetID;
}
+int OutputConfiguration::getSurfaceType() const {
+ return mSurfaceType;
+}
+
+int OutputConfiguration::getWidth() const {
+ return mWidth;
+}
+
+int OutputConfiguration::getHeight() const {
+ return mHeight;
+}
+
OutputConfiguration::OutputConfiguration() :
mRotation(INVALID_ROTATION),
- mSurfaceSetID(INVALID_SET_ID) {
+ mSurfaceSetID(INVALID_SET_ID),
+ mSurfaceType(SURFACE_TYPE_UNKNOWN),
+ mWidth(0),
+ mHeight(0) {
}
OutputConfiguration::OutputConfiguration(const Parcel& parcel) :
@@ -70,18 +85,48 @@ status_t OutputConfiguration::readFromParcel(const Parcel* parcel) {
return err;
}
+ int surfaceType = SURFACE_TYPE_UNKNOWN;
+ if ((err = parcel->readInt32(&surfaceType)) != OK) {
+ ALOGE("%s: Failed to read surface type from parcel", __FUNCTION__);
+ return err;
+ }
+
+ int width = 0;
+ if ((err = parcel->readInt32(&width)) != OK) {
+ ALOGE("%s: Failed to read surface width from parcel", __FUNCTION__);
+ return err;
+ }
+
+ int height = 0;
+ if ((err = parcel->readInt32(&height)) != OK) {
+ ALOGE("%s: Failed to read surface height from parcel", __FUNCTION__);
+ return err;
+ }
+
view::Surface surfaceShim;
if ((err = surfaceShim.readFromParcel(parcel)) != OK) {
- ALOGE("%s: Failed to read surface from parcel", __FUNCTION__);
- return err;
+ // Read surface failure for deferred surface configuration is expected.
+ if (surfaceType == SURFACE_TYPE_SURFACE_VIEW ||
+ surfaceType == SURFACE_TYPE_SURFACE_TEXTURE) {
+ ALOGV("%s: Get null surface from a deferred surface configuration (%dx%d)",
+ __FUNCTION__, width, height);
+ err = OK;
+ } else {
+ ALOGE("%s: Failed to read surface from parcel", __FUNCTION__);
+ return err;
+ }
}
mGbp = surfaceShim.graphicBufferProducer;
mRotation = rotation;
mSurfaceSetID = setID;
+ mSurfaceType = surfaceType;
+ mWidth = width;
+ mHeight = height;
- ALOGV("%s: OutputConfiguration: bp = %p, name = %s, rotation = %d, setId = %d", __FUNCTION__,
- mGbp.get(), String8(surfaceShim.name).string(), mRotation, mSurfaceSetID);
+ ALOGV("%s: OutputConfiguration: bp = %p, name = %s, rotation = %d, setId = %d,"
+ "surfaceType = %d", __FUNCTION__, mGbp.get(), String8(surfaceShim.name).string(),
+ mRotation, mSurfaceSetID, mSurfaceType);
return err;
}
@@ -104,6 +149,15 @@ status_t OutputConfiguration::writeToParcel(Parcel* parcel) const {
err = parcel->writeInt32(mSurfaceSetID);
if (err != OK) return err;
+ err = parcel->writeInt32(mSurfaceType);
+ if (err != OK) return err;
+
+ err = parcel->writeInt32(mWidth);
+ if (err != OK) return err;
+
+ err = parcel->writeInt32(mHeight);
+ if (err != OK) return err;
+
view::Surface surfaceShim;
surfaceShim.name = String16("unknown_name"); // name of surface
surfaceShim.graphicBufferProducer = mGbp;