drm/edid: store quirks in display info

Although the quirks are internal to EDID parsing, it'll be helpful to
store them in display info to avoid having to pass them around.

This will also help separate adding probed modes (which needs the
quirks) from updating display info.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/819b908f64ad2d158245917f436f24d33a65b95d.1672826282.git.jani.nikula@intel.com
This commit is contained in:
Jani Nikula 2023-01-04 12:05:27 +02:00
parent 852be13f3b
commit 783dedc535
2 changed files with 26 additions and 21 deletions

View File

@ -6428,18 +6428,20 @@ static void drm_reset_display_info(struct drm_connector *connector)
kfree(info->vics);
info->vics = NULL;
info->vics_len = 0;
info->quirks = 0;
}
static u32 update_display_info(struct drm_connector *connector,
const struct drm_edid *drm_edid)
static void update_display_info(struct drm_connector *connector,
const struct drm_edid *drm_edid)
{
struct drm_display_info *info = &connector->display_info;
const struct edid *edid = drm_edid->edid;
u32 quirks = edid_get_quirks(drm_edid);
drm_reset_display_info(connector);
info->quirks = edid_get_quirks(drm_edid);
info->width_mm = edid->width_cm * 10;
info->height_mm = edid->height_cm * 10;
@ -6510,17 +6512,15 @@ static u32 update_display_info(struct drm_connector *connector,
drm_update_mso(connector, drm_edid);
out:
if (quirks & EDID_QUIRK_NON_DESKTOP) {
if (info->quirks & EDID_QUIRK_NON_DESKTOP) {
drm_dbg_kms(connector->dev, "[CONNECTOR:%d:%s] Non-desktop display%s\n",
connector->base.id, connector->name,
info->non_desktop ? " (redundant quirk)" : "");
info->non_desktop = true;
}
if (quirks & EDID_QUIRK_CAP_DSC_15BPP)
if (info->quirks & EDID_QUIRK_CAP_DSC_15BPP)
info->max_dsc_bpp = 15;
return quirks;
}
static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *dev,
@ -6618,8 +6618,8 @@ static int add_displayid_detailed_modes(struct drm_connector *connector,
static int _drm_edid_connector_update(struct drm_connector *connector,
const struct drm_edid *drm_edid)
{
struct drm_display_info *info = &connector->display_info;
int num_modes = 0;
u32 quirks;
if (!drm_edid) {
drm_reset_display_info(connector);
@ -6632,7 +6632,7 @@ static int _drm_edid_connector_update(struct drm_connector *connector,
* To avoid multiple parsing of same block, lets parse that map
* from sink info, before parsing CEA modes.
*/
quirks = update_display_info(connector, drm_edid);
update_display_info(connector, drm_edid);
/* Depends on info->cea_rev set by update_display_info() above */
drm_edid_to_eld(connector, drm_edid);
@ -6651,7 +6651,7 @@ static int _drm_edid_connector_update(struct drm_connector *connector,
*
* XXX order for additional mode types in extension blocks?
*/
num_modes += add_detailed_modes(connector, drm_edid, quirks);
num_modes += add_detailed_modes(connector, drm_edid, info->quirks);
num_modes += add_cvt_modes(connector, drm_edid);
num_modes += add_standard_modes(connector, drm_edid);
num_modes += add_established_modes(connector, drm_edid);
@ -6661,20 +6661,20 @@ static int _drm_edid_connector_update(struct drm_connector *connector,
if (drm_edid->edid->features & DRM_EDID_FEATURE_CONTINUOUS_FREQ)
num_modes += add_inferred_modes(connector, drm_edid);
if (quirks & (EDID_QUIRK_PREFER_LARGE_60 | EDID_QUIRK_PREFER_LARGE_75))
edid_fixup_preferred(connector, quirks);
if (info->quirks & (EDID_QUIRK_PREFER_LARGE_60 | EDID_QUIRK_PREFER_LARGE_75))
edid_fixup_preferred(connector, info->quirks);
if (quirks & EDID_QUIRK_FORCE_6BPC)
connector->display_info.bpc = 6;
if (info->quirks & EDID_QUIRK_FORCE_6BPC)
info->bpc = 6;
if (quirks & EDID_QUIRK_FORCE_8BPC)
connector->display_info.bpc = 8;
if (info->quirks & EDID_QUIRK_FORCE_8BPC)
info->bpc = 8;
if (quirks & EDID_QUIRK_FORCE_10BPC)
connector->display_info.bpc = 10;
if (info->quirks & EDID_QUIRK_FORCE_10BPC)
info->bpc = 10;
if (quirks & EDID_QUIRK_FORCE_12BPC)
connector->display_info.bpc = 12;
if (info->quirks & EDID_QUIRK_FORCE_12BPC)
info->bpc = 12;
return num_modes;
}

View File

@ -728,6 +728,11 @@ struct drm_display_info {
* @vics_len: Number of elements in vics. Internal to EDID parsing.
*/
int vics_len;
/**
* @quirks: EDID based quirks. Internal to EDID parsing.
*/
u32 quirks;
};
int drm_display_info_set_bus_formats(struct drm_display_info *info,