* add video_electronics.c

(.c to keep compatibility with older C accelerants)
* use functions for decoding video_electronics
* thanks for the guidance Axel!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42668 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Alexander von Gluck IV
2011-08-21 17:30:55 +00:00
parent ed32703038
commit 3671476941
3 changed files with 86 additions and 32 deletions
@@ -27,28 +27,6 @@
#define VIDEO_CONNECTOR_TV 0x0E
const struct video_connectors {
uint32 type;
const char* name;
} kVideoConnector[] = {
{VIDEO_CONNECTOR_UNKNOWN, "Unknown"},
{VIDEO_CONNECTOR_VGA, "VGA" },
{VIDEO_CONNECTOR_DVII, "DVI-I"},
{VIDEO_CONNECTOR_DVID, "DVI-D"},
{VIDEO_CONNECTOR_DVIA, "DVI-A"},
{VIDEO_CONNECTOR_COMPOSITE, "Composite"},
{VIDEO_CONNECTOR_SVIDEO, "S-Video"},
{VIDEO_CONNECTOR_LVDS, "LVDS"},
{VIDEO_CONNECTOR_COMPONENT, "Component"},
{VIDEO_CONNECTOR_9DIN, "DIN"},
{VIDEO_CONNECTOR_DP, "DisplayPort"},
{VIDEO_CONNECTOR_EDP, "Embedded DisplayPort"},
{VIDEO_CONNECTOR_HDMIA, "HDMI A"},
{VIDEO_CONNECTOR_HDMIB, "HDMI B"},
{VIDEO_CONNECTOR_TV, "TV"},
};
// Video encoder types
#define VIDEO_ENCODER_NONE 0x00
#define VIDEO_ENCODER_DAC 0x01
@@ -57,16 +35,20 @@ const struct video_connectors {
#define VIDEO_ENCODER_TVDAC 0x04
const struct video_encoders {
uint32 type;
const char* name;
} kVideoEncoder[] = {
{VIDEO_ENCODER_NONE, "None"},
{VIDEO_ENCODER_DAC, "DAC"},
{VIDEO_ENCODER_TMDS, "TMDS"},
{VIDEO_ENCODER_LVDS, "LVDS"},
{VIDEO_ENCODER_TVDAC, "TV"},
};
// to ensure compatibility with C accelerants
#ifdef __cplusplus
extern "C" {
#endif
// mostly for debugging detected monitors
const char* decode_connector_name(uint32 connector);
const char* decode_encoder_name(uint32 encoder);
#ifdef __cplusplus
}
#endif
#endif /* _VIDEO_ELECTRONICS_H */
+1
View File
@@ -9,6 +9,7 @@ UsePrivateHeaders [ FDirName graphics common ] ;
StaticLibrary libaccelerantscommon.a :
compute_display_timing.cpp
create_display_modes.cpp
video_electronics.c
ddc.c
decode_edid.c
dump_edid.c
@@ -0,0 +1,71 @@
/*
* Copyright 2011, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Alexander von Gluck, [email protected]
*/
#include <KernelExport.h>
#include <stdio.h>
#include "video_electronics.h"
const char*
decode_connector_name(uint32 connector)
{
switch (connector) {
case VIDEO_CONNECTOR_VGA:
return "VGA";
case VIDEO_CONNECTOR_DVII:
return "DVI-I (Digital and Analog)";
case VIDEO_CONNECTOR_DVID:
return "DVI-D (Digital Only)";
case VIDEO_CONNECTOR_DVIA:
return "DVI-A (Analog Only)";
case VIDEO_CONNECTOR_COMPOSITE:
return "Composite";
case VIDEO_CONNECTOR_SVIDEO:
return "S-Video";
case VIDEO_CONNECTOR_LVDS:
return "LVDS Panel";
case VIDEO_CONNECTOR_COMPONENT:
return "Component";
case VIDEO_CONNECTOR_9DIN:
return "9-Pin DIN";
case VIDEO_CONNECTOR_DP:
return "DisplayPort";
case VIDEO_CONNECTOR_EDP:
return "Embedded DisplayPort";
case VIDEO_CONNECTOR_HDMIA:
return "HDMI A";
case VIDEO_CONNECTOR_HDMIB:
return "HDMI B";
case VIDEO_CONNECTOR_TV:
return "TV";
case VIDEO_CONNECTOR_UNKNOWN:
return "Unknown";
}
return "Connector Undefined";
}
const char*
decode_encoder_name(uint32 encoder)
{
switch (encoder) {
case VIDEO_ENCODER_NONE:
return "None";
case VIDEO_ENCODER_DAC:
return "DAC";
case VIDEO_ENCODER_TMDS:
return "TMDS";
case VIDEO_ENCODER_LVDS:
return "LVDS";
case VIDEO_ENCODER_TVDAC:
return "TV DAC";
}
return "Encoder Undefined";
}