diff --git a/include/nuttx/video/edid.h b/include/nuttx/video/edid.h index 3098275d1c2..39716a2545b 100644 --- a/include/nuttx/video/edid.h +++ b/include/nuttx/video/edid.h @@ -5,10 +5,10 @@ * Copyright (C) 2019 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * - * Reference: Wikipedia + * Reference: Wikipedia (initial version) * - * Some of structures in this file derive from FreeBSD which has a - * compatible 2-clause BSD license: + * Updated and extended with definitions from FreeBSD which has a compatible 2-clause BSD + * license: * * Copyright (c) 2006 Itronix Inc. All rights reserved. * Written by Garrett D'Amore for Itronix Inc. @@ -169,6 +169,8 @@ /* For digital input: */ #define EDID_DISPLAY_INPUT_VIDIF_SHIFT (0) /* Bits 0-3: Video interface */ +#define EDID_DISPLAY_INPUT_VIDIF_MASK (15 << EDID_DISPLAY_INPUT_VIDIF_SHIFT) +# define EDID_DISPLAY_INPUT_DFP1_COMPAT (1 << EDID_DISPLAY_INPUT_VIDIF_SHIFT) #define EDID_DISPLAY_INPUT_BITDEPTH_SHIFT (4) /* Bits 4-6: Bit depth */ #define EDID_DISPLAY_INPUT_BITDEPTH_MASK (7 << EDID_DISPLAY_INPUT_BITDEPTH_SHIFT) @@ -181,9 +183,13 @@ * supported */ #define EDID_DISPLAY_INPUT_SYNC (1 << 3) /* Bit 3: Separate sync supported */ #define EDID_DISPLAY_INPUT_BLANK2BLACK (1 << 4) /* Bit 4: Blank to black setup */ -#define EDID_DISPLAY_INPUT_LEVELS_SHIFT (0) /* Bits 5-6: Video white and sync levels, +#define EDID_DISPLAY_INPUT_LEVELS_SHIFT (5) /* Bits 5-6: Video white and sync levels, * relative to blank */ #define EDID_DISPLAY_INPUT_LEVELS_MASK (3 << EDID_DISPLAY_INPUT_LEVELS_SHIFT) +# define EDID_DISPLAY_INPUT_LEVEL_1 (0 << EDID_DISPLAY_INPUT_LEVELS_SHIFT) /* -0.7, 0.3V */ +# define EDID_DISPLAY_INPUT_LEVEL_2 (1 << EDID_DISPLAY_INPUT_LEVELS_SHIFT) /* -0.714, 0.286V */ +# define EDID_DISPLAY_INPUT_LEVEL_3 (2 << EDID_DISPLAY_INPUT_LEVELS_SHIFT) /* -1.0, 0.4V */ +# define EDID_DISPLAY_INPUT_LEVEL_4 (3 << EDID_DISPLAY_INPUT_LEVELS_SHIFT) /* -0.7, 0.0V */ /* Display Section: Supported Features */ @@ -205,6 +211,10 @@ #define EDID_DISPLAY_FEATURE_ATYPE_MASK (3 << EDID_DISPLAY_FEATURE_ATYPE_SHIFT) #define EDID_DISPLAY_FEATURE_DTYPE_SHIFT (3) /* Bits 3-4: Display type (digital) */ #define EDID_DISPLAY_FEATURE_DTYPE_MASK (3 << EDID_DISPLAY_FEATURE_DTYPE_SHIFT) +# define EDID_ISPLAY_FEATURES_DTYPE_MONO (0 << EDID_DISPLAY_FEATURE_DTYPE_SHIFT) +# define EDID_ISPLAY_FEATURES_DTYPE_RGB (1 << EDID_DISPLAY_FEATURE_DTYPE_SHIFT) +# define EDID_ISPLAY_FEATURES_DTYPE_NON_RGB (2 << EDID_DISPLAY_FEATURE_DTYPE_SHIFT) +# define EDID_ISPLAY_FEATURES_DTYPE_UNDEFINED (3 << EDID_DISPLAY_FEATURE_DTYPE_SHIFT) #define EDID_DISPLAY_FEATURE_DPMSOFF (1 << 5) /* Bit 5: DPMS active-off supported */ #define EDID_DISPLAY_FEATURE_DPMSSUSP (1 << 6) /* Bit 6: DPMS suspend supported */ #define EDID_DISPLAY_FEATURE_DPMSSTDBY (1 << 7) /* Bit 7: DPMS standby supported */ @@ -505,8 +515,9 @@ struct edid_range_s uint16_t er_min_hfreq; /* kHz */ uint16_t er_max_hfreq; /* kHz */ uint16_t er_max_clock; /* MHz */ - int er_have_gtf2; uint16_t er_gtf2_hfreq; + + bool er_have_gtf2; uint16_t er_gtf2_c; uint16_t er_gtf2_m; uint16_t er_gtf2_k; @@ -526,9 +537,9 @@ struct edid_info_s uint8_t edid_ext_block_count; uint16_t edid_product; uint32_t edid_serial; - int edid_year; - int edid_week; - int edid_have_range; + uint16_t edid_year; + uint8_t edid_week; + bool edid_have_range; struct edid_range_s edid_range; struct edid_chroma_s edid_chroma; @@ -563,4 +574,20 @@ struct edid_info_s int edid_parse(FAR const uint8_t *data, FAR struct edid_info_s *edid); +/**************************************************************************** + * Name: edid_dump + * + * Description: + * Dump the full content of the EDID + * + * Input Parameters: + * edid - The edid to be dumped + * + * Returned Value: + * None + * + ****************************************************************************/ + +void edid_dump(FAR const struct edid_info_s *edid); + #endif /* __INCLUDE_NUTTX_VIDEO_EDID_H */ diff --git a/include/nuttx/video/videomode.h b/include/nuttx/video/videomode.h index d137e6724f6..af326b83e4e 100644 --- a/include/nuttx/video/videomode.h +++ b/include/nuttx/video/videomode.h @@ -1,4 +1,4 @@ -/******************************************************************************************** +/**************************************************************************** * include/nuttx/video/videomode.h * EDID (Extended Display Identification Data) Format * @@ -38,20 +38,21 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ********************************************************************************************/ + ****************************************************************************/ #ifndef __INCLUDE_NUTTX_VIDEO_VIDEOMODE_H #define __INCLUDE_NUTTX_VIDEO_VIDEOMODE_H -/******************************************************************************************** +/**************************************************************************** * Included Files - ********************************************************************************************/ + ****************************************************************************/ #include +#include -/******************************************************************************************** +/**************************************************************************** * Pre-processor Definitions - ********************************************************************************************/ + ****************************************************************************/ /* Video mode flags used in struct hdmi_videomode_s */ @@ -70,12 +71,13 @@ #define VID_DBLCLK (1 << 13) #define VID_CLKDIV2 (1 << 14) -/******************************************************************************************** +/**************************************************************************** * Pre-processor Definitions - ********************************************************************************************/ + ****************************************************************************/ -/* This structure represents one video mode extracted from the EDID. CAREFUL: Fields - * may not change without also modification to initializer in videomode.c. +/* This structure represents one video mode extracted from the EDID. + * CAREFUL: Fields may not change without also modification to initializer + * in videomode_lookup.c. */ struct videomode_s @@ -94,11 +96,11 @@ struct videomode_s FAR const char *name; }; -/******************************************************************************************** +/**************************************************************************** * Public Function Prototypes - ********************************************************************************************/ + ****************************************************************************/ -/******************************************************************************************** +/**************************************************************************** * Name: sort_videomodes * * Description: @@ -117,19 +119,40 @@ struct videomode_s * Returned Value: * None * - ********************************************************************************************/ + ****************************************************************************/ void sort_videomodes(FAR struct videomode_s *modes, - FAR struct videomode_s **preferred, unsigned int nmodes); + FAR struct videomode_s **preferred, + unsigned int nmodes); -/******************************************************************************************** +/**************************************************************************** * Name: videomode_lookup * * Description: * Find the video mode in a look-up table * - ********************************************************************************************/ + ****************************************************************************/ FAR const struct videomode_s *videomode_lookup(FAR const char *name); +/**************************************************************************** + * Name: videomode_dump + * + * Description: + * Dump the content of a video mode one one line to the SYSLOG. + * + * Input Parameters: + * prefix - A string to print at the beginning of the line + * videomode - The videomode to be dumped + * terse - True: print only a minimal amount of data, sufficent to + * identify the video mode. + * + * Returned Value: + * None + * + ****************************************************************************/ + +void videomode_dump(FAR const char *prefix, + FAR const struct videomode_s *videomode, bool terse); + #endif /* __INCLUDE_NUTTX_VIDEO_VIDEOMODE_H */ diff --git a/video/edid/Make.defs b/video/edid/Make.defs index b86815cfc8d..cce7462d3be 100644 --- a/video/edid/Make.defs +++ b/video/edid/Make.defs @@ -38,7 +38,8 @@ ifeq ($(CONFIG_VIDEO_EDID),y) # Files required for EDID support ASRCS += -CSRCS += edid_parse.c videomode_lookup.c videomode_sort.c +CSRCS += edid_parse.c edid_dump.c +CSRCS += videomode_lookup.c videomode_sort.c videomode_dump.c # Include EDID build support diff --git a/video/edid/edid_dump.c b/video/edid/edid_dump.c new file mode 100644 index 00000000000..3bed76a3fcd --- /dev/null +++ b/video/edid/edid_dump.c @@ -0,0 +1,264 @@ + +/**************************************************************************** + * video/edid/edid_dump.c + * + * Copyright (C) 2019 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Derives from logic in FreeBSD which has an compatible 2-clause BSD + * license: + * + * Copyright (c) 2006 Itronix Inc. + * All rights reserved. + * + * Written by Garrett D'Amore for Itronix Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE NETBSD FOUNDATION BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include +#include + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: edid_dump + * + * Description: + * Dump the full content of the EDID + * + * Input Parameters: + * edid - The edid to be dumped + * + * Returned Value: + * None + * + ****************************************************************************/ + +void edid_dump(FAR const struct edid_info_s *edid) +{ + FAR const char *prefix; + int i; + + if (edid == NULL) + { + return; + } + + syslog(LOG_INFO, "%-16s[%s]\n", + "Manufacturer:", edid->edid_manufacturer); + syslog(LOG_INFO, "%-16s%u.%u\n", + "EDID Version:", edid->edid_version, edid->edid_revision); + + syslog(LOG_INFO, "%-16s%02x\n", + "Video Input:", edid->edid_video_input); + if ((edid->edid_video_input & EDID_DISPLAY_INPUT_DIGITAL) != 0) + { + if ((edid->edid_video_input & EDID_DISPLAY_INPUT_DFP1_COMPAT) != 0) + { + syslog(LOG_INFO, "%-16s%s\n", + "", "Digital (DFP 1.x compatible)\n"); + } + else + { + syslog(LOG_INFO, "%-16s%s\n", + "", "Digital"); + } + } + else + { + switch (edid->edid_video_input & EDID_DISPLAY_INPUT_LEVELS_MASK) + { + case EDID_DISPLAY_INPUT_LEVEL_1: + syslog(LOG_INFO, "%-16s-0.7, 0.3V\n", "", "Analog:"); + break; + + case EDID_DISPLAY_INPUT_LEVEL_2: + syslog(LOG_INFO, "%-16s-0.714, 0.286V\n", "", "Analog:"); + break; + + case EDID_DISPLAY_INPUT_LEVEL_3: + syslog(LOG_INFO, "%-16s-1.0, 0.4V\n", "", "Analog:"); + break; + + case EDID_DISPLAY_INPUT_LEVEL_4: + syslog(LOG_INFO, "%-16s-0.7, 0.0V\n", "", "Analog:"); + break; + } + + if ((edid->edid_video_input & EDID_DISPLAY_INPUT_BLANK2BLACK) != 0) + { + syslog(LOG_INFO, "%-16sBlank-to-black setup\n", ""); + } + + if ((edid->edid_video_input & EDID_DISPLAY_INPUT_SYNC) != 0) + { + syslog(LOG_INFO, " %-16sSeperate syncs\n", ""); + } + + if ((edid->edid_video_input & EDID_DISPLAY_INPUT_COMPOSITE) != 0) + { + syslog(LOG_INFO, "%-16sComposite sync\n", ""); + } + + if ((edid->edid_video_input & EDID_DISPLAY_INPUT_GREEN) != 0) + { + syslog(LOG_INFO, "%-16sSync on green\n", ""); + } + + if ((edid->edid_video_input & EDID_DISPLAY_INPUT_VSERRATED) != 0) + { + syslog(LOG_INFO, "%-16sSerrated vsync\n", ""); + } + } + + syslog(LOG_INFO, "Max Size: %d cm x %d cm\n", + edid->edid_max_hsize, edid->edid_max_vsize); + syslog(LOG_INFO, "Gamma: %u.%02\n", + edid->edid_gamma / 100, edid->edid_gamma % 100); + + syslog(LOG_INFO, "%-16s%02x\n", + "Features:", edid->edid_features); + if (edid->edid_features & EDID_DISPLAY_FEATURE_DPMSSTDBY) + { + syslog(LOG_INFO, "%-16sDPMS standby\n", ""); + } + + if (edid->edid_features & EDID_DISPLAY_FEATURE_DPMSSUSP) + { + syslog(LOG_INFO, "%-16sDPMS suspend\n", ""); + } + + if (edid->edid_features & EDID_DISPLAY_FEATURE_DPMSOFF) + { + syslog(LOG_INFO, "%-16sDPMS active-off\n", ""); + } + + switch (edid->edid_features & EDID_DISPLAY_FEATURE_DTYPE_MASK) + { + case EDID_ISPLAY_FEATURES_DTYPE_MONO: + syslog(LOG_INFO, "%-16sMonochrome\n", ""); + break; + + case EDID_ISPLAY_FEATURES_DTYPE_RGB: + syslog(LOG_INFO, "%-16sRGB\n", ""); + break; + + case EDID_ISPLAY_FEATURES_DTYPE_NON_RGB: + syslog(LOG_INFO, "%-16sMulticolor\n", ""); + break; + + case EDID_ISPLAY_FEATURES_DTYPE_UNDEFINED: + syslog(LOG_INFO, "%-16sUndefined monitor type\n", ""); + break; + } + + if (edid->edid_features & EDID_DISPLAY_FEATURE_STDRGB) + { + syslog(LOG_INFO, "%-16sStandard color space\n", ""); + } + + if (edid->edid_features & EDID_DISPLAY_FEATURE_MODE) + { + syslog(LOG_INFO, "%-16sPreferred timing\n", ""); + } + + if (edid->edid_features & EDID_DISPLAY_FEATURE_CONTINUOUS) + { + syslog(LOG_INFO, "%-16sDefault GTF supported\n", ""); + } + + syslog(LOG_INFO, "%-16s%d\n", + "Ext Blocks:", edid->edid_ext_block_count); + syslog(LOG_INFO, "%-16s%u\n", + "Product:", edid->edid_product); + syslog(LOG_INFO, "%-16s%lu\n", + "Serial No:", (unsigned long)edid->edid_serial); + syslog(LOG_INFO, "%-16sYear %d, Week %d\n", + "Manufactured:", edid->edid_year, edid->edid_week); + + if (edid->edid_have_range) + { + syslog(LOG_INFO, "%-16sHorizontal: %d - %d kHz\n", + "Range:", edid->edid_range.er_min_hfreq, edid->edid_range.er_max_hfreq); + syslog(LOG_INFO, "%-16sVertical: %d - %d Hz\n", + "", edid->edid_range.er_min_vfreq, edid->edid_range.er_max_vfreq); + syslog(LOG_INFO, "%-16sMax Dot Clock: %d MHz\n", + "", edid->edid_range.er_max_clock); + if (edid->edid_range.er_have_gtf2) + { + syslog(LOG_INFO, "%-16sGTF2 hfreq: %d\n", + "", edid->edid_range.er_gtf2_hfreq); + syslog(LOG_INFO, "%-16sGTF2 C: %d\n", + "", edid->edid_range.er_gtf2_c); + syslog(LOG_INFO, "%-16sGTF2 M: %d\n", + "", edid->edid_range.er_gtf2_m); + syslog(LOG_INFO, "%-16sGTF2 J: %d\n", + "", edid->edid_range.er_gtf2_j); + syslog(LOG_INFO, "%-16sGTF2 K: %d\n", + "", edid->edid_range.er_gtf2_k); + } + } + + syslog(LOG_INFO, "%-16sRed X: 0.%03d\n", + "Chroma Info:", edid->edid_chroma.ec_redx); + syslog(LOG_INFO, "%-16sRed Y: 0.%03d\n", + "", edid->edid_chroma.ec_redy); + syslog(LOG_INFO, "%-16sGrn X: 0.%03d\n", + "", edid->edid_chroma.ec_greenx); + syslog(LOG_INFO, "%-16sGrn Y: 0.%03d\n", + "", edid->edid_chroma.ec_greeny); + syslog(LOG_INFO, "%-16sBlu X: 0.%03d\n", + "", edid->edid_chroma.ec_bluex); + syslog(LOG_INFO, "%-16sBlu Y: 0.%03d\n", + "", edid->edid_chroma.ec_bluey); + syslog(LOG_INFO, "%-16sWht X: 0.%03d\n", + "", edid->edid_chroma.ec_whitex); + syslog(LOG_INFO, "%-16sWht Y: 0.%03d\n", + "", edid->edid_chroma.ec_whitey); + + prefix = "Video modes: "; + for (i = 0; i < edid->edid_nmodes; i++) + { + videomode_dump(prefix, &edid->edid_modes[i], false); + prefix = " "; + } + + if (edid->edid_preferred_mode) + { + prefix = "Preferred Mode: "; + videomode_dump(prefix, edid->edid_preferred_mode, true); + } +} diff --git a/video/edid/edid_parse.c b/video/edid/edid_parse.c index e1e566781a2..39a5927fe68 100644 --- a/video/edid/edid_parse.c +++ b/video/edid/edid_parse.c @@ -285,7 +285,9 @@ static bool edid_desc_timing(FAR const uint8_t *desc, mode->vsync_start = vactive + vsyncoff; mode->vsync_end = mode->vsync_start + vsyncwid; + mode->hskew = 0; mode->flags = 0; + mode->name = NULL; if ((flags & EDID_DESC_INTERLACED) != 0) { @@ -385,7 +387,7 @@ static void edid_block(FAR struct edid_info_s *edid, FAR const uint8_t *desc) break; case EDID_DESCTYPE_LIMITS: - edid->edid_have_range = 1; + edid->edid_have_range = true; edid->edid_range.er_min_vfreq = EDID_DESC_RANGE_MIN_VFREQ(desc); edid->edid_range.er_max_vfreq = EDID_DESC_RANGE_MAX_VFREQ(desc); edid->edid_range.er_min_hfreq = EDID_DESC_RANGE_MIN_HFREQ(desc); @@ -397,7 +399,7 @@ static void edid_block(FAR struct edid_info_s *edid, FAR const uint8_t *desc) break; } - edid->edid_range.er_have_gtf2 = 1; + edid->edid_range.er_have_gtf2 = true; edid->edid_range.er_gtf2_hfreq = EDID_DESC_RANGE_GTF2_HFREQ(desc); edid->edid_range.er_gtf2_c = EDID_DESC_RANGE_GTF2_C(desc); edid->edid_range.er_gtf2_m = EDID_DESC_RANGE_GTF2_M(desc); diff --git a/video/edid/videomode_dump.c b/video/edid/videomode_dump.c new file mode 100644 index 00000000000..ab08dd0d7e1 --- /dev/null +++ b/video/edid/videomode_dump.c @@ -0,0 +1,124 @@ +/**************************************************************************** + * video/edid/videomode_dump.c + * + * Copyright (C) 2019 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Derives from logic in FreeBSD which has an compatible 2-clause BSD + * license: + * + * Copyright (c) 2006 Itronix Inc. + * All rights reserved. + * + * Written by Garrett D'Amore for Itronix Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE NETBSD FOUNDATION BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define DIVIDE(x,y) (((x) + ((y) / 2)) / (y)) + +/**************************************************************************** + * Name: videomode_refresh + * + * Description: + * Calculate the refresh rate. + * + * Input Parameters: + * videomode - The videomode to be dumped + * + * Returned Value: + * None + * + ****************************************************************************/ + +static uint32_t videomode_refresh(FAR const struct videomode_s *videomode) +{ + return DIVIDE(DIVIDE(videomode->dotclock * 1000, videomode->htotal), + videomode->vtotal); +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: videomode_dump + * + * Description: + * Dump the content of a video mode one one line to the SYSLOG. + * + * Input Parameters: + * prefix - A string to print at the beginning of the line + * videomode - The videomode to be dumped + * terse - True: print only a minimal amount of data, sufficent to + * identify the video mode. + * + * Returned Value: + * None + * + ****************************************************************************/ + +void videomode_dump(FAR const char *prefix, + FAR const struct videomode_s *videomode, bool terse) +{ + if (videomode != NULL) + { + if (prefix != NULL) + { + syslog(LOG_INFO, "%s", prefix); + } + + syslog(LOG_INFO, "%ux%u @ %luHz", + videomode->hdisplay, videomode->vdisplay, + (unsigned long)videomode_refresh(videomode)); + + if (!terse) + { + syslog(LOG_INFO, " (%lu %u %u %u %u %u %u", + (unsigned long)videomode->dotclock, + videomode->hsync_start, videomode->hsync_end, videomode->htotal, + videomode->vsync_start, videomode->vsync_end, videomode->vtotal); + syslog(LOG_INFO, " %s%sH %s%sV)\n", + videomode->flags & VID_PHSYNC ? "+" : "", + videomode->flags & VID_NHSYNC ? "-" : "", + videomode->flags & VID_PVSYNC ? "+" : "", + videomode->flags & VID_NVSYNC ? "-" : ""); + } + } +} diff --git a/video/edid/videomode_sort.c b/video/edid/videomode_sort.c index 6fd13262b0d..e5b484ac210 100644 --- a/video/edid/videomode_sort.c +++ b/video/edid/videomode_sort.c @@ -81,7 +81,8 @@ static inline int _abs(int a) * Public Functions ****************************************************************************/ -/* Name: sort_videomodes +/**************************************************************************** + * Name: sort_videomodes * * Description: * Sort video modes by refresh rate, aspect ratio, then resolution. @@ -99,10 +100,11 @@ static inline int _abs(int a) * Returned Value: * None * - ********************************************************************************************/ + ****************************************************************************/ void sort_videomodes(FAR struct videomode_s *modes, - FAR struct videomode_s **preferred, unsigned int nmodes) + FAR struct videomode_s **preferred, + unsigned int nmodes) { FAR struct videomode_s *tmpmode = NULL; int aspect;