[Patch v4 2/8] drm/omap: Add ovl checking funcs to dispc_ops

From: Benoit Parrot
Date: Fri Oct 12 2018 - 16:17:18 EST


In order to be able to dynamically assign overlays to planes we need to
be able to asses the overlay capabilities.

Add a helper function to be able to retrieve the supported capabilities
of an overlay.

And export the function to check if a fourcc is supported on a given
overlay.

Signed-off-by: Benoit Parrot <bparrot@xxxxxx>
---
drivers/gpu/drm/omapdrm/dss/dispc.c | 8 ++++++++
drivers/gpu/drm/omapdrm/dss/omapdss.h | 4 ++++
2 files changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
index 70c3e3353947..ea8b57003620 100644
--- a/drivers/gpu/drm/omapdrm/dss/dispc.c
+++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
@@ -2499,6 +2499,12 @@ static int dispc_ovl_calc_scaling_44xx(struct dispc_device *dispc,
return 0;
}

+static enum omap_overlay_caps dispc_ovl_get_caps(struct dispc_device *dispc,
+ enum omap_plane_id plane)
+{
+ return dispc->feat->overlay_caps[plane];
+}
+
#define DIV_FRAC(dividend, divisor) \
((dividend) * 100 / (divisor) - ((dividend) / (divisor) * 100))

@@ -4757,6 +4763,8 @@ static const struct dispc_ops dispc_ops = {
.ovl_enable = dispc_ovl_enable,
.ovl_setup = dispc_ovl_setup,
.ovl_get_color_modes = dispc_ovl_get_color_modes,
+ .ovl_color_mode_supported = dispc_ovl_color_mode_supported,
+ .ovl_get_caps = dispc_ovl_get_caps,
.ovl_get_max_size = dispc_ovl_get_max_size,

.wb_get_framedone_irq = dispc_wb_get_framedone_irq,
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 45334d5c618e..b5640e8479dc 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -632,6 +632,10 @@ struct dispc_ops {

const u32 *(*ovl_get_color_modes)(struct dispc_device *dispc,
enum omap_plane_id plane);
+ bool (*ovl_color_mode_supported)(struct dispc_device *dispc,
+ enum omap_plane_id plane, u32 fourcc);
+ enum omap_overlay_caps (*ovl_get_caps)(struct dispc_device *dispc,
+ enum omap_plane_id plane);
void (*ovl_get_max_size)(struct dispc_device *dispc,
u16 *width, u16 *height);

--
2.9.0