Merge "atrace: fix duplicate tag 'sync'"
diff --git a/include/media/openmax/OMX_Audio.h b/include/media/openmax/OMX_Audio.h
index f4cb643..d9c223d 100644
--- a/include/media/openmax/OMX_Audio.h
+++ b/include/media/openmax/OMX_Audio.h
@@ -13,6 +13,25 @@
* express or implied.
* See the License for the specific language governing permissions
* and limitations under the License.
+ *
+ * This file was modified by Dolby Laboratories, Inc. The portions of the
+ * code that are surrounded by "DOLBY..." are copyrighted and
+ * licensed separately, as follows:
+ *
+ * (C) 2011-2012 Dolby Laboratories, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
* -------------------------------------------------------------------
*/
/*
@@ -107,6 +126,9 @@
OMX_AUDIO_CodingRA, /**< Any variant of RA encoded data */
OMX_AUDIO_CodingMIDI, /**< Any variant of MIDI encoded data */
OMX_AUDIO_CodingFLAC, /**< Any variant of FLAC encoded data */
+#ifdef DOLBY_UDC
+ OMX_AUDIO_CodingDDP, /**< Any variant of DDP encoded data */
+#endif // DOLBY_END
OMX_AUDIO_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
OMX_AUDIO_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
OMX_AUDIO_CodingMax = 0x7FFFFFFF
diff --git a/libs/gui/IGraphicBufferAlloc.cpp b/libs/gui/IGraphicBufferAlloc.cpp
index 139f219..e090746 100644
--- a/libs/gui/IGraphicBufferAlloc.cpp
+++ b/libs/gui/IGraphicBufferAlloc.cpp
@@ -50,9 +50,13 @@
data.writeInt32(h);
data.writeInt32(format);
data.writeInt32(usage);
- remote()->transact(CREATE_GRAPHIC_BUFFER, data, &reply);
+ status_t result = remote()->transact(CREATE_GRAPHIC_BUFFER, data, &reply);
+ if(result != NO_ERROR){
+ *error = result;
+ return NULL;
+ }
sp<GraphicBuffer> graphicBuffer;
- status_t result = reply.readInt32();
+ result = reply.readInt32();
if (result == NO_ERROR) {
graphicBuffer = new GraphicBuffer();
result = reply.read(*graphicBuffer);
diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp
index c166aaa..526feb6 100644
--- a/services/surfaceflinger/DisplayDevice.cpp
+++ b/services/surfaceflinger/DisplayDevice.cpp
@@ -134,6 +134,11 @@
property_get("persist.panel.orientation", property, "0");
panelOrientation = atoi(property) / 90;
+ mPanelInverseMounted = false;
+ // Check if panel is inverse mounted (contents show up HV flipped)
+ property_get("persist.panel.inversemounted", property, "0");
+ mPanelInverseMounted = !!atoi(property);
+
// initialize the display orientation transform.
setProjection(panelOrientation, mViewport, mFrame);
}
@@ -408,6 +413,11 @@
default:
return BAD_VALUE;
}
+
+ if (DISPLAY_PRIMARY == mHwcDisplayId && isPanelInverseMounted()) {
+ flags = flags ^ Transform::ROT_180;
+ }
+
tr->set(flags, w, h);
return NO_ERROR;
}
diff --git a/services/surfaceflinger/DisplayDevice.h b/services/surfaceflinger/DisplayDevice.h
index 76243f0..a1b6f64 100644
--- a/services/surfaceflinger/DisplayDevice.h
+++ b/services/surfaceflinger/DisplayDevice.h
@@ -126,6 +126,10 @@
int32_t getHwcDisplayId() const { return mHwcDisplayId; }
const wp<IBinder>& getDisplayToken() const { return mDisplayToken; }
+ bool isPanelInverseMounted() const {
+ return mPanelInverseMounted;
+ }
+
// We pass in mustRecompose so we can keep VirtualDisplaySurface's state
// machine happy without actually queueing a buffer if nothing has changed
status_t beginFrame(bool mustRecompose) const;
@@ -215,7 +219,7 @@
/*
* Transaction state
*/
- static status_t orientationToTransfrom(int orientation,
+ status_t orientationToTransfrom(int orientation,
int w, int h, Transform* tr);
uint32_t mLayerStack;
@@ -232,6 +236,8 @@
int mPowerMode;
// Current active config
int mActiveConfig;
+ // Panel is inverse mounted
+ int mPanelInverseMounted;
};
}; // namespace android
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index d8eaf7a..1f17b5c 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -179,6 +179,7 @@
config.height = mFbDev->height;
config.xdpi = mFbDev->xdpi;
config.ydpi = mFbDev->ydpi;
+ config.secure = true; //XXX: Assuming primary is always true
config.refresh = nsecs_t(1e9 / mFbDev->fps);
disp.configs.push_back(config);
disp.currentConfig = 0;
@@ -350,6 +351,10 @@
HWC_DISPLAY_HEIGHT,
HWC_DISPLAY_DPI_X,
HWC_DISPLAY_DPI_Y,
+ //To specify if display is secure
+ //Primary is considered as secure always
+ //HDMI can be secure based on HDCP
+ HWC_DISPLAY_SECURE,
HWC_DISPLAY_NO_ATTRIBUTE,
};
#define NUM_DISPLAY_ATTRIBUTES (sizeof(DISPLAY_ATTRIBUTES) / sizeof(DISPLAY_ATTRIBUTES)[0])
@@ -405,6 +410,9 @@
case HWC_DISPLAY_DPI_Y:
config.ydpi = values[i] / 1000.0f;
break;
+ case HWC_DISPLAY_SECURE:
+ config.secure = values[i];
+ break;
default:
ALOG_ASSERT(false, "unknown display attribute[%zu] %#x",
i, DISPLAY_ATTRIBUTES[i]);
@@ -439,6 +447,8 @@
config.width = w;
config.height = h;
config.xdpi = config.ydpi = getDefaultDensity(w, h);
+ //XXXX: No need to set secure for virtual display's as its initiated by
+ //the frameworks
return NO_ERROR;
}
@@ -514,6 +524,12 @@
return mDisplayData[disp].configs[currentConfig].ydpi;
}
+bool HWComposer::isSecure(int disp) const {
+ size_t currentConfig = mDisplayData[disp].currentConfig;
+ return mDisplayData[disp].configs[currentConfig].secure;
+}
+
+
nsecs_t HWComposer::getRefreshPeriod(int disp) const {
size_t currentConfig = mDisplayData[disp].currentConfig;
return mDisplayData[disp].configs[currentConfig].refresh;
@@ -1240,9 +1256,9 @@
result.appendFormat(" Display[%zd] configurations (* current):\n", i);
for (size_t c = 0; c < disp.configs.size(); ++c) {
const DisplayConfig& config(disp.configs[c]);
- result.appendFormat(" %s%zd: %ux%u, xdpi=%f, ydpi=%f, refresh=%" PRId64 "\n",
+ result.appendFormat(" %s%zd: %ux%u, xdpi=%f, ydpi=%f, secure=%d refresh=%" PRId64 "\n",
c == disp.currentConfig ? "* " : "", c, config.width, config.height,
- config.xdpi, config.ydpi, config.refresh);
+ config.xdpi, config.ydpi, config.secure, config.refresh);
}
if (disp.list) {
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h
index 97e03fb..a624a22 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.h
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.h
@@ -274,6 +274,7 @@
uint32_t height;
float xdpi;
float ydpi;
+ bool secure;
nsecs_t refresh;
};
@@ -283,6 +284,7 @@
sp<Fence> getDisplayFence(int disp) const;
uint32_t getFormat(int disp) const;
bool isConnected(int disp) const;
+ bool isSecure(int disp) const;
// These return the values for the current config of a given display index.
// To get the values for all configs, use getConfigs below.
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 4b7d3a0..232918e 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -278,13 +278,13 @@
setTransactionFlags(eDisplayTransactionNeeded);
}
-void SurfaceFlinger::createBuiltinDisplayLocked(DisplayDevice::DisplayType type) {
+void SurfaceFlinger::createBuiltinDisplayLocked(DisplayDevice::DisplayType type,
+ bool secure) {
ALOGW_IF(mBuiltinDisplays[type],
"Overwriting display token for display type %d", type);
mBuiltinDisplays[type] = new BBinder();
DisplayDeviceState info(type);
- // All non-virtual displays are currently considered secure.
- info.isSecure = true;
+ info.isSecure = secure;
mCurrentState.displays.add(mBuiltinDisplays[type], info);
}
@@ -444,9 +444,9 @@
DisplayDevice::DisplayType type((DisplayDevice::DisplayType)i);
// set-up the displays that are already connected
if (mHwc->isConnected(i) || type==DisplayDevice::DISPLAY_PRIMARY) {
- // All non-virtual displays are currently considered secure.
- bool isSecure = true;
- createBuiltinDisplayLocked(type);
+ // query from hwc if the non-virtual display is secure.
+ bool isSecure = mHwc->isSecure(i);;
+ createBuiltinDisplayLocked(type, isSecure);
wp<IBinder> token = mBuiltinDisplays[i];
sp<IGraphicBufferProducer> producer;
@@ -626,8 +626,8 @@
info.presentationDeadline =
hwConfig.refresh - SF_VSYNC_EVENT_PHASE_OFFSET_NS + 1000000;
- // All non-virtual displays are currently considered secure.
- info.secure = true;
+ // set secure info based on the hwcConfig
+ info.secure = hwConfig.secure;
configs->push_back(info);
}
@@ -840,7 +840,9 @@
if (uint32_t(type) < DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES) {
Mutex::Autolock _l(mStateLock);
if (connected) {
- createBuiltinDisplayLocked((DisplayDevice::DisplayType)type);
+ // query from hwc if the connected display is secure
+ bool secure = mHwc->isSecure(type);;
+ createBuiltinDisplayLocked((DisplayDevice::DisplayType)type, secure);
} else {
mCurrentState.displays.removeItem(mBuiltinDisplays[type]);
mBuiltinDisplays[type].clear();
@@ -3528,6 +3530,12 @@
// make sure to clear all GL error flags
engine.checkErrors();
+ if (DisplayDevice::DISPLAY_PRIMARY == hw->getDisplayType() &&
+ hw->isPanelInverseMounted()) {
+ rotation = (Transform::orientation_flags)
+ (rotation ^ Transform::ROT_180);
+ }
+
// set-up our viewport
engine.setViewportAndProjection(
reqWidth, reqHeight, sourceCrop, hw_h, yswap, rotation);
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 7faeb67..8f9dc6d 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -357,7 +357,8 @@
void initializeDisplays();
// Create an IBinder for a builtin display and add it to current state
- void createBuiltinDisplayLocked(DisplayDevice::DisplayType type);
+ void createBuiltinDisplayLocked(DisplayDevice::DisplayType type,
+ bool secure);
// NOTE: can only be called from the main thread or with mStateLock held
sp<const DisplayDevice> getDisplayDevice(const wp<IBinder>& dpy) const {