mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
drm/rockchip: Add common interface for rockchip_drm_is_afbc/rfbc
rockchip_drm_is_abfc() / rockchip_drm_is_rfbc() is used to determine if the frame buffer is in afbc or rfbc format. The same code can be shared between different rockchip vop architectures. Signed-off-by: Chaoyi Chen <chaoyi.chen@rock-chips.com> Change-Id: I7c409a09044aa54e0690eed29551a6b3416fb10c
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include <drm/drm_displayid.h>
|
||||
#include <drm/drm_fb_helper.h>
|
||||
#include <drm/drm_gem_dma_helper.h>
|
||||
#include <drm/drm_gem_framebuffer_helper.h>
|
||||
#include <drm/drm_of.h>
|
||||
#include <drm/drm_probe_helper.h>
|
||||
#include <drm/drm_vblank.h>
|
||||
@@ -98,6 +99,42 @@ void rockchip_drm_dbg(const struct device *dev, enum rockchip_drm_debug_category
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
bool rockchip_drm_is_afbc(struct drm_plane *plane, u64 modifier)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (modifier == DRM_FORMAT_MOD_LINEAR)
|
||||
return false;
|
||||
|
||||
if (!drm_is_afbc(modifier))
|
||||
return false;
|
||||
|
||||
for (i = 0 ; i < plane->modifier_count; i++)
|
||||
if (plane->modifiers[i] == modifier)
|
||||
break;
|
||||
|
||||
return (i < plane->modifier_count) ? true : false;
|
||||
}
|
||||
EXPORT_SYMBOL(rockchip_drm_is_afbc);
|
||||
|
||||
bool rockchip_drm_is_rfbc(struct drm_plane *plane, u64 modifier)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (modifier == DRM_FORMAT_MOD_LINEAR)
|
||||
return false;
|
||||
|
||||
if (!IS_ROCKCHIP_RFBC_MOD(modifier))
|
||||
return false;
|
||||
|
||||
for (i = 0 ; i < plane->modifier_count; i++)
|
||||
if (plane->modifiers[i] == modifier)
|
||||
break;
|
||||
|
||||
return (i < plane->modifier_count) ? true : false;
|
||||
}
|
||||
EXPORT_SYMBOL(rockchip_drm_is_rfbc);
|
||||
|
||||
/**
|
||||
* rockchip_drm_wait_vact_end
|
||||
* @crtc: CRTC to enable line flag
|
||||
|
||||
@@ -633,6 +633,8 @@ int rockchip_drm_parse_colorimetry_data_block(u8 *colorimetry, const struct edid
|
||||
struct dma_buf *rockchip_drm_gem_prime_export(struct drm_gem_object *obj, int flags);
|
||||
long rockchip_drm_dclk_round_rate(u32 version, struct clk *dclk, unsigned long rate);
|
||||
int rockchip_drm_dclk_set_rate(u32 version, struct clk *dclk, unsigned long rate);
|
||||
bool rockchip_drm_is_afbc(struct drm_plane *plane, u64 modifier);
|
||||
bool rockchip_drm_is_rfbc(struct drm_plane *plane, u64 modifier);
|
||||
|
||||
__printf(3, 4)
|
||||
void rockchip_drm_dbg(const struct device *dev, enum rockchip_drm_debug_category category,
|
||||
|
||||
@@ -795,16 +795,7 @@ static bool is_alpha_support(uint32_t format)
|
||||
|
||||
static inline bool rockchip_afbc(struct drm_plane *plane, u64 modifier)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (modifier == DRM_FORMAT_MOD_LINEAR)
|
||||
return false;
|
||||
|
||||
for (i = 0 ; i < plane->modifier_count; i++)
|
||||
if (plane->modifiers[i] == modifier)
|
||||
break;
|
||||
|
||||
return (i < plane->modifier_count) ? true : false;
|
||||
return rockchip_drm_is_afbc(plane, modifier);
|
||||
}
|
||||
|
||||
static uint16_t scl_vop_cal_scale(enum scale_mode mode, uint32_t src,
|
||||
|
||||
@@ -2386,19 +2386,7 @@ static bool is_alpha_support(uint32_t format)
|
||||
|
||||
static inline bool rockchip_afbc(struct drm_plane *plane, u64 modifier)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (modifier == DRM_FORMAT_MOD_LINEAR)
|
||||
return false;
|
||||
|
||||
if (!drm_is_afbc(modifier))
|
||||
return false;
|
||||
|
||||
for (i = 0 ; i < plane->modifier_count; i++)
|
||||
if (plane->modifiers[i] == modifier)
|
||||
break;
|
||||
|
||||
return (i < plane->modifier_count) ? true : false;
|
||||
return rockchip_drm_is_afbc(plane, modifier);
|
||||
}
|
||||
|
||||
static inline bool rockchip_tiled(struct drm_plane *plane, u64 modifier)
|
||||
@@ -2420,19 +2408,7 @@ static inline bool rockchip_tiled(struct drm_plane *plane, u64 modifier)
|
||||
|
||||
static inline bool rockchip_rfbc(struct drm_plane *plane, u64 modifier)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (modifier == DRM_FORMAT_MOD_LINEAR)
|
||||
return false;
|
||||
|
||||
if (!IS_ROCKCHIP_RFBC_MOD(modifier))
|
||||
return false;
|
||||
|
||||
for (i = 0 ; i < plane->modifier_count; i++)
|
||||
if (plane->modifiers[i] == modifier)
|
||||
break;
|
||||
|
||||
return (i < plane->modifier_count) ? true : false;
|
||||
return rockchip_drm_is_rfbc(plane, modifier);
|
||||
}
|
||||
|
||||
static bool rockchip_vop2_mod_supported(struct drm_plane *plane, u32 format, u64 modifier)
|
||||
|
||||
Reference in New Issue
Block a user