Ticket #12773: video_connector.diff

File video_connector.diff, 10.3 KB (added by kallisti5, 8 years ago)
  • headers/private/graphics/common/video_configuration.h

    diff --git a/headers/private/graphics/common/video_configuration.h b/headers/private/graphics/common/video_configuration.h
    index e565d97..3f2f3c9 100644
    a b  
    1313
    1414
    1515// Video connector types
    16 #define VIDEO_CONNECTOR_UNKNOWN     0x00
    17 #define VIDEO_CONNECTOR_VGA         0x01
    18 #define VIDEO_CONNECTOR_DVII        0x02
    19 #define VIDEO_CONNECTOR_DVID        0x03
    20 #define VIDEO_CONNECTOR_DVIA        0x04
    21 #define VIDEO_CONNECTOR_COMPOSITE   0x05
    22 #define VIDEO_CONNECTOR_SVIDEO      0x06
    23 #define VIDEO_CONNECTOR_LVDS        0x07
    24 #define VIDEO_CONNECTOR_COMPONENT   0x08
    25 #define VIDEO_CONNECTOR_9DIN        0x09
    26 #define VIDEO_CONNECTOR_DP          0x0A
    27 #define VIDEO_CONNECTOR_EDP         0x0B
    28 #define VIDEO_CONNECTOR_HDMIA       0x0C
    29 #define VIDEO_CONNECTOR_HDMIB       0x0D
    30 #define VIDEO_CONNECTOR_TV          0x0E
     16enum video_connector {
     17    VIDEO_CONNECTOR_ANY,
     18    VIDEO_CONNECTOR_UNKNOWN,
     19    VIDEO_CONNECTOR_VGA,
     20    VIDEO_CONNECTOR_DVII,
     21    VIDEO_CONNECTOR_DVID,
     22    VIDEO_CONNECTOR_DVIA,
     23    VIDEO_CONNECTOR_COMPOSITE,
     24    VIDEO_CONNECTOR_SVIDEO,
     25    VIDEO_CONNECTOR_LVDS,
     26    VIDEO_CONNECTOR_COMPONENT,
     27    VIDEO_CONNECTOR_9DIN,
     28    VIDEO_CONNECTOR_DP,
     29    VIDEO_CONNECTOR_EDP,
     30    VIDEO_CONNECTOR_HDMI,
     31    VIDEO_CONNECTOR_TV,
     32    VIDEO_CONNECTOR_HDMIB,
     33        // TODO: remove from radeon_hd, do not use.
     34};
    3135
    3236
    3337// Video encoder types
    34 #define VIDEO_ENCODER_NONE      0x00
    35 #define VIDEO_ENCODER_DAC       0x01
    36 #define VIDEO_ENCODER_TMDS      0x02
    37 #define VIDEO_ENCODER_LVDS      0x03
    38 #define VIDEO_ENCODER_TVDAC     0x04
     38enum video_encoder {
     39    VIDEO_ENCODER_NONE,
     40    VIDEO_ENCODER_DAC,
     41    VIDEO_ENCODER_TMDS,
     42    VIDEO_ENCODER_LVDS,
     43    VIDEO_ENCODER_TVDAC,
     44};
    3945
    4046
    4147// to ensure compatibility with C accelerants
    extern "C" {  
    4551
    4652
    4753// mostly for debugging detected monitors
    48 const char* get_connector_name(uint32 connector);
    49 const char* get_encoder_name(uint32 encoder);
     54const char* get_connector_name(video_connector type);
     55const char* get_encoder_name(video_encoder type);
    5056
    5157
    5258#ifdef __cplusplus
  • src/add-ons/accelerants/common/video_configuration.cpp

    diff --git a/src/add-ons/accelerants/common/video_configuration.cpp b/src/add-ons/accelerants/common/video_configuration.cpp
    index a6ed5bd..fe2ecca 100644
    a b  
    11/*
    2  * Copyright 2011, Haiku, Inc. All Rights Reserved.
     2 * Copyright 2011-2016, Haiku, Inc. All Rights Reserved.
    33 * Distributed under the terms of the MIT License.
    44 *
    55 * Authors:
     
    1414
    1515
    1616const char*
    17 get_connector_name(uint32 connector)
     17get_connector_name(video_connector type)
    1818{
    19     switch (connector) {
     19    switch (type) {
     20        case VIDEO_CONNECTOR_ANY:
     21            return "Generic";
     22        case VIDEO_CONNECTOR_UNKNOWN:
     23            return "Unknown";
    2024        case VIDEO_CONNECTOR_VGA:
    2125            return "VGA";
    2226        case VIDEO_CONNECTOR_DVII:
    get_connector_name(uint32 connector)  
    3943            return "DisplayPort";
    4044        case VIDEO_CONNECTOR_EDP:
    4145            return "Embedded DisplayPort";
    42         case VIDEO_CONNECTOR_HDMIA:
    43             return "HDMI A";
     46        case VIDEO_CONNECTOR_HDMI:
     47            return "HDMI";
    4448        case VIDEO_CONNECTOR_HDMIB:
    4549            return "HDMI B";
    4650        case VIDEO_CONNECTOR_TV:
    4751            return "TV";
    48         case VIDEO_CONNECTOR_UNKNOWN:
    49             return "Unknown";
    5052    }
    5153    return "Undefined";
    5254}
    5355
    5456
    5557const char*
    56 get_encoder_name(uint32 encoder)
     58get_encoder_name(video_encoder type)
    5759{
    58     switch (encoder) {
     60    switch (type) {
    5961        case VIDEO_ENCODER_NONE:
    6062            return "None";
    6163        case VIDEO_ENCODER_DAC:
  • src/add-ons/accelerants/radeon_hd/accelerant.h

    diff --git a/src/add-ons/accelerants/radeon_hd/accelerant.h b/src/add-ons/accelerants/radeon_hd/accelerant.h
    index 94c43a6..496a2a7 100644
    a b  
    1212
    1313#include <ByteOrder.h>
    1414#include <edid.h>
     15#include <video_configuration.h>
    1516
    1617#include "atom.h"
    1718#include "dp.h"
    typedef struct {  
    141142
    142143
    143144struct encoder_info {
    144     bool        valid;
    145     uint16      objectID;
    146     uint32      type;
    147     uint32      capabilities;
    148     uint32      linkEnumeration; // ex. linkb == GRAPH_OBJECT_ENUM_ID2
    149     bool        isExternal;
    150     bool        isDPBridge;
     145    bool            valid;
     146    uint16          objectID;
     147    video_encoder   type;
     148    uint32          capabilities;
     149    uint32          linkEnumeration; // ex. linkb == GRAPH_OBJECT_ENUM_ID2
     150    bool            isExternal;
     151    bool            isDPBridge;
    151152    struct pll_info pll;
    152153};
    153154
    154155
    155156typedef struct {
    156     bool        valid;
    157     uint16      objectID;
    158     uint32      type;
    159     uint32      flags;
    160     uint32      lvdsFlags;
    161     uint16      i2cPinIndex; // id of gpio pin for i2c communications
    162     uint16      hpdPinIndex; // id of gpio pin for hotplug detection
     157    bool            valid;
     158    uint16          objectID;
     159    video_connector type;
     160    uint32          flags;
     161    uint32          lvdsFlags;
     162    uint16          i2cPinIndex; // id of gpio pin for i2c communications
     163    uint16          hpdPinIndex; // id of gpio pin for hotplug detection
    163164    struct encoder_info encoder;
    164165    struct encoder_info encoderExternal;
    165     dp_info     dpInfo;
     166    dp_info         dpInfo;
    166167} connector_info;
    167168
    168169
  • src/add-ons/accelerants/radeon_hd/connector.cpp

    diff --git a/src/add-ons/accelerants/radeon_hd/connector.cpp b/src/add-ons/accelerants/radeon_hd/connector.cpp
    index 3ab6527..1efcb7f 100644
    a b connector_probe()  
    703703        path = (ATOM_DISPLAY_OBJECT_PATH*)address;
    704704        pathSize += B_LENDIAN_TO_HOST_INT16(path->usSize);
    705705
    706         uint32 connectorType;
     706        video_connector connectorType;
    707707        uint16 connectorFlags = B_LENDIAN_TO_HOST_INT16(path->usDeviceTag);
    708708
    709709        if ((deviceSupport & connectorFlags) != 0) {
    connector_probe()  
    794794                                = (encoderObjectRaw & OBJECT_ID_MASK)
    795795                                    >> OBJECT_ID_SHIFT;
    796796
    797                             uint32 encoderType = encoder_type_lookup(encoderID,
    798                                 connectorFlags);
     797                            video_encoder encoderType = encoder_type_lookup(
     798                                encoderID, connectorFlags);
    799799
    800800                            if (encoderType == VIDEO_ENCODER_NONE) {
    801801                                ERROR("%s: Path #%" B_PRId32 ":"
    debug_connectors()  
    919919    ERROR("Currently detected connectors=============\n");
    920920    for (uint32 id = 0; id < ATOM_MAX_SUPPORTED_DEVICE; id++) {
    921921        if (gConnector[id]->valid == true) {
    922             uint32 connectorType = gConnector[id]->type;
     922            video_connector connectorType = gConnector[id]->type;
    923923            uint16 i2cPinIndex = gConnector[id]->i2cPinIndex;
    924924            uint16 hpdPinIndex = gConnector[id]->hpdPinIndex;
    925925
  • src/add-ons/accelerants/radeon_hd/connector.h

    diff --git a/src/add-ons/accelerants/radeon_hd/connector.h b/src/add-ons/accelerants/radeon_hd/connector.h
    index 1b95e04..b3feb89 100644
    a b  
    1515
    1616
    1717// convert radeon connector to common connector type
    18 const int kConnectorConvertLegacy[] = {
     18const video_connector kConnectorConvertLegacy[] = {
    1919    VIDEO_CONNECTOR_UNKNOWN,
    2020    VIDEO_CONNECTOR_VGA,
    2121    VIDEO_CONNECTOR_DVII,
    const int kConnectorConvertLegacy[] = {  
    2626    VIDEO_CONNECTOR_LVDS,
    2727    VIDEO_CONNECTOR_UNKNOWN,
    2828    VIDEO_CONNECTOR_UNKNOWN,
    29     VIDEO_CONNECTOR_HDMIA,
     29    VIDEO_CONNECTOR_HDMI,
    3030    VIDEO_CONNECTOR_HDMIB,
    3131    VIDEO_CONNECTOR_UNKNOWN,
    3232    VIDEO_CONNECTOR_UNKNOWN,
    const int kConnectorConvertLegacy[] = {  
    3434    VIDEO_CONNECTOR_DP
    3535};
    3636
    37 const int kConnectorConvert[] = {
     37const video_connector kConnectorConvert[] = {
    3838    VIDEO_CONNECTOR_UNKNOWN,
    3939    VIDEO_CONNECTOR_DVII,
    4040    VIDEO_CONNECTOR_DVII,
    const int kConnectorConvert[] = {  
    4747    VIDEO_CONNECTOR_UNKNOWN,
    4848    VIDEO_CONNECTOR_9DIN,
    4949    VIDEO_CONNECTOR_UNKNOWN,
    50     VIDEO_CONNECTOR_HDMIA,
     50    VIDEO_CONNECTOR_HDMI,
    5151    VIDEO_CONNECTOR_HDMIB,
    5252    VIDEO_CONNECTOR_LVDS,
    5353    VIDEO_CONNECTOR_9DIN,
  • 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 5555756..a107c44 100644
    a b debug_displays()  
    417417        uint32 connectorIndex = gDisplay[id]->connectorIndex;
    418418
    419419        if (gDisplay[id]->attached) {
    420             uint32 connectorType = gConnector[connectorIndex]->type;
    421             uint32 encoderType = gConnector[connectorIndex]->encoder.type;
     420            video_connector connectorType = gConnector[connectorIndex]->type;
     421            video_encoder encoderType
     422                = gConnector[connectorIndex]->encoder.type;
    422423            ERROR(" + connector ID:   %" B_PRIu32 "\n", connectorIndex);
    423424            ERROR(" + connector type: %s\n", get_connector_name(connectorType));
    424425            ERROR(" + encoder type:   %s\n", get_encoder_name(encoderType));
    display_get_encoder_mode(uint32 connectorIndex)  
    477478                return ATOM_ENCODER_MODE_CRT;
    478479            break;
    479480        case VIDEO_CONNECTOR_DVID:
    480         case VIDEO_CONNECTOR_HDMIA:
     481        case VIDEO_CONNECTOR_HDMI:
    481482        default:
    482483            // TODO: if audio detected on edid and DCE4, ATOM_ENCODER_MODE_DVI
    483484            //        if audio detected on edid not DCE4, ATOM_ENCODER_MODE_HDMI
  • 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 72a123e..020a263 100644
    a b encoder_digital_setup(uint32 connectorIndex, uint32 pixelClock, int command)  
    444444    uint32 lvdsFlags = gConnector[connectorIndex]->lvdsFlags;
    445445
    446446    bool isHdmi = false;
    447     if (gConnector[connectorIndex]->type == VIDEO_CONNECTOR_HDMIA
     447    if (gConnector[connectorIndex]->type == VIDEO_CONNECTOR_HDMI
    448448        || gConnector[connectorIndex]->type == VIDEO_CONNECTOR_HDMIB) {
    449449        isHdmi = true;
    450450    }
    encoder_object_lookup(uint32 connectorFlags, uint8 dacID)  
    20982098}
    20992099
    21002100
    2101 uint32
     2101video_encoder
    21022102encoder_type_lookup(uint32 encoderID, uint32 connectorFlags)
    21032103{
    21042104    switch (encoderID) {
  • src/add-ons/accelerants/radeon_hd/encoder.h

    diff --git a/src/add-ons/accelerants/radeon_hd/encoder.h b/src/add-ons/accelerants/radeon_hd/encoder.h
    index 8db3f50..b7924a0 100644
    a b  
    11/*
    2  * Copyright 2006-2011, Haiku, Inc. All Rights Reserved.
     2 * Copyright 2006-2016, Haiku, Inc. All Rights Reserved.
    33 * Distributed under the terms of the MIT License.
    44 *
    55 * Authors:
     
    1010
    1111
    1212#include <SupportDefs.h>
     13#include <video_configuration.h>
     14
    1315
    1416void encoder_init();
    1517
    void encoder_dpms_set_external(uint8 crtcID, int mode);  
    4345
    4446const char* encoder_name_lookup(uint32 encoderID);
    4547uint32 encoder_object_lookup(uint32 connectorFlags, uint8 dacID);
    46 uint32 encoder_type_lookup(uint32 encoderID, uint32 connectorFlags);
     48video_encoder encoder_type_lookup(uint32 encoderID, uint32 connectorFlags);
    4749bool encoder_is_external(uint32 encoderID);
    4850bool encoder_is_dp_bridge(uint32 encoderID);
    4951