summaryrefslogtreecommitdiff
path: root/libs/gui/Surface.cpp
diff options
context:
space:
mode:
author Jeff Brown <jeffbrown@google.com> 2012-08-24 20:00:51 -0700
committer Jeff Brown <jeffbrown@google.com> 2012-08-27 14:40:17 -0700
commit9d4e3d2f42e93e2d12bacabe97d307d30c3c20dd (patch)
tree3db010ef45a3793c5b09887ae321b4a8095a5001 /libs/gui/Surface.cpp
parent225c66a48cdc3acef21ee380dc134449749d3cb3 (diff)
Banish DisplayID from the SurfaceFlinger API.
Use only display tokens in the API to refer to new displays. Don't require the caller to specify the display when creating a surface (since in general a surface could be shown on any display). This is intended to be a minimum change just to update the API. Note that SurfaceFlinger still uses DisplayID in a few places internally that might cause some features not to work properly when there are multiple displays (LayerScreenshot, for example). Change-Id: I3d91eec2da406eefd97bcd53655d403ad865a7e6
Diffstat (limited to 'libs/gui/Surface.cpp')
-rw-r--r--libs/gui/Surface.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp
index b9cbfa6d6b..33cc48023e 100644
--- a/libs/gui/Surface.cpp
+++ b/libs/gui/Surface.cpp
@@ -92,6 +92,12 @@ bool SurfaceControl::isSameSurface(
return lhs->mSurface->asBinder() == rhs->mSurface->asBinder();
}
+status_t SurfaceControl::setLayerStack(int32_t layerStack) {
+ status_t err = validate();
+ if (err < 0) return err;
+ const sp<SurfaceComposerClient>& client(mClient);
+ return client->setLayerStack(mToken, layerStack);
+}
status_t SurfaceControl::setLayer(int32_t layer) {
status_t err = validate();
if (err < 0) return err;
@@ -299,8 +305,11 @@ void Surface::init(const sp<ISurfaceTexture>& surfaceTexture)
setUsage(GraphicBuffer::USAGE_HW_RENDER);
}
+ // TODO: the display metrics should come from the display manager
DisplayInfo dinfo;
- SurfaceComposerClient::getDisplayInfo(0, &dinfo);
+ sp<IBinder> display = SurfaceComposerClient::getBuiltInDisplay(
+ ISurfaceComposer::eDisplayIdMain);
+ SurfaceComposerClient::getDisplayInfo(display, &dinfo);
const_cast<float&>(ANativeWindow::xdpi) = dinfo.xdpi;
const_cast<float&>(ANativeWindow::ydpi) = dinfo.ydpi;
const_cast<uint32_t&>(ANativeWindow::flags) = 0;