drm: Allow reading color primaries from EDID on Galileo

This commit is contained in:
Joshua Ashton 2023-11-14 19:30:07 +00:00
parent a54ffcab0f
commit 4d4cc40440

View file

@ -502,13 +502,8 @@ drm_hdr_parse_edid(drm_t *drm, struct connector *connector, const struct di_edid
} }
} }
if (connector->is_steam_deck_display)
{
drm_log.infof("[colorimetry]: Steam Deck (internal display) detected.");
bool bUseDefaultDeckColors = true;
const char *coloroverride = getenv( "GAMESCOPE_INTERNAL_COLORIMETRY_OVERRIDE" ); const char *coloroverride = getenv( "GAMESCOPE_INTERNAL_COLORIMETRY_OVERRIDE" );
if (coloroverride) if (coloroverride && drm_get_connector_type(connector->connector) == DRM_SCREEN_TYPE_INTERNAL)
{ {
if (sscanf( coloroverride, "%f %f %f %f %f %f %f %f", if (sscanf( coloroverride, "%f %f %f %f %f %f %f %f",
&metadata->colorimetry.primaries.r.x, &metadata->colorimetry.primaries.r.y, &metadata->colorimetry.primaries.r.x, &metadata->colorimetry.primaries.r.y,
@ -517,23 +512,22 @@ drm_hdr_parse_edid(drm_t *drm, struct connector *connector, const struct di_edid
&metadata->colorimetry.white.x, &metadata->colorimetry.white.y ) == 8 ) &metadata->colorimetry.white.x, &metadata->colorimetry.white.y ) == 8 )
{ {
drm_log.infof("[colorimetry]: GAMESCOPE_INTERNAL_COLORIMETRY_OVERRIDE detected"); drm_log.infof("[colorimetry]: GAMESCOPE_INTERNAL_COLORIMETRY_OVERRIDE detected");
bUseDefaultDeckColors = false;
} }
else else
{ {
drm_log.errorf("[colorimetry]: GAMESCOPE_INTERNAL_COLORIMETRY_OVERRIDE specified, but could not parse \"rx ry gx gy bx by wx wy\""); drm_log.errorf("[colorimetry]: GAMESCOPE_INTERNAL_COLORIMETRY_OVERRIDE specified, but could not parse \"rx ry gx gy bx by wx wy\"");
} }
} }
else if (connector->is_steam_deck_display && !connector->is_galileo_display)
if (bUseDefaultDeckColors)
{ {
drm_log.infof("[colorimetry]: Steam Deck (internal display) detected.");
// Hardcode Steam Deck display info to support // Hardcode Steam Deck display info to support
// BIOSes with missing info for this in EDID. // BIOSes with missing info for this in EDID.
drm_log.infof("[colorimetry]: using default steamdeck colorimetry"); drm_log.infof("[colorimetry]: using default steamdeck colorimetry");
metadata->colorimetry = displaycolorimetry_steamdeck_measured; metadata->colorimetry = displaycolorimetry_steamdeck_measured;
metadata->eotf = EOTF_Gamma22; metadata->eotf = EOTF_Gamma22;
} }
}
else if (chroma && chroma->red_x != 0.0f) else if (chroma && chroma->red_x != 0.0f)
{ {
drm_log.infof("[colorimetry]: EDID with colorimetry detected. Using it"); drm_log.infof("[colorimetry]: EDID with colorimetry detected. Using it");