Loading services/surfaceflinger/Layer.cpp +21 −12 Original line number Diff line number Diff line Loading @@ -280,7 +280,8 @@ void Layer::onDraw(const Region& clip) const return; } const GLenum target = GL_TEXTURE_EXTERNAL_OES; GLenum target = GL_TEXTURE_EXTERNAL_OES; if (!isProtected()) { glBindTexture(target, mTextureName); if (getFiltering() || needsFiltering() || isFixedSize() || isCropped()) { // TODO: we could be more subtle with isFixedSize() Loading @@ -294,6 +295,14 @@ void Layer::onDraw(const Region& clip) const glMatrixMode(GL_TEXTURE); glLoadMatrixf(mTextureMatrix); glMatrixMode(GL_MODELVIEW); } else { target = GL_TEXTURE_2D; glBindTexture(target, mFlinger->getProtectedTexName()); glEnable(target); glMatrixMode(GL_TEXTURE); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); } drawWithOpenGL(clip); Loading services/surfaceflinger/SurfaceFlinger.cpp +14 −18 Original line number Diff line number Diff line Loading @@ -275,7 +275,7 @@ status_t SurfaceFlinger::readyToRun() const uint16_t g0 = pack565(0x0F,0x1F,0x0F); const uint16_t g1 = pack565(0x17,0x2f,0x17); const uint16_t textureData[4] = { g0, g1, g1, g0 }; const uint16_t wormholeTexData[4] = { g0, g1, g1, g0 }; glGenTextures(1, &mWormholeTexName); glBindTexture(GL_TEXTURE_2D, mWormholeTexName); glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); Loading @@ -283,7 +283,17 @@ status_t SurfaceFlinger::readyToRun() glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 2, 2, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, textureData); GL_RGB, GL_UNSIGNED_SHORT_5_6_5, wormholeTexData); const uint16_t protTexData[] = { pack565(0x03, 0x03, 0x03) }; glGenTextures(1, &mProtectedTexName); glBindTexture(GL_TEXTURE_2D, mProtectedTexName); glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, protTexData); glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); Loading Loading @@ -2255,22 +2265,6 @@ status_t SurfaceFlinger::captureScreenImplLocked(DisplayID dpy, if (UNLIKELY(uint32_t(dpy) >= DISPLAY_COUNT)) return BAD_VALUE; // make sure none of the layers are protected const LayerVector& layers(mDrawingState.layersSortedByZ); const size_t count = layers.size(); for (size_t i=0 ; i<count ; ++i) { const sp<LayerBase>& layer(layers[i]); const uint32_t flags = layer->drawingState().flags; if (!(flags & ISurfaceComposer::eLayerHidden)) { const uint32_t z = layer->drawingState().z; if (z >= minLayerZ && z <= maxLayerZ) { if (layer->isProtected()) { return INVALID_OPERATION; } } } } if (!GLExtensions::getInstance().haveFramebufferObject()) return INVALID_OPERATION; Loading Loading @@ -2320,6 +2314,8 @@ status_t SurfaceFlinger::captureScreenImplLocked(DisplayID dpy, glClearColor(0,0,0,1); glClear(GL_COLOR_BUFFER_BIT); const LayerVector& layers(mDrawingState.layersSortedByZ); const size_t count = layers.size(); for (size_t i=0 ; i<count ; ++i) { const sp<LayerBase>& layer(layers[i]); const uint32_t flags = layer->drawingState().flags; Loading services/surfaceflinger/SurfaceFlinger.h +3 −0 Original line number Diff line number Diff line Loading @@ -192,6 +192,8 @@ public: sp<Layer> getLayer(const sp<ISurface>& sur) const; GLuint getProtectedTexName() const { return mProtectedTexName; } private: // DeathRecipient interface virtual void binderDied(const wp<IBinder>& who); Loading Loading @@ -349,6 +351,7 @@ private: sp<IMemoryHeap> mServerHeap; surface_flinger_cblk_t* mServerCblk; GLuint mWormholeTexName; GLuint mProtectedTexName; nsecs_t mBootTime; // Can only accessed from the main thread, these members Loading Loading
services/surfaceflinger/Layer.cpp +21 −12 Original line number Diff line number Diff line Loading @@ -280,7 +280,8 @@ void Layer::onDraw(const Region& clip) const return; } const GLenum target = GL_TEXTURE_EXTERNAL_OES; GLenum target = GL_TEXTURE_EXTERNAL_OES; if (!isProtected()) { glBindTexture(target, mTextureName); if (getFiltering() || needsFiltering() || isFixedSize() || isCropped()) { // TODO: we could be more subtle with isFixedSize() Loading @@ -294,6 +295,14 @@ void Layer::onDraw(const Region& clip) const glMatrixMode(GL_TEXTURE); glLoadMatrixf(mTextureMatrix); glMatrixMode(GL_MODELVIEW); } else { target = GL_TEXTURE_2D; glBindTexture(target, mFlinger->getProtectedTexName()); glEnable(target); glMatrixMode(GL_TEXTURE); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); } drawWithOpenGL(clip); Loading
services/surfaceflinger/SurfaceFlinger.cpp +14 −18 Original line number Diff line number Diff line Loading @@ -275,7 +275,7 @@ status_t SurfaceFlinger::readyToRun() const uint16_t g0 = pack565(0x0F,0x1F,0x0F); const uint16_t g1 = pack565(0x17,0x2f,0x17); const uint16_t textureData[4] = { g0, g1, g1, g0 }; const uint16_t wormholeTexData[4] = { g0, g1, g1, g0 }; glGenTextures(1, &mWormholeTexName); glBindTexture(GL_TEXTURE_2D, mWormholeTexName); glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); Loading @@ -283,7 +283,17 @@ status_t SurfaceFlinger::readyToRun() glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 2, 2, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, textureData); GL_RGB, GL_UNSIGNED_SHORT_5_6_5, wormholeTexData); const uint16_t protTexData[] = { pack565(0x03, 0x03, 0x03) }; glGenTextures(1, &mProtectedTexName); glBindTexture(GL_TEXTURE_2D, mProtectedTexName); glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, protTexData); glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); Loading Loading @@ -2255,22 +2265,6 @@ status_t SurfaceFlinger::captureScreenImplLocked(DisplayID dpy, if (UNLIKELY(uint32_t(dpy) >= DISPLAY_COUNT)) return BAD_VALUE; // make sure none of the layers are protected const LayerVector& layers(mDrawingState.layersSortedByZ); const size_t count = layers.size(); for (size_t i=0 ; i<count ; ++i) { const sp<LayerBase>& layer(layers[i]); const uint32_t flags = layer->drawingState().flags; if (!(flags & ISurfaceComposer::eLayerHidden)) { const uint32_t z = layer->drawingState().z; if (z >= minLayerZ && z <= maxLayerZ) { if (layer->isProtected()) { return INVALID_OPERATION; } } } } if (!GLExtensions::getInstance().haveFramebufferObject()) return INVALID_OPERATION; Loading Loading @@ -2320,6 +2314,8 @@ status_t SurfaceFlinger::captureScreenImplLocked(DisplayID dpy, glClearColor(0,0,0,1); glClear(GL_COLOR_BUFFER_BIT); const LayerVector& layers(mDrawingState.layersSortedByZ); const size_t count = layers.size(); for (size_t i=0 ; i<count ; ++i) { const sp<LayerBase>& layer(layers[i]); const uint32_t flags = layer->drawingState().flags; Loading
services/surfaceflinger/SurfaceFlinger.h +3 −0 Original line number Diff line number Diff line Loading @@ -192,6 +192,8 @@ public: sp<Layer> getLayer(const sp<ISurface>& sur) const; GLuint getProtectedTexName() const { return mProtectedTexName; } private: // DeathRecipient interface virtual void binderDied(const wp<IBinder>& who); Loading Loading @@ -349,6 +351,7 @@ private: sp<IMemoryHeap> mServerHeap; surface_flinger_cblk_t* mServerCblk; GLuint mWormholeTexName; GLuint mProtectedTexName; nsecs_t mBootTime; // Can only accessed from the main thread, these members Loading