lkml.org 
[lkml]   [2021]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 1/3] drm/omap: add crtc background property
    Date
    From: Tomi Valkeinen <tomi.valkeinen@ti.com>

    Add DRM properties for crtc background color property. Background
    color is shown on areas where there are no planes.

    Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
    Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
    ---
    drivers/gpu/drm/omapdrm/omap_crtc.c | 22 +++++++++++++++++++++-
    drivers/gpu/drm/omapdrm/omap_drv.c | 7 +++++++
    drivers/gpu/drm/omapdrm/omap_drv.h | 3 +++
    3 files changed, 31 insertions(+), 1 deletion(-)

    diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
    index 06a719c104f4..4ba2d3e51b2b 100644
    --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
    +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
    @@ -24,6 +24,8 @@ struct omap_crtc_state {
    unsigned int rotation;
    unsigned int zpos;
    bool manually_updated;
    +
    + u32 default_color;
    };

    #define to_omap_crtc(x) container_of(x, struct omap_crtc, base)
    @@ -395,13 +397,14 @@ static void omap_crtc_cpr_coefs_from_ctm(const struct drm_color_ctm *ctm,

    static void omap_crtc_write_crtc_properties(struct drm_crtc *crtc)
    {
    + const struct omap_crtc_state *omap_state = to_omap_crtc_state(crtc->state);
    struct omap_drm_private *priv = crtc->dev->dev_private;
    struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
    struct omap_overlay_manager_info info;

    memset(&info, 0, sizeof(info));

    - info.default_color = 0x000000;
    + info.default_color = omap_state->default_color;
    info.trans_enabled = false;
    info.partial_alpha_enabled = false;

    @@ -668,6 +671,7 @@ static int omap_crtc_atomic_set_property(struct drm_crtc *crtc,
    {
    struct omap_drm_private *priv = crtc->dev->dev_private;
    struct drm_plane_state *plane_state;
    + struct omap_crtc_state *omap_state = to_omap_crtc_state(state);

    /*
    * Delegate property set to the primary plane. Get the plane state and
    @@ -683,6 +687,8 @@ static int omap_crtc_atomic_set_property(struct drm_crtc *crtc,
    plane_state->rotation = val;
    else if (property == priv->zorder_prop)
    plane_state->zpos = val;
    + else if (property == priv->background_color_prop)
    + omap_state->default_color = val;
    else
    return -EINVAL;

    @@ -701,6 +707,8 @@ static int omap_crtc_atomic_get_property(struct drm_crtc *crtc,
    *val = omap_state->rotation;
    else if (property == priv->zorder_prop)
    *val = omap_state->zpos;
    + else if (property == priv->background_color_prop)
    + *val = omap_state->default_color;
    else
    return -EINVAL;

    @@ -741,6 +749,8 @@ omap_crtc_duplicate_state(struct drm_crtc *crtc)
    state->rotation = current_state->rotation;
    state->manually_updated = current_state->manually_updated;

    + state->default_color = current_state->default_color;
    +
    return &state->base;
    }

    @@ -778,6 +788,15 @@ static const char *channel_names[] = {
    [OMAP_DSS_CHANNEL_LCD3] = "lcd3",
    };

    +static void omap_crtc_install_properties(struct drm_crtc *crtc)
    +{
    + struct drm_device *dev = crtc->dev;
    + struct drm_mode_object *obj = &crtc->base;
    + struct omap_drm_private *priv = dev->dev_private;
    +
    + drm_object_attach_property(obj, priv->background_color_prop, 0);
    +}
    +
    /* initialize crtc */
    struct drm_crtc *omap_crtc_init(struct drm_device *dev,
    struct omap_drm_pipeline *pipe,
    @@ -843,6 +862,7 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
    drm_mode_crtc_set_gamma_size(crtc, gamma_lut_size);
    }

    + omap_crtc_install_properties(crtc);
    omap_plane_install_properties(crtc->primary, &crtc->base);

    return crtc;
    diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
    index f86e20578143..48ebd1689601 100644
    --- a/drivers/gpu/drm/omapdrm/omap_drv.c
    +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
    @@ -200,6 +200,13 @@ static int omap_modeset_init_properties(struct drm_device *dev)
    if (!priv->zorder_prop)
    return -ENOMEM;

    + /* crtc properties */
    +
    + priv->background_color_prop =
    + drm_property_create_range(dev, 0, "background", 0, 0xffffff);
    + if (!priv->background_color_prop)
    + return -ENOMEM;
    +
    return 0;
    }

    diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h
    index 591d4c273f02..ed69ae78ae89 100644
    --- a/drivers/gpu/drm/omapdrm/omap_drv.h
    +++ b/drivers/gpu/drm/omapdrm/omap_drv.h
    @@ -73,6 +73,9 @@ struct omap_drm_private {
    /* properties: */
    struct drm_property *zorder_prop;

    + /* crtc properties */
    + struct drm_property *background_color_prop;
    +
    /* irq handling: */
    spinlock_t wait_lock; /* protects the wait_list */
    struct list_head wait_list; /* list of omap_irq_wait */
    --
    2.25.1
    \
     
     \ /
      Last update: 2021-09-21 16:18    [W:3.361 / U:1.360 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site