Handle protected video playback.
BZ: 103301
This patch contains the following changes:
1) Define GraphicBuffer class and make it part of common library.
This class wraps buffer format and buffer usage as for now and provides
helper to check whether buffer is protected.
2) Avoid overhead of multiple data buffer creation during prepare, buffer is created
only once and attributes of buffer is stored internally for later use.
3) Ensure protected video is always rendered using harrdware overlay. IED needs to
be enabled when protected layer is received, a special hint is set in backbuffer
(OSTART_0Y) such that display controller can enable IED decryption during flip.
Change-Id: I32c4cf5f72e4fd650678264aaa9f0f63376f998b
Signed-off-by: Andy Qiu <junhai.qiu@intel.com>
Reviewed-on: http://android.intel.com:8080/102513
Reviewed-by: cactus <cactus@intel.com>
Reviewed-by: Jin, Fu <fu.jin@intel.com>
Reviewed-by: Bish, Jim <jim.bish@intel.com>
Reviewed-by: Stimson, Dale B <dale.b.stimson@intel.com>
Tested-by: Stimson, Dale B <dale.b.stimson@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
diff --git a/common/base/HwcLayerList.cpp b/common/base/HwcLayerList.cpp
index b341a1f..56fdea1 100644
--- a/common/base/HwcLayerList.cpp
+++ b/common/base/HwcLayerList.cpp
@@ -29,6 +29,7 @@
#include <Drm.h>
#include <HwcLayerList.h>
#include <Hwcomposer.h>
+#include <GraphicBuffer.h>
#include <IDisplayDevice.h>
#include <PlaneCapabilities.h>
@@ -39,9 +40,11 @@
: mIndex(index),
mLayer(layer),
mPlane(0),
+ mFormat(DataBuffer::FORMAT_INVALID),
+ mIsProtected(false),
mType(LAYER_FB)
{
-
+ setupAttributes();
}
bool HwcLayer::attachPlane(DisplayPlane* plane)
@@ -94,6 +97,16 @@
return mIndex;
}
+uint32_t HwcLayer::getFormat() const
+{
+ return mFormat;
+}
+
+bool HwcLayer::isProtected() const
+{
+ return mIsProtected;
+}
+
hwc_layer_1_t* HwcLayer::getLayer() const
{
return mLayer;
@@ -110,6 +123,7 @@
// update layer
mLayer = layer;
+ setupAttributes();
// if not a FB layer & a plane was attached update plane's data buffer
if (mPlane) {
@@ -124,15 +138,51 @@
layer->sourceCrop.bottom - layer->sourceCrop.top);
mPlane->setTransform(layer->transform);
ret = mPlane->setDataBuffer((uint32_t)layer->handle);
- if (!ret) {
- ETRACE("failed to set data buffer");
+ if (ret == true) {
+ return true;
+ }
+ ETRACE("failed to set data buffer");
+ if (!mIsProtected) {
return false;
+ } else {
+ // protected video has to be rendered using overlay.
+ // if buffer is not ready overlay will still be attached to this layer
+ // but rendering needs to be skipped.
+ ETRACE("ignoring result of data buffer setting for protected video");
+ return true;
}
}
return true;
}
+void HwcLayer::setupAttributes()
+{
+ if (mFormat != DataBuffer::FORMAT_INVALID) {
+ return;
+ }
+
+ if (mLayer->handle == NULL) {
+ WTRACE("invalid handle");
+ return;
+ }
+
+ BufferManager *bm = Hwcomposer::getInstance().getBufferManager();
+ if (bm == NULL) {
+ // TODO: this check is redundant
+ return;
+ }
+
+ DataBuffer *buffer = bm->get((uint32_t)mLayer->handle);
+ if (!buffer) {
+ ETRACE("failed to get buffer");
+ } else {
+ mFormat = buffer->getFormat();
+ mIsProtected = GraphicBuffer::isProtectedBuffer((GraphicBuffer*)buffer);
+ bm->put(*buffer);
+ }
+}
+
//------------------------------------------------------------------------------
HwcLayerList::HwcLayerList(hwc_display_contents_1_t *list,
DisplayPlaneManager& dpm,
@@ -188,12 +238,10 @@
return l->getIndex() - r->getIndex();
}
//------------------------------------------------------------------------------
-bool HwcLayerList::check(int planeType, hwc_layer_1_t& layer)
+bool HwcLayerList::checkSupported(int planeType, HwcLayer *hwcLayer)
{
bool valid = false;
- BufferManager *bm = Hwcomposer::getInstance().getBufferManager();
- DataBuffer *buffer;
- uint32_t format;
+ hwc_layer_1_t& layer = *(hwcLayer->getLayer());
// check layer flags
if (layer.flags & HWC_SKIP_LAYER) {
@@ -201,23 +249,13 @@
return false;
}
- if (!bm) {
- ETRACE("failed to get buffer manager");
+ if (layer.handle == 0) {
+ WTRACE("invalid buffer handle");
return false;
}
- // get buffer source format
- buffer = bm->get((uint32_t)layer.handle);
- if (!buffer) {
- ETRACE("failed to get buffer");
- return false;
- }
-
- format = buffer->getFormat();
- bm->put(*buffer);
-
// check buffer format
- valid = PlaneCapabilities::isFormatSupported(planeType, format);
+ valid = PlaneCapabilities::isFormatSupported(planeType, hwcLayer->getFormat());
if (!valid) {
VTRACE("plane type %d: (bad buffer format)", planeType);
goto check_out;
@@ -350,8 +388,8 @@
// 1) all the other layers have been set to OVERLAY layer.
if ((mFBLayers.size() == 1)) {
HwcLayer *hwcLayer = mFBLayers.itemAt(0);
- if (check(DisplayPlane::PLANE_PRIMARY, *(hwcLayer->getLayer()))) {
- VTRACE("primary check passed for primary layer");
+ if (checkSupported(DisplayPlane::PLANE_PRIMARY, hwcLayer)) {
+ ITRACE("primary check passed for primary layer");
// attach primary to hwc layer
hwcLayer->attachPlane(mPrimaryPlane);
// set the layer type to overlay
@@ -386,7 +424,7 @@
DisplayPlane *plane;
Drm *drm = Hwcomposer::getInstance().getDrm();
- if (!mList || index >= mLayerCount)
+ if (!mList || index >= mLayerCount || !drm)
return;
freeSpriteCount = mDisplayPlaneManager.getFreeSpriteCount();
@@ -414,10 +452,15 @@
continue;
}
+ if (layer->handle == NULL) {
+ WTRACE("null buffer handle");
+ continue;
+ }
+
// check whether the layer can be handled by sprite plane
if (freeSpriteCount) {
- if (check(DisplayPlane::PLANE_SPRITE, *layer)) {
- VTRACE("sprite check passed for layer %d", i);
+ if (checkSupported(DisplayPlane::PLANE_SPRITE, hwcLayer)) {
+ ITRACE("sprite check passed for layer %d", i);
plane = mDisplayPlaneManager.getSpritePlane();
if (plane) {
// attach plane to hwc layer
@@ -426,45 +469,55 @@
hwcLayer->setType(HwcLayer::LAYER_OVERLAY);
// clear fb
layer->hints |= HWC_HINT_CLEAR_FB;
+ } else {
+ ETRACE("sprite plane is null, impossible");
}
+ mOverlayLayers.add(hwcLayer);
+ continue;
}
}
// check whether the layer can be handled by overlay plane
if (freeOverlayCount) {
- if (check(DisplayPlane::PLANE_OVERLAY, *layer)) {
- VTRACE("overlay check passed for layer %d", i);
- plane = mDisplayPlaneManager.getOverlayPlane();
- if (plane) {
- // attach plane to hwc layer
- hwcLayer->attachPlane(plane);
- // set the layer type to overlay
- hwcLayer->setType(HwcLayer::LAYER_OVERLAY);
- // clear fb
- layer->hints |= HWC_HINT_CLEAR_FB;
- }
-
- // handle extend video mode use case
- // FIXME: fall back to android's native use case
- // extend video mode & presentation mode should be triggered
- // by layer stack configuration.
- if (drm) {
- bool extConnected =
- drm->outputConnected(Drm::OUTPUT_EXTERNAL);
- if (extConnected && plane && !mDisplayIndex) {
- hwcLayer->detachPlane();
- mDisplayPlaneManager.putOverlayPlane(*plane);
+ if (checkSupported(DisplayPlane::PLANE_OVERLAY, hwcLayer)) {
+ ITRACE("overlay check passed for layer %d", i);
+ // set the layer type to overlay
+ hwcLayer->setType(HwcLayer::LAYER_OVERLAY);
+ bool extConnected = drm->outputConnected(Drm::OUTPUT_EXTERNAL);
+ if (extConnected && !mDisplayIndex) {
+ // handle extend video mode use case
+ // FIXME: fall back to android's native use case
+ // extend video mode & presentation mode should be triggered
+ // by layer stack configuration.
+ // TODO: remove this hack
+ } else {
+ plane = mDisplayPlaneManager.getOverlayPlane();
+ if (plane) {
+ // attach plane to hwc layer
+ hwcLayer->attachPlane(plane);
+ // clear fb
+ layer->hints |= HWC_HINT_CLEAR_FB;
+ } else {
+ ETRACE("overlay plane is null, impossible");
}
- hwcLayer->setType(HwcLayer::LAYER_OVERLAY);
}
+ mOverlayLayers.add(hwcLayer);
+ continue;
}
}
- // if still FB layer
- if (hwcLayer->getType() == HwcLayer::LAYER_FB)
- mFBLayers.add(hwcLayer);
- else
+ if (hwcLayer->isProtected()) {
+ // TODO: we need to detach overlay from non-protected layers
+ WTRACE("protected layer is skipped");
+ hwcLayer->setType(HwcLayer::LAYER_OVERLAY);
mOverlayLayers.add(hwcLayer);
+ continue;
+ }
+
+ // if still FB layer
+ if (hwcLayer->getType() == HwcLayer::LAYER_FB) {
+ mFBLayers.add(hwcLayer);
+ }
} // for (ssize_t i = index; i >= 0; i--)
// revisit the plane assignments
@@ -554,6 +607,18 @@
return hwcLayer->getPlane();
}
+bool HwcLayerList::hasProtectedLayer()
+{
+ for (size_t i = 0; i < mLayers.size(); i++) {
+ HwcLayer *hwcLayer = mLayers.itemAt(i);
+ if (hwcLayer && hwcLayer->isProtected()) {
+ ITRACE("protected layer found, layer index is %d", i);
+ return true;
+ }
+ }
+ return false;
+}
+
void HwcLayerList::dump(Dump& d)
{
d.append("Layer list: (number of layers %d):\n", mLayers.size());
diff --git a/common/base/HwcLayerList.h b/common/base/HwcLayerList.h
index 0fa2160..4e501c9 100644
--- a/common/base/HwcLayerList.h
+++ b/common/base/HwcLayerList.h
@@ -31,7 +31,7 @@
#include <Dump.h>
#include <hardware/hwcomposer.h>
#include <utils/SortedVector.h>
-
+#include <DataBuffer.h>
#include <DisplayPlane.h>
#include <DisplayPlaneManager.h>
@@ -56,14 +56,22 @@
uint32_t getType() const;
int getIndex() const;
+ uint32_t getFormat() const;
+ bool isProtected() const;
hwc_layer_1_t* getLayer() const;
DisplayPlane* getPlane() const;
bool update(hwc_layer_1_t *layer, int disp);
+
+private:
+ void setupAttributes();
+
private:
const int mIndex;
hwc_layer_1_t *mLayer;
DisplayPlane *mPlane;
+ uint32_t mFormat;
+ bool mIsProtected;
uint32_t mType;
};
@@ -82,12 +90,14 @@
virtual bool update(hwc_display_contents_1_t *list);
virtual DisplayPlane* getPlane(uint32_t index) const;
+ bool hasProtectedLayer();
+
// dump interface
virtual void dump(Dump& d);
protected:
virtual void setZOrder();
virtual void revisit();
- virtual bool check(int planeType, hwc_layer_1_t& layer);
+ virtual bool checkSupported(int planeType, HwcLayer *hwcLayer);
virtual void analyze(uint32_t index);
private:
hwc_display_contents_1_t *mList;
diff --git a/common/buffers/GraphicBuffer.cpp b/common/buffers/GraphicBuffer.cpp
new file mode 100644
index 0000000..f36d3a4
--- /dev/null
+++ b/common/buffers/GraphicBuffer.cpp
@@ -0,0 +1,61 @@
+/*
+ * Copyright © 2012 Intel Corporation
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Jackie Li <yaodong.li@intel.com>
+ *
+ */
+#include <HwcTrace.h>
+#include <GraphicBuffer.h>
+
+namespace android {
+namespace intel {
+
+GraphicBuffer::GraphicBuffer(uint32_t handle)
+ : DataBuffer(handle),
+ mUsage(USAGE_INVALID),
+ mBpp(0)
+{
+}
+
+bool GraphicBuffer::isProtectedUsage(uint32_t usage)
+{
+ if (usage == USAGE_INVALID) {
+ return false;
+ }
+
+ return (usage & GRALLOC_USAGE_PROTECTED) != 0;
+}
+
+bool GraphicBuffer::isProtectedBuffer(GraphicBuffer *buffer)
+{
+ if (buffer == NULL) {
+ return false;
+ }
+
+ return isProtectedUsage(buffer->mUsage);
+}
+
+
+}
+}
diff --git a/common/devices/PhysicalDevice.cpp b/common/devices/PhysicalDevice.cpp
index b573013..17005fd 100644
--- a/common/devices/PhysicalDevice.cpp
+++ b/common/devices/PhysicalDevice.cpp
@@ -40,6 +40,7 @@
mActiveDisplayConfig(-1),
mVsyncControl(0),
mBlankControl(0),
+ mPrepareListener(0),
mVsyncObserver(0),
mLayerList(0),
mPrimaryPlane(0),
@@ -129,9 +130,12 @@
return true;
// check if geometry is changed
- if (display->flags & HWC_GEOMETRY_CHANGED)
+ if (display->flags & HWC_GEOMETRY_CHANGED) {
onGeometryChanged(display);
-
+ if (mLayerList && mLayerList->hasProtectedLayer()) {
+ mPrepareListener->onProtectedLayerStart(mType);
+ }
+ }
if (!mLayerList) {
ETRACE("null HWC layer list");
return false;
@@ -484,6 +488,12 @@
DEINIT_AND_RETURN_FALSE("failed to create blank control");
}
+ // create hwc prepare listener
+ mPrepareListener = createPrepareListener();
+ if (!mPrepareListener) {
+ DEINIT_AND_RETURN_FALSE("failed to create prepare listener");
+ }
+
// create vsync event observer
mVsyncObserver = new VsyncEventObserver(*this, *mVsyncControl);
if (!mVsyncObserver.get()) {
@@ -514,6 +524,11 @@
mVsyncControl = 0;
}
+ if (mPrepareListener) {
+ delete mPrepareListener;
+ mPrepareListener = 0;
+ }
+
// remove configs
removeDisplayConfigs();
diff --git a/common/planes/DisplayPlane.cpp b/common/planes/DisplayPlane.cpp
index 61aed7d..ecffffc 100644
--- a/common/planes/DisplayPlane.cpp
+++ b/common/planes/DisplayPlane.cpp
@@ -28,6 +28,7 @@
#include <HwcTrace.h>
#include <Hwcomposer.h>
#include <DisplayPlane.h>
+#include <GraphicBuffer.h>
namespace android {
namespace intel {
@@ -38,6 +39,7 @@
mDevice(disp),
mInitialized(false),
mDataBuffers(),
+ mIsProtectedBuffer(false),
mTransform(PLANE_TRANSFORM_0)
{
CTRACE();
@@ -143,6 +145,7 @@
// update buffer's source crop
buffer->setCrop(mSrcCrop.x, mSrcCrop.y, mSrcCrop.w, mSrcCrop.h);
+ mIsProtectedBuffer = GraphicBuffer::isProtectedBuffer((GraphicBuffer*)buffer);
// map buffer if it's not in cache
index = mDataBuffers.indexOfKey(buffer->getKey());
if (index < 0) {
diff --git a/include/DisplayPlane.h b/include/DisplayPlane.h
index 109be25..f09e959 100644
--- a/include/DisplayPlane.h
+++ b/include/DisplayPlane.h
@@ -128,6 +128,7 @@
KeyedVector<uint64_t, BufferMapper*> mDataBuffers;
PlanePosition mPosition;
crop_t mSrcCrop;
+ bool mIsProtectedBuffer;
int mTransform;
};
diff --git a/include/GraphicBuffer.h b/include/GraphicBuffer.h
new file mode 100644
index 0000000..cdebfe8
--- /dev/null
+++ b/include/GraphicBuffer.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright © 2012 Intel Corporation
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Jackie Li <yaodong.li@intel.com>
+ *
+ */
+#ifndef GRAPHIC_BUFFER_H
+#define GRAPHIC_BUFFER_H
+
+#include <DataBuffer.h>
+
+
+namespace android {
+namespace intel {
+
+class GraphicBuffer : public DataBuffer {
+public:
+ enum {
+ USAGE_INVALID = 0xffffffff,
+ };
+
+public:
+ GraphicBuffer(uint32_t handle);
+ virtual ~GraphicBuffer() {}
+
+ uint32_t getUsage() const { return mUsage; }
+ uint32_t getBpp() const { return mBpp; }
+
+ static bool isProtectedUsage(uint32_t usage);
+ static bool isProtectedBuffer(GraphicBuffer *buffer);
+
+protected:
+ uint32_t mUsage;
+ uint32_t mBpp;
+};
+
+} // namespace intel
+} // namespace android
+
+#endif /* GRAPHIC_BUFFER_H */
diff --git a/include/IPrepareListener.h b/include/IPrepareListener.h
new file mode 100644
index 0000000..ec64908
--- /dev/null
+++ b/include/IPrepareListener.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright © 2012 Intel Corporation
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Jackie Li <yaodong.li@intel.com>
+ *
+ */
+#ifndef IPREPARE_LISTENER_H
+#define IPREPARE_LISTENER_H
+
+namespace android {
+namespace intel {
+
+class IPrepareListener {
+public:
+ IPrepareListener() {}
+ virtual ~IPrepareListener() {}
+public:
+ virtual void onProtectedLayerStart(int disp) = 0;
+};
+
+} // namespace intel
+} // namespace android
+
+#endif /* IPREPARE_LISTENER_H */
diff --git a/include/PhysicalDevice.h b/include/PhysicalDevice.h
index ea17425..4ee1c19 100644
--- a/include/PhysicalDevice.h
+++ b/include/PhysicalDevice.h
@@ -31,6 +31,7 @@
#include <DisplayPlane.h>
#include <IVsyncControl.h>
#include <IBlankControl.h>
+#include <IPrepareListener.h>
#include <VsyncEventObserver.h>
#include <HotplugEventObserver.h>
#include <HwcLayerList.h>
@@ -83,6 +84,7 @@
virtual IVsyncControl* createVsyncControl() = 0;
virtual IBlankControl* createBlankControl() = 0;
+ virtual IPrepareListener* createPrepareListener() = 0;
protected:
uint32_t mType;
const char *mName;
@@ -98,6 +100,8 @@
IVsyncControl *mVsyncControl;
// blank control
IBlankControl *mBlankControl;
+
+ IPrepareListener *mPrepareListener;
// vsync event observer
sp<VsyncEventObserver> mVsyncObserver;
diff --git a/ips/common/GrallocBufferBase.cpp b/ips/common/GrallocBufferBase.cpp
index 677a844..21b09fe 100644
--- a/ips/common/GrallocBufferBase.cpp
+++ b/ips/common/GrallocBufferBase.cpp
@@ -32,7 +32,7 @@
namespace intel {
GrallocBufferBase::GrallocBufferBase(uint32_t handle)
- :DataBuffer(handle)
+ : GraphicBuffer(handle)
{
ATRACE("handle = %#x", handle);
}
diff --git a/ips/common/GrallocBufferBase.h b/ips/common/GrallocBufferBase.h
index feb9a85..3ef6afe 100644
--- a/ips/common/GrallocBufferBase.h
+++ b/ips/common/GrallocBufferBase.h
@@ -28,7 +28,7 @@
#ifndef GRALLOC_BUFFER_BASE_H
#define GRALLOC_BUFFER_BASE_H
-#include <DataBuffer.h>
+#include <GraphicBuffer.h>
#include <hal_public.h>
// FIXME: remove it, why define NV12_VED based on OMX's value?
#include <OMX_IVCommon.h>
@@ -36,18 +36,14 @@
namespace android {
namespace intel {
-class GrallocBufferBase : public DataBuffer {
+class GrallocBufferBase : public GraphicBuffer {
public:
GrallocBufferBase(uint32_t handle);
virtual ~GrallocBufferBase() {}
- // gralloc buffer operation
- uint32_t getUsage() const { return mUsage; };
+
protected:
// fully initialize buffer
virtual void initialize();
-protected:
- uint32_t mUsage;
- uint32_t mBpp;
};
} // namespace intel
diff --git a/ips/common/PrepareListener.cpp b/ips/common/PrepareListener.cpp
new file mode 100644
index 0000000..76e7bcd
--- /dev/null
+++ b/ips/common/PrepareListener.cpp
@@ -0,0 +1,55 @@
+/*
+ * Copyright © 2012 Intel Corporation
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Jackie Li <yaodong.li@intel.com>
+ *
+ */
+
+#include <HwcTrace.h>
+#include <Drm.h>
+#include <Hwcomposer.h>
+#include <common/PrepareListener.h>
+
+namespace android {
+namespace intel {
+
+PrepareListener::PrepareListener()
+ : IPrepareListener()
+{
+}
+
+void PrepareListener::onProtectedLayerStart(int disp)
+{
+ ATRACE("disp = %d", disp);
+ Drm *drm = Hwcomposer::getInstance().getDrm();
+ int ret = drmCommandNone(drm->getDrmFd(), DRM_PSB_HDCP_DISPLAY_IED_ON);
+ if (ret != 0) {
+ ETRACE("failed to turn on display IED");
+ } else {
+ ITRACE("display IED is turned on");
+ }
+}
+
+} // namespace intel
+} // namespace android
diff --git a/ips/common/PrepareListener.h b/ips/common/PrepareListener.h
new file mode 100644
index 0000000..4315f64
--- /dev/null
+++ b/ips/common/PrepareListener.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright © 2012 Intel Corporation
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Jackie Li <yaodong.li@intel.com>
+ *
+ */
+#ifndef PREPARE_LISTENER_H
+#define PREPARE_LISTENER_H
+
+#include <IPrepareListener.h>
+
+namespace android {
+namespace intel {
+
+class PrepareListener : public IPrepareListener {
+public:
+ PrepareListener();
+public:
+ virtual void onProtectedLayerStart(int disp);
+};
+
+} // namespace intel
+} // namespace android
+
+#endif /* PREPARE_LISTENER_H */
diff --git a/ips/tangier/TngOverlayPlane.cpp b/ips/tangier/TngOverlayPlane.cpp
index 21c8344..0fd584b 100644
--- a/ips/tangier/TngOverlayPlane.cpp
+++ b/ips/tangier/TngOverlayPlane.cpp
@@ -73,5 +73,20 @@
return (void *)&mContext;
}
+bool TngOverlayPlane::setDataBuffer(BufferMapper& mapper)
+{
+ if (OverlayPlaneBase::setDataBuffer(mapper) == false) {
+ return false;
+ }
+
+ if (mIsProtectedBuffer) {
+ // Bit 0: Decryption request, only allowed to change on a synchronous flip
+ // This request will be qualified with the separate decryption enable bit for OV
+ mBackBuffer->buf->OSTART_0Y |= 0x1;
+ }
+ return true;
+}
+
+
} // namespace intel
} // namespace android
diff --git a/ips/tangier/TngOverlayPlane.h b/ips/tangier/TngOverlayPlane.h
index f07d40a..a0c66e4 100644
--- a/ips/tangier/TngOverlayPlane.h
+++ b/ips/tangier/TngOverlayPlane.h
@@ -48,6 +48,10 @@
virtual bool flip();
virtual void* getContext() const;
+
+protected:
+ virtual bool setDataBuffer(BufferMapper& mapper);
+
protected:
struct intel_dc_plane_ctx mContext;
};
diff --git a/platforms/merrifield/Android.mk b/platforms/merrifield/Android.mk
index 73ac6be..de74ee3 100644
--- a/platforms/merrifield/Android.mk
+++ b/platforms/merrifield/Android.mk
@@ -28,6 +28,7 @@
../../common/base/Hwcomposer.cpp \
../../common/base/HwcModule.cpp \
../../common/buffers/BufferCache.cpp \
+ ../../common/buffers/GraphicBuffer.cpp \
../../common/buffers/BufferManager.cpp \
../../common/devices/PhysicalDevice.cpp \
../../common/devices/PrimaryDevice.cpp \
@@ -44,6 +45,7 @@
../../ips/common/BlankControl.cpp \
../../ips/common/HotplugControl.cpp \
../../ips/common/VsyncControl.cpp \
+ ../../ips/common/PrepareListener.cpp \
../../ips/common/OverlayPlaneBase.cpp \
../../ips/common/SpritePlaneBase.cpp \
../../ips/common/PixelFormat.cpp \
diff --git a/platforms/merrifield/PlatfExternalDevice.cpp b/platforms/merrifield/PlatfExternalDevice.cpp
index e7d5168..78440d8 100644
--- a/platforms/merrifield/PlatfExternalDevice.cpp
+++ b/platforms/merrifield/PlatfExternalDevice.cpp
@@ -30,6 +30,7 @@
#include <common/VsyncControl.h>
#include <common/BlankControl.h>
#include <common/HotplugControl.h>
+#include <common/PrepareListener.h>
namespace android {
namespace intel {
@@ -56,6 +57,11 @@
return new BlankControl();
}
+IPrepareListener* PlatfExternalDevice::createPrepareListener()
+{
+ return new PrepareListener();
+}
+
IHotplugControl* PlatfExternalDevice::createHotplugControl()
{
return new HotplugControl();
diff --git a/platforms/merrifield/PlatfExternalDevice.h b/platforms/merrifield/PlatfExternalDevice.h
index 303d2c8..96f9693 100644
--- a/platforms/merrifield/PlatfExternalDevice.h
+++ b/platforms/merrifield/PlatfExternalDevice.h
@@ -43,6 +43,7 @@
protected:
IVsyncControl* createVsyncControl();
IBlankControl* createBlankControl();
+ IPrepareListener* createPrepareListener();
IHotplugControl* createHotplugControl();
};
diff --git a/platforms/merrifield/PlatfPrimaryDevice.cpp b/platforms/merrifield/PlatfPrimaryDevice.cpp
index 502d12a..cb82bc6 100644
--- a/platforms/merrifield/PlatfPrimaryDevice.cpp
+++ b/platforms/merrifield/PlatfPrimaryDevice.cpp
@@ -29,6 +29,7 @@
#include <PlatfPrimaryDevice.h>
#include <common/VsyncControl.h>
#include <common/BlankControl.h>
+#include <common/PrepareListener.h>
namespace android {
@@ -56,6 +57,11 @@
return new BlankControl();
}
+IPrepareListener* PlatfPrimaryDevice::createPrepareListener()
+{
+ return new PrepareListener();
+}
+
} // namespace intel
} // namespace android
diff --git a/platforms/merrifield/PlatfPrimaryDevice.h b/platforms/merrifield/PlatfPrimaryDevice.h
index 9b92239..7aa0a61 100644
--- a/platforms/merrifield/PlatfPrimaryDevice.h
+++ b/platforms/merrifield/PlatfPrimaryDevice.h
@@ -43,6 +43,7 @@
protected:
IVsyncControl* createVsyncControl();
IBlankControl* createBlankControl();
+ IPrepareListener* createPrepareListener();
};
}