Ticket #13700: radeon_hd-encoder_reversal.diff

File radeon_hd-encoder_reversal.diff, 9.1 KB (added by kallisti5, 7 years ago)

encoder swap v1

  • src/add-ons/accelerants/radeon_hd/accelerant.cpp

    diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.cpp b/src/add-ons/accelerants/radeon_hd/accelerant.cpp
    index 727a3ca38a..8f429f8f44 100644
    a b radeon_init_accelerant(int device)  
    280280    // print found connectors
    281281    debug_connectors();
    282282
    283     // setup encoders on each connector if needed
    284     encoder_init();
    285 
    286283    // program external pll clock
    287284    pll_external_init();
    288285
    radeon_init_accelerant(int device)  
    297294    // print found displays
    298295    debug_displays();
    299296
     297    // setup encoders on each connector if needed
     298    encoder_init();
     299
    300300    // create initial list of video modes
    301301    status = create_mode_list();
    302302    //if (status != B_OK) {
  • src/add-ons/accelerants/radeon_hd/display.cpp

    diff --git a/src/add-ons/accelerants/radeon_hd/display.cpp b/src/add-ons/accelerants/radeon_hd/display.cpp
    index 55557568a3..7dcfc29ce5 100644
    a b display_get_encoder_mode(uint32 connectorIndex)  
    449449            return ATOM_ENCODER_MODE_DVO;
    450450    }
    451451
    452     // Find crtc for connector so we can identify source of edid data
    453     int32 crtc = -1;
     452    // Find display for connector so we can identify source of edid data
     453    int32 crtcID = -1;
    454454    for (int32 id = 0; id < MAX_DISPLAY; id++) {
    455455        if (gDisplay[id]->connectorIndex == connectorIndex) {
    456             crtc = id;
     456            crtcID = id;
    457457            break;
    458458        }
    459459    }
    460460    bool edidDigital = false;
    461     if (crtc == -1) {
    462         ERROR("%s: BUG: executed on connector without crtc!\n", __func__);
     461    if (crtcID == -1) {
     462        ERROR("%s: BUG: executed on connector without assigned display!\n",
     463            __func__);
    463464    } else {
    464         edid1_info* edid = &gDisplay[crtc]->edidData;
     465        edid1_info* edid = &gDisplay[crtcID]->edidData;
    465466        edidDigital = edid->display.input_type ? true : false;
    466467    }
    467468
  • src/add-ons/accelerants/radeon_hd/encoder.cpp

    diff --git a/src/add-ons/accelerants/radeon_hd/encoder.cpp b/src/add-ons/accelerants/radeon_hd/encoder.cpp
    index 1cc11c383c..c6c560d4ac 100644
    a b encoder_init()  
    4141    TRACE("%s: called\n", __func__);
    4242    radeon_shared_info &info = *gInfo->shared_info;
    4343
    44     for (uint32 id = 0; id < ATOM_MAX_SUPPORTED_DEVICE; id++) {
    45         if (gConnector[id]->valid == false)
     44    // For each attached display...
     45    uint32 crtcID;
     46    uint32 initCount = 0;
     47    for (crtcID = 0; crtcID < MAX_DISPLAY; crtcID++) {
     48        if (gDisplay[crtcID]->attached != true)
    4649            continue;
     50        uint16 connectorID = gDisplay[crtcID]->connectorIndex;
     51
     52        if (gConnector[connectorID]->valid == false)
     53            continue;
     54
     55        initCount++;
    4756
    48         switch (gConnector[id]->encoder.objectID) {
     57        switch (gConnector[connectorID]->encoder.objectID) {
    4958            case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
    5059            case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:
    5160            case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:
    5261            case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA:
    53                 transmitter_dig_setup(id, 0, 0, 0,
     62                transmitter_dig_setup(connectorID, 0, 0, 0,
    5463                    ATOM_TRANSMITTER_ACTION_INIT);
    5564                break;
    5665            default:
    encoder_init()  
    5867        }
    5968
    6069        if ((info.chipsetFlags & CHIP_APU) != 0) {
    61             if (gConnector[id]->encoderExternal.valid == true) {
    62                 encoder_external_setup(id,
     70            if (gConnector[connectorID]->encoderExternal.valid == true) {
     71                encoder_external_setup(connectorID,
    6372                    EXTERNAL_ENCODER_ACTION_V3_ENCODER_INIT);
    6473            }
    6574        }
    6675    }
     76    if (initCount == 0) {
     77        ERROR("%s: WARNING: Didn't find any attached displays to init!",
     78            __func__);
     79    }
    6780}
    6881
    6982
    7083void
    7184encoder_assign_crtc(uint8 crtcID)
    7285{
    73     TRACE("%s\n", __func__);
     86    TRACE("%s: display %" B_PRIu8 "\n", __func__, crtcID);
    7487
    7588    int index = GetIndexIntoMasterTable(COMMAND, SelectCRTC_Source);
    7689
    encoder_assign_crtc(uint8 crtcID)  
    223236uint32
    224237encoder_pick_dig(uint32 connectorIndex)
    225238{
    226     TRACE("%s\n", __func__);
     239    TRACE("%s: connector %" B_PRIu32 "\n", __func__, connectorIndex);
    227240    radeon_shared_info &info = *gInfo->shared_info;
    228241    uint32 encoderID = gConnector[connectorIndex]->encoder.objectID;
    229242
    encoder_pick_dig(uint32 connectorIndex)  
    274287void
    275288encoder_apply_quirks(uint8 crtcID)
    276289{
    277     TRACE("%s\n", __func__);
     290    TRACE("%s: display %" B_PRIu8 "\n", __func__, crtcID);
    278291    radeon_shared_info &info = *gInfo->shared_info;
    279292    register_info* regs = gDisplay[crtcID]->regs;
    280293    uint32 connectorIndex = gDisplay[crtcID]->connectorIndex;
    encoder_apply_quirks(uint8 crtcID)  
    293306void
    294307encoder_mode_set(uint8 crtcID)
    295308{
    296     TRACE("%s\n", __func__);
     309    TRACE("%s: display %" B_PRIu8 "\n", __func__, crtcID);
    297310    radeon_shared_info &info = *gInfo->shared_info;
    298311    uint32 connectorIndex = gDisplay[crtcID]->connectorIndex;
    299312    uint16 connectorFlags = gConnector[connectorIndex]->flags;
    encoder_mode_set(uint8 crtcID)  
    386399status_t
    387400encoder_tv_setup(uint32 connectorIndex, uint32 pixelClock, int command)
    388401{
     402    TRACE("%s: connector %" B_PRIu32 ", pixelClock: %" B_PRIu32 "\n", __func__,
     403        connectorIndex, pixelClock);
     404
    389405    uint16 connectorFlags = gConnector[connectorIndex]->flags;
    390406
    391407    TV_ENCODER_CONTROL_PS_ALLOCATION args;
    encoder_tv_setup(uint32 connectorIndex, uint32 pixelClock, int command)  
    411427status_t
    412428encoder_digital_setup(uint32 connectorIndex, uint32 pixelClock, int command)
    413429{
    414     TRACE("%s\n", __func__);
     430    TRACE("%s: connector %" B_PRIu32 ", pixelClock: %" B_PRIu32 "\n", __func__,
     431        connectorIndex, pixelClock);
    415432
    416433    int index = 0;
    417434    uint16 connectorFlags = gConnector[connectorIndex]->flags;
    encoder_get_bpc()  
    573590status_t
    574591encoder_dig_setup(uint32 connectorIndex, uint32 pixelClock, int command)
    575592{
     593    TRACE("%s\n", __func__);
     594
    576595    radeon_shared_info &info = *gInfo->shared_info;
    577596    connector_info* connector = gConnector[connectorIndex];
    578597
    encoder_dig_setup(uint32 connectorIndex, uint32 pixelClock, int command)  
    834853status_t
    835854encoder_external_setup(uint32 connectorIndex, int command)
    836855{
    837     TRACE("%s\n", __func__);
     856    TRACE("%s: connector %" B_PRIu32 "\n", __func__, connectorIndex);
    838857
    839858    encoder_info* encoder
    840859        = &gConnector[connectorIndex]->encoder;
    encoder_external_setup(uint32 connectorIndex, int command)  
    10041023status_t
    10051024encoder_analog_setup(uint32 connectorIndex, uint32 pixelClock, int command)
    10061025{
    1007     TRACE("%s\n", __func__);
     1026    TRACE("%s: connector %" B_PRIu32 ", pixelClock: %" B_PRIu32 "\n", __func__,
     1027        connectorIndex, pixelClock);
    10081028
    10091029    uint32 connectorFlags = gConnector[connectorIndex]->flags;
    10101030
    encoder_analog_setup(uint32 connectorIndex, uint32 pixelClock, int command)  
    10491069bool
    10501070encoder_analog_load_detect(uint32 connectorIndex)
    10511071{
    1052     TRACE("%s\n", __func__);
     1072    TRACE("%s: connector %" B_PRIu32 "\n", __func__, connectorIndex);
    10531073
    10541074    if (gConnector[connectorIndex]->encoderExternal.valid == true)
    10551075        return encoder_dig_load_detect(connectorIndex);
    encoder_analog_load_detect(uint32 connectorIndex)  
    10611081bool
    10621082encoder_dac_load_detect(uint32 connectorIndex)
    10631083{
    1064     TRACE("%s\n", __func__);
     1084    TRACE("%s: connector %" B_PRIu32 "\n", __func__, connectorIndex);
    10651085
    10661086    uint32 connectorFlags = gConnector[connectorIndex]->flags;
    10671087    uint32 encoderID = gConnector[connectorIndex]->encoder.objectID;
    encoder_dac_load_detect(uint32 connectorIndex)  
    11561176bool
    11571177encoder_dig_load_detect(uint32 connectorIndex)
    11581178{
    1159     TRACE("%s\n", __func__);
     1179    TRACE("%s: connector %" B_PRIu32 "\n", __func__, connectorIndex);
    11601180    radeon_shared_info &info = *gInfo->shared_info;
    11611181
    11621182    if (info.dceMajor < 4) {
    status_t  
    11971217transmitter_dig_setup(uint32 connectorIndex, uint32 pixelClock,
    11981218    uint8 laneNumber, uint8 laneSet, int command)
    11991219{
    1200     TRACE("%s\n", __func__);
     1220    TRACE("%s: connector %" B_PRIu32 ", pixelClock: %" B_PRIu32 "\n", __func__,
     1221        connectorIndex, pixelClock);
    12011222
    12021223    uint16 encoderID = gConnector[connectorIndex]->encoder.objectID;
    12031224    int index;
    transmitter_dig_setup(uint32 connectorIndex, uint32 pixelClock,  
    16711692void
    16721693encoder_crtc_scratch(uint8 crtcID)
    16731694{
    1674     TRACE("%s\n", __func__);
     1695    TRACE("%s: display %" B_PRIu8 "\n", __func__, crtcID);
    16751696
    16761697    uint32 connectorIndex = gDisplay[crtcID]->connectorIndex;
    16771698    uint32 connectorFlags = gConnector[connectorIndex]->flags;
    encoder_crtc_scratch(uint8 crtcID)  
    17201741void
    17211742encoder_dpms_scratch(uint8 crtcID, bool power)
    17221743{
    1723     TRACE("%s\n", __func__);
     1744    TRACE("%s: display %" B_PRIu8 "\n", __func__, crtcID);
    17241745
    17251746    uint32 connectorIndex = gDisplay[crtcID]->connectorIndex;
    17261747    uint32 connectorFlags = gConnector[connectorIndex]->flags;
    encoder_dpms_scratch(uint8 crtcID, bool power)  
    17951816void
    17961817encoder_dpms_set(uint8 crtcID, int mode)
    17971818{
    1798     TRACE("%s: power: %s\n", __func__, mode == B_DPMS_ON ? "true" : "false");
     1819    TRACE("%s: display %" B_PRIu8 ", power: %s\n", __func__, crtcID,
     1820        mode == B_DPMS_ON ? "true" : "false");
    17991821
    18001822    int index = -1;
    18011823    radeon_shared_info &info = *gInfo->shared_info;
    encoder_dpms_set(uint8 crtcID, int mode)  
    18901912void
    18911913encoder_dpms_set_dig(uint8 crtcID, int mode)
    18921914{
    1893     TRACE("%s: power: %s\n", __func__, mode == B_DPMS_ON ? "true" : "false");
     1915    TRACE("%s: display %" B_PRIu8 ", power: %s\n", __func__, crtcID,
     1916        mode == B_DPMS_ON ? "true" : "false");
    18941917
    18951918    radeon_shared_info &info = *gInfo->shared_info;
    18961919    uint32 connectorIndex = gDisplay[crtcID]->connectorIndex;