displayid: rename enum di_displayid_type_i_ii_vii_timing_aspect_ratio

This is also used by type III timings, and there is no other
competing aspect ratio enum in the DisplayID standard.

Signed-off-by: Simon Ser <contact@emersion.fr>
This commit is contained in:
Simon Ser 2024-03-21 17:09:18 +01:00
parent 8f4b0f768f
commit 179f481c8f
3 changed files with 36 additions and 36 deletions

View file

@ -43,42 +43,42 @@ print_displayid_display_params(const struct di_displayid_display_params *params)
}
static void
get_displayid_type_i_ii_vii_timing_aspect_ratio(enum di_displayid_type_i_ii_vii_timing_aspect_ratio ratio,
int *horiz, int *vert)
get_displayid_timing_aspect_ratio(enum di_displayid_timing_aspect_ratio ratio,
int *horiz, int *vert)
{
switch (ratio) {
case DI_DISPLAYID_TYPE_I_II_VII_TIMING_ASPECT_RATIO_1_1:
case DI_DISPLAYID_TIMING_ASPECT_RATIO_1_1:
*horiz = *vert = 1;
return;
case DI_DISPLAYID_TYPE_I_II_VII_TIMING_ASPECT_RATIO_5_4:
case DI_DISPLAYID_TIMING_ASPECT_RATIO_5_4:
*horiz = 5;
*vert = 4;
return;
case DI_DISPLAYID_TYPE_I_II_VII_TIMING_ASPECT_RATIO_4_3:
case DI_DISPLAYID_TIMING_ASPECT_RATIO_4_3:
*horiz = 4;
*vert = 3;
return;
case DI_DISPLAYID_TYPE_I_II_VII_TIMING_ASPECT_RATIO_15_9:
case DI_DISPLAYID_TIMING_ASPECT_RATIO_15_9:
*horiz = 15;
*vert = 9;
return;
case DI_DISPLAYID_TYPE_I_II_VII_TIMING_ASPECT_RATIO_16_9:
case DI_DISPLAYID_TIMING_ASPECT_RATIO_16_9:
*horiz = 16;
*vert = 9;
return;
case DI_DISPLAYID_TYPE_I_II_VII_TIMING_ASPECT_RATIO_16_10:
case DI_DISPLAYID_TIMING_ASPECT_RATIO_16_10:
*horiz = 16;
*vert = 10;
return;
case DI_DISPLAYID_TYPE_I_II_VII_TIMING_ASPECT_RATIO_64_27:
case DI_DISPLAYID_TIMING_ASPECT_RATIO_64_27:
*horiz = 64;
*vert = 27;
return;
case DI_DISPLAYID_TYPE_I_II_VII_TIMING_ASPECT_RATIO_256_135:
case DI_DISPLAYID_TIMING_ASPECT_RATIO_256_135:
*horiz = 256;
*vert = 135;
return;
case DI_DISPLAYID_TYPE_I_II_VII_TIMING_ASPECT_RATIO_UNDEFINED:
case DI_DISPLAYID_TIMING_ASPECT_RATIO_UNDEFINED:
*horiz = *vert = 0;
return;
}
@ -120,8 +120,8 @@ print_displayid_type_i_ii_vii_timing(const struct di_displayid_type_i_ii_vii_tim
int horiz_ratio, vert_ratio;
double pixel_clock_hz, refresh, horiz_freq_hz;
get_displayid_type_i_ii_vii_timing_aspect_ratio(t->aspect_ratio,
&horiz_ratio, &vert_ratio);
get_displayid_timing_aspect_ratio(t->aspect_ratio,
&horiz_ratio, &vert_ratio);
horiz_total = t->horiz_active + t->horiz_blank;
vert_total = t->vert_active + t->vert_blank;
@ -139,7 +139,7 @@ print_displayid_type_i_ii_vii_timing(const struct di_displayid_type_i_ii_vii_tim
printf(" %8.3f kHz %13.6f MHz", horiz_freq_hz / 1000,
t->pixel_clock_mhz);
printf(" (aspect ");
if (t->aspect_ratio == DI_DISPLAYID_TYPE_I_II_VII_TIMING_ASPECT_RATIO_UNDEFINED)
if (t->aspect_ratio == DI_DISPLAYID_TIMING_ASPECT_RATIO_UNDEFINED)
printf("undefined");
else
printf("%d:%d", horiz_ratio, vert_ratio);

View file

@ -159,19 +159,19 @@ _di_displayid_parse_type_1_7_timing(struct di_displayid_type_i_ii_vii_timing *t,
aspect_ratio = get_bit_range(data[3], 3, 0);
switch (aspect_ratio) {
case DI_DISPLAYID_TYPE_I_II_VII_TIMING_ASPECT_RATIO_1_1:
case DI_DISPLAYID_TYPE_I_II_VII_TIMING_ASPECT_RATIO_5_4:
case DI_DISPLAYID_TYPE_I_II_VII_TIMING_ASPECT_RATIO_4_3:
case DI_DISPLAYID_TYPE_I_II_VII_TIMING_ASPECT_RATIO_15_9:
case DI_DISPLAYID_TYPE_I_II_VII_TIMING_ASPECT_RATIO_16_9:
case DI_DISPLAYID_TYPE_I_II_VII_TIMING_ASPECT_RATIO_16_10:
case DI_DISPLAYID_TYPE_I_II_VII_TIMING_ASPECT_RATIO_64_27:
case DI_DISPLAYID_TYPE_I_II_VII_TIMING_ASPECT_RATIO_256_135:
case DI_DISPLAYID_TYPE_I_II_VII_TIMING_ASPECT_RATIO_UNDEFINED:
case DI_DISPLAYID_TIMING_ASPECT_RATIO_1_1:
case DI_DISPLAYID_TIMING_ASPECT_RATIO_5_4:
case DI_DISPLAYID_TIMING_ASPECT_RATIO_4_3:
case DI_DISPLAYID_TIMING_ASPECT_RATIO_15_9:
case DI_DISPLAYID_TIMING_ASPECT_RATIO_16_9:
case DI_DISPLAYID_TIMING_ASPECT_RATIO_16_10:
case DI_DISPLAYID_TIMING_ASPECT_RATIO_64_27:
case DI_DISPLAYID_TIMING_ASPECT_RATIO_256_135:
case DI_DISPLAYID_TIMING_ASPECT_RATIO_UNDEFINED:
t->aspect_ratio = aspect_ratio;
break;
default:
t->aspect_ratio = DI_DISPLAYID_TYPE_I_II_VII_TIMING_ASPECT_RATIO_UNDEFINED;
t->aspect_ratio = DI_DISPLAYID_TIMING_ASPECT_RATIO_UNDEFINED;
logger_add_failure(logger, "%s: Unknown aspect 0x%02x.",
prefix, aspect_ratio);
break;
@ -254,7 +254,7 @@ parse_type_ii_timing(struct di_displayid *displayid,
return false;
}
t->aspect_ratio = DI_DISPLAYID_TYPE_I_II_VII_TIMING_ASPECT_RATIO_UNDEFINED;
t->aspect_ratio = DI_DISPLAYID_TIMING_ASPECT_RATIO_UNDEFINED;
raw_pixel_clock = data[0] | (data[1] << 8) | (data[2] << 16);
t->pixel_clock_mhz = (double)(1 + raw_pixel_clock) * 0.01;

View file

@ -173,16 +173,16 @@ enum di_displayid_type_i_ii_vii_timing_stereo_3d {
DI_DISPLAYID_TYPE_I_II_VII_TIMING_STEREO_3D_USER = 0x02,
};
enum di_displayid_type_i_ii_vii_timing_aspect_ratio {
DI_DISPLAYID_TYPE_I_II_VII_TIMING_ASPECT_RATIO_1_1 = 0x00,
DI_DISPLAYID_TYPE_I_II_VII_TIMING_ASPECT_RATIO_5_4 = 0x01,
DI_DISPLAYID_TYPE_I_II_VII_TIMING_ASPECT_RATIO_4_3 = 0x02,
DI_DISPLAYID_TYPE_I_II_VII_TIMING_ASPECT_RATIO_15_9 = 0x03,
DI_DISPLAYID_TYPE_I_II_VII_TIMING_ASPECT_RATIO_16_9 = 0x04,
DI_DISPLAYID_TYPE_I_II_VII_TIMING_ASPECT_RATIO_16_10 = 0x05,
DI_DISPLAYID_TYPE_I_II_VII_TIMING_ASPECT_RATIO_64_27 = 0x06,
DI_DISPLAYID_TYPE_I_II_VII_TIMING_ASPECT_RATIO_256_135 = 0x07,
DI_DISPLAYID_TYPE_I_II_VII_TIMING_ASPECT_RATIO_UNDEFINED = 0x08,
enum di_displayid_timing_aspect_ratio {
DI_DISPLAYID_TIMING_ASPECT_RATIO_1_1 = 0x00,
DI_DISPLAYID_TIMING_ASPECT_RATIO_5_4 = 0x01,
DI_DISPLAYID_TIMING_ASPECT_RATIO_4_3 = 0x02,
DI_DISPLAYID_TIMING_ASPECT_RATIO_15_9 = 0x03,
DI_DISPLAYID_TIMING_ASPECT_RATIO_16_9 = 0x04,
DI_DISPLAYID_TIMING_ASPECT_RATIO_16_10 = 0x05,
DI_DISPLAYID_TIMING_ASPECT_RATIO_64_27 = 0x06,
DI_DISPLAYID_TIMING_ASPECT_RATIO_256_135 = 0x07,
DI_DISPLAYID_TIMING_ASPECT_RATIO_UNDEFINED = 0x08,
};
enum di_displayid_type_i_ii_vii_timing_sync_polarity {
@ -200,7 +200,7 @@ struct di_displayid_type_i_ii_vii_timing {
bool preferred;
enum di_displayid_type_i_ii_vii_timing_stereo_3d stereo_3d;
bool interlaced;
enum di_displayid_type_i_ii_vii_timing_aspect_ratio aspect_ratio;
enum di_displayid_timing_aspect_ratio aspect_ratio;
int32_t horiz_active, vert_active;
int32_t horiz_blank, vert_blank;
int32_t horiz_offset, vert_offset;