ExternalDisplay::ExternalDisplay(hwc_context_t* ctx):mFd(-1),
    mCurrentMode(-1), mExternalDisplay(0), mModeCount(0), mHwcContext(ctx)
{
    memset(&mVInfo, 0, sizeof(mVInfo));
    //Enable HPD for HDMI
    writeHPDOption(1);
}
ExternalDisplay::ExternalDisplay(hwc_context_t* ctx):mFd(-1),
    mCurrentMode(-1), mConnected(0), mConnectedFbNum(0), mModeCount(0),
    mUnderscanSupported(false), mHwcContext(ctx), mHdmiFbNum(-1),
    mWfdFbNum(-1), mExtDpyNum(HWC_DISPLAY_EXTERNAL)
{
    memset(&mVInfo, 0, sizeof(mVInfo));
    //Determine the fb index for external display devices.
    updateExtDispDevFbIndex();
    // disable HPD at start, it will be enabled later
    // when the display powers on
    // This helps for framework reboot or adb shell stop/start
    writeHPDOption(0);

}
Esempio n. 3
0
HDMIDisplay::HDMIDisplay():mFd(-1),
    mCurrentMode(-1), mModeCount(0), mPrimaryWidth(0), mPrimaryHeight(0),
    mUnderscanSupported(false)
{
    memset(&mVInfo, 0, sizeof(mVInfo));

    mDisplayId = HWC_DISPLAY_EXTERNAL;
    // Update the display if HDMI is connected as primary
    if (isHDMIPrimaryDisplay()) {
        mDisplayId = HWC_DISPLAY_PRIMARY;
    }

    mFbNum = overlay::Overlay::getInstance()->getFbForDpy(mDisplayId);
    // disable HPD at start, it will be enabled later
    // when the display powers on
    // This helps for framework reboot or adb shell stop/start
    writeHPDOption(0);

    // for HDMI - retreive all the modes supported by the driver
    if(mFbNum != -1) {
        supported_video_mode_lut =
                        new msm_hdmi_mode_timing_info[HDMI_VFRMT_MAX];
        // Populate the mode table for supported modes
        MSM_HDMI_MODES_INIT_TIMINGS(supported_video_mode_lut);
        MSM_HDMI_MODES_SET_SUPP_TIMINGS(supported_video_mode_lut,
                                        MSM_HDMI_MODES_ALL);
        // Update the Source Product Information
        // Vendor Name
        setSPDInfo("vendor_name", "ro.product.manufacturer");
        // Product Description
        setSPDInfo("product_description", "ro.product.name");
    }

    ALOGD_IF(DEBUG, "%s mDisplayId(%d) mFbNum(%d)",
            __FUNCTION__, mDisplayId, mFbNum);
}
void ExternalDisplay::setHPD(uint32_t startEnd) {
    ALOGD_IF(DEBUG,"HPD enabled=%d", startEnd);
    writeHPDOption(startEnd);
}
void ExternalDisplay::setHPDStatus(int enabled) {
    ALOGD_IF(DEBUG,"HPD enabled=%d", enabled);
    writeHPDOption(enabled);
}
Esempio n. 6
0
int HDMIDaemon::processFrameworkCommand()
{
    char buffer[128];
    int ret;

    if ((ret = read(mAcceptedConnection, buffer, sizeof(buffer) -1)) < 0) {
        LOGE("Unable to read framework command (%s)", strerror(errno));
        return -1;
    }
    else if (!ret)
        return -1;

    buffer[ret] = 0;

    if (!strcmp(buffer, HDMI_CMD_ENABLE_HDMI)) {
        if (!openFramebuffer())
            return -1;
        LOGD(HDMI_CMD_ENABLE_HDMI);
        if(mNxtMode != -1) {
            LOGD("processFrameworkCommand: setResolution with =%d", mNxtMode);
            setResolution(mNxtMode);
        }
    } else if (!strcmp(buffer, HDMI_CMD_DISABLE_HDMI)) {
        LOGD(HDMI_CMD_DISABLE_HDMI);

        if (!openFramebuffer())
            return -1;
        property_set("hw.hdmiON", "0");
        SurfaceComposerClient::enableHDMIOutput(0);
        close(fd1);
        fd1 = -1;
    } else if (!strncmp(buffer, HDMI_CMD_SET_ASWIDTH, strlen(HDMI_CMD_SET_ASWIDTH))) {
        float asWidthRatio;
        int ret = sscanf(buffer, HDMI_CMD_SET_ASWIDTH "%f", &asWidthRatio);
        if(ret==1) {
            SurfaceComposerClient::setActionSafeWidthRatio(asWidthRatio);
        }
    } else if (!strncmp(buffer, HDMI_CMD_SET_ASHEIGHT, strlen(HDMI_CMD_SET_ASHEIGHT))) {
        float asHeightRatio;
        int ret = sscanf(buffer, HDMI_CMD_SET_ASHEIGHT "%f", &asHeightRatio);
        if(ret==1) {
            SurfaceComposerClient::setActionSafeHeightRatio(asHeightRatio);
        }
    } else if (!strncmp(buffer, HDMI_CMD_HPDOPTION, strlen(HDMI_CMD_HPDOPTION))) {
        int option;
        int ret = sscanf(buffer, HDMI_CMD_HPDOPTION "%d", &option);
        if (ret == 1) {
            LOGD(HDMI_CMD_HPDOPTION ": %d", option);
            writeHPDOption(option);
        }
    } else {
        int mode;
        int ret = sscanf(buffer, HDMI_CMD_CHANGE_MODE "%d", &mode);
        if (ret == 1) {
            LOGD(HDMI_CMD_CHANGE_MODE);
            /* To change the resolution */
            char prop_val[PROPERTY_VALUE_MAX];
            property_get("enable.hdmi.edid", prop_val, "0");
            int val = atoi(prop_val);
            if(val == 1) {
                 /* Based on the hw.yRes set the resolution */
                 char property_value[PROPERTY_VALUE_MAX];
                 property_get("hdmi.yRes", property_value, "0");
                 int yres = atoi(property_value);
                 switch(yres){
                 case 480:
                     mode = 3;
                     break;
                 case 720:
                    mode = 4;
                    break;
                 case 1080:
                    mode = 16;
                    break;
                default:
                    break;
                 }
            }
            // If we have a valid fd1 - setresolution
            if(fd1 > 0) {
                setResolution(mode);
            } else {
            // Store the mode
                mNxtMode = mode;
            }
        }
    }

    return 0;
}
Esempio n. 7
0
void HDMIDisplay::setHPD(uint32_t value) {
    ALOGD_IF(DEBUG,"HPD enabled=%d", value);
    writeHPDOption(value);
}
ExtDisplayObserver::ExtDisplayObserver() : Thread(false),
    fd(-1), mCurrentID(-1), mHwcContext(NULL)
{
    //Enable HPD for HDMI
    writeHPDOption(1);
}