/* create a display
* requires ACCESS_SURFACE_FLINGER permission.
*/
- virtual sp<IBinder> createDisplay() = 0;
+ virtual sp<IBinder> createDisplay(const String8& displayName) = 0;
/* get the token for the existing default displays. possible values
* for id are eDisplayIdMain and eDisplayIdHdmi.
);
//! Create a display
- static sp<IBinder> createDisplay();
+ static sp<IBinder> createDisplay(const String8& displayName);
//! Get the token for the existing default displays.
//! Possible values for id are eDisplayIdMain and eDisplayIdHdmi.
return result;
}
- virtual sp<IBinder> createDisplay()
+ virtual sp<IBinder> createDisplay(const String8& displayName)
{
Parcel data, reply;
data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
+ data.writeString8(displayName);
remote()->transact(BnSurfaceComposer::CREATE_DISPLAY, data, &reply);
return reply.readStrongBinder();
}
} break;
case CREATE_DISPLAY: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
- sp<IBinder> display(createDisplay());
+ String8 displayName = data.readString8();
+ sp<IBinder> display(createDisplay(displayName));
reply->writeStrongBinder(display);
return NO_ERROR;
} break;
DisplayState& getDisplayStateLocked(const sp<IBinder>& token);
public:
- sp<IBinder> createDisplay();
+ sp<IBinder> createDisplay(const String8& displayName);
sp<IBinder> getBuiltInDisplay(int32_t id);
status_t setPosition(const sp<SurfaceComposerClient>& client, SurfaceID id,
// ---------------------------------------------------------------------------
-sp<IBinder> Composer::createDisplay() {
- return ComposerService::getComposerService()->createDisplay();
+sp<IBinder> Composer::createDisplay(const String8& displayName) {
+ return ComposerService::getComposerService()->createDisplay(displayName);
}
sp<IBinder> Composer::getBuiltInDisplay(int32_t id) {
return result;
}
-sp<IBinder> SurfaceComposerClient::createDisplay() {
- return Composer::getInstance().createDisplay();
+sp<IBinder> SurfaceComposerClient::createDisplay(const String8& displayName) {
+ return Composer::getInstance().createDisplay(displayName);
}
sp<IBinder> SurfaceComposerClient::getBuiltInDisplay(int32_t id) {
// get an h/w composer ID
mHwcDisplayId = mFlinger->allocateHwcDisplayId(mType);
+ // Name the display. The name will be replaced shortly if the display
+ // was created with createDisplay().
+ switch (mType) {
+ case DISPLAY_PRIMARY:
+ mDisplayName = "Built-in Screen";
+ break;
+ case DISPLAY_EXTERNAL:
+ mDisplayName = "HDMI Screen";
+ break;
+ default:
+ mDisplayName = "Virtual Screen"; // e.g. Overlay #n
+ break;
+ }
+
// initialize the display orientation transform.
setProjection(DisplayState::eOrientationDefault, mViewport, mFrame);
}
}
inline Rect bounds() const { return getBounds(); }
+ void setDisplayName(const String8& displayName) {
+ mDisplayName = displayName;
+ }
+ const String8& getDisplayName() const { return mDisplayName; }
+
static EGLBoolean makeCurrent(EGLDisplay dpy,
const sp<const DisplayDevice>& hw, EGLContext ctx);
/* ------------------------------------------------------------------------
- * blank / unplank management
+ * blank / unblank management
*/
void releaseScreen() const;
void acquireScreen() const;
PixelFormat mFormat;
uint32_t mFlags;
mutable uint32_t mPageFlipCount;
+ String8 mDisplayName;
/*
* Can only accessed from the main thread, these members
return bclient;
}
-sp<IBinder> SurfaceFlinger::createDisplay()
+sp<IBinder> SurfaceFlinger::createDisplay(const String8& displayName)
{
class DisplayToken : public BBinder {
sp<SurfaceFlinger> flinger;
Mutex::Autolock _l(mStateLock);
DisplayDeviceState info(DisplayDevice::DISPLAY_VIRTUAL);
+ info.displayName = displayName;
mCurrentState.displays.add(token, info);
return token;
}
if (token == 0) {
- token = createDisplay();
+ token = createDisplay(String8("Display from connectDisplay"));
}
{ // scope for the lock
hw->setLayerStack(state.layerStack);
hw->setProjection(state.orientation,
state.viewport, state.frame);
+ hw->setDisplayName(state.displayName);
mDisplays.add(display, hw);
if (hw->getDisplayType() < DisplayDevice::NUM_DISPLAY_TYPES) {
// notify the system that this display is now up
* Dump Display state
*/
+ snprintf(buffer, SIZE, "Displays (%d entries)\n", mDisplays.size());
+ result.append(buffer);
for (size_t dpy=0 ; dpy<mDisplays.size() ; dpy++) {
const sp<const DisplayDevice>& hw(mDisplays[dpy]);
snprintf(buffer, SIZE,
- "+ DisplayDevice[%u]\n"
+ "+ DisplayDevice[%u] '%s'\n"
" type=%x, layerStack=%u, (%4dx%4d), orient=%2d (type=%08x), "
"flips=%u, secure=%d, numLayers=%u, v:[%d,%d,%d,%d], f:[%d,%d,%d,%d], "
"transform:[[%0.3f,%0.3f,%0.3f][%0.3f,%0.3f,%0.3f][%0.3f,%0.3f,%0.3f]]\n",
- dpy,
+ dpy, (const char*) hw->getDisplayName(),
hw->getDisplayType(), hw->getLayerStack(),
hw->getWidth(), hw->getHeight(),
hw->getOrientation(), hw->getTransform().getType(),
Rect viewport;
Rect frame;
uint8_t orientation;
+ String8 displayName;
};
struct State {
*/
virtual sp<ISurfaceComposerClient> createConnection();
virtual sp<IGraphicBufferAlloc> createGraphicBufferAlloc();
- virtual sp<IBinder> createDisplay();
+ virtual sp<IBinder> createDisplay(const String8& displayName);
virtual sp<IBinder> getBuiltInDisplay(int32_t id);
virtual void setTransactionState(const Vector<ComposerState>& state,
const Vector<DisplayState>& displays, uint32_t flags);