diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2012-04-16 09:16:19 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-04-20 07:45:21 -0400 |
commit | a988bc728f93b58d7d4c6657513c89a5f0eb4706 (patch) | |
tree | dd3f9657837c95b7af9919ce2cafcf045f9d2f04 /drivers/gpu/drm/drm_edid.c | |
parent | ee58808deca66bd0879562abf606e171752e8e15 (diff) |
drm: Parse color format information in CEA blocks
The CEA extension block has a field which describes which YCbCr modes are
supported by the device, use it to fill the drm_display_info color_formats
fields. Also the existence of a CEA extension block is used as indication
that the device supports RGB.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_edid.c')
-rw-r--r-- | drivers/gpu/drm/drm_edid.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 8a4580c2a1d0..e07491088400 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c | |||
@@ -1312,6 +1312,8 @@ add_detailed_modes(struct drm_connector *connector, struct edid *edid, | |||
1312 | #define VENDOR_BLOCK 0x03 | 1312 | #define VENDOR_BLOCK 0x03 |
1313 | #define SPEAKER_BLOCK 0x04 | 1313 | #define SPEAKER_BLOCK 0x04 |
1314 | #define EDID_BASIC_AUDIO (1 << 6) | 1314 | #define EDID_BASIC_AUDIO (1 << 6) |
1315 | #define EDID_CEA_YCRCB444 (1 << 5) | ||
1316 | #define EDID_CEA_YCRCB422 (1 << 4) | ||
1315 | 1317 | ||
1316 | /** | 1318 | /** |
1317 | * Search EDID for CEA extension block. | 1319 | * Search EDID for CEA extension block. |
@@ -1666,13 +1668,29 @@ static void drm_add_display_info(struct edid *edid, | |||
1666 | info->bpc = 0; | 1668 | info->bpc = 0; |
1667 | info->color_formats = 0; | 1669 | info->color_formats = 0; |
1668 | 1670 | ||
1669 | /* Only defined for 1.4 with digital displays */ | 1671 | if (edid->revision < 3) |
1670 | if (edid->revision < 4) | ||
1671 | return; | 1672 | return; |
1672 | 1673 | ||
1673 | if (!(edid->input & DRM_EDID_INPUT_DIGITAL)) | 1674 | if (!(edid->input & DRM_EDID_INPUT_DIGITAL)) |
1674 | return; | 1675 | return; |
1675 | 1676 | ||
1677 | /* Get data from CEA blocks if present */ | ||
1678 | edid_ext = drm_find_cea_extension(edid); | ||
1679 | if (edid_ext) { | ||
1680 | info->cea_rev = edid_ext[1]; | ||
1681 | |||
1682 | /* The existence of a CEA block should imply RGB support */ | ||
1683 | info->color_formats = DRM_COLOR_FORMAT_RGB444; | ||
1684 | if (edid_ext[3] & EDID_CEA_YCRCB444) | ||
1685 | info->color_formats |= DRM_COLOR_FORMAT_YCRCB444; | ||
1686 | if (edid_ext[3] & EDID_CEA_YCRCB422) | ||
1687 | info->color_formats |= DRM_COLOR_FORMAT_YCRCB422; | ||
1688 | } | ||
1689 | |||
1690 | /* Only defined for 1.4 with digital displays */ | ||
1691 | if (edid->revision < 4) | ||
1692 | return; | ||
1693 | |||
1676 | switch (edid->input & DRM_EDID_DIGITAL_DEPTH_MASK) { | 1694 | switch (edid->input & DRM_EDID_DIGITAL_DEPTH_MASK) { |
1677 | case DRM_EDID_DIGITAL_DEPTH_6: | 1695 | case DRM_EDID_DIGITAL_DEPTH_6: |
1678 | info->bpc = 6; | 1696 | info->bpc = 6; |
@@ -1698,18 +1716,11 @@ static void drm_add_display_info(struct edid *edid, | |||
1698 | break; | 1716 | break; |
1699 | } | 1717 | } |
1700 | 1718 | ||
1701 | info->color_formats = DRM_COLOR_FORMAT_RGB444; | 1719 | info->color_formats |= DRM_COLOR_FORMAT_RGB444; |
1702 | if (edid->features & DRM_EDID_FEATURE_RGB_YCRCB444) | 1720 | if (edid->features & DRM_EDID_FEATURE_RGB_YCRCB444) |
1703 | info->color_formats |= DRM_COLOR_FORMAT_YCRCB444; | 1721 | info->color_formats |= DRM_COLOR_FORMAT_YCRCB444; |
1704 | if (edid->features & DRM_EDID_FEATURE_RGB_YCRCB422) | 1722 | if (edid->features & DRM_EDID_FEATURE_RGB_YCRCB422) |
1705 | info->color_formats |= DRM_COLOR_FORMAT_YCRCB422; | 1723 | info->color_formats |= DRM_COLOR_FORMAT_YCRCB422; |
1706 | |||
1707 | /* Get data from CEA blocks if present */ | ||
1708 | edid_ext = drm_find_cea_extension(edid); | ||
1709 | if (!edid_ext) | ||
1710 | return; | ||
1711 | |||
1712 | info->cea_rev = edid_ext[1]; | ||
1713 | } | 1724 | } |
1714 | 1725 | ||
1715 | /** | 1726 | /** |