void DisplayDevice::dump(Dump& d)
{
    d.append("-------------------------------------------------------------\n");
    d.append("Device Name: %s (%s)\n", mName,
            mConnection ? "connected" : "disconnected");
    d.append("Display configs (count = %d):\n", mDisplayConfigs.size());
    d.append(" CONFIG | VSYNC_PERIOD | WIDTH | HEIGHT | DPI_X | DPI_Y \n");
    d.append("--------+--------------+-------+--------+-------+-------\n");
    for (size_t i = 0; i < mDisplayConfigs.size(); i++) {
        DisplayConfig *config = mDisplayConfigs.itemAt(i);
        if (config) {
            d.append("%s %2d   |     %4d     | %5d |  %4d  |  %3d  |  %3d  \n",
                     (i == (size_t)mActiveDisplayConfig) ? "* " : "  ",
                     i,
                     config->getRefreshRate(),
                     config->getWidth(),
                     config->getHeight(),
                     config->getDpiX(),
                     config->getDpiY());
        }
    }
    // dump layer list
    if (mLayerList)
        mLayerList->dump(d);
}
void BufferManager::dump(Dump& d)
{
    d.append("Buffer Manager status: pool size %d\n", mBufferPool->getCacheSize());
    d.append("-------------------------------------------------------------\n");
    for (size_t i = 0; i < mBufferPool->getCacheSize(); i++) {
        BufferMapper *mapper = mBufferPool->getMapper(i);
        d.append("Buffer %d: handle %#x, (%dx%d), format %d, refCount %d\n",
                 i,
                 mapper->getHandle(),
                 mapper->getWidth(),
                 mapper->getHeight(),
                 mapper->getFormat(),
                 mapper->getRef());
    }
    return;
}
void HwcLayerList::dump(Dump& d)
{
    d.append("Layer list: (number of layers %d):\n", mLayers.size());
    d.append(" LAYER |    TYPE    |   PLANE INDEX  \n");
    d.append("-------+------------+----------------\n");
    for (size_t i = 0; i < mLayers.size(); i++) {
        HwcLayer *hwcLayer = mLayers.itemAt(i);
        IDisplayPlane *plane;
        int planeIndex = -1;
        const char *type;

        if (hwcLayer) {
            switch (hwcLayer->getType()) {
            case HwcLayer::LAYER_FB:
                type = "FB";
                break;
            case HwcLayer::LAYER_SPRITE:
                type = "Sprite";
                break;
            case HwcLayer::LAYER_OVERLAY:
                type = "Overlay";
                break;
            case HwcLayer::LAYER_PRIMARY:
                type = "Primary";
                break;
            default:
                type = "Unknown";
            }

            plane = hwcLayer->getPlane();
            if (plane)
                planeIndex = plane->getIndex();


            d.append("  %2d   | %8s   |%10D  \n", i, type, planeIndex);
        }
    }
}
void DisplayPlaneManager::dump(Dump& d)
{
    d.append("Display Plane Manager state:\n");
    d.append("-------------------------------------------------------------\n");
    d.append(" PLANE TYPE | COUNT |   FREE   | RECLAIMED \n");
    d.append("------------+-------+----------+-----------\n");
    d.append("    SPRITE  |  %2d   | %08x | %08x\n",
             mPlaneCount[DisplayPlane::PLANE_SPRITE],
             mFreePlanes[DisplayPlane::PLANE_SPRITE],
             mReclaimedPlanes[DisplayPlane::PLANE_SPRITE]);
    d.append("   OVERLAY  |  %2d   | %08x | %08x\n",
             mPlaneCount[DisplayPlane::PLANE_OVERLAY],
             mFreePlanes[DisplayPlane::PLANE_OVERLAY],
             mReclaimedPlanes[DisplayPlane::PLANE_OVERLAY]);
    d.append("   PRIMARY  |  %2d   | %08x | %08x\n",
             mPlaneCount[DisplayPlane::PLANE_PRIMARY],
             mFreePlanes[DisplayPlane::PLANE_PRIMARY],
             mReclaimedPlanes[DisplayPlane::PLANE_PRIMARY]);
    d.append("   CURSOR   |  %2d   | %08x | %08x\n",
             mPlaneCount[DisplayPlane::PLANE_CURSOR],
             mFreePlanes[DisplayPlane::PLANE_CURSOR],
             mReclaimedPlanes[DisplayPlane::PLANE_CURSOR]);
}