Skip to content

Commit 911a3b2

Browse files
Lawstorant1Naim
authored andcommitted
drm/edid: Parse more info from HDMI Forum vsdb
[Why] Drivers may need info about gaming features exposed by HDMI sinks. Add a central way of storing this information. [How] Adds flags and a struct to hold HDMI VRR information. `supported` here is an additional property which allows easier parsing in consumers and adds a bit of logic used to detect malformed VRRmin/VRRmax values. Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com> Tested-by: Bernhard Berger <bernhard.berger@gmail.com>
1 parent 0f8e718 commit 911a3b2

2 files changed

Lines changed: 87 additions & 1 deletion

File tree

drivers/gpu/drm/drm_edid.c

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6152,6 +6152,33 @@ static void drm_parse_ycbcr420_deep_color_info(struct drm_connector *connector,
61526152
hdmi->y420_dc_modes = dc_mask;
61536153
}
61546154

6155+
static void drm_parse_hdmi_gaming_info(struct drm_hdmi_info *hdmi, const u8 *db)
6156+
{
6157+
struct drm_hdmi_vrr_cap *vrr = &hdmi->vrr_cap;
6158+
6159+
if (cea_db_payload_len(db) < 8)
6160+
return;
6161+
6162+
hdmi->fapa_start_location = db[8] & DRM_EDID_FAPA_START_LOCATION;
6163+
hdmi->allm = db[8] & DRM_EDID_ALLM;
6164+
vrr->fva = db[8] & DRM_EDID_FVA;
6165+
vrr->cnmvrr = db[8] & DRM_EDID_CNMVRR;
6166+
vrr->cinema_vrr = db[8] & DRM_EDID_CINEMA_VRR;
6167+
vrr->mdelta = db[8] & DRM_EDID_MDELTA;
6168+
6169+
if (cea_db_payload_len(db) < 9)
6170+
return;
6171+
6172+
vrr->vrr_min = db[9] & DRM_EDID_VRR_MIN_MASK;
6173+
vrr->supported = (vrr->vrr_min > 0 && vrr->vrr_min <= 48);
6174+
6175+
if (cea_db_payload_len(db) < 10)
6176+
return;
6177+
6178+
vrr->vrr_max = (db[9] & DRM_EDID_VRR_MAX_UPPER_MASK) << 2 | db[10];
6179+
vrr->supported &= (vrr->vrr_max == 0 || vrr->vrr_max >= 100);
6180+
}
6181+
61556182
static void drm_parse_dsc_info(struct drm_hdmi_dsc_cap *hdmi_dsc,
61566183
const u8 *hf_scds)
61576184
{
@@ -6277,7 +6304,7 @@ static void drm_parse_hdmi_forum_scds(struct drm_connector *connector,
62776304
}
62786305

62796306
drm_parse_ycbcr420_deep_color_info(connector, hf_scds);
6280-
6307+
drm_parse_hdmi_gaming_info(&connector->display_info.hdmi, hf_scds);
62816308
if (cea_db_payload_len(hf_scds) >= 11 && hf_scds[11]) {
62826309
drm_parse_dsc_info(hdmi_dsc, hf_scds);
62836310
dsc_support = true;
@@ -6287,6 +6314,18 @@ static void drm_parse_hdmi_forum_scds(struct drm_connector *connector,
62876314
"[CONNECTOR:%d:%s] HF-VSDB: max TMDS clock: %d KHz, HDMI 2.1 support: %s, DSC 1.2 support: %s\n",
62886315
connector->base.id, connector->name,
62896316
max_tmds_clock, str_yes_no(max_frl_rate), str_yes_no(dsc_support));
6317+
drm_dbg_kms(connector->dev,
6318+
"[CONNECTOR:%d:%s] FAPA in blanking: %s, ALLM support: %s, Fast Vactive support: %s\n",
6319+
connector->base.id, connector->name, str_yes_no(hdmi->fapa_start_location),
6320+
str_yes_no(hdmi->allm), str_yes_no(hdmi->vrr_cap.fva));
6321+
drm_dbg_kms(connector->dev,
6322+
"[CONNECTOR:%d:%s] Negative M VRR support: %s, CinemaVRR support: %s, Mdelta: %d\n",
6323+
connector->base.id, connector->name, str_yes_no(hdmi->vrr_cap.cnmvrr),
6324+
str_yes_no(hdmi->vrr_cap.cinema_vrr), hdmi->vrr_cap.mdelta);
6325+
drm_dbg_kms(connector->dev,
6326+
"[CONNECTOR:%d:%s] VRRmin: %u, VRRmax: %u, VRR supported: %s\n",
6327+
connector->base.id, connector->name, hdmi->vrr_cap.vrr_min,
6328+
hdmi->vrr_cap.vrr_max, str_yes_no(hdmi->vrr_cap.supported));
62906329
}
62916330

62926331
static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector,

include/drm/drm_connector.h

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,44 @@ struct drm_scdc {
254254
struct drm_scrambling scrambling;
255255
};
256256

257+
/**
258+
* struct drm_hdmi_vrr_cap - Information about VRR capabilities of a HDMI sink
259+
*
260+
* Describes the VRR support provided by HDMI 2.1 sink. The information is
261+
* fetched fom additional HFVSDB blocks defined for HDMI 2.1.
262+
*/
263+
struct drm_hdmi_vrr_cap {
264+
/** @fva: flag for Fast VActive (Quick Frame Transport) support */
265+
bool fva;
266+
267+
/** @mcnmvrr: flag for Negative M VRR support */
268+
bool cnmvrr;
269+
270+
/** @mcinema_vrr: flag for Cinema VRR support */
271+
bool cinema_vrr;
272+
273+
/** @mdelta: flag for limited frame-to-frame compensation support */
274+
bool mdelta;
275+
276+
/**
277+
* @vrr_min : minimum supported variable refresh rate in Hz.
278+
* Valid values only inide 1 - 48 range
279+
*/
280+
u16 vrr_min;
281+
282+
/**
283+
* @vrr_max : maximum supported variable refresh rate in Hz (optional).
284+
* Valid values are either 0 (max based on video mode) or >= 100
285+
*/
286+
u16 vrr_max;
287+
288+
/**
289+
* @supported: flag for vrr support based on checking for VRRmin and
290+
* VRRmax values having correct values.
291+
*/
292+
bool supported;
293+
};
294+
257295
/**
258296
* struct drm_hdmi_dsc_cap - DSC capabilities of HDMI sink
259297
*
@@ -330,6 +368,15 @@ struct drm_hdmi_info {
330368
/** @max_lanes: supported by sink */
331369
u8 max_lanes;
332370

371+
/** @fapa_start_location: flag for the FAPA in blanking support */
372+
bool fapa_start_location;
373+
374+
/** @allm: flag for Auto Low Latency Mode support by sink */
375+
bool allm;
376+
377+
/** @vrr_cap: VRR capabilities of the sink */
378+
struct drm_hdmi_vrr_cap vrr_cap;
379+
333380
/** @dsc_cap: DSC capabilities of the sink */
334381
struct drm_hdmi_dsc_cap dsc_cap;
335382
};

0 commit comments

Comments
 (0)