Skip to content

Commit 2570fe2

Browse files
contactshashanksharmavsyrjala
authored andcommitted
drm: add helper functions for YCBCR420 handling
This patch adds helper functions for YCBCR 420 handling. These functions do: - check if a given video mode is YCBCR 420 only mode. - check if a given video mode is YCBCR 420 also mode. V2: Added YCBCR functions as helpers in DRM layer, instead of keeping it in I915 layer. V3: Added handling for YCBCR-420 only modes too. V4: EXPORT_SYMBOL(drm_find_hdmi_output_type) V5: Addressed review comments from Danvet: - %s/drm_find_hdmi_output_type/drm_display_info_hdmi_output_type - %s/drm_can_support_ycbcr_output/drm_display_supports_ycbcr_output - %s/drm_can_support_this_ycbcr_output/ drm_display_supports_this_ycbcr_output - pass drm_display_info instead of drm_connector for consistency - For drm_get_highest_quality_ycbcr_supported doc, move the variable description above, and then the function description. V6: Add only YCBCR420 helpers (Ville) V7: Addressed review comments from Ville - Remove cea_vic_valid() check. - Fix indentation. - Make input parameters to helpers, const. Cc: Ville Syrjala <ville.syrjala@linux.intel.com> Cc: Jose Abreu <Jose.Abreu@synopsys.com> Cc: Daniel Vetter <daniel.vetter@intel.com> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/1499960000-9232-9-git-send-email-shashank.sharma@intel.com [vsyrjala: Fix sparse indentation warn] Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
1 parent e6a9a2c commit 2570fe2

2 files changed

Lines changed: 64 additions & 0 deletions

File tree

‎drivers/gpu/drm/drm_modes.c‎

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,3 +1605,61 @@ int drm_mode_convert_umode(struct drm_display_mode *out,
16051605
out:
16061606
return ret;
16071607
}
1608+
1609+
/**
1610+
* drm_mode_is_420_only - if a given videomode can be only supported in YCBCR420
1611+
* output format
1612+
*
1613+
* @connector: drm connector under action.
1614+
* @mode: video mode to be tested.
1615+
*
1616+
* Returns:
1617+
* true if the mode can be supported in YCBCR420 format
1618+
* false if not.
1619+
*/
1620+
bool drm_mode_is_420_only(const struct drm_display_info *display,
1621+
const struct drm_display_mode *mode)
1622+
{
1623+
u8 vic = drm_match_cea_mode(mode);
1624+
1625+
return test_bit(vic, display->hdmi.y420_vdb_modes);
1626+
}
1627+
EXPORT_SYMBOL(drm_mode_is_420_only);
1628+
1629+
/**
1630+
* drm_mode_is_420_also - if a given videomode can be supported in YCBCR420
1631+
* output format also (along with RGB/YCBCR444/422)
1632+
*
1633+
* @display: display under action.
1634+
* @mode: video mode to be tested.
1635+
*
1636+
* Returns:
1637+
* true if the mode can be support YCBCR420 format
1638+
* false if not.
1639+
*/
1640+
bool drm_mode_is_420_also(const struct drm_display_info *display,
1641+
const struct drm_display_mode *mode)
1642+
{
1643+
u8 vic = drm_match_cea_mode(mode);
1644+
1645+
return test_bit(vic, display->hdmi.y420_cmdb_modes);
1646+
}
1647+
EXPORT_SYMBOL(drm_mode_is_420_also);
1648+
/**
1649+
* drm_mode_is_420 - if a given videomode can be supported in YCBCR420
1650+
* output format
1651+
*
1652+
* @display: display under action.
1653+
* @mode: video mode to be tested.
1654+
*
1655+
* Returns:
1656+
* true if the mode can be supported in YCBCR420 format
1657+
* false if not.
1658+
*/
1659+
bool drm_mode_is_420(const struct drm_display_info *display,
1660+
const struct drm_display_mode *mode)
1661+
{
1662+
return drm_mode_is_420_only(display, mode) ||
1663+
drm_mode_is_420_also(display, mode);
1664+
}
1665+
EXPORT_SYMBOL(drm_mode_is_420);

‎include/drm/drm_modes.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,12 @@ int drm_mode_convert_umode(struct drm_display_mode *out,
452452
const struct drm_mode_modeinfo *in);
453453
void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode);
454454
void drm_mode_debug_printmodeline(const struct drm_display_mode *mode);
455+
bool drm_mode_is_420_only(const struct drm_display_info *display,
456+
const struct drm_display_mode *mode);
457+
bool drm_mode_is_420_also(const struct drm_display_info *display,
458+
const struct drm_display_mode *mode);
459+
bool drm_mode_is_420(const struct drm_display_info *display,
460+
const struct drm_display_mode *mode);
455461

456462
struct drm_display_mode *drm_cvt_mode(struct drm_device *dev,
457463
int hdisplay, int vdisplay, int vrefresh,

0 commit comments

Comments
 (0)