diff options
17 files changed, 124 insertions, 127 deletions
diff --git a/services/surfaceflinger/Android.mk b/services/surfaceflinger/Android.mk index e4fd291..eb45840 100644 --- a/services/surfaceflinger/Android.mk +++ b/services/surfaceflinger/Android.mk @@ -3,13 +3,13 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES:= \ Client.cpp \ - DisplayHardware.cpp \ + DisplayDevice.cpp \ EventThread.cpp \ Layer.cpp \ LayerBase.cpp \ LayerDim.cpp \ LayerScreenshot.cpp \ - DisplayHardware/DisplayHardwareBase.cpp \ + DisplayHardware/DisplayDeviceBase.cpp \ DisplayHardware/FramebufferSurface.cpp \ DisplayHardware/HWComposer.cpp \ DisplayHardware/PowerHAL.cpp \ diff --git a/services/surfaceflinger/DisplayHardware.cpp b/services/surfaceflinger/DisplayDevice.cpp index b468aae..70ce2d9 100644 --- a/services/surfaceflinger/DisplayHardware.cpp +++ b/services/surfaceflinger/DisplayDevice.cpp @@ -34,10 +34,10 @@ #include <hardware/gralloc.h> #include "DisplayHardware/FramebufferSurface.h" -#include "DisplayHardware/DisplayHardwareBase.h" +#include "DisplayHardware/DisplayDeviceBase.h" #include "DisplayHardware/HWComposer.h" -#include "DisplayHardware.h" +#include "DisplayDevice.h" #include "GLExtensions.h" #include "SurfaceFlinger.h" #include "LayerBase.h" @@ -98,12 +98,12 @@ void checkEGLErrors(const char* token) * */ -DisplayHardware::DisplayHardware( +DisplayDevice::DisplayDevice( const sp<SurfaceFlinger>& flinger, int display, const sp<SurfaceTextureClient>& surface, EGLConfig config) - : DisplayHardwareBase(display), + : DisplayDeviceBase(display), mFlinger(flinger), mDisplayId(display), mNativeWindow(surface), @@ -114,42 +114,42 @@ DisplayHardware::DisplayHardware( init(config); } -DisplayHardware::~DisplayHardware() { +DisplayDevice::~DisplayDevice() { } -float DisplayHardware::getDpiX() const { +float DisplayDevice::getDpiX() const { return mDpiX; } -float DisplayHardware::getDpiY() const { +float DisplayDevice::getDpiY() const { return mDpiY; } -float DisplayHardware::getDensity() const { +float DisplayDevice::getDensity() const { return mDensity; } -float DisplayHardware::getRefreshRate() const { +float DisplayDevice::getRefreshRate() const { return mRefreshRate; } -int DisplayHardware::getWidth() const { +int DisplayDevice::getWidth() const { return mDisplayWidth; } -int DisplayHardware::getHeight() const { +int DisplayDevice::getHeight() const { return mDisplayHeight; } -PixelFormat DisplayHardware::getFormat() const { +PixelFormat DisplayDevice::getFormat() const { return mFormat; } -EGLSurface DisplayHardware::getEGLSurface() const { +EGLSurface DisplayDevice::getEGLSurface() const { return mSurface; } -status_t DisplayHardware::getInfo(DisplayInfo* info) const { +status_t DisplayDevice::getInfo(DisplayInfo* info) const { info->w = getWidth(); info->h = getHeight(); info->xdpi = getDpiX(); @@ -162,7 +162,7 @@ status_t DisplayHardware::getInfo(DisplayInfo* info) const { return NO_ERROR; } -void DisplayHardware::init(EGLConfig config) +void DisplayDevice::init(EGLConfig config) { ANativeWindow* const window = mNativeWindow.get(); @@ -241,14 +241,14 @@ void DisplayHardware::init(EGLConfig config) mPageFlipCount = 0; // initialize the display orientation transform. - DisplayHardware::setOrientation(ISurfaceComposer::eOrientationDefault); + DisplayDevice::setOrientation(ISurfaceComposer::eOrientationDefault); } -uint32_t DisplayHardware::getPageFlipCount() const { +uint32_t DisplayDevice::getPageFlipCount() const { return mPageFlipCount; } -nsecs_t DisplayHardware::getRefreshTimestamp() const { +nsecs_t DisplayDevice::getRefreshTimestamp() const { // this returns the last refresh timestamp. // if the last one is not available, we estimate it based on // the refresh period and whatever closest timestamp we have. @@ -257,23 +257,23 @@ nsecs_t DisplayHardware::getRefreshTimestamp() const { return now - ((now - mLastHwVSync) % mRefreshPeriod); } -nsecs_t DisplayHardware::getRefreshPeriod() const { +nsecs_t DisplayDevice::getRefreshPeriod() const { return mRefreshPeriod; } -status_t DisplayHardware::compositionComplete() const { +status_t DisplayDevice::compositionComplete() const { if (mFramebufferSurface == NULL) { return NO_ERROR; } return mFramebufferSurface->compositionComplete(); } -void DisplayHardware::onVSyncReceived(nsecs_t timestamp) { +void DisplayDevice::onVSyncReceived(nsecs_t timestamp) { Mutex::Autolock _l(mLock); mLastHwVSync = timestamp; } -void DisplayHardware::flip(const Region& dirty) const +void DisplayDevice::flip(const Region& dirty) const { checkGLErrors(); @@ -298,19 +298,19 @@ void DisplayHardware::flip(const Region& dirty) const mPageFlipCount++; } -uint32_t DisplayHardware::getFlags() const +uint32_t DisplayDevice::getFlags() const { return mFlags; } -void DisplayHardware::dump(String8& res) const +void DisplayDevice::dump(String8& res) const { if (mFramebufferSurface != NULL) { mFramebufferSurface->dump(res); } } -void DisplayHardware::makeCurrent(const DisplayHardware& hw, EGLContext ctx) { +void DisplayDevice::makeCurrent(const DisplayDevice& hw, EGLContext ctx) { EGLSurface sur = eglGetCurrentSurface(EGL_DRAW); if (sur != hw.mSurface) { EGLDisplay dpy = eglGetCurrentDisplay(); @@ -320,7 +320,7 @@ void DisplayHardware::makeCurrent(const DisplayHardware& hw, EGLContext ctx) { // ---------------------------------------------------------------------------- -void DisplayHardware::setVisibleLayersSortedByZ(const Vector< sp<LayerBase> >& layers) { +void DisplayDevice::setVisibleLayersSortedByZ(const Vector< sp<LayerBase> >& layers) { mVisibleLayersSortedByZ = layers; size_t count = layers.size(); for (size_t i=0 ; i<count ; i++) { @@ -330,17 +330,17 @@ void DisplayHardware::setVisibleLayersSortedByZ(const Vector< sp<LayerBase> >& l } } -Vector< sp<LayerBase> > DisplayHardware::getVisibleLayersSortedByZ() const { +Vector< sp<LayerBase> > DisplayDevice::getVisibleLayersSortedByZ() const { return mVisibleLayersSortedByZ; } -bool DisplayHardware::getSecureLayerVisible() const { +bool DisplayDevice::getSecureLayerVisible() const { return mSecureLayerVisible; } // ---------------------------------------------------------------------------- -status_t DisplayHardware::orientationToTransfrom( +status_t DisplayDevice::orientationToTransfrom( int orientation, int w, int h, Transform* tr) { uint32_t flags = 0; @@ -364,11 +364,11 @@ status_t DisplayHardware::orientationToTransfrom( return NO_ERROR; } -status_t DisplayHardware::setOrientation(int orientation) { +status_t DisplayDevice::setOrientation(int orientation) { int w = mDisplayWidth; int h = mDisplayHeight; - DisplayHardware::orientationToTransfrom( + DisplayDevice::orientationToTransfrom( orientation, w, h, &mGlobalTransform); if (orientation & ISurfaceComposer::eOrientationSwapMask) { int tmp = w; diff --git a/services/surfaceflinger/DisplayHardware.h b/services/surfaceflinger/DisplayDevice.h index a638dc0..c9caffb 100644 --- a/services/surfaceflinger/DisplayHardware.h +++ b/services/surfaceflinger/DisplayDevice.h @@ -32,7 +32,7 @@ #include "Transform.h" -#include "DisplayHardware/DisplayHardwareBase.h" +#include "DisplayHardware/DisplayDeviceBase.h" namespace android { @@ -42,7 +42,7 @@ class LayerBase; class SurfaceFlinger; class SurfaceTextureClient; -class DisplayHardware : public DisplayHardwareBase +class DisplayDevice : public DisplayDeviceBase { public: // region in layer-stack space @@ -57,13 +57,13 @@ public: SWAP_RECTANGLE = 0x00080000, }; - DisplayHardware( + DisplayDevice( const sp<SurfaceFlinger>& flinger, int dpy, const sp<SurfaceTextureClient>& surface, EGLConfig config); - virtual ~DisplayHardware(); + virtual ~DisplayDevice(); // Flip the front and back buffers if the back buffer is "dirty". Might // be instantaneous, might involve copying the frame buffer around. @@ -107,7 +107,7 @@ public: } inline Rect bounds() const { return getBounds(); } - static void makeCurrent(const DisplayHardware& hw, EGLContext ctx); + static void makeCurrent(const DisplayDevice& hw, EGLContext ctx); private: void init(EGLConfig config); diff --git a/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp b/services/surfaceflinger/DisplayHardware/DisplayDeviceBase.cpp index 4141181..e0a4de6 100644 --- a/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp +++ b/services/surfaceflinger/DisplayHardware/DisplayDeviceBase.cpp @@ -17,31 +17,31 @@ #include <stdint.h> #include <sys/types.h> -#include "DisplayHardware/DisplayHardwareBase.h" +#include "DisplayHardware/DisplayDeviceBase.h" // ---------------------------------------------------------------------------- namespace android { -DisplayHardwareBase::DisplayHardwareBase(uint32_t displayIndex) { +DisplayDeviceBase::DisplayDeviceBase(uint32_t displayIndex) { mScreenAcquired = true; } -DisplayHardwareBase::~DisplayHardwareBase() { +DisplayDeviceBase::~DisplayDeviceBase() { } -bool DisplayHardwareBase::canDraw() const { +bool DisplayDeviceBase::canDraw() const { return mScreenAcquired; } -void DisplayHardwareBase::releaseScreen() const { +void DisplayDeviceBase::releaseScreen() const { mScreenAcquired = false; } -void DisplayHardwareBase::acquireScreen() const { +void DisplayDeviceBase::acquireScreen() const { mScreenAcquired = true; } -bool DisplayHardwareBase::isScreenAcquired() const { +bool DisplayDeviceBase::isScreenAcquired() const { return mScreenAcquired; } diff --git a/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.h b/services/surfaceflinger/DisplayHardware/DisplayDeviceBase.h index e6eb2b5..9432cf2 100644 --- a/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.h +++ b/services/surfaceflinger/DisplayHardware/DisplayDeviceBase.h @@ -21,10 +21,10 @@ namespace android { -class DisplayHardwareBase { +class DisplayDeviceBase { public: - DisplayHardwareBase(uint32_t displayIndex); - ~DisplayHardwareBase(); + DisplayDeviceBase(uint32_t displayIndex); + ~DisplayDeviceBase(); // console management void releaseScreen() const; diff --git a/services/surfaceflinger/EventThread.cpp b/services/surfaceflinger/EventThread.cpp index 3d79577..9b61fa9 100644 --- a/services/surfaceflinger/EventThread.cpp +++ b/services/surfaceflinger/EventThread.cpp @@ -27,7 +27,6 @@ #include <utils/String8.h> #include <utils/Trace.h> -#include "DisplayHardware.h" #include "EventThread.h" #include "SurfaceFlinger.h" diff --git a/services/surfaceflinger/EventThread.h b/services/surfaceflinger/EventThread.h index 2f10cdb..a71d985 100644 --- a/services/surfaceflinger/EventThread.h +++ b/services/surfaceflinger/EventThread.h @@ -27,7 +27,6 @@ #include <utils/threads.h> #include <utils/SortedVector.h> -#include "DisplayHardware.h" #include "DisplayHardware/PowerHAL.h" // --------------------------------------------------------------------------- diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 815a6f9..97f3cd4 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -36,7 +36,7 @@ #include <gui/Surface.h> #include "clz.h" -#include "DisplayHardware.h" +#include "DisplayDevice.h" #include "GLExtensions.h" #include "Layer.h" #include "SurfaceFlinger.h" @@ -78,9 +78,9 @@ void Layer::onLayerDisplayed(HWComposer::HWCLayerInterface* layer) { } if (mFrameLatencyNeeded) { - // we need a DisplayHardware for debugging only right now - // XXX: should this be called per DisplayHardware? - const DisplayHardware& hw(mFlinger->getDefaultDisplayHardware()); + // we need a DisplayDevice for debugging only right now + // XXX: should this be called per DisplayDevice? + const DisplayDevice& hw(mFlinger->getDefaultDisplayDevice()); mFrameStats[mFrameLatencyOffset].timestamp = mSurfaceTexture->getTimestamp(); mFrameStats[mFrameLatencyOffset].set = systemTime(); mFrameStats[mFrameLatencyOffset].vsync = hw.getRefreshTimestamp(); @@ -248,7 +248,7 @@ Rect Layer::computeBufferCrop() const { } void Layer::setGeometry( - const DisplayHardware& hw, + const DisplayDevice& hw, HWComposer::HWCLayerInterface& layer) { LayerBaseClient::setGeometry(hw, layer); @@ -307,7 +307,7 @@ void Layer::setAcquireFence(HWComposer::HWCLayerInterface& layer) { layer.setAcquireFenceFd(fenceFd); } -void Layer::onDraw(const DisplayHardware& hw, const Region& clip) const +void Layer::onDraw(const DisplayDevice& hw, const Region& clip) const { ATRACE_CALL(); @@ -723,7 +723,7 @@ void Layer::dumpStats(String8& result, char* buffer, size_t SIZE) const { LayerBaseClient::dumpStats(result, buffer, SIZE); const size_t o = mFrameLatencyOffset; - const DisplayHardware& hw(mFlinger->getDefaultDisplayHardware()); + const DisplayDevice& hw(mFlinger->getDefaultDisplayDevice()); const nsecs_t period = hw.getRefreshPeriod(); result.appendFormat("%lld\n", period); for (size_t i=0 ; i<128 ; i++) { @@ -764,7 +764,7 @@ uint32_t Layer::getTransformHint() const { // apply to all displays. // This is why we use the default display here. This is not an // oversight. - const DisplayHardware& hw(mFlinger->getDefaultDisplayHardware()); + const DisplayDevice& hw(mFlinger->getDefaultDisplayDevice()); const Transform& planeTransform(hw.getTransform()); orientation = planeTransform.getOrientation(); if (orientation & Transform::ROT_INVALID) { diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h index 239250d..22a441d 100644 --- a/services/surfaceflinger/Layer.h +++ b/services/surfaceflinger/Layer.h @@ -64,12 +64,12 @@ public: bool isFixedSize() const; // LayerBase interface - virtual void setGeometry(const DisplayHardware& hw, + virtual void setGeometry(const DisplayDevice& hw, HWComposer::HWCLayerInterface& layer); virtual void setPerFrameData(HWComposer::HWCLayerInterface& layer); virtual void setAcquireFence(HWComposer::HWCLayerInterface& layer); - virtual void onDraw(const DisplayHardware& hw, const Region& clip) const; + virtual void onDraw(const DisplayDevice& hw, const Region& clip) const; virtual uint32_t doTransaction(uint32_t transactionFlags); virtual Region latchBuffer(bool& recomputeVisibleRegions); virtual bool isOpaque() const; diff --git a/services/surfaceflinger/LayerBase.cpp b/services/surfaceflinger/LayerBase.cpp index f654445..a92bf52 100644 --- a/services/surfaceflinger/LayerBase.cpp +++ b/services/surfaceflinger/LayerBase.cpp @@ -33,7 +33,7 @@ #include "LayerBase.h" #include "Layer.h" #include "SurfaceFlinger.h" -#include "DisplayHardware.h" +#include "DisplayDevice.h" namespace android { @@ -223,7 +223,7 @@ uint32_t LayerBase::doTransaction(uint32_t flags) return flags; } -void LayerBase::computeGeometry(const DisplayHardware& hw, LayerMesh* mesh) const +void LayerBase::computeGeometry(const DisplayDevice& hw, LayerMesh* mesh) const { const Layer::State& s(drawingState()); const Transform tr(hw.getTransform() * s.transform); @@ -260,7 +260,7 @@ Region LayerBase::latchBuffer(bool& recomputeVisibleRegions) { } void LayerBase::setGeometry( - const DisplayHardware& hw, + const DisplayDevice& hw, HWComposer::HWCLayerInterface& layer) { layer.setDefaultState(); @@ -309,19 +309,19 @@ bool LayerBase::getFiltering() const return mFiltering; } -void LayerBase::draw(const DisplayHardware& hw, const Region& clip) const +void LayerBase::draw(const DisplayDevice& hw, const Region& clip) const { onDraw(hw, clip); } -void LayerBase::drawForSreenShot(const DisplayHardware& hw) +void LayerBase::drawForSreenShot(const DisplayDevice& hw) { setFiltering(true); onDraw( hw, Region(hw.bounds()) ); setFiltering(false); } -void LayerBase::clearWithOpenGL(const DisplayHardware& hw, const Region& clip, +void LayerBase::clearWithOpenGL(const DisplayDevice& hw, const Region& clip, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) const { const uint32_t fbHeight = hw.getHeight(); @@ -338,12 +338,12 @@ void LayerBase::clearWithOpenGL(const DisplayHardware& hw, const Region& clip, glDrawArrays(GL_TRIANGLE_FAN, 0, mesh.getVertexCount()); } -void LayerBase::clearWithOpenGL(const DisplayHardware& hw, const Region& clip) const +void LayerBase::clearWithOpenGL(const DisplayDevice& hw, const Region& clip) const { clearWithOpenGL(hw, clip, 0,0,0,0); } -void LayerBase::drawWithOpenGL(const DisplayHardware& hw, const Region& clip) const +void LayerBase::drawWithOpenGL(const DisplayDevice& hw, const Region& clip) const { const uint32_t fbHeight = hw.getHeight(); const State& s(drawingState()); diff --git a/services/surfaceflinger/LayerBase.h b/services/surfaceflinger/LayerBase.h index 7bf634e..5aab4fc 100644 --- a/services/surfaceflinger/LayerBase.h +++ b/services/surfaceflinger/LayerBase.h @@ -33,7 +33,6 @@ #include <private/gui/LayerState.h> -#include "DisplayHardware.h" #include "Transform.h" #include "DisplayHardware/HWComposer.h" @@ -42,7 +41,7 @@ namespace android { // --------------------------------------------------------------------------- class Client; -class DisplayHardware; +class DisplayDevice; class GraphicBuffer; class Layer; class LayerBaseClient; @@ -124,7 +123,7 @@ public: uint32_t getTransactionFlags(uint32_t flags); uint32_t setTransactionFlags(uint32_t flags); - void computeGeometry(const DisplayHardware& hw, LayerMesh* mesh) const; + void computeGeometry(const DisplayDevice& hw, LayerMesh* mesh) const; Rect computeBounds() const; @@ -133,7 +132,7 @@ public: virtual const char* getTypeId() const { return "LayerBase"; } - virtual void setGeometry(const DisplayHardware& hw, + virtual void setGeometry(const DisplayDevice& hw, HWComposer::HWCLayerInterface& layer); virtual void setPerFrameData(HWComposer::HWCLayerInterface& layer); virtual void setAcquireFence(HWComposer::HWCLayerInterface& layer); @@ -144,13 +143,13 @@ public: * Typically this method is not overridden, instead implement onDraw() * to perform the actual drawing. */ - virtual void draw(const DisplayHardware& hw, const Region& clip) const; - virtual void drawForSreenShot(const DisplayHardware& hw); + virtual void draw(const DisplayDevice& hw, const Region& clip) const; + virtual void drawForSreenShot(const DisplayDevice& hw); /** * onDraw - draws the surface. */ - virtual void onDraw(const DisplayHardware& hw, const Region& clip) const = 0; + virtual void onDraw(const DisplayDevice& hw, const Region& clip) const = 0; /** * initStates - called just after construction @@ -241,12 +240,12 @@ public: inline const State& currentState() const { return mCurrentState; } inline State& currentState() { return mCurrentState; } - void clearWithOpenGL(const DisplayHardware& hw, const Region& clip) const; + void clearWithOpenGL(const DisplayDevice& hw, const Region& clip) const; protected: - void clearWithOpenGL(const DisplayHardware& hw, const Region& clip, + void clearWithOpenGL(const DisplayDevice& hw, const Region& clip, GLclampf r, GLclampf g, GLclampf b, GLclampf alpha) const; - void drawWithOpenGL(const DisplayHardware& hw, const Region& clip) const; + void drawWithOpenGL(const DisplayDevice& hw, const Region& clip) const; void setFiltering(bool filtering); bool getFiltering() const; diff --git a/services/surfaceflinger/LayerDim.cpp b/services/surfaceflinger/LayerDim.cpp index 5c37d01..b78396e 100644 --- a/services/surfaceflinger/LayerDim.cpp +++ b/services/surfaceflinger/LayerDim.cpp @@ -25,7 +25,7 @@ #include "LayerDim.h" #include "SurfaceFlinger.h" -#include "DisplayHardware.h" +#include "DisplayDevice.h" namespace android { // --------------------------------------------------------------------------- @@ -40,7 +40,7 @@ LayerDim::~LayerDim() { } -void LayerDim::onDraw(const DisplayHardware& hw, const Region& clip) const +void LayerDim::onDraw(const DisplayDevice& hw, const Region& clip) const { const State& s(drawingState()); if (s.alpha>0) { diff --git a/services/surfaceflinger/LayerDim.h b/services/surfaceflinger/LayerDim.h index 2d9eaef..a0ec593 100644 --- a/services/surfaceflinger/LayerDim.h +++ b/services/surfaceflinger/LayerDim.h @@ -36,7 +36,7 @@ public: const sp<Client>& client); virtual ~LayerDim(); - virtual void onDraw(const DisplayHardware& hw, const Region& clip) const; + virtual void onDraw(const DisplayDevice& hw, const Region& clip) const; virtual bool isOpaque() const { return false; } virtual bool isSecure() const { return false; } virtual bool isProtectedByApp() const { return false; } diff --git a/services/surfaceflinger/LayerScreenshot.cpp b/services/surfaceflinger/LayerScreenshot.cpp index bed8206..5b7cf68 100644 --- a/services/surfaceflinger/LayerScreenshot.cpp +++ b/services/surfaceflinger/LayerScreenshot.cpp @@ -25,7 +25,7 @@ #include "LayerScreenshot.h" #include "SurfaceFlinger.h" -#include "DisplayHardware.h" +#include "DisplayDevice.h" namespace android { @@ -105,7 +105,7 @@ uint32_t LayerScreenshot::doTransaction(uint32_t flags) return LayerBaseClient::doTransaction(flags); } -void LayerScreenshot::onDraw(const DisplayHardware& hw, const Region& clip) const +void LayerScreenshot::onDraw(const DisplayDevice& hw, const Region& clip) const { const State& s(drawingState()); if (s.alpha>0) { diff --git a/services/surfaceflinger/LayerScreenshot.h b/services/surfaceflinger/LayerScreenshot.h index 0ddb376..64c0281 100644 --- a/services/surfaceflinger/LayerScreenshot.h +++ b/services/surfaceflinger/LayerScreenshot.h @@ -43,7 +43,7 @@ public: virtual void initStates(uint32_t w, uint32_t h, uint32_t flags); virtual uint32_t doTransaction(uint32_t flags); - virtual void onDraw(const DisplayHardware& hw, const Region& clip) const; + virtual void onDraw(const DisplayDevice& hw, const Region& clip) const; virtual bool isOpaque() const { return false; } virtual bool isSecure() const { return false; } virtual bool isProtectedByApp() const { return false; } diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 7081d58..7caf099 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -50,7 +50,7 @@ #include "clz.h" #include "DdmConnection.h" -#include "DisplayHardware.h" +#include "DisplayDevice.h" #include "Client.h" #include "EventThread.h" #include "GLExtensions.h" @@ -370,8 +370,8 @@ status_t SurfaceFlinger::readyToRun() mEGLContext = createGLContext(mEGLDisplay, mEGLConfig); // initialize our main display hardware - DisplayHardware* const hw = new DisplayHardware(this, 0, anw, mEGLConfig); - mDisplayHardwares[0] = hw; + DisplayDevice* const hw = new DisplayDevice(this, 0, anw, mEGLConfig); + mDisplayDevices[0] = hw; // initialize OpenGL ES EGLSurface surface = hw->getEGLSurface(); @@ -457,7 +457,7 @@ status_t SurfaceFlinger::getDisplayInfo(DisplayID dpy, DisplayInfo* info) { if (uint32_t(dpy) >= 2) { return BAD_INDEX; } - const DisplayHardware& hw(getDefaultDisplayHardware()); + const DisplayDevice& hw(getDefaultDisplayDevice()); return hw.getInfo(info); } @@ -468,7 +468,7 @@ sp<IDisplayEventConnection> SurfaceFlinger::createDisplayEventConnection() { } void SurfaceFlinger::connectDisplay(const sp<ISurfaceTexture> display) { - const DisplayHardware& hw(getDefaultDisplayHardware()); + const DisplayDevice& hw(getDefaultDisplayDevice()); EGLSurface result = EGL_NO_SURFACE; EGLSurface old_surface = EGL_NO_SURFACE; sp<SurfaceTextureClient> stc; @@ -540,7 +540,7 @@ bool SurfaceFlinger::threadLoop() { } void SurfaceFlinger::onVSyncReceived(int dpy, nsecs_t timestamp) { - DisplayHardware& hw(const_cast<DisplayHardware&>(getDisplayHardware(dpy))); + DisplayDevice& hw(const_cast<DisplayDevice&>(getDisplayDevice(dpy))); hw.onVSyncReceived(timestamp); mEventThread->onVSyncReceived(dpy, timestamp); } @@ -588,7 +588,7 @@ void SurfaceFlinger::handleMessageRefresh() { const LayerVector& currentLayers(mDrawingState.layersSortedByZ); for (int dpy=0 ; dpy<1 ; dpy++) { // TODO: iterate through all displays - DisplayHardware& hw(const_cast<DisplayHardware&>(getDisplayHardware(dpy))); + DisplayDevice& hw(const_cast<DisplayDevice&>(getDisplayDevice(dpy))); Region opaqueRegion; Region dirtyRegion; @@ -618,7 +618,7 @@ void SurfaceFlinger::handleMessageRefresh() { const bool workListsDirty = mHwWorkListDirty; mHwWorkListDirty = false; for (int dpy=0 ; dpy<1 ; dpy++) { // TODO: iterate through all displays - DisplayHardware& hw(const_cast<DisplayHardware&>(getDisplayHardware(dpy))); + DisplayDevice& hw(const_cast<DisplayDevice&>(getDisplayDevice(dpy))); const Vector< sp<LayerBase> >& currentLayers(hw.getVisibleLayersSortedByZ()); const size_t count = currentLayers.size(); @@ -649,7 +649,7 @@ void SurfaceFlinger::handleMessageRefresh() { const bool repaintEverything = android_atomic_and(0, &mRepaintEverything); for (int dpy=0 ; dpy<1 ; dpy++) { // TODO: iterate through all displays - DisplayHardware& hw(const_cast<DisplayHardware&>(getDisplayHardware(dpy))); + DisplayDevice& hw(const_cast<DisplayDevice&>(getDisplayDevice(dpy))); // transform the dirty region into this screen's coordinate space const Transform& planeTransform(hw.getTransform()); @@ -695,7 +695,7 @@ void SurfaceFlinger::handleMessageRefresh() { glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - DisplayHardware& hw(const_cast<DisplayDevice&>(getDisplayHardware(0))); + DisplayDevice& hw(const_cast<DisplayDevice&>(getDisplayDevice(0))); const Vector< sp<LayerBase> >& layers( hw.getVisibleLayersSortedByZ() ); const size_t count = layers.size(); for (size_t i=0 ; i<count ; ++i) { @@ -728,7 +728,7 @@ void SurfaceFlinger::postFramebuffer() HWComposer& hwc(getHwComposer()); for (int dpy=0 ; dpy<1 ; dpy++) { // TODO: iterate through all displays - DisplayHardware& hw(const_cast<DisplayHardware&>(getDisplayHardware(dpy))); + DisplayDevice& hw(const_cast<DisplayDevice&>(getDisplayDevice(dpy))); if (hwc.initCheck() == NO_ERROR) { const Vector< sp<LayerBase> >& currentLayers(hw.getVisibleLayersSortedByZ()); const size_t count = currentLayers.size(); @@ -745,11 +745,11 @@ void SurfaceFlinger::postFramebuffer() if (hwc.initCheck() == NO_ERROR) { // FIXME: eventually commit() won't take arguments - hwc.commit(mEGLDisplay, getDefaultDisplayHardware().getEGLSurface()); + hwc.commit(mEGLDisplay, getDefaultDisplayDevice().getEGLSurface()); } for (int dpy=0 ; dpy<1 ; dpy++) { // TODO: iterate through all displays - DisplayHardware& hw(const_cast<DisplayHardware&>(getDisplayHardware(dpy))); + DisplayDevice& hw(const_cast<DisplayDevice&>(getDisplayDevice(dpy))); const Vector< sp<LayerBase> >& currentLayers(hw.getVisibleLayersSortedByZ()); const size_t count = currentLayers.size(); if (hwc.initCheck() == NO_ERROR) { @@ -829,7 +829,7 @@ void SurfaceFlinger::handleTransactionLocked(uint32_t transactionFlags) // and invalidate everything. const int dpy = 0; // FIXME: should be a parameter - DisplayHardware& hw(const_cast<DisplayHardware&>(getDisplayHardware(dpy))); + DisplayDevice& hw(const_cast<DisplayDevice&>(getDisplayDevice(dpy))); hw.setOrientation(mCurrentState.orientation); hw.dirtyRegion.set(hw.bounds()); @@ -1015,7 +1015,7 @@ void SurfaceFlinger::invalidateLayerStack(uint32_t layerStack, const Region& dirty) { // FIXME: update the dirty region of all displays // presenting this layer's layer stack. - DisplayHardware& hw(const_cast<DisplayHardware&>(getDisplayHardware(0))); + DisplayDevice& hw(const_cast<DisplayDevice&>(getDisplayDevice(0))); hw.dirtyRegion.orSelf(dirty); } @@ -1060,7 +1060,7 @@ void SurfaceFlinger::handleRefresh() } } -void SurfaceFlinger::handleRepaint(const DisplayHardware& hw, +void SurfaceFlinger::handleRepaint(const DisplayDevice& hw, const Region& inDirtyRegion) { ATRACE_CALL(); @@ -1075,17 +1075,17 @@ void SurfaceFlinger::handleRepaint(const DisplayHardware& hw, } uint32_t flags = hw.getFlags(); - if (flags & DisplayHardware::SWAP_RECTANGLE) { + if (flags & DisplayDevice::SWAP_RECTANGLE) { // we can redraw only what's dirty, but since SWAP_RECTANGLE only // takes a rectangle, we must make sure to update that whole // rectangle in that case dirtyRegion.set(hw.swapRegion.bounds()); } else { - if (flags & DisplayHardware::PARTIAL_UPDATES) { + if (flags & DisplayDevice::PARTIAL_UPDATES) { // We need to redraw the rectangle that will be updated // (pushed to the framebuffer). // This is needed because PARTIAL_UPDATES only takes one - // rectangle instead of a region (see DisplayHardware::flip()) + // rectangle instead of a region (see DisplayDevice::flip()) dirtyRegion.set(hw.swapRegion.bounds()); } else { // we need to redraw everything (the whole screen) @@ -1100,7 +1100,7 @@ void SurfaceFlinger::handleRepaint(const DisplayHardware& hw, hw.swapRegion.orSelf(dirtyRegion); } -void SurfaceFlinger::composeSurfaces(const DisplayHardware& hw, const Region& dirty) +void SurfaceFlinger::composeSurfaces(const DisplayDevice& hw, const Region& dirty) { HWComposer& hwc(getHwComposer()); HWComposer::LayerListIterator cur = hwc.begin(); @@ -1109,7 +1109,7 @@ void SurfaceFlinger::composeSurfaces(const DisplayHardware& hw, const Region& di const size_t fbLayerCount = hwc.getLayerCount(HWC_FRAMEBUFFER); // FIXME: this should be per display if (cur==end || fbLayerCount) { - DisplayHardware::makeCurrent(hw, mEGLContext); + DisplayDevice::makeCurrent(hw, mEGLContext); // set the frame buffer glMatrixMode(GL_MODELVIEW); @@ -1164,7 +1164,7 @@ void SurfaceFlinger::composeSurfaces(const DisplayHardware& hw, const Region& di } } -void SurfaceFlinger::debugFlashRegions(const DisplayHardware& hw, +void SurfaceFlinger::debugFlashRegions(const DisplayDevice& hw, const Region& dirtyRegion) { const uint32_t flags = hw.getFlags(); @@ -1173,8 +1173,8 @@ void SurfaceFlinger::debugFlashRegions(const DisplayHardware& hw, return; } - if (!(flags & DisplayHardware::SWAP_RECTANGLE)) { - const Region repaint((flags & DisplayHardware::PARTIAL_UPDATES) ? + if (!(flags & DisplayDevice::SWAP_RECTANGLE)) { + const Region repaint((flags & DisplayDevice::PARTIAL_UPDATES) ? dirtyRegion.bounds() : hw.bounds()); composeSurfaces(hw, repaint); } @@ -1569,7 +1569,7 @@ uint32_t SurfaceFlinger::setClientStateLocked( void SurfaceFlinger::onScreenAcquired() { ALOGD("Screen about to return, flinger = %p", this); - const DisplayHardware& hw(getDefaultDisplayHardware()); // XXX: this should be per DisplayHardware + const DisplayDevice& hw(getDefaultDisplayDevice()); // XXX: this should be per DisplayDevice getHwComposer().acquire(); hw.acquireScreen(); mEventThread->onScreenAcquired(); @@ -1582,7 +1582,7 @@ void SurfaceFlinger::onScreenAcquired() { void SurfaceFlinger::onScreenReleased() { ALOGD("About to give-up screen, flinger = %p", this); - const DisplayHardware& hw(getDefaultDisplayHardware()); // XXX: this should be per DisplayHardware + const DisplayDevice& hw(getDefaultDisplayDevice()); // XXX: this should be per DisplayDevice if (hw.isScreenAcquired()) { mEventThread->onScreenReleased(); hw.releaseScreen(); @@ -1782,7 +1782,7 @@ void SurfaceFlinger::dumpAllLocked( snprintf(buffer, SIZE, "SurfaceFlinger global state:\n"); result.append(buffer); - const DisplayHardware& hw(getDefaultDisplayHardware()); + const DisplayDevice& hw(getDefaultDisplayDevice()); const GLExtensions& extensions(GLExtensions::getInstance()); snprintf(buffer, SIZE, "GLES: %s, %s, %s\n", extensions.getVendor(), @@ -1949,7 +1949,7 @@ status_t SurfaceFlinger::onTransact( return NO_ERROR; case 1013: { Mutex::Autolock _l(mStateLock); - const DisplayHardware& hw(getDefaultDisplayHardware()); + const DisplayDevice& hw(getDefaultDisplayDevice()); reply->writeInt32(hw.getPageFlipCount()); } return NO_ERROR; @@ -1981,7 +1981,7 @@ status_t SurfaceFlinger::renderScreenToTextureLocked(DisplayID dpy, return INVALID_OPERATION; // get screen geometry - const DisplayHardware& hw(getDisplayHardware(dpy)); + const DisplayDevice& hw(getDisplayDevice(dpy)); const uint32_t hw_w = hw.getWidth(); const uint32_t hw_h = hw.getHeight(); GLfloat u = 1; @@ -2072,7 +2072,7 @@ public: status_t SurfaceFlinger::electronBeamOffAnimationImplLocked() { // get screen geometry - const DisplayHardware& hw(getDefaultDisplayHardware()); + const DisplayDevice& hw(getDefaultDisplayDevice()); const uint32_t hw_w = hw.getWidth(); const uint32_t hw_h = hw.getHeight(); const Region screenBounds(hw.getBounds()); @@ -2254,7 +2254,7 @@ status_t SurfaceFlinger::electronBeamOnAnimationImplLocked() // get screen geometry - const DisplayHardware& hw(getDefaultDisplayHardware()); + const DisplayDevice& hw(getDefaultDisplayDevice()); const uint32_t hw_w = hw.getWidth(); const uint32_t hw_h = hw.getHeight(); const Region screenBounds(hw.bounds()); @@ -2403,7 +2403,7 @@ status_t SurfaceFlinger::turnElectronBeamOffImplLocked(int32_t mode) { ATRACE_CALL(); - DisplayHardware& hw(const_cast<DisplayHardware&>(getDefaultDisplayHardware())); + DisplayDevice& hw(const_cast<DisplayDevice&>(getDefaultDisplayDevice())); if (!hw.canDraw()) { // we're already off return NO_ERROR; @@ -2463,7 +2463,7 @@ status_t SurfaceFlinger::turnElectronBeamOff(int32_t mode) status_t SurfaceFlinger::turnElectronBeamOnImplLocked(int32_t mode) { - DisplayHardware& hw(const_cast<DisplayHardware&>(getDefaultDisplayHardware())); + DisplayDevice& hw(const_cast<DisplayDevice&>(getDefaultDisplayDevice())); if (hw.canDraw()) { // we're already on return NO_ERROR; @@ -2525,7 +2525,7 @@ status_t SurfaceFlinger::captureScreenImplLocked(DisplayID dpy, } // get screen geometry - const DisplayHardware& hw(getDisplayHardware(dpy)); + const DisplayDevice& hw(getDisplayDevice(dpy)); const uint32_t hw_w = hw.getWidth(); const uint32_t hw_h = hw.getHeight(); diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index 447eece..6091e33 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -56,7 +56,7 @@ namespace android { class Client; class DisplayEventConnection; -class DisplayHardware; +class DisplayDevice; class EventThread; class Layer; class LayerBase; @@ -118,8 +118,8 @@ public: GLfloat* uOut, GLfloat* vOut); // returns the default Display - const DisplayHardware& getDefaultDisplayHardware() const { - return getDisplayHardware(0); + const DisplayDevice& getDefaultDisplayDevice() const { + return getDisplayDevice(0); } // utility function to delete a texture on the main thread @@ -237,7 +237,7 @@ private: void handlePageFlip(); void handleRefresh(); - void handleRepaint(const DisplayHardware& hw, const Region& dirtyRegion); + void handleRepaint(const DisplayDevice& hw, const Region& dirtyRegion); /* ------------------------------------------------------------------------ * Transactions @@ -316,8 +316,8 @@ private: /* ------------------------------------------------------------------------ * Display and layer stack management */ - const DisplayHardware& getDisplayHardware(DisplayID dpy) const { - return *mDisplayHardwares[dpy]; + const DisplayDevice& getDisplayDevice(DisplayID dpy) const { + return *mDisplayDevices[dpy]; } // mark a region of a layer stack dirty. this updates the dirty @@ -338,7 +338,7 @@ private: uint32_t layerStack, Region& dirtyRegion, Region& opaqueRegion); void postFramebuffer(); - void composeSurfaces(const DisplayHardware& hw, const Region& dirty); + void composeSurfaces(const DisplayDevice& hw, const Region& dirty); void drawWormhole(const Region& region) const; GLuint getProtectedTexName() const { return mProtectedTexName; @@ -347,7 +347,7 @@ private: /* ------------------------------------------------------------------------ * Debugging & dumpsys */ - void debugFlashRegions(const DisplayHardware& hw, const Region& dirtyReg); + void debugFlashRegions(const DisplayDevice& hw, const Region& dirtyReg); void listLayersLocked(const Vector<String16>& args, size_t& index, String8& result, char* buffer, size_t SIZE) const; void dumpStatsLocked(const Vector<String16>& args, size_t& index, @@ -370,7 +370,7 @@ private: Vector<sp<LayerBase> > mLayersPendingRemoval; // protected by mStateLock (but we could use another lock) - DisplayHardware* mDisplayHardwares[1]; + DisplayDevice* mDisplayDevices[1]; bool mLayersRemoved; // access must be protected by mInvalidateLock |