* move encoder info into own struct

* rename some connector / encoder struct members
* improve debugging in connector / encoder
  AtomBIOS walking


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42815 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Alexander von Gluck IV 2011-10-09 19:51:59 +00:00
parent 17b66d8250
commit d0509b7eb9
6 changed files with 61 additions and 50 deletions

View File

@ -164,15 +164,24 @@ typedef struct {
} gpio_info;
struct encoder_info {
bool valid;
uint32 type;
uint16 object_id;
uint32 flags;
bool is_hdmi;
bool is_tv;
};
typedef struct {
bool valid;
uint32 type;
uint16 object_id;
uint32 flags;
uint16 line_mux;
uint16 connector_flags;
uint32 connector_type;
uint16 connector_object_id;
uint16 connector_gpio_id;
uint32 encoder_type;
uint16 encoder_object_id;
uint16 gpio_id;
struct encoder_info encoder;
// TODO struct radeon_hpd hpd;
} connector_info;

View File

@ -267,11 +267,11 @@ detect_connectors_legacy()
ATOM_CONNECTOR_INFO_I2C ci
= supported_devices->info.asConnInfo[i];
gConnector[i]->connector_type
gConnector[i]->type
= connector_convert_legacy[
ci.sucConnectorInfo.sbfAccess.bfConnectorType];
if (gConnector[i]->connector_type == VIDEO_CONNECTOR_UNKNOWN) {
if (gConnector[i]->type == VIDEO_CONNECTOR_UNKNOWN) {
TRACE("%s: skipping unknown connector at %" B_PRId32
" of 0x%" B_PRIX8 "\n", __func__, i,
ci.sucConnectorInfo.sbfAccess.bfConnectorType);
@ -287,10 +287,10 @@ detect_connectors_legacy()
// Always set CRT1 and CRT2 as VGA, some cards incorrectly set
// VGA ports as DVI
if (i == ATOM_DEVICE_CRT1_INDEX || i == ATOM_DEVICE_CRT2_INDEX)
gConnector[i]->connector_type = VIDEO_CONNECTOR_VGA;
gConnector[i]->type = VIDEO_CONNECTOR_VGA;
gConnector[i]->valid = true;
gConnector[i]->connector_flags = (1 << i);
gConnector[i]->encoder.flags = (1 << i);
// TODO : add the encoder
#if 0
@ -310,7 +310,7 @@ detect_connectors_legacy()
for (i = 0; i < ATOM_MAX_SUPPORTED_DEVICE_INFO; i++) {
if (gConnector[i]->valid == true) {
TRACE("%s: connector #%" B_PRId32 " is %s\n", __func__, i,
get_connector_name(gConnector[i]->connector_type));
get_connector_name(gConnector[i]->type));
}
}
@ -410,13 +410,11 @@ detect_connectors()
}
if (connector_type == VIDEO_CONNECTOR_UNKNOWN) {
TRACE("%s: Path #%" B_PRId32 ": skipping unknown connector.\n",
ERROR("%s: Path #%" B_PRId32 ": skipping unknown connector.\n",
__func__, i);
continue;
}
uint32 encoder_type = VIDEO_ENCODER_NONE;
uint16 encoder_object_id = 0;
int32 j;
for (j = 0; j < ((B_LENDIAN_TO_HOST_INT16(path->usSize) - 8) / 2);
j++) {
@ -464,6 +462,7 @@ detect_connectors()
uint32 encoder_id = (encoder_obj & OBJECT_ID_MASK)
>> OBJECT_ID_SHIFT;
uint32 encoder_type = VIDEO_ENCODER_NONE;
switch(encoder_id) {
case ENCODER_OBJECT_ID_INTERNAL_LVDS:
case ENCODER_OBJECT_ID_INTERNAL_TMDS1:
@ -525,7 +524,24 @@ detect_connectors()
// drm_encoder_helper_add
break;
}
encoder_object_id = encoder_id;
if (encoder_type == VIDEO_ENCODER_NONE) {
ERROR("%s: Path #%" B_PRId32 ":"
"skipping unknown encoder.\n",
__func__, i);
continue;
}
// Set up encoder on connector if valid
TRACE("%s: Path #%" B_PRId32 ": Found encoder "
"%s\n", __func__, i,
get_encoder_name(encoder_type));
gConnector[connector_index]->encoder.valid
= true;
gConnector[connector_index]->encoder.object_id
= encoder_id;
gConnector[connector_index]->encoder.type
= encoder_type;
}
}
} else if (grph_obj_type == GRAPH_OBJECT_TYPE_ROUTER) {
@ -581,27 +597,13 @@ detect_connectors()
TRACE("%s: Path #%" B_PRId32 ": Found %s (0x%" B_PRIX32 ")\n",
__func__, i, get_connector_name(connector_type),
connector_type);
TRACE("%s: Path #%" B_PRId32 ": Found encoder %s\n", __func__,
i, get_encoder_name(encoder_type));
gConnector[connector_index]->valid = true;
gConnector[connector_index]->connector_flags = connector_flags;
gConnector[connector_index]->connector_type = connector_type;
gConnector[connector_index]->connector_object_id
gConnector[connector_index]->flags = connector_flags;
gConnector[connector_index]->type = connector_type;
gConnector[connector_index]->object_id
= connector_object_id;
gConnector[connector_index]->encoder_type = encoder_type;
gConnector[connector_index]->encoder_object_id = encoder_object_id;
connector_index++;
// radeon_add_atom_connector(dev,
// conn_id,
// le16_to_cpu(path-> usDeviceTag),
// connector_type, &ddc_bus,
// igp_lane_info,
// connector_object_id,
// &hpd,
// &router);
}
} // end for each display path
@ -645,7 +647,7 @@ detect_displays()
" Injecting first connector as a last resort.\n", __func__);
for (uint32 id = 0; id < ATOM_MAX_SUPPORTED_DEVICE; id++) {
// skip TV DAC connectors as likely fallback isn't for TV
if (gConnector[id]->encoder_type == VIDEO_ENCODER_TVDAC)
if (gConnector[id]->encoder.type == VIDEO_ENCODER_TVDAC)
continue;
gDisplay[0]->active = true;
gDisplay[0]->connector_index = id;
@ -672,8 +674,8 @@ debug_displays()
uint32 connector_index = gDisplay[id]->connector_index;
if (gDisplay[id]->active) {
uint32 connector_type = gConnector[connector_index]->connector_type;
uint32 encoder_type = gConnector[connector_index]->encoder_type;
uint32 connector_type = gConnector[connector_index]->type;
uint32 encoder_type = gConnector[connector_index]->encoder.type;
ERROR(" + connector: %s\n", get_connector_name(connector_type));
ERROR(" + encoder: %s\n", get_encoder_name(encoder_type));
@ -694,9 +696,9 @@ debug_connectors()
ERROR("Currently detected connectors=============\n");
for (uint32 id = 0; id < ATOM_MAX_SUPPORTED_DEVICE; id++) {
if (gConnector[id]->valid == true) {
uint32 connector_type = gConnector[id]->connector_type;
uint32 encoder_type = gConnector[id]->encoder_type;
uint16 gpio_id = gConnector[id]->connector_gpio_id;
uint32 connector_type = gConnector[id]->type;
uint32 encoder_type = gConnector[id]->encoder.type;
uint16 gpio_id = gConnector[id]->gpio_id;
ERROR("Connector #%" B_PRIu32 ")\n", id);
ERROR(" + connector: %s\n", get_connector_name(connector_type));
ERROR(" + encoder: %s\n", get_encoder_name(encoder_type));
@ -714,7 +716,7 @@ debug_connectors()
uint32
display_get_encoder_mode(uint32 connector_index)
{
uint32 connector_type = gConnector[connector_index]->connector_type;
uint32 connector_type = gConnector[connector_index]->type;
switch (connector_type) {
case VIDEO_CONNECTOR_DVII:
case VIDEO_CONNECTOR_HDMIB: /* HDMI-B is DL-DVI; analog works fine */

View File

@ -51,7 +51,7 @@ encoder_assign_crtc(uint8 id)
return;
uint16 connector_index = gDisplay[id]->connector_index;
uint16 encoder_id = gConnector[connector_index]->encoder_object_id;
uint16 encoder_id = gConnector[connector_index]->encoder.object_id;
switch (frev) {
case 1:
@ -177,7 +177,7 @@ encoder_mode_set(uint8 id, uint32 pixelClock)
{
uint32 connector_index = gDisplay[id]->connector_index;
switch (gConnector[connector_index]->encoder_object_id) {
switch (gConnector[connector_index]->encoder.object_id) {
case ENCODER_OBJECT_ID_INTERNAL_DAC1:
case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1:
case ENCODER_OBJECT_ID_INTERNAL_DAC2:
@ -225,9 +225,9 @@ encoder_digital_setup(uint8 id, uint32 pixelClock, int command)
memset(&args, 0, sizeof(args));
int index = 0;
uint16 connector_flags = gConnector[connector_index]->connector_flags;
uint16 connector_flags = gConnector[connector_index]->encoder.flags;
switch (gConnector[connector_index]->encoder_object_id) {
switch (gConnector[connector_index]->encoder.object_id) {
case ENCODER_OBJECT_ID_INTERNAL_LVDS:
index = GetIndexIntoMasterTable(COMMAND, LVDSEncoderControl);
break;
@ -343,7 +343,7 @@ encoder_analog_setup(uint8 id, uint32 pixelClock, int command)
DAC_ENCODER_CONTROL_PS_ALLOCATION args;
memset(&args, 0, sizeof(args));
switch (gConnector[connector_index]->encoder_object_id) {
switch (gConnector[connector_index]->encoder.object_id) {
case ENCODER_OBJECT_ID_INTERNAL_DAC1:
case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1:
index = GetIndexIntoMasterTable(COMMAND, DAC1EncoderControl);

View File

@ -371,7 +371,7 @@ bool
radeon_gpu_read_edid(uint32 connector, edid1_info *edid)
{
// ensure things are sane
uint32 gpio_id = gConnector[connector]->connector_gpio_id;
uint32 gpio_id = gConnector[connector]->gpio_id;
if (gGPIOInfo[gpio_id]->valid == false)
return false;
@ -399,11 +399,11 @@ radeon_gpu_read_edid(uint32 connector, edid1_info *edid)
status_t
radeon_gpu_i2c_attach(uint32 id, uint8 hw_line)
{
gConnector[id]->connector_gpio_id = 0;
gConnector[id]->gpio_id = 0;
for (uint32 i = 0; i < ATOM_MAX_SUPPORTED_DEVICE; i++) {
if (gGPIOInfo[i]->hw_line != hw_line)
continue;
gConnector[id]->connector_gpio_id = i;
gConnector[id]->gpio_id = i;
return B_OK;
}

View File

@ -140,7 +140,7 @@ radeon_set_display_mode(display_mode *mode)
// *** encoder prep
encoder_output_lock(true);
encoder_dpms_set(gConnector[connector_index]->encoder_object_id,
encoder_dpms_set(gConnector[connector_index]->encoder.object_id,
B_DPMS_OFF);
encoder_assign_crtc(id);
@ -166,7 +166,7 @@ radeon_set_display_mode(display_mode *mode)
display_crtc_lock(id, ATOM_DISABLE);
// *** encoder commit
encoder_dpms_set(gConnector[connector_index]->encoder_object_id,
encoder_dpms_set(gConnector[connector_index]->encoder.object_id,
B_DPMS_ON);
encoder_output_lock(false);
}

View File

@ -222,7 +222,7 @@ pll_set(uint8 pll_id, uint32 pixelClock, uint8 crtc_id)
// if (ss_enabled && (ss->type & ATOM_EXTERNAL_SS_MASK))
// args.v3.ucMiscInfo |= PIXEL_CLOCK_MISC_REF_DIV_SRC;
args.v3.ucTransmitterId
= gConnector[connector_index]->encoder_object_id;
= gConnector[connector_index]->encoder.object_id;
args.v3.ucEncoderMode = display_get_encoder_mode(connector_index);
break;
default: