Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 16f0453f authored by Glenn Kasten's avatar Glenn Kasten
Browse files

Protected surface API

To be used by DRM framework, implemented by display HAL

Change-Id: I054a07a94f4d5dbe792f3a597e2e49a100d90eb2
parent b7d342c6
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -44,6 +44,8 @@ public:
        eSecure             = 0x00000080,
        eNonPremultiplied   = 0x00000100,
        eOpaque             = 0x00000400,
        eProtectedByApp     = 0x00000800,
        eProtectedByDRM     = 0x00001000,

        eFXSurfaceNormal    = 0x00000000,
        eFXSurfaceBlur      = 0x00010000,
+4 −2
Original line number Diff line number Diff line
@@ -57,6 +57,8 @@ public:

        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,
+8 −0
Original line number Diff line number Diff line
@@ -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;
}

+5 −1
Original line number Diff line number Diff line
@@ -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)
+12 −0
Original line number Diff line number Diff line
@@ -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; }
Loading