summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger/DisplayHardware
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2012-08-13 17:54:26 -0700
committerMathias Agopian <mathias@google.com>2012-08-13 17:54:26 -0700
commit8b736f138cfd9b239a2c7073347a13c489534ae1 (patch)
treeb59ff0dd03c2256a13ca41e42eb4446e380a1bff /services/surfaceflinger/DisplayHardware
parent670d24a8aeffee2788680be665bd74e0275cc2cf (diff)
downloadframeworks_native-8b736f138cfd9b239a2c7073347a13c489534ae1.zip
frameworks_native-8b736f138cfd9b239a2c7073347a13c489534ae1.tar.gz
frameworks_native-8b736f138cfd9b239a2c7073347a13c489534ae1.tar.bz2
xdpi / ydpi were reported as 0
Bug: 6975723 Change-Id: Ia7fa37ec11e2308804f5034959a37e508d292d31
Diffstat (limited to 'services/surfaceflinger/DisplayHardware')
-rw-r--r--services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp13
-rw-r--r--services/surfaceflinger/DisplayHardware/FramebufferSurface.h10
-rw-r--r--services/surfaceflinger/DisplayHardware/HWComposer.cpp30
-rw-r--r--services/surfaceflinger/DisplayHardware/HWComposer.h11
4 files changed, 34 insertions, 30 deletions
diff --git a/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp b/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp
index f329136..6d33592 100644
--- a/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp
+++ b/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp
@@ -175,19 +175,6 @@ void FramebufferSurface::freeBufferLocked(int slotIndex) {
}
}
-float FramebufferSurface::getRefreshRate() const {
- /* FIXME: REFRESH_RATE is a temporary HACK until we are able to report the
- * refresh rate properly from the HAL. The WindowManagerService now relies
- * on this value.
- */
-#ifndef REFRESH_RATE
- return fbDev->fps;
-#else
- return REFRESH_RATE;
-#warning "refresh rate set via makefile to REFRESH_RATE"
-#endif
-}
-
status_t FramebufferSurface::setUpdateRectangle(const Rect& r)
{
return INVALID_OPERATION;
diff --git a/services/surfaceflinger/DisplayHardware/FramebufferSurface.h b/services/surfaceflinger/DisplayHardware/FramebufferSurface.h
index 95feaa0..bfa500b 100644
--- a/services/surfaceflinger/DisplayHardware/FramebufferSurface.h
+++ b/services/surfaceflinger/DisplayHardware/FramebufferSurface.h
@@ -38,9 +38,6 @@ public:
static sp<FramebufferSurface> create();
- // TODO: this should be coming from HWC
- float getRefreshRate() const;
-
bool isUpdateOnDemand() const { return false; }
status_t setUpdateRectangle(const Rect& updateRect);
status_t compositionComplete();
@@ -52,6 +49,13 @@ public:
// BufferQueue. The new buffer is returned in the 'buffer' argument.
status_t nextBuffer(sp<GraphicBuffer>* buffer);
+ // FIXME: currently there are information we can only get from the
+ // FB HAL, and FB HAL can only be instantiated once on some devices.
+ // Eventually this functionality will have to move in HWC or somewhere else.
+ const framebuffer_device_t* getFbHal() const {
+ return fbDev;
+ }
+
private:
FramebufferSurface();
virtual ~FramebufferSurface(); // this class cannot be overloaded
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index 49aba52..c9df7a4 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -179,7 +179,8 @@ struct HWComposer::cb_context {
HWComposer::HWComposer(
const sp<SurfaceFlinger>& flinger,
- EventHandler& handler)
+ EventHandler& handler,
+ framebuffer_device_t const* fbDev)
: mFlinger(flinger),
mModule(0), mHwc(0), mCapacity(0),
mNumOVLayers(0), mNumFBLayers(0),
@@ -238,19 +239,14 @@ HWComposer::HWComposer(
}
}
- if (mRefreshPeriod == 0) {
- // for compatibility, we attempt to get the refresh rate from
- // the FB HAL if we couldn't get it from the HWC HAL.
- hw_module_t const* module;
- if (hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module) == 0) {
- framebuffer_device_t* fbDev;
- int err = framebuffer_open(module, &fbDev);
- if (!err && fbDev) {
- mRefreshPeriod = nsecs_t(1e9 / fbDev->fps);
- framebuffer_close(fbDev);
- }
+
+ if (fbDev) {
+ if (mRefreshPeriod == 0) {
+ mRefreshPeriod = nsecs_t(1e9 / fbDev->fps);
+ ALOGW("getting VSYNC period from fb HAL: %lld", mRefreshPeriod);
}
- ALOGW("getting VSYNC period from fb HAL: %lld", mRefreshPeriod);
+ mDpiX = fbDev->xdpi;
+ mDpiY = fbDev->ydpi;
}
if (mRefreshPeriod == 0) {
@@ -313,6 +309,14 @@ nsecs_t HWComposer::getRefreshTimestamp() const {
return now - ((now - mLastHwVSync) % mRefreshPeriod);
}
+float HWComposer::getDpiX() const {
+ return mDpiX;
+}
+
+float HWComposer::getDpiY() const {
+ return mDpiY;
+}
+
void HWComposer::eventControl(int event, int enabled) {
status_t err = NO_ERROR;
if (mHwc && mHwc->common.version >= HWC_DEVICE_API_VERSION_0_3) {
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h
index 52171f3..ac2257e 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.h
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.h
@@ -36,6 +36,7 @@ extern "C" int clock_nanosleep(clockid_t clock_id, int flags,
struct hwc_composer_device_1;
struct hwc_display_contents_1;
struct hwc_procs;
+struct framebuffer_device_t;
namespace android {
// ---------------------------------------------------------------------------
@@ -62,7 +63,11 @@ public:
MAX_DISPLAYS
};
- HWComposer(const sp<SurfaceFlinger>& flinger, EventHandler& handler);
+ HWComposer(
+ const sp<SurfaceFlinger>& flinger,
+ EventHandler& handler,
+ framebuffer_device_t const* fbDev);
+
~HWComposer();
status_t initCheck() const;
@@ -194,6 +199,8 @@ public:
nsecs_t getRefreshPeriod() const;
nsecs_t getRefreshTimestamp() const;
+ float getDpiX() const;
+ float getDpiY() const;
// this class is only used to fake the VSync event on systems that don't
// have it.
@@ -245,6 +252,8 @@ private:
cb_context* mCBContext;
EventHandler& mEventHandler;
nsecs_t mRefreshPeriod;
+ float mDpiX;
+ float mDpiY;
size_t mVSyncCount;
sp<VSyncThread> mVSyncThread;
bool mDebugForceFakeVSync;