diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2011-12-19 17:33:24 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-12-20 15:34:32 -0500 |
commit | d0d110e096298d2715aa26b3698e604e0d4a2fb9 (patch) | |
tree | 5ea4b13f7fcb28940a9c1f5d4ffa28188ebc4704 /drivers/gpu/drm/drm_crtc_helper.c | |
parent | c75488376a55c207172f78664d600b87df88107f (diff) |
drm: Add drm_format_num_planes() utility function
This function returns the number of planes used by a specific pixel
format.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Rob Clark <rob.clark@linaro.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_crtc_helper.c')
-rw-r--r-- | drivers/gpu/drm/drm_crtc_helper.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 0cd2ba19bad1..84a4a809793f 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c | |||
@@ -1015,3 +1015,36 @@ void drm_helper_hpd_irq_event(struct drm_device *dev) | |||
1015 | queue_delayed_work(system_nrt_wq, &dev->mode_config.output_poll_work, 0); | 1015 | queue_delayed_work(system_nrt_wq, &dev->mode_config.output_poll_work, 0); |
1016 | } | 1016 | } |
1017 | EXPORT_SYMBOL(drm_helper_hpd_irq_event); | 1017 | EXPORT_SYMBOL(drm_helper_hpd_irq_event); |
1018 | |||
1019 | |||
1020 | /** | ||
1021 | * drm_format_num_planes - get the number of planes for format | ||
1022 | * @format: pixel format (DRM_FORMAT_*) | ||
1023 | * | ||
1024 | * RETURNS: | ||
1025 | * The number of planes used by the specified pixel format. | ||
1026 | */ | ||
1027 | int drm_format_num_planes(uint32_t format) | ||
1028 | { | ||
1029 | switch (format) { | ||
1030 | case DRM_FORMAT_YUV410: | ||
1031 | case DRM_FORMAT_YVU410: | ||
1032 | case DRM_FORMAT_YUV411: | ||
1033 | case DRM_FORMAT_YVU411: | ||
1034 | case DRM_FORMAT_YUV420: | ||
1035 | case DRM_FORMAT_YVU420: | ||
1036 | case DRM_FORMAT_YUV422: | ||
1037 | case DRM_FORMAT_YVU422: | ||
1038 | case DRM_FORMAT_YUV444: | ||
1039 | case DRM_FORMAT_YVU444: | ||
1040 | return 3; | ||
1041 | case DRM_FORMAT_NV12: | ||
1042 | case DRM_FORMAT_NV21: | ||
1043 | case DRM_FORMAT_NV16: | ||
1044 | case DRM_FORMAT_NV61: | ||
1045 | return 2; | ||
1046 | default: | ||
1047 | return 1; | ||
1048 | } | ||
1049 | } | ||
1050 | EXPORT_SYMBOL(drm_format_num_planes); | ||