diff --git a/headers/private/graphics/common/video_configuration.h b/headers/private/graphics/common/video_configuration.h
index e565d97..3f2f3c9 100644
a
|
b
|
|
13 | 13 | |
14 | 14 | |
15 | 15 | // 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 |
| 16 | enum 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 | }; |
31 | 35 | |
32 | 36 | |
33 | 37 | // 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 |
| 38 | enum video_encoder { |
| 39 | VIDEO_ENCODER_NONE, |
| 40 | VIDEO_ENCODER_DAC, |
| 41 | VIDEO_ENCODER_TMDS, |
| 42 | VIDEO_ENCODER_LVDS, |
| 43 | VIDEO_ENCODER_TVDAC, |
| 44 | }; |
39 | 45 | |
40 | 46 | |
41 | 47 | // to ensure compatibility with C accelerants |
… |
… |
extern "C" {
|
45 | 51 | |
46 | 52 | |
47 | 53 | // mostly for debugging detected monitors |
48 | | const char* get_connector_name(uint32 connector); |
49 | | const char* get_encoder_name(uint32 encoder); |
| 54 | const char* get_connector_name(video_connector type); |
| 55 | const char* get_encoder_name(video_encoder type); |
50 | 56 | |
51 | 57 | |
52 | 58 | #ifdef __cplusplus |
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
|
|
1 | 1 | /* |
2 | | * Copyright 2011, Haiku, Inc. All Rights Reserved. |
| 2 | * Copyright 2011-2016, Haiku, Inc. All Rights Reserved. |
3 | 3 | * Distributed under the terms of the MIT License. |
4 | 4 | * |
5 | 5 | * Authors: |
… |
… |
|
14 | 14 | |
15 | 15 | |
16 | 16 | const char* |
17 | | get_connector_name(uint32 connector) |
| 17 | get_connector_name(video_connector type) |
18 | 18 | { |
19 | | switch (connector) { |
| 19 | switch (type) { |
| 20 | case VIDEO_CONNECTOR_ANY: |
| 21 | return "Generic"; |
| 22 | case VIDEO_CONNECTOR_UNKNOWN: |
| 23 | return "Unknown"; |
20 | 24 | case VIDEO_CONNECTOR_VGA: |
21 | 25 | return "VGA"; |
22 | 26 | case VIDEO_CONNECTOR_DVII: |
… |
… |
get_connector_name(uint32 connector)
|
39 | 43 | return "DisplayPort"; |
40 | 44 | case VIDEO_CONNECTOR_EDP: |
41 | 45 | return "Embedded DisplayPort"; |
42 | | case VIDEO_CONNECTOR_HDMIA: |
43 | | return "HDMI A"; |
| 46 | case VIDEO_CONNECTOR_HDMI: |
| 47 | return "HDMI"; |
44 | 48 | case VIDEO_CONNECTOR_HDMIB: |
45 | 49 | return "HDMI B"; |
46 | 50 | case VIDEO_CONNECTOR_TV: |
47 | 51 | return "TV"; |
48 | | case VIDEO_CONNECTOR_UNKNOWN: |
49 | | return "Unknown"; |
50 | 52 | } |
51 | 53 | return "Undefined"; |
52 | 54 | } |
53 | 55 | |
54 | 56 | |
55 | 57 | const char* |
56 | | get_encoder_name(uint32 encoder) |
| 58 | get_encoder_name(video_encoder type) |
57 | 59 | { |
58 | | switch (encoder) { |
| 60 | switch (type) { |
59 | 61 | case VIDEO_ENCODER_NONE: |
60 | 62 | return "None"; |
61 | 63 | case VIDEO_ENCODER_DAC: |
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
|
|
12 | 12 | |
13 | 13 | #include <ByteOrder.h> |
14 | 14 | #include <edid.h> |
| 15 | #include <video_configuration.h> |
15 | 16 | |
16 | 17 | #include "atom.h" |
17 | 18 | #include "dp.h" |
… |
… |
typedef struct {
|
141 | 142 | |
142 | 143 | |
143 | 144 | struct 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; |
151 | 152 | struct pll_info pll; |
152 | 153 | }; |
153 | 154 | |
154 | 155 | |
155 | 156 | typedef 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 |
163 | 164 | struct encoder_info encoder; |
164 | 165 | struct encoder_info encoderExternal; |
165 | | dp_info dpInfo; |
| 166 | dp_info dpInfo; |
166 | 167 | } connector_info; |
167 | 168 | |
168 | 169 | |
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()
|
703 | 703 | path = (ATOM_DISPLAY_OBJECT_PATH*)address; |
704 | 704 | pathSize += B_LENDIAN_TO_HOST_INT16(path->usSize); |
705 | 705 | |
706 | | uint32 connectorType; |
| 706 | video_connector connectorType; |
707 | 707 | uint16 connectorFlags = B_LENDIAN_TO_HOST_INT16(path->usDeviceTag); |
708 | 708 | |
709 | 709 | if ((deviceSupport & connectorFlags) != 0) { |
… |
… |
connector_probe()
|
794 | 794 | = (encoderObjectRaw & OBJECT_ID_MASK) |
795 | 795 | >> OBJECT_ID_SHIFT; |
796 | 796 | |
797 | | uint32 encoderType = encoder_type_lookup(encoderID, |
798 | | connectorFlags); |
| 797 | video_encoder encoderType = encoder_type_lookup( |
| 798 | encoderID, connectorFlags); |
799 | 799 | |
800 | 800 | if (encoderType == VIDEO_ENCODER_NONE) { |
801 | 801 | ERROR("%s: Path #%" B_PRId32 ":" |
… |
… |
debug_connectors()
|
919 | 919 | ERROR("Currently detected connectors=============\n"); |
920 | 920 | for (uint32 id = 0; id < ATOM_MAX_SUPPORTED_DEVICE; id++) { |
921 | 921 | if (gConnector[id]->valid == true) { |
922 | | uint32 connectorType = gConnector[id]->type; |
| 922 | video_connector connectorType = gConnector[id]->type; |
923 | 923 | uint16 i2cPinIndex = gConnector[id]->i2cPinIndex; |
924 | 924 | uint16 hpdPinIndex = gConnector[id]->hpdPinIndex; |
925 | 925 | |
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
|
|
15 | 15 | |
16 | 16 | |
17 | 17 | // convert radeon connector to common connector type |
18 | | const int kConnectorConvertLegacy[] = { |
| 18 | const video_connector kConnectorConvertLegacy[] = { |
19 | 19 | VIDEO_CONNECTOR_UNKNOWN, |
20 | 20 | VIDEO_CONNECTOR_VGA, |
21 | 21 | VIDEO_CONNECTOR_DVII, |
… |
… |
const int kConnectorConvertLegacy[] = {
|
26 | 26 | VIDEO_CONNECTOR_LVDS, |
27 | 27 | VIDEO_CONNECTOR_UNKNOWN, |
28 | 28 | VIDEO_CONNECTOR_UNKNOWN, |
29 | | VIDEO_CONNECTOR_HDMIA, |
| 29 | VIDEO_CONNECTOR_HDMI, |
30 | 30 | VIDEO_CONNECTOR_HDMIB, |
31 | 31 | VIDEO_CONNECTOR_UNKNOWN, |
32 | 32 | VIDEO_CONNECTOR_UNKNOWN, |
… |
… |
const int kConnectorConvertLegacy[] = {
|
34 | 34 | VIDEO_CONNECTOR_DP |
35 | 35 | }; |
36 | 36 | |
37 | | const int kConnectorConvert[] = { |
| 37 | const video_connector kConnectorConvert[] = { |
38 | 38 | VIDEO_CONNECTOR_UNKNOWN, |
39 | 39 | VIDEO_CONNECTOR_DVII, |
40 | 40 | VIDEO_CONNECTOR_DVII, |
… |
… |
const int kConnectorConvert[] = {
|
47 | 47 | VIDEO_CONNECTOR_UNKNOWN, |
48 | 48 | VIDEO_CONNECTOR_9DIN, |
49 | 49 | VIDEO_CONNECTOR_UNKNOWN, |
50 | | VIDEO_CONNECTOR_HDMIA, |
| 50 | VIDEO_CONNECTOR_HDMI, |
51 | 51 | VIDEO_CONNECTOR_HDMIB, |
52 | 52 | VIDEO_CONNECTOR_LVDS, |
53 | 53 | VIDEO_CONNECTOR_9DIN, |
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()
|
417 | 417 | uint32 connectorIndex = gDisplay[id]->connectorIndex; |
418 | 418 | |
419 | 419 | 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; |
422 | 423 | ERROR(" + connector ID: %" B_PRIu32 "\n", connectorIndex); |
423 | 424 | ERROR(" + connector type: %s\n", get_connector_name(connectorType)); |
424 | 425 | ERROR(" + encoder type: %s\n", get_encoder_name(encoderType)); |
… |
… |
display_get_encoder_mode(uint32 connectorIndex)
|
477 | 478 | return ATOM_ENCODER_MODE_CRT; |
478 | 479 | break; |
479 | 480 | case VIDEO_CONNECTOR_DVID: |
480 | | case VIDEO_CONNECTOR_HDMIA: |
| 481 | case VIDEO_CONNECTOR_HDMI: |
481 | 482 | default: |
482 | 483 | // TODO: if audio detected on edid and DCE4, ATOM_ENCODER_MODE_DVI |
483 | 484 | // if audio detected on edid not DCE4, ATOM_ENCODER_MODE_HDMI |
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)
|
444 | 444 | uint32 lvdsFlags = gConnector[connectorIndex]->lvdsFlags; |
445 | 445 | |
446 | 446 | bool isHdmi = false; |
447 | | if (gConnector[connectorIndex]->type == VIDEO_CONNECTOR_HDMIA |
| 447 | if (gConnector[connectorIndex]->type == VIDEO_CONNECTOR_HDMI |
448 | 448 | || gConnector[connectorIndex]->type == VIDEO_CONNECTOR_HDMIB) { |
449 | 449 | isHdmi = true; |
450 | 450 | } |
… |
… |
encoder_object_lookup(uint32 connectorFlags, uint8 dacID)
|
2098 | 2098 | } |
2099 | 2099 | |
2100 | 2100 | |
2101 | | uint32 |
| 2101 | video_encoder |
2102 | 2102 | encoder_type_lookup(uint32 encoderID, uint32 connectorFlags) |
2103 | 2103 | { |
2104 | 2104 | switch (encoderID) { |
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
|
|
1 | 1 | /* |
2 | | * Copyright 2006-2011, Haiku, Inc. All Rights Reserved. |
| 2 | * Copyright 2006-2016, Haiku, Inc. All Rights Reserved. |
3 | 3 | * Distributed under the terms of the MIT License. |
4 | 4 | * |
5 | 5 | * Authors: |
… |
… |
|
10 | 10 | |
11 | 11 | |
12 | 12 | #include <SupportDefs.h> |
| 13 | #include <video_configuration.h> |
| 14 | |
13 | 15 | |
14 | 16 | void encoder_init(); |
15 | 17 | |
… |
… |
void encoder_dpms_set_external(uint8 crtcID, int mode);
|
43 | 45 | |
44 | 46 | const char* encoder_name_lookup(uint32 encoderID); |
45 | 47 | uint32 encoder_object_lookup(uint32 connectorFlags, uint8 dacID); |
46 | | uint32 encoder_type_lookup(uint32 encoderID, uint32 connectorFlags); |
| 48 | video_encoder encoder_type_lookup(uint32 encoderID, uint32 connectorFlags); |
47 | 49 | bool encoder_is_external(uint32 encoderID); |
48 | 50 | bool encoder_is_dp_bridge(uint32 encoderID); |
49 | 51 | |