Squashed commit of the following:

drivers/lcd/tda19988.c:  Now uses the new common videomode structure of include/nuttx/video/videomode.h as do other video components.

    video/, include/nuttx/video/videomode.h:  Separate EDID and from videomode managment.  They really are separate things.
This commit is contained in:
Gregory Nutt 2019-07-10 09:00:17 -06:00
parent d2e884f43c
commit 2811a297c7
12 changed files with 213 additions and 175 deletions

View file

@ -82,7 +82,7 @@
****************************************************************************/
static uint32_t
am335x_videomode_vrefresh(FAR const struct edid_videomode_s *videomode)
am335x_videomode_vrefresh(FAR const struct videomode_s *videomode)
{
uint32_t refresh;
@ -113,7 +113,7 @@ static uint32_t
****************************************************************************/
static bool
am335x_videomode_valid(FAR const struct edid_videomode_s *videomode)
am335x_videomode_valid(FAR const struct videomode_s *videomode)
{
size_t fbstride;
size_t fbsize;
@ -216,10 +216,10 @@ static bool
*
****************************************************************************/
static const struct edid_videomode_s *
static const struct videomode_s *
am335x_lcd_pickmode(FAR struct edid_info_s *ei)
{
FAR const struct edid_videomode_s *videomode;
FAR const struct videomode_s *videomode;
int n;
/* Get standard VGA as default */
@ -242,7 +242,7 @@ static const struct edid_videomode_s *
* are sorted on closest match to that mode.
*/
edid_sort_modes(ei->edid_modes, &ei->edid_preferred_mode, ei->edid_nmodes);
sort_videomodes(ei->edid_modes, &ei->edid_preferred_mode, ei->edid_nmodes);
/* Pick the first valid mode in the list */
@ -280,7 +280,7 @@ static const struct edid_videomode_s *
*
****************************************************************************/
void am335x_lcd_videomode(FAR const struct edid_videomode_s *videomode,
void am335x_lcd_videomode(FAR const struct videomode_s *videomode,
FAR struct am335x_panel_info_s *panel)
{
lcdinfo("Detected videomode: %dx%d @ %dKHz\n",
@ -355,9 +355,9 @@ void am335x_lcd_videomode(FAR const struct edid_videomode_s *videomode,
void am335x_lcd_edid(FAR const uint8_t *edid, size_t edid_len,
FAR struct am335x_panel_info_s *panel,
FAR struct edid_videomode_s *selected)
FAR const struct videomode_s **selected)
{
FAR const struct edid_videomode_s *videomode = NULL;
FAR const struct videomode_s *videomode = NULL;
struct edid_info_s ei;
/* Do we have EDID data? */
@ -380,7 +380,7 @@ void am335x_lcd_edid(FAR const uint8_t *edid, size_t edid_len,
if (videomode == NULL)
{
videomode = edid_mode_lookup("640x480x60");
videomode = videomode_lookup("640x480x60");
DEBUGASSERT(videomode != NULL);
}
@ -392,6 +392,6 @@ void am335x_lcd_edid(FAR const uint8_t *edid, size_t edid_len,
if (selected != NULL)
{
memcpy(selected, videomode, sizeof(struct edid_videomode_s));
*selected = videomode;
}
}

View file

@ -251,9 +251,9 @@ void am335x_lcdclear(nxgl_mxpixel_t color);
*
****************************************************************************/
struct edid_videomode_s; /* Forward reference */
struct videomode_s; /* Forward reference */
void am335x_lcd_videomode(FAR const struct edid_videomode_s *videomode,
void am335x_lcd_videomode(FAR const struct videomode_s *videomode,
FAR struct am335x_panel_info_s *panel);
/****************************************************************************
@ -281,7 +281,7 @@ void am335x_lcd_videomode(FAR const struct edid_videomode_s *videomode,
void am335x_lcd_edid(FAR const uint8_t *edid, size_t edid_len,
FAR struct am335x_panel_info_s *panel,
FAR struct edid_videomode_s *selected);
FAR const struct videomode_s **selected);
/****************************************************************************
* Name: am335x_backlight

View file

@ -47,6 +47,7 @@
#include <nuttx/lcd/tda19988.h>
#include <nuttx/video/fb.h>
#include <nuttx/video/edid.h>
#include <nuttx/video/videomode.h>
#include "am335x_lcdc.h"
#include "beaglebone-black.h"
@ -132,11 +133,13 @@ static int am335x_enable(const struct tda19988_lower_s *lower, bool enable)
int up_fbinitialize(int display)
{
FAR const struct edid_videomode_s *videomode;
FAR const struct videomode_s *videomode;
struct am335x_panel_info_s panel;
int ret;
#ifdef HAVE_TDA19988
TDA19988_HANDLE handle;
/* Initialize the TDA19988 GPIO interrupt input */
/* Initialize the TDA19988 lower half state instance */
/* Initialize the TDA19988 HDMI controller driver */
@ -149,7 +152,7 @@ int up_fbinitialize(int display)
#else
/* Lookup the video mode corresponding to the default video mode */
videomode = edid_mode_lookup(CONFIG_BEAGLEBONE_VIDEOMODE);
videomode = videomode_lookup(CONFIG_BEAGLEBONE_VIDEOMODE);
if (videomode == NULL)
{
lcderr("ERROR: Videomode \"%s\" is not supported.\n",
@ -158,7 +161,7 @@ int up_fbinitialize(int display)
}
#endif
/* Convert the video mode to a AM335X LCD panel configuration */
/* Convert the selected video mode to a AM335X LCD panel configuration */
am335x_lcd_videomode(videomode, &panel);
@ -172,10 +175,14 @@ int up_fbinitialize(int display)
}
#ifdef HAVE_TDA19988
/* Convert the EDID video mode to a TDA19988 video mode */
/* Initialize the HDMI controller using the TDA19988 video mode */
/* Initialize the HDMI controller using the selected video mode */
#warning Missing logic
ret = tda19988_videomode(handle, videomode);
if (ret < 0)
{
lcderr("ERROR: tda19988_videomode() failed: %d\n", ret);
return ret;
}
#endif
return OK;

View file

@ -172,7 +172,7 @@ static int tda19988_unlink(FAR struct inode *inode);
static int tda19988_hwinitialize(FAR struct tda1988_dev_s *priv);
static int tda19988_videomode_internal(FAR struct tda1988_dev_s *priv,
FAR const struct tda19988_videomode_s *mode);
FAR const struct videomode_s *mode);
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
static void tda19988_shutdown(FAR struct tda1988_dev_s *priv);
#endif
@ -229,7 +229,8 @@ static int tda19988_getregs(FAR const struct tda19988_i2c_s *dev,
return -1;
}
lcdinfo("Read: %02x:%02x->%02x\n", page, regaddr, *regval);
lcdinfo("Write: %02x<-%02x\n", regaddr, *regval);
lcderrdumpbuffer("Read:", regval, nregs);
return OK;
}
@ -263,7 +264,7 @@ static int tda19988_putreg(FAR const struct tda19988_i2c_s *dev,
return ret;
}
lcdinfo("Wrote: %02x:%02x<-%02x\n", page, regaddr, regval);
lcdinfo("Wrote: %02x<-%02x\n", regaddr, regval);
return OK;
}
@ -298,7 +299,7 @@ static int tda19988_putreg16(FAR const struct tda19988_i2c_s *dev,
return ret;
}
lcdinfo("Wrote: %02x:%02x<-%02x\n", page, regaddr, regval);
lcdinfo("Wrote: 02x<-%04x\n", regaddr, regval);
return OK;
}
@ -729,7 +730,7 @@ static int tda19988_fetch_edid(struct tda1988_dev_s *priv)
goto done;
}
blocks = priv->edid[EDID_TRAILER_NEXTENSIONS];
blocks = priv->edid[EDID_TRAILER_NEXTENSIONS_OFFSET];
if (blocks > 0)
{
FAR uint8_t *edid;
@ -1125,15 +1126,15 @@ static int tda19988_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
* of the initialization of the driver. This is
* equivalent to calling tda18899_videomode() within
* the OS.
* Argument: A reference to a tda19988_videomode_s structure
* Argument: A reference to a videomode_s structure
* instance.
* Returns: None
*/
case TDA19988_IOC_VIDEOMODE:
{
FAR const struct tda19988_videomode_s *mode =
(FAR const struct tda19988_videomode_s *)((uintptr_t)arg);
FAR const struct videomode_s *mode =
(FAR const struct videomode_s *)((uintptr_t)arg);
if (mode == NULL)
{
@ -1385,7 +1386,7 @@ done:
static int
tda19988_videomode_internal(FAR struct tda1988_dev_s *priv,
FAR const struct tda19988_videomode_s *mode)
FAR const struct videomode_s *mode)
{
uint16_t ref_pix;
uint16_t ref_line;
@ -1462,7 +1463,7 @@ static int
(mode->vsync_end - mode->vsync_start) / 2;
}
div = 148500 / mode->dot_clock;
div = 148500 / mode->dotclock;
if (div != 0)
{
if (--div > 3)
@ -1732,7 +1733,7 @@ TDA19988_HANDLE tda19988_register(FAR const char *devpath,
****************************************************************************/
int tda19988_videomode(TDA19988_HANDLE handle,
FAR const struct tda19988_videomode_s *mode)
FAR const struct videomode_s *mode)
{
FAR struct tda1988_dev_s *priv = (FAR struct tda1988_dev_s *)handle;
int ret;

View file

@ -46,6 +46,7 @@
#include <nuttx/irq.h>
#include <nuttx/i2c/i2c_master.h>
#include <nuttx/lcd/lcd_ioctl.h>
#include <nuttx/video/videomode.h>
#ifdef CONFIG_LCD_TDA19988
@ -59,30 +60,13 @@
* Description: Select the video mode. This must be done as part of the
* initialization of the driver. This is equivalent to
* calling tda18899_videomode() within the OS.
* Argument: A reference to a tda19988_videomode_s structure instance.
* See struct tda19988_videomode_s below.
* Argument: A reference to a videomode_s structure instance.
* See struct videomode_s below.
* Returns: None
*/
#define TDA19988_IOC_VIDEOMODE _LCDIOC(TDA19988_NIOCTL_BASE + 0)
/* Values for video mode flags */
#define VID_PHSYNC 0x0001
#define VID_NHSYNC 0x0002
#define VID_PVSYNC 0x0004
#define VID_NVSYNC 0x0008
#define VID_INTERLACE 0x0010
#define VID_DBLSCAN 0x0020
#define VID_CSYNC 0x0040
#define VID_PCSYNC 0x0080
#define VID_NCSYNC 0x0100
#define VID_HSKEW 0x0200
#define VID_BCAST 0x0400
#define VID_PIXMUX 0x1000
#define VID_DBLCLK 0x2000
#define VID_CLKDIV2 0x4000
/****************************************************************************
* Public Types
****************************************************************************/
@ -91,26 +75,6 @@
typedef FAR void *TDA19988_HANDLE;
/* Structure that provides the TDA19988 video mode */
struct tda19988_videomode_s
{
int dot_clock; /* Dot clock frequency in kHz. */
int hdisplay;
int hsync_start;
int hsync_end;
int htotal;
int vdisplay;
int vsync_start;
int vsync_end;
int vtotal;
int flags; /* Video mode flags; see above. */
int hskew;
};
/* This structure defines the I2C interface.
* REVISIT: This could be simplified because the CEC and HDMI reside on
* the same I2C bus (pins CSCL and CSCA).
@ -210,7 +174,7 @@ TDA19988_HANDLE tda19988_register(FAR const char *devpath,
****************************************************************************/
int tda19988_videomode(TDA19988_HANDLE handle,
FAR const struct tda19988_videomode_s *mode);
FAR const struct videomode_s *mode);
/****************************************************************************
* Name: tda19988_read_edid

View file

@ -50,6 +50,7 @@
********************************************************************************************/
#include <stdint.h>
#include <nuttx/video/videomode.h>
/********************************************************************************************
* Pre-processor Definitions
@ -479,46 +480,10 @@
* from manufacturer. However, the value is
* later used by DDDB. */
/* Video mode flags used in struct hdmi_videomode_s */
#define VID_PHSYNC (1 << 0)
#define VID_NHSYNC (1 << 1)
#define VID_PVSYNC (1 << 2)
#define VID_NVSYNC (1 << 3)
#define VID_INTERLACE (1 << 4)
#define VID_DBLSCAN (1 << 5)
#define VID_CSYNC (1 << 6)
#define VID_PCSYNC (1 << 7)
#define VID_NCSYNC (1 << 8)
#define VID_HSKEW (1 << 9)
#define VID_BCAST (1 << 10)
#define VID_PIXMUX (1 << 11)
#define VID_DBLCLK (1 << 12)
#define VID_CLKDIV2 (1 << 13)
/********************************************************************************************
* Pre-processor Definitions
********************************************************************************************/
/* This structure represents one video mode extracted from the EDID. CAREFUL: Fields
* may not change without also modification to initializer in edid_videomode.c.
*/
struct edid_videomode_s
{
uint32_t dotclock; /* Dot clock frequency in kHz. */
uint16_t hdisplay;
uint16_t hsync_start;
uint16_t hsync_end;
uint16_t htotal;
uint16_t vdisplay;
uint16_t vsync_start;
uint16_t vsync_end;
uint16_t vtotal;
uint16_t flags; /* Video mode flags; see above. */
FAR const char *name;
};
/* These structures is a user-friendly digest of the EDID data. */
struct edid_chroma_s
@ -570,9 +535,9 @@ struct edid_info_s
/* Parsed modes */
FAR struct edid_videomode_s *edid_preferred_mode;
FAR struct videomode_s *edid_preferred_mode;
int edid_nmodes;
struct edid_videomode_s edid_modes[64];
struct videomode_s edid_modes[64];
};
/********************************************************************************************
@ -598,38 +563,4 @@ struct edid_info_s
int edid_parse(FAR const uint8_t *data, FAR struct edid_info_s *edid);
/********************************************************************************************
* Name: edid_sort_modes
*
* Description:
* Sort video modes by refresh rate, aspect ratio, then resolution.
* Preferred mode or largest mode is first in the list and other modes
* are sorted on closest match to that mode.
*
* Note that the aspect ratio calculation treats "close" aspect ratios
* (within 12.5%) as the same for this purpose.
*
* Input Parameters:
* modes - A reference to the first entry in a list of video modes
* preferred - A pointer to the pointer to the preferred mode in the list
* nmodes - The number of modes in the list
*
* Returned Value:
* None
*
********************************************************************************************/
void edid_sort_modes(FAR struct edid_videomode_s *modes,
FAR struct edid_videomode_s **preferred, unsigned int nmodes);
/********************************************************************************************
* Name: edid_mode_lookup
*
* Description:
* Find the video mode in a look-up table
*
********************************************************************************************/
FAR const struct edid_videomode_s *edid_mode_lookup(FAR const char *name);
#endif /* __INCLUDE_NUTTX_VIDEO_EDID_H */

View file

@ -0,0 +1,135 @@
/********************************************************************************************
* include/nuttx/video/videomode.h
* EDID (Extended Display Identification Data) Format
*
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Some of structures in this file derive 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.
*
* 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.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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
* COPYRIGHT OWNER OR CONTRIBUTORS 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.
*
********************************************************************************************/
#ifndef __INCLUDE_NUTTX_VIDEO_VIDEOMODE_H
#define __INCLUDE_NUTTX_VIDEO_VIDEOMODE_H
/********************************************************************************************
* Included Files
********************************************************************************************/
#include <stdint.h>
/********************************************************************************************
* Pre-processor Definitions
********************************************************************************************/
/* Video mode flags used in struct hdmi_videomode_s */
#define VID_PHSYNC (1 << 0)
#define VID_NHSYNC (1 << 1)
#define VID_PVSYNC (1 << 2)
#define VID_NVSYNC (1 << 3)
#define VID_INTERLACE (1 << 4)
#define VID_DBLSCAN (1 << 5)
#define VID_CSYNC (1 << 6)
#define VID_PCSYNC (1 << 7)
#define VID_NCSYNC (1 << 8)
#define VID_HSKEW (1 << 9)
#define VID_BCAST (1 << 10)
#define VID_PIXMUX (1 << 12)
#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.
*/
struct videomode_s
{
uint32_t dotclock; /* Dot clock frequency in kHz. */
uint16_t hdisplay;
uint16_t hsync_start;
uint16_t hsync_end;
uint16_t htotal;
uint16_t vdisplay;
uint16_t vsync_start;
uint16_t vsync_end;
uint16_t vtotal;
uint16_t hskew;
uint16_t flags; /* Video mode flags; see above. */
FAR const char *name;
};
/********************************************************************************************
* Public Function Prototypes
********************************************************************************************/
/********************************************************************************************
* Name: sort_videomodes
*
* Description:
* Sort video modes by refresh rate, aspect ratio, then resolution.
* Preferred mode or largest mode is first in the list and other modes
* are sorted on closest match to that mode.
*
* Note that the aspect ratio calculation treats "close" aspect ratios
* (within 12.5%) as the same for this purpose.
*
* Input Parameters:
* modes - A reference to the first entry in a list of video modes
* preferred - A pointer to the pointer to the preferred mode in the list
* nmodes - The number of modes in the list
*
* Returned Value:
* None
*
********************************************************************************************/
void sort_videomodes(FAR struct videomode_s *modes,
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);
#endif /* __INCLUDE_NUTTX_VIDEO_VIDEOMODE_H */

View file

@ -4,7 +4,7 @@
#
config VIDEO_EDID
bool "EDID Support"
bool "EDID / Videomode Support"
default n
---help---
Enable support for managing EDID data EDID (Extended Display

View file

@ -38,7 +38,7 @@ ifeq ($(CONFIG_VIDEO_EDID),y)
# Files required for EDID support
ASRCS +=
CSRCS += edid_parse.c edid_videomode.c edid_sort.c
CSRCS += edid_parse.c videomode_lookup.c videomode_sort.c
# Include EDID build support

View file

@ -52,6 +52,7 @@
#include <errno.h>
#include <nuttx/video/edid.h>
#include <nuttx/video/videomode.h>
/****************************************************************************
* Pre-processor Definitions
@ -134,9 +135,9 @@ static bool edid_valid(FAR const uint8_t *data)
****************************************************************************/
static bool edid_std_timing(FAR const uint8_t *stdtim,
FAR struct edid_videomode_s *mode)
FAR struct videomode_s *mode)
{
FAR const struct edid_videomode_s *lookup;
FAR const struct videomode_s *lookup;
char name[80];
unsigned x;
unsigned y;
@ -175,7 +176,7 @@ static bool edid_std_timing(FAR const uint8_t *stdtim,
/* First try to lookup the mode as a DMT timing */
snprintf(name, sizeof(name), "%dx%dx%d", x, y, f);
if ((lookup = edid_mode_lookup(name)) != NULL)
if ((lookup = videomode_lookup(name)) != NULL)
{
*mode = *lookup;
}
@ -205,9 +206,9 @@ static bool edid_std_timing(FAR const uint8_t *stdtim,
*
****************************************************************************/
static struct edid_videomode_s *
static struct videomode_s *
edid_search_mode(FAR struct edid_info_s *edid,
FAR const struct edid_videomode_s *mode)
FAR const struct videomode_s *mode)
{
int refresh;
int i;
@ -238,7 +239,7 @@ static struct edid_videomode_s *
****************************************************************************/
static bool edid_desc_timing(FAR const uint8_t *desc,
FAR struct edid_videomode_s *mode)
FAR struct videomode_s *mode)
{
uint16_t hactive;
unsigned int hblank;
@ -322,8 +323,8 @@ static bool edid_desc_timing(FAR const uint8_t *desc,
static void edid_block(FAR struct edid_info_s *edid, FAR const uint8_t *desc)
{
struct edid_videomode_s mode;
FAR struct edid_videomode_s *exist_mode;
struct videomode_s mode;
FAR struct videomode_s *exist_mode;
uint16_t pixclk;
int i;
@ -461,7 +462,7 @@ static void edid_block(FAR struct edid_info_s *edid, FAR const uint8_t *desc)
int edid_parse(FAR const uint8_t *data, FAR struct edid_info_s *edid)
{
FAR const struct edid_videomode_s *mode;
FAR const struct videomode_s *mode;
uint16_t manufacturer;
uint16_t estmodes;
uint8_t gamma;
@ -532,7 +533,7 @@ int edid_parse(FAR const uint8_t *data, FAR struct edid_info_s *edid)
{
if (estmodes & (1 << i))
{
mode = edid_mode_lookup(g_edid_modes[i]);
mode = videomode_lookup(g_edid_modes[i]);
if (mode != NULL)
{
edid->edid_modes[edid->edid_nmodes] = *mode;
@ -550,8 +551,8 @@ int edid_parse(FAR const uint8_t *data, FAR struct edid_info_s *edid)
for (i = 0; i < EDID_STDTIMING_NUMBER; i++)
{
struct edid_videomode_s stdmode;
FAR struct edid_videomode_s *exist_mode;
struct videomode_s stdmode;
FAR struct videomode_s *exist_mode;
if (edid_std_timing(data + EDID_STDTIMING_OFFSET + i * 2, &stdmode))
{

View file

@ -1,5 +1,5 @@
/****************************************************************************
* video/edid/edid_parse.c
* video/edid/videomode_lookup.c
*
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@ -48,7 +48,7 @@
#include <sys/types.h>
#include <string.h>
#include <nuttx/video/edid.h>
#include <nuttx/video/videomode.h>
/****************************************************************************
* Pre-processor Definitions
@ -65,14 +65,14 @@
#define M(nm,hr,vr,clk,hs,he,ht,vs,ve,vt,f) \
{ \
clk, hr, hs, he, ht, vr, vs, ve, vt, f, nm \
clk, hr, hs, he, ht, vr, vs, ve, vt, 0, f, nm \
}
/****************************************************************************
* Private Data
****************************************************************************/
static const struct edid_videomode_s g_videomodes[] =
static const struct videomode_s g_videomodes[] =
{
M("640x350x85", 640, 350, 31500, 672, 736, 832, 382, 385, 445, HP|VN),
M("640x400x85", 640, 400, 31500, 672, 736, 832, 401, 404, 445, HN|VP),
@ -185,7 +185,7 @@ static const int g_nvideomodes = 46;
*
****************************************************************************/
FAR const struct edid_videomode_s *edid_mode_lookup(FAR const char *name)
FAR const struct videomode_s *edid_mode_lookup(FAR const char *name)
{
int i;

View file

@ -1,5 +1,5 @@
/****************************************************************************
* video/edid/edid_sort.c
* video/edid/videomode_sort.c
*
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@ -43,7 +43,7 @@
#include <sys/types.h>
#include <string.h>
#include <nuttx/video/edid.h>
#include <nuttx/video/videomode.h>
/****************************************************************************
* Pre-processor Definitions
@ -55,10 +55,10 @@
* Private Functions
****************************************************************************/
static inline void swap_modes(FAR struct edid_videomode_s *left,
FAR struct edid_videomode_s *right)
static inline void videomode_swap(FAR struct videomode_s *left,
FAR struct videomode_s *right)
{
struct edid_videomode_s temp;
struct videomode_s temp;
temp = *left;
*left = *right;
@ -81,8 +81,7 @@ static inline int _abs(int a)
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: edid_sort_modes
/* Name: sort_videomodes
*
* Description:
* Sort video modes by refresh rate, aspect ratio, then resolution.
@ -100,12 +99,12 @@ static inline int _abs(int a)
* Returned Value:
* None
*
****************************************************************************/
********************************************************************************************/
void edid_sort_modes(FAR struct edid_videomode_s *modes,
FAR struct edid_videomode_s **preferred, unsigned int nmodes)
void sort_videomodes(FAR struct videomode_s *modes,
FAR struct videomode_s **preferred, unsigned int nmodes)
{
FAR struct edid_videomode_s *tmpmode = NULL;
FAR struct videomode_s *tmpmode = NULL;
int aspect;
int refresh;
int hbest;
@ -131,7 +130,7 @@ void edid_sort_modes(FAR struct edid_videomode_s *modes,
(*preferred)->htotal), (*preferred)->vtotal);
if (*preferred != modes)
{
swap_modes(*preferred, modes);
videomode_swap(*preferred, modes);
*preferred = modes;
}
}
@ -165,7 +164,7 @@ void edid_sort_modes(FAR struct edid_videomode_s *modes,
tmpmode->htotal), tmpmode->vtotal);
if (tmpmode != modes)
{
swap_modes(tmpmode, modes);
videomode_swap(tmpmode, modes);
}
}
@ -220,7 +219,7 @@ void edid_sort_modes(FAR struct edid_videomode_s *modes,
if (tmpmode != &modes[j])
{
swap_modes(tmpmode, &modes[j]);
videomode_swap(tmpmode, &modes[j]);
}
}
}