drm/rockchip: driver: add interface to get format bpp

drm_format_info can't offer yuv afbc bpp info, so we add this
interface to replenish it.

Signed-off-by: Sandy Huang <hjc@rock-chips.com>
Change-Id: Ib4d5f804b2ccdc20909420acd4911aa159d5a6fc
This commit is contained in:
Sandy Huang
2021-09-10 16:05:16 +08:00
committed by Tao Huang
parent fa6c7f1111
commit a0b4d1fa92
2 changed files with 25 additions and 1 deletions

View File

@@ -45,6 +45,28 @@
static bool is_support_iommu = true;
static struct drm_driver rockchip_drm_driver;
uint32_t rockchip_drm_get_bpp(const struct drm_format_info *info)
{
/* use whatever a driver has set */
if (info->cpp[0])
return info->cpp[0] * 8;
switch (info->format) {
case DRM_FORMAT_YUV420_8BIT:
return 12;
case DRM_FORMAT_YUV420_10BIT:
return 15;
case DRM_FORMAT_VUY101010:
return 30;
default:
break;
}
/* all attempts failed */
return 0;
}
EXPORT_SYMBOL(rockchip_drm_get_bpp);
/**
* rockchip_drm_of_find_possible_crtcs - find the possible CRTCs for an active
* encoder port

View File

@@ -9,8 +9,9 @@
#ifndef _ROCKCHIP_DRM_DRV_H
#define _ROCKCHIP_DRM_DRV_H
#include <drm/drm_fb_helper.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_fb_helper.h>
#include <drm/drm_fourcc.h>
#include <drm/drm_gem.h>
#include <drm/rockchip_drm.h>
#include <linux/module.h>
@@ -231,6 +232,7 @@ static inline int rockchip_drm_get_sub_dev_type(void)
int rockchip_drm_endpoint_is_subdriver(struct device_node *ep);
uint32_t rockchip_drm_of_find_possible_crtcs(struct drm_device *dev,
struct device_node *port);
uint32_t rockchip_drm_get_bpp(const struct drm_format_info *info);
extern struct platform_driver cdn_dp_driver;
extern struct platform_driver dw_hdmi_rockchip_pltfm_driver;