diff options
-rw-r--r-- | core/java/android/view/Surface.java | 11 | ||||
-rw-r--r-- | core/java/android/view/WindowManager.java | 2 | ||||
-rw-r--r-- | include/surfaceflinger/ISurfaceComposer.h | 2 | ||||
-rw-r--r-- | include/ui/GraphicBuffer.h | 6 | ||||
-rw-r--r-- | services/surfaceflinger/Layer.cpp | 8 | ||||
-rw-r--r-- | services/surfaceflinger/Layer.h | 6 | ||||
-rw-r--r-- | services/surfaceflinger/LayerBase.h | 12 | ||||
-rw-r--r-- | services/surfaceflinger/LayerDim.h | 6 |
8 files changed, 47 insertions, 6 deletions
diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java index 0326a8f..83f9119 100644 --- a/core/java/android/view/Surface.java +++ b/core/java/android/view/Surface.java @@ -99,6 +99,17 @@ public class Surface implements Parcelable { */ public static final int OPAQUE = 0x00000400; + /** + * Application requires a hardware-protected path to an + * external display sink. If a hardware-protected path is not available, + * then this surface will not be displayed on the external sink. + * + * @hide + */ + public static final int PROTECTED_APP = 0x00000800; + + // 0x1000 is reserved for an independent DRM protected flag in framework + /** Creates a normal surface. This is the default. */ public static final int FX_SURFACE_NORMAL = 0x00000000; diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index 02e5b63..ca932e9 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -537,7 +537,7 @@ public interface WindowManager extends ViewManager { public static final int FLAG_DITHER = 0x00001000; /** Window flag: don't allow screen shots while this window is - * displayed. */ + * displayed. Maps to Surface.SECURE. */ public static final int FLAG_SECURE = 0x00002000; /** Window flag: a special mode where the layout parameters are used diff --git a/include/surfaceflinger/ISurfaceComposer.h b/include/surfaceflinger/ISurfaceComposer.h index 56ed3a4..361e7dc 100644 --- a/include/surfaceflinger/ISurfaceComposer.h +++ b/include/surfaceflinger/ISurfaceComposer.h @@ -44,6 +44,8 @@ public: eSecure = 0x00000080, eNonPremultiplied = 0x00000100, eOpaque = 0x00000400, + eProtectedByApp = 0x00000800, + eProtectedByDRM = 0x00001000, eFXSurfaceNormal = 0x00000000, eFXSurfaceBlur = 0x00010000, diff --git a/include/ui/GraphicBuffer.h b/include/ui/GraphicBuffer.h index 8b256f4..02d6f8f 100644 --- a/include/ui/GraphicBuffer.h +++ b/include/ui/GraphicBuffer.h @@ -54,9 +54,11 @@ public: USAGE_SW_WRITE_RARELY = GRALLOC_USAGE_SW_WRITE_RARELY, USAGE_SW_WRITE_OFTEN = GRALLOC_USAGE_SW_WRITE_OFTEN, USAGE_SW_WRITE_MASK = GRALLOC_USAGE_SW_WRITE_MASK, - + USAGE_SOFTWARE_MASK = USAGE_SW_READ_MASK|USAGE_SW_WRITE_MASK, - + + USAGE_PROTECTED = GRALLOC_USAGE_PROTECTED, + USAGE_HW_TEXTURE = GRALLOC_USAGE_HW_TEXTURE, USAGE_HW_RENDER = GRALLOC_USAGE_HW_RENDER, USAGE_HW_2D = GRALLOC_USAGE_HW_2D, diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 3730739..188686d 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -56,6 +56,8 @@ Layer::Layer(SurfaceFlinger* flinger, mNeedsBlending(true), mNeedsDithering(false), mSecure(false), + mProtectedByApp(false), + mProtectedByDRM(false), mTextureManager(), mBufferManager(mTextureManager), mWidth(0), mHeight(0), mNeedsScaling(false), mFixedSize(false) @@ -191,6 +193,8 @@ status_t Layer::setBuffers( uint32_t w, uint32_t h, mReqHeight = h; mSecure = (flags & ISurfaceComposer::eSecure) ? true : false; + mProtectedByApp = (flags & ISurfaceComposer::eProtectedByApp) ? true : false; + mProtectedByDRM = (flags & ISurfaceComposer::eProtectedByDRM) ? true : false; mNeedsBlending = (info.h_alpha - info.l_alpha) > 0 && (flags & ISurfaceComposer::eOpaque) == 0; @@ -476,6 +480,10 @@ uint32_t Layer::getEffectiveUsage(uint32_t usage) const // request EGLImage for all buffers usage |= GraphicBuffer::USAGE_HW_TEXTURE; } + if (mProtectedByApp || mProtectedByDRM) { + // need a hardware-protected path to external video sink + usage |= GraphicBuffer::USAGE_PROTECTED; + } return usage; } diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h index 2908119..d9a8be3 100644 --- a/services/surfaceflinger/Layer.h +++ b/services/surfaceflinger/Layer.h @@ -79,6 +79,8 @@ public: virtual bool needsDithering() const { return mNeedsDithering; } virtual bool needsFiltering() const; virtual bool isSecure() const { return mSecure; } + virtual bool isProtectedByApp() const { return mProtectedByApp; } + virtual bool isProtectedByDRM() const { return mProtectedByDRM; } virtual sp<Surface> createSurface() const; virtual status_t ditch(); virtual void onRemoved(); @@ -218,7 +220,9 @@ private: bool mNeedsDithering; // page-flip thread (currently main thread) - bool mSecure; + bool mSecure; // no screenshots + bool mProtectedByApp; // application requires protected path to external sink + bool mProtectedByDRM; // DRM agent requires protected path to external sink Region mPostedDirtyRegion; // page-flip thread and transaction thread (currently main thread) diff --git a/services/surfaceflinger/LayerBase.h b/services/surfaceflinger/LayerBase.h index 8ed4749..184edd7 100644 --- a/services/surfaceflinger/LayerBase.h +++ b/services/surfaceflinger/LayerBase.h @@ -196,6 +196,18 @@ public: */ virtual bool isSecure() const { return false; } + /** + * isProtectedByApp - true if application says this surface is protected, that + * is if it requires a hardware-protected data path to an external sink. + */ + virtual bool isProtectedByApp() const { return false; } + + /** + * isProtectedByDRM - true if DRM agent says this surface is protected, that + * is if it requires a hardware-protected data path to an external sink. + */ + virtual bool isProtectedByDRM() const { return false; } + /** Called from the main thread, when the surface is removed from the * draw list */ virtual status_t ditch() { return NO_ERROR; } diff --git a/services/surfaceflinger/LayerDim.h b/services/surfaceflinger/LayerDim.h index f032314..a04a0c0 100644 --- a/services/surfaceflinger/LayerDim.h +++ b/services/surfaceflinger/LayerDim.h @@ -42,8 +42,10 @@ public: virtual ~LayerDim(); virtual void onDraw(const Region& clip) const; - virtual bool needsBlending() const { return true; } - virtual bool isSecure() const { return false; } + virtual bool needsBlending() const { return true; } + virtual bool isSecure() const { return false; } + virtual bool isProtectedByApp() const { return false; } + virtual bool isProtectedByDRM() const { return false; } virtual const char* getTypeId() const { return "LayerDim"; } static void initDimmer(SurfaceFlinger* flinger, uint32_t w, uint32_t h); |