mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 11:26:12 +08:00
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:
+1
-1
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
+13
-12
@@ -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))
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user