Commit 0deed25b authored by Stephane Viau's avatar Stephane Viau Committed by Rob Clark

drm/msm: add multiple CRTC and overlay support

MDP5 currently support one single CRTC with its private pipe.
This change allows the configuration of multiple CRTCs with
the possibility to attach several public planes to these CRTCs.
Signed-off-by: default avatarStephane Viau <sviau@codeaurora.org>
Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
parent ac7a5704
...@@ -26,6 +26,7 @@ msm-y := \ ...@@ -26,6 +26,7 @@ msm-y := \
mdp/mdp4/mdp4_kms.o \ mdp/mdp4/mdp4_kms.o \
mdp/mdp4/mdp4_plane.o \ mdp/mdp4/mdp4_plane.o \
mdp/mdp5/mdp5_cfg.o \ mdp/mdp5/mdp5_cfg.o \
mdp/mdp5/mdp5_ctl.o \
mdp/mdp5/mdp5_crtc.o \ mdp/mdp5/mdp5_crtc.o \
mdp/mdp5/mdp5_encoder.o \ mdp/mdp5/mdp5_encoder.o \
mdp/mdp5/mdp5_irq.o \ mdp/mdp5/mdp5_irq.o \
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
*/ */
extern const struct mdp5_cfg_hw *mdp5_cfg; extern const struct mdp5_cfg_hw *mdp5_cfg;
#define MAX_CTL 8
#define MAX_BASES 8 #define MAX_BASES 8
#define MAX_SMP_BLOCKS 44 #define MAX_SMP_BLOCKS 44
#define MAX_CLIENTS 32 #define MAX_CLIENTS 32
......
This diff is collapsed.
/*
* Copyright (c) 2014 The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "mdp5_kms.h"
#include "mdp5_ctl.h"
/*
* CTL - MDP Control Pool Manager
*
* Controls are shared between all CRTCs.
*
* They are intended to be used for data path configuration.
* The top level register programming describes the complete data path for
* a specific data path ID - REG_MDP5_CTL_*(<id>, ...)
*
* Hardware capabilities determine the number of concurrent data paths
*
* In certain use cases (high-resolution dual pipe), one single CTL can be
* shared across multiple CRTCs.
*
* Because the number of CTLs can be less than the number of CRTCs,
* CTLs are dynamically allocated from a pool of CTLs, only once a CRTC is
* requested by the client (in mdp5_crtc_mode_set()).
*/
struct mdp5_ctl {
u32 id;
/* whether this CTL has been allocated or not: */
bool busy;
/* memory output connection (@see mdp5_ctl_mode): */
u32 mode;
/* REG_MDP5_CTL_*(<id>) registers access info + lock: */
spinlock_t hw_lock;
u32 reg_offset;
/* flush mask used to commit CTL registers */
u32 flush_mask;
bool cursor_on;
void *crtc;
};
struct mdp5_ctl_manager {
struct drm_device *dev;
/* number of CTL / Layer Mixers in this hw config: */
u32 nlm;
u32 nctl;
/* pool of CTLs + lock to protect resource allocation (ctls[i].busy) */
spinlock_t pool_lock;
struct mdp5_ctl ctls[MAX_CTL];
};
static struct mdp5_ctl_manager mdp5_ctl_mgr;
static inline
struct mdp5_kms *get_kms(struct mdp5_ctl_manager *ctl_mgr)
{
struct msm_drm_private *priv = ctl_mgr->dev->dev_private;
return to_mdp5_kms(to_mdp_kms(priv->kms));
}
static inline
void ctl_write(struct mdp5_ctl *ctl, u32 reg, u32 data)
{
struct mdp5_ctl_manager *ctl_mgr = &mdp5_ctl_mgr;
struct mdp5_kms *mdp5_kms = get_kms(ctl_mgr);
(void)ctl->reg_offset; /* TODO use this instead of mdp5_write */
mdp5_write(mdp5_kms, reg, data);
}
static inline
u32 ctl_read(struct mdp5_ctl *ctl, u32 reg)
{
struct mdp5_ctl_manager *ctl_mgr = &mdp5_ctl_mgr;
struct mdp5_kms *mdp5_kms = get_kms(ctl_mgr);
(void)ctl->reg_offset; /* TODO use this instead of mdp5_write */
return mdp5_read(mdp5_kms, reg);
}
int mdp5_ctl_set_intf(void *c, enum mdp5_intf intf)
{
struct mdp5_ctl *ctl = c;
unsigned long flags;
static const enum mdp5_intfnum intfnum[] = {
INTF0, INTF1, INTF2, INTF3,
};
spin_lock_irqsave(&ctl->hw_lock, flags);
ctl_write(ctl, REG_MDP5_CTL_OP(ctl->id),
MDP5_CTL_OP_MODE(ctl->mode) |
MDP5_CTL_OP_INTF_NUM(intfnum[intf]));
spin_unlock_irqrestore(&ctl->hw_lock, flags);
return 0;
}
int mdp5_ctl_set_cursor(void *c, bool enable)
{
struct mdp5_ctl_manager *ctl_mgr = &mdp5_ctl_mgr;
struct mdp5_ctl *ctl = c;
unsigned long flags;
u32 blend_cfg;
int lm;
lm = mdp5_crtc_get_lm(ctl->crtc);
if (unlikely(WARN_ON(lm < 0))) {
dev_err(ctl_mgr->dev->dev, "CTL %d cannot find LM: %d",
ctl->id, lm);
return -EINVAL;
}
spin_lock_irqsave(&ctl->hw_lock, flags);
blend_cfg = ctl_read(ctl, REG_MDP5_CTL_LAYER_REG(ctl->id, lm));
if (enable)
blend_cfg |= MDP5_CTL_LAYER_REG_CURSOR_OUT;
else
blend_cfg &= ~MDP5_CTL_LAYER_REG_CURSOR_OUT;
ctl_write(ctl, REG_MDP5_CTL_LAYER_REG(ctl->id, lm), blend_cfg);
spin_unlock_irqrestore(&ctl->hw_lock, flags);
ctl->cursor_on = enable;
return 0;
}
int mdp5_ctl_blend(void *c, u32 lm, u32 blend_cfg)
{
struct mdp5_ctl *ctl = c;
unsigned long flags;
if (ctl->cursor_on)
blend_cfg |= MDP5_CTL_LAYER_REG_CURSOR_OUT;
else
blend_cfg &= ~MDP5_CTL_LAYER_REG_CURSOR_OUT;
spin_lock_irqsave(&ctl->hw_lock, flags);
ctl_write(ctl, REG_MDP5_CTL_LAYER_REG(ctl->id, lm), blend_cfg);
spin_unlock_irqrestore(&ctl->hw_lock, flags);
return 0;
}
int mdp5_ctl_commit(void *c, u32 flush_mask)
{
struct mdp5_ctl_manager *ctl_mgr = &mdp5_ctl_mgr;
struct mdp5_ctl *ctl = c;
unsigned long flags;
if (flush_mask & MDP5_CTL_FLUSH_CURSOR_DUMMY) {
int lm = mdp5_crtc_get_lm(ctl->crtc);
if (unlikely(WARN_ON(lm < 0))) {
dev_err(ctl_mgr->dev->dev, "CTL %d cannot find LM: %d",
ctl->id, lm);
return -EINVAL;
}
/* for current targets, cursor bit is the same as LM bit */
flush_mask |= mdp_ctl_flush_mask_lm(lm);
}
spin_lock_irqsave(&ctl->hw_lock, flags);
ctl_write(ctl, REG_MDP5_CTL_FLUSH(ctl->id), flush_mask);
spin_unlock_irqrestore(&ctl->hw_lock, flags);
return 0;
}
u32 mdp5_ctl_get_flush(void *c)
{
struct mdp5_ctl *ctl = c;
return ctl->flush_mask;
}
void mdp5_ctl_release(void *c)
{
struct mdp5_ctl_manager *ctl_mgr = &mdp5_ctl_mgr;
struct mdp5_ctl *ctl = c;
unsigned long flags;
if (unlikely(WARN_ON(ctl->id >= MAX_CTL) || !ctl->busy)) {
dev_err(ctl_mgr->dev->dev, "CTL %d in bad state (%d)",
ctl->id, ctl->busy);
return;
}
spin_lock_irqsave(&ctl_mgr->pool_lock, flags);
ctl->busy = false;
spin_unlock_irqrestore(&ctl_mgr->pool_lock, flags);
DBG("CTL %d released", ctl->id);
}
/*
* mdp5_ctl_request() - CTL dynamic allocation
*
* Note: Current implementation considers that we can only have one CRTC per CTL
*
* @return first free CTL
*/
void *mdp5_ctl_request(void *ctlm, void *crtc)
{
struct mdp5_ctl_manager *ctl_mgr = ctlm;
struct mdp5_ctl *ctl = NULL;
unsigned long flags;
int c;
spin_lock_irqsave(&ctl_mgr->pool_lock, flags);
for (c = 0; c < ctl_mgr->nctl; c++)
if (!ctl_mgr->ctls[c].busy)
break;
if (unlikely(c >= ctl_mgr->nctl)) {
dev_err(ctl_mgr->dev->dev, "No more CTL available!");
goto unlock;
}
ctl = &ctl_mgr->ctls[c];
ctl->crtc = crtc;
ctl->busy = true;
DBG("CTL %d allocated", ctl->id);
unlock:
spin_unlock_irqrestore(&ctl_mgr->pool_lock, flags);
return ctl;
}
void mdp5_ctlm_hw_reset(void *ctlm)
{
struct mdp5_ctl_manager *ctl_mgr = ctlm;
unsigned long flags;
int c;
for (c = 0; c < ctl_mgr->nctl; c++) {
struct mdp5_ctl *ctl = &ctl_mgr->ctls[c];
spin_lock_irqsave(&ctl->hw_lock, flags);
ctl_write(ctl, REG_MDP5_CTL_OP(ctl->id), 0);
spin_unlock_irqrestore(&ctl->hw_lock, flags);
}
}
void mdp5_ctlm_destroy(void *ctlm)
{
struct mdp5_ctl_manager *ctl_mgr = ctlm;
kfree(ctl_mgr);
}
void *mdp5_ctlm_init(struct drm_device *dev, void __iomem *mmio_base,
const struct mdp5_cfg_hw *hw_cfg)
{
struct mdp5_ctl_manager *ctl_mgr = &mdp5_ctl_mgr;
const struct mdp5_sub_block *ctl_cfg = &hw_cfg->ctl;
unsigned long flags;
int c, ret;
if (unlikely(WARN_ON(ctl_cfg->count > MAX_CTL))) {
dev_err(dev->dev, "Increase static pool size to at least %d\n",
ctl_cfg->count);
ret = -ENOSPC;
goto fail;
}
/* initialize the CTL manager: */
ctl_mgr->dev = dev;
ctl_mgr->nlm = hw_cfg->lm.count;
ctl_mgr->nctl = ctl_cfg->count;
spin_lock_init(&ctl_mgr->pool_lock);
/* initialize each CTL of the pool: */
spin_lock_irqsave(&ctl_mgr->pool_lock, flags);
for (c = 0; c < ctl_mgr->nctl; c++) {
struct mdp5_ctl *ctl = &ctl_mgr->ctls[c];
if (WARN_ON(!ctl_cfg->base[c])) {
dev_err(dev->dev, "CTL_%d: base is null!\n", c);
ret = -EINVAL;
goto fail;
}
ctl->id = c;
ctl->mode = MODE_NONE;
ctl->reg_offset = ctl_cfg->base[c];
ctl->flush_mask = MDP5_CTL_FLUSH_CTL;
ctl->busy = false;
spin_lock_init(&ctl->hw_lock);
}
spin_unlock_irqrestore(&ctl_mgr->pool_lock, flags);
DBG("Pool of %d CTLs created.", ctl_mgr->nctl);
return ctl_mgr;
fail:
if (ctl_mgr)
mdp5_ctlm_destroy(ctl_mgr);
return ERR_PTR(ret);
}
/*
* Copyright (c) 2014 The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef __MDP5_CTL_H__
#define __MDP5_CTL_H__
#include "msm_drv.h"
/*
* CTL Manager prototypes:
* mdp5_ctlm_init() returns a ctlm (CTL Manager) handler,
* which is then used to call the other mdp5_ctlm_*(ctlm, ...) functions.
*/
void *mdp5_ctlm_init(struct drm_device *dev, void __iomem *mmio_base,
const struct mdp5_cfg_hw *hw_cfg);
void mdp5_ctlm_hw_reset(void *ctlm);
void mdp5_ctlm_destroy(void *ctlm);
/*
* CTL prototypes:
* mdp5_ctl_request(ctlm, ...) returns a ctl (CTL resource) handler,
* which is then used to call the other mdp5_ctl_*(ctl, ...) functions.
*/
void *mdp5_ctl_request(void *ctlm, void *crtc);
int mdp5_ctl_set_intf(void *ctl, enum mdp5_intf intf);
int mdp5_ctl_set_cursor(void *ctl, bool enable);
/* @blend_cfg: see LM blender config definition below */
int mdp5_ctl_blend(void *ctl, u32 lm, u32 blend_cfg);
/* @flush_mask: see CTL flush masks definitions below */
int mdp5_ctl_commit(void *ctl, u32 flush_mask);
u32 mdp5_ctl_get_flush(void *ctl);
void mdp5_ctl_release(void *ctl);
/*
* blend_cfg (LM blender config):
*
* The function below allows the caller of mdp5_ctl_blend() to specify how pipes
* are being blended according to their stage (z-order), through @blend_cfg arg.
*/
static inline u32 mdp_ctl_blend_mask(enum mdp5_pipe pipe,
enum mdp_mixer_stage_id stage)
{
switch (pipe) {
case SSPP_VIG0: return MDP5_CTL_LAYER_REG_VIG0(stage);
case SSPP_VIG1: return MDP5_CTL_LAYER_REG_VIG1(stage);
case SSPP_VIG2: return MDP5_CTL_LAYER_REG_VIG2(stage);
case SSPP_RGB0: return MDP5_CTL_LAYER_REG_RGB0(stage);
case SSPP_RGB1: return MDP5_CTL_LAYER_REG_RGB1(stage);
case SSPP_RGB2: return MDP5_CTL_LAYER_REG_RGB2(stage);
case SSPP_DMA0: return MDP5_CTL_LAYER_REG_DMA0(stage);
case SSPP_DMA1: return MDP5_CTL_LAYER_REG_DMA1(stage);
case SSPP_VIG3: return MDP5_CTL_LAYER_REG_VIG3(stage);
case SSPP_RGB3: return MDP5_CTL_LAYER_REG_RGB3(stage);
default: return 0;
}
}
/*
* flush_mask (CTL flush masks):
*
* The following functions allow each DRM entity to get and store
* their own flush mask.
* Once stored, these masks will then be accessed through each DRM's
* interface and used by the caller of mdp5_ctl_commit() to specify
* which block(s) need to be flushed through @flush_mask parameter.
*/
#define MDP5_CTL_FLUSH_CURSOR_DUMMY 0x80000000
static inline u32 mdp_ctl_flush_mask_cursor(int cursor_id)
{
/* TODO: use id once multiple cursor support is present */
(void)cursor_id;
return MDP5_CTL_FLUSH_CURSOR_DUMMY;
}
static inline u32 mdp_ctl_flush_mask_lm(int lm)
{
switch (lm) {
case 0: return MDP5_CTL_FLUSH_LM0;
case 1: return MDP5_CTL_FLUSH_LM1;
case 2: return MDP5_CTL_FLUSH_LM2;
case 5: return MDP5_CTL_FLUSH_LM5;
default: return 0;
}
}
static inline u32 mdp_ctl_flush_mask_pipe(enum mdp5_pipe pipe)
{
switch (pipe) {
case SSPP_VIG0: return MDP5_CTL_FLUSH_VIG0;
case SSPP_VIG1: return MDP5_CTL_FLUSH_VIG1;
case SSPP_VIG2: return MDP5_CTL_FLUSH_VIG2;
case SSPP_RGB0: return MDP5_CTL_FLUSH_RGB0;
case SSPP_RGB1: return MDP5_CTL_FLUSH_RGB1;
case SSPP_RGB2: return MDP5_CTL_FLUSH_RGB2;
case SSPP_DMA0: return MDP5_CTL_FLUSH_DMA0;
case SSPP_DMA1: return MDP5_CTL_FLUSH_DMA1;
case SSPP_VIG3: return MDP5_CTL_FLUSH_VIG3;
case SSPP_RGB3: return MDP5_CTL_FLUSH_RGB3;
default: return 0;
}
}
#endif /* __MDP5_CTL_H__ */
...@@ -24,6 +24,7 @@ struct mdp5_encoder { ...@@ -24,6 +24,7 @@ struct mdp5_encoder {
struct drm_encoder base; struct drm_encoder base;
int intf; int intf;
enum mdp5_intf intf_id; enum mdp5_intf intf_id;
spinlock_t intf_lock; /* protect REG_MDP5_INTF_* registers */
bool enabled; bool enabled;
uint32_t bsc; uint32_t bsc;
}; };
...@@ -115,6 +116,7 @@ static void mdp5_encoder_dpms(struct drm_encoder *encoder, int mode) ...@@ -115,6 +116,7 @@ static void mdp5_encoder_dpms(struct drm_encoder *encoder, int mode)
struct mdp5_kms *mdp5_kms = get_kms(encoder); struct mdp5_kms *mdp5_kms = get_kms(encoder);
int intf = mdp5_encoder->intf; int intf = mdp5_encoder->intf;
bool enabled = (mode == DRM_MODE_DPMS_ON); bool enabled = (mode == DRM_MODE_DPMS_ON);
unsigned long flags;
DBG("mode=%d", mode); DBG("mode=%d", mode);
...@@ -123,9 +125,13 @@ static void mdp5_encoder_dpms(struct drm_encoder *encoder, int mode) ...@@ -123,9 +125,13 @@ static void mdp5_encoder_dpms(struct drm_encoder *encoder, int mode)
if (enabled) { if (enabled) {
bs_set(mdp5_encoder, 1); bs_set(mdp5_encoder, 1);
spin_lock_irqsave(&mdp5_encoder->intf_lock, flags);
mdp5_write(mdp5_kms, REG_MDP5_INTF_TIMING_ENGINE_EN(intf), 1); mdp5_write(mdp5_kms, REG_MDP5_INTF_TIMING_ENGINE_EN(intf), 1);
spin_unlock_irqrestore(&mdp5_encoder->intf_lock, flags);
} else { } else {
spin_lock_irqsave(&mdp5_encoder->intf_lock, flags);
mdp5_write(mdp5_kms, REG_MDP5_INTF_TIMING_ENGINE_EN(intf), 0); mdp5_write(mdp5_kms, REG_MDP5_INTF_TIMING_ENGINE_EN(intf), 0);
spin_unlock_irqrestore(&mdp5_encoder->intf_lock, flags);
bs_set(mdp5_encoder, 0); bs_set(mdp5_encoder, 0);
} }
...@@ -150,6 +156,7 @@ static void mdp5_encoder_mode_set(struct drm_encoder *encoder, ...@@ -150,6 +156,7 @@ static void mdp5_encoder_mode_set(struct drm_encoder *encoder,
uint32_t display_v_start, display_v_end; uint32_t display_v_start, display_v_end;
uint32_t hsync_start_x, hsync_end_x; uint32_t hsync_start_x, hsync_end_x;
uint32_t format; uint32_t format;
unsigned long flags;
mode = adjusted_mode; mode = adjusted_mode;
...@@ -180,6 +187,8 @@ static void mdp5_encoder_mode_set(struct drm_encoder *encoder, ...@@ -180,6 +187,8 @@ static void mdp5_encoder_mode_set(struct drm_encoder *encoder,
display_v_start = (mode->vtotal - mode->vsync_start) * mode->htotal + dtv_hsync_skew; display_v_start = (mode->vtotal - mode->vsync_start) * mode->htotal + dtv_hsync_skew;
display_v_end = vsync_period - ((mode->vsync_start - mode->vdisplay) * mode->htotal) + dtv_hsync_skew - 1; display_v_end = vsync_period - ((mode->vsync_start - mode->vdisplay) * mode->htotal) + dtv_hsync_skew - 1;
spin_lock_irqsave(&mdp5_encoder->intf_lock, flags);
mdp5_write(mdp5_kms, REG_MDP5_INTF_HSYNC_CTL(intf), mdp5_write(mdp5_kms, REG_MDP5_INTF_HSYNC_CTL(intf),
MDP5_INTF_HSYNC_CTL_PULSEW(mode->hsync_end - mode->hsync_start) | MDP5_INTF_HSYNC_CTL_PULSEW(mode->hsync_end - mode->hsync_start) |
MDP5_INTF_HSYNC_CTL_PERIOD(mode->htotal)); MDP5_INTF_HSYNC_CTL_PERIOD(mode->htotal));
...@@ -201,6 +210,8 @@ static void mdp5_encoder_mode_set(struct drm_encoder *encoder, ...@@ -201,6 +210,8 @@ static void mdp5_encoder_mode_set(struct drm_encoder *encoder,
mdp5_write(mdp5_kms, REG_MDP5_INTF_ACTIVE_VEND_F0(intf), 0); mdp5_write(mdp5_kms, REG_MDP5_INTF_ACTIVE_VEND_F0(intf), 0);
mdp5_write(mdp5_kms, REG_MDP5_INTF_PANEL_FORMAT(intf), format); mdp5_write(mdp5_kms, REG_MDP5_INTF_PANEL_FORMAT(intf), format);
mdp5_write(mdp5_kms, REG_MDP5_INTF_FRAME_LINE_COUNT_EN(intf), 0x3); /* frame+line? */ mdp5_write(mdp5_kms, REG_MDP5_INTF_FRAME_LINE_COUNT_EN(intf), 0x3); /* frame+line? */
spin_unlock_irqrestore(&mdp5_encoder->intf_lock, flags);
} }
static void mdp5_encoder_prepare(struct drm_encoder *encoder) static void mdp5_encoder_prepare(struct drm_encoder *encoder)
...@@ -242,6 +253,8 @@ struct drm_encoder *mdp5_encoder_init(struct drm_device *dev, int intf, ...@@ -242,6 +253,8 @@ struct drm_encoder *mdp5_encoder_init(struct drm_device *dev, int intf,
mdp5_encoder->intf_id = intf_id; mdp5_encoder->intf_id = intf_id;
encoder = &mdp5_encoder->base; encoder = &mdp5_encoder->base;
spin_lock_init(&mdp5_encoder->intf_lock);
drm_encoder_init(dev, encoder, &mdp5_encoder_funcs, drm_encoder_init(dev, encoder, &mdp5_encoder_funcs,
DRM_MODE_ENCODER_TMDS); DRM_MODE_ENCODER_TMDS);
drm_encoder_helper_add(encoder, &mdp5_encoder_helper_funcs); drm_encoder_helper_add(encoder, &mdp5_encoder_helper_funcs);
......
...@@ -28,9 +28,8 @@ static const char *iommu_ports[] = { ...@@ -28,9 +28,8 @@ static const char *iommu_ports[] = {
static int mdp5_hw_init(struct msm_kms *kms) static int mdp5_hw_init(struct msm_kms *kms)
{ {
struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(kms)); struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(kms));
const struct mdp5_cfg_hw *hw_cfg;
struct drm_device *dev = mdp5_kms->dev; struct drm_device *dev = mdp5_kms->dev;
int i; unsigned long flags;
pm_runtime_get_sync(dev->dev); pm_runtime_get_sync(dev->dev);
...@@ -58,12 +57,11 @@ static int mdp5_hw_init(struct msm_kms *kms) ...@@ -58,12 +57,11 @@ static int mdp5_hw_init(struct msm_kms *kms)
* care. * care.
*/ */
spin_lock_irqsave(&mdp5_kms->resource_lock, flags);
mdp5_write(mdp5_kms, REG_MDP5_DISP_INTF_SEL, 0); mdp5_write(mdp5_kms, REG_MDP5_DISP_INTF_SEL, 0);
spin_unlock_irqrestore(&mdp5_kms->resource_lock, flags);
hw_cfg = mdp5_cfg_get_hw_config(mdp5_kms->cfg_priv); mdp5_ctlm_hw_reset(mdp5_kms->ctl_priv);
for (i = 0; i < hw_cfg->ctl.count; i++)
mdp5_write(mdp5_kms, REG_MDP5_CTL_OP(i), 0);
pm_runtime_put_sync(dev->dev); pm_runtime_put_sync(dev->dev);
...@@ -92,6 +90,7 @@ static void mdp5_destroy(struct msm_kms *kms) ...@@ -92,6 +90,7 @@ static void mdp5_destroy(struct msm_kms *kms)
struct msm_mmu *mmu = mdp5_kms->mmu; struct msm_mmu *mmu = mdp5_kms->mmu;
void *smp = mdp5_kms->smp_priv; void *smp = mdp5_kms->smp_priv;
void *cfg = mdp5_kms->cfg_priv; void *cfg = mdp5_kms->cfg_priv;
void *ctl = mdp5_kms->ctl_priv;
mdp5_irq_domain_fini(mdp5_kms); mdp5_irq_domain_fini(mdp5_kms);
...@@ -99,7 +98,8 @@ static void mdp5_destroy(struct msm_kms *kms) ...@@ -99,7 +98,8 @@ static void mdp5_destroy(struct msm_kms *kms)
mmu->funcs->detach(mmu, iommu_ports, ARRAY_SIZE(iommu_ports)); mmu->funcs->detach(mmu, iommu_ports, ARRAY_SIZE(iommu_ports));
mmu->funcs->destroy(mmu); mmu->funcs->destroy(mmu);
} }
if (ctl)
mdp5_ctlm_destroy(ctl);
if (smp) if (smp)
mdp5_smp_destroy(smp); mdp5_smp_destroy(smp);
if (cfg) if (cfg)
...@@ -154,6 +154,9 @@ static int modeset_init(struct mdp5_kms *mdp5_kms) ...@@ -154,6 +154,9 @@ static int modeset_init(struct mdp5_kms *mdp5_kms)
static const enum mdp5_pipe crtcs[] = { static const enum mdp5_pipe crtcs[] = {
SSPP_RGB0, SSPP_RGB1, SSPP_RGB2, SSPP_RGB3, SSPP_RGB0, SSPP_RGB1, SSPP_RGB2, SSPP_RGB3,
}; };
static const enum mdp5_pipe pub_planes[] = {
SSPP_VIG0, SSPP_VIG1, SSPP_VIG2, SSPP_VIG3,
};
struct drm_device *dev = mdp5_kms->dev; struct drm_device *dev = mdp5_kms->dev;
struct msm_drm_private *priv = dev->dev_private; struct msm_drm_private *priv = dev->dev_private;
struct drm_encoder *encoder; struct drm_encoder *encoder;
...@@ -169,12 +172,13 @@ static int modeset_init(struct mdp5_kms *mdp5_kms) ...@@ -169,12 +172,13 @@ static int modeset_init(struct mdp5_kms *mdp5_kms)
if (ret) if (ret)
goto fail; goto fail;
/* construct CRTCs: */ /* construct CRTCs and their private planes: */
for (i = 0; i < hw_cfg->pipe_rgb.count; i++) { for (i = 0; i < hw_cfg->pipe_rgb.count; i++) {
struct drm_plane *plane; struct drm_plane *plane;
struct drm_crtc *crtc; struct drm_crtc *crtc;
plane = mdp5_plane_init(dev, crtcs[i], true); plane = mdp5_plane_init(dev, crtcs[i], true,
hw_cfg->pipe_rgb.base[i]);
if (IS_ERR(plane)) { if (IS_ERR(plane)) {
ret = PTR_ERR(plane); ret = PTR_ERR(plane);
dev_err(dev->dev, "failed to construct plane for %s (%d)\n", dev_err(dev->dev, "failed to construct plane for %s (%d)\n",
...@@ -192,6 +196,20 @@ static int modeset_init(struct mdp5_kms *mdp5_kms) ...@@ -192,6 +196,20 @@ static int modeset_init(struct mdp5_kms *mdp5_kms)
priv->crtcs[priv->num_crtcs++] = crtc; priv->crtcs[priv->num_crtcs++] = crtc;
} }
/* Construct public planes: */
for (i = 0; i < hw_cfg->pipe_vig.count; i++) {
struct drm_plane *plane;
plane = mdp5_plane_init(dev, pub_planes[i], false,
hw_cfg->pipe_vig.base[i]);
if (IS_ERR(plane)) {
ret = PTR_ERR(plane);
dev_err(dev->dev, "failed to construct %s plane: %d\n",
pipe2name(pub_planes[i]), ret);
goto fail;
}
}
/* Construct encoder for HDMI: */ /* Construct encoder for HDMI: */
encoder = mdp5_encoder_init(dev, 3, INTF_HDMI); encoder = mdp5_encoder_init(dev, 3, INTF_HDMI);
if (IS_ERR(encoder)) { if (IS_ERR(encoder)) {
...@@ -274,6 +292,8 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev) ...@@ -274,6 +292,8 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev)
goto fail; goto fail;
} }
spin_lock_init(&mdp5_kms->resource_lock);
mdp_kms_init(&mdp5_kms->base, &kms_funcs); mdp_kms_init(&mdp5_kms->base, &kms_funcs);
kms = &mdp5_kms->base.base; kms = &mdp5_kms->base.base;
...@@ -348,6 +368,13 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev) ...@@ -348,6 +368,13 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev)
} }
mdp5_kms->smp_priv = priv; mdp5_kms->smp_priv = priv;
priv = mdp5_ctlm_init(dev, mdp5_kms->mmio, config->hw);
if (IS_ERR(priv)) {
ret = PTR_ERR(priv);
goto fail;
}
mdp5_kms->ctl_priv = priv;
/* make sure things are off before attaching iommu (bootloader could /* make sure things are off before attaching iommu (bootloader could
* have left things on, in which case we'll start getting faults if * have left things on, in which case we'll start getting faults if
* we don't disable): * we don't disable):
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "mdp/mdp_kms.h" #include "mdp/mdp_kms.h"
#include "mdp5_cfg.h" /* must be included before mdp5.xml.h */ #include "mdp5_cfg.h" /* must be included before mdp5.xml.h */
#include "mdp5.xml.h" #include "mdp5.xml.h"
#include "mdp5_ctl.h"
#include "mdp5_smp.h" #include "mdp5_smp.h"
struct mdp5_kms { struct mdp5_kms {
...@@ -37,6 +38,7 @@ struct mdp5_kms { ...@@ -37,6 +38,7 @@ struct mdp5_kms {
struct msm_mmu *mmu; struct msm_mmu *mmu;
void *smp_priv; void *smp_priv;
void *ctl_priv;
/* io/register spaces: */ /* io/register spaces: */
void __iomem *mmio, *vbif; void __iomem *mmio, *vbif;
...@@ -50,6 +52,12 @@ struct mdp5_kms { ...@@ -50,6 +52,12 @@ struct mdp5_kms {
struct clk *lut_clk; struct clk *lut_clk;
struct clk *vsync_clk; struct clk *vsync_clk;
/*
* lock to protect access to global resources: ie., following register:
* - REG_MDP5_DISP_INTF_SEL
*/
spinlock_t resource_lock;
struct mdp_irq error_handler; struct mdp_irq error_handler;
struct { struct {
...@@ -59,6 +67,10 @@ struct mdp5_kms { ...@@ -59,6 +67,10 @@ struct mdp5_kms {
}; };
#define to_mdp5_kms(x) container_of(x, struct mdp5_kms, base) #define to_mdp5_kms(x) container_of(x, struct mdp5_kms, base)
struct mdp5_overlay_info {
enum mdp_mixer_stage_id zorder;
};
static inline void mdp5_write(struct mdp5_kms *mdp5_kms, u32 reg, u32 data) static inline void mdp5_write(struct mdp5_kms *mdp5_kms, u32 reg, u32 data)
{ {
msm_writel(data, mdp5_kms->mmio + reg); msm_writel(data, mdp5_kms->mmio + reg);
...@@ -82,23 +94,6 @@ static inline const char *pipe2name(enum mdp5_pipe pipe) ...@@ -82,23 +94,6 @@ static inline const char *pipe2name(enum mdp5_pipe pipe)
return names[pipe]; return names[pipe];
} }
static inline uint32_t pipe2flush(enum mdp5_pipe pipe)
{
switch (pipe) {
case SSPP_VIG0: return MDP5_CTL_FLUSH_VIG0;
case SSPP_VIG1: return MDP5_CTL_FLUSH_VIG1;
case SSPP_VIG2: return MDP5_CTL_FLUSH_VIG2;
case SSPP_RGB0: return MDP5_CTL_FLUSH_RGB0;
case SSPP_RGB1: return MDP5_CTL_FLUSH_RGB1;
case SSPP_RGB2: return MDP5_CTL_FLUSH_RGB2;
case SSPP_DMA0: return MDP5_CTL_FLUSH_DMA0;
case SSPP_DMA1: return MDP5_CTL_FLUSH_DMA1;
case SSPP_VIG3: return MDP5_CTL_FLUSH_VIG3;
case SSPP_RGB3: return MDP5_CTL_FLUSH_RGB3;
default: return 0;
}
}
static inline int pipe2nclients(enum mdp5_pipe pipe) static inline int pipe2nclients(enum mdp5_pipe pipe)
{ {
switch (pipe) { switch (pipe) {
...@@ -112,16 +107,6 @@ static inline int pipe2nclients(enum mdp5_pipe pipe) ...@@ -112,16 +107,6 @@ static inline int pipe2nclients(enum mdp5_pipe pipe)
} }
} }
static inline uint32_t mixer2flush(int lm)
{
switch (lm) {
case 0: return MDP5_CTL_FLUSH_LM0;
case 1: return MDP5_CTL_FLUSH_LM1;
case 2: return MDP5_CTL_FLUSH_LM2;
default: return 0;
}
}
static inline uint32_t intf2err(int intf) static inline uint32_t intf2err(int intf)
{ {
switch (intf) { switch (intf) {
...@@ -169,6 +154,10 @@ uint32_t mdp5_get_formats(enum mdp5_pipe pipe, uint32_t *pixel_formats, ...@@ -169,6 +154,10 @@ uint32_t mdp5_get_formats(enum mdp5_pipe pipe, uint32_t *pixel_formats,
void mdp5_plane_install_properties(struct drm_plane *plane, void mdp5_plane_install_properties(struct drm_plane *plane,
struct drm_mode_object *obj); struct drm_mode_object *obj);
void mdp5_plane_set_overlay_info(struct drm_plane *plane,
const struct mdp5_overlay_info *overlay_info);
struct mdp5_overlay_info *mdp5_plane_get_overlay_info(struct drm_plane *plane);
uint32_t mdp5_plane_get_flush(struct drm_plane *plane);
void mdp5_plane_set_scanout(struct drm_plane *plane, void mdp5_plane_set_scanout(struct drm_plane *plane,
struct drm_framebuffer *fb); struct drm_framebuffer *fb);
int mdp5_plane_mode_set(struct drm_plane *plane, int mdp5_plane_mode_set(struct drm_plane *plane,
...@@ -180,14 +169,15 @@ int mdp5_plane_mode_set(struct drm_plane *plane, ...@@ -180,14 +169,15 @@ int mdp5_plane_mode_set(struct drm_plane *plane,
void mdp5_plane_complete_flip(struct drm_plane *plane); void mdp5_plane_complete_flip(struct drm_plane *plane);
enum mdp5_pipe mdp5_plane_pipe(struct drm_plane *plane); enum mdp5_pipe mdp5_plane_pipe(struct drm_plane *plane);
struct drm_plane *mdp5_plane_init(struct drm_device *dev, struct drm_plane *mdp5_plane_init(struct drm_device *dev,
enum mdp5_pipe pipe, bool private_plane); enum mdp5_pipe pipe, bool private_plane, uint32_t reg_offset);
uint32_t mdp5_crtc_vblank(struct drm_crtc *crtc); uint32_t mdp5_crtc_vblank(struct drm_crtc *crtc);
int mdp5_crtc_get_lm(struct drm_crtc *crtc);
void mdp5_crtc_cancel_pending_flip(struct drm_crtc *crtc, struct drm_file *file); void mdp5_crtc_cancel_pending_flip(struct drm_crtc *crtc, struct drm_file *file);
void mdp5_crtc_set_intf(struct drm_crtc *crtc, int intf, void mdp5_crtc_set_intf(struct drm_crtc *crtc, int intf,
enum mdp5_intf intf_id); enum mdp5_intf intf_id);
void mdp5_crtc_attach(struct drm_crtc *crtc, struct drm_plane *plane); int mdp5_crtc_attach(struct drm_crtc *crtc, struct drm_plane *plane);
void mdp5_crtc_detach(struct drm_crtc *crtc, struct drm_plane *plane); void mdp5_crtc_detach(struct drm_crtc *crtc, struct drm_plane *plane);
struct drm_crtc *mdp5_crtc_init(struct drm_device *dev, struct drm_crtc *mdp5_crtc_init(struct drm_device *dev,
struct drm_plane *plane, int id); struct drm_plane *plane, int id);
......
/* /*
* Copyright (c) 2014 The Linux Foundation. All rights reserved.
* Copyright (C) 2013 Red Hat * Copyright (C) 2013 Red Hat
* Author: Rob Clark <robdclark@gmail.com> * Author: Rob Clark <robdclark@gmail.com>
* *
...@@ -17,6 +18,7 @@ ...@@ -17,6 +18,7 @@
#include "mdp5_kms.h" #include "mdp5_kms.h"
#define MAX_PLANE 4
struct mdp5_plane { struct mdp5_plane {
struct drm_plane base; struct drm_plane base;
...@@ -24,6 +26,13 @@ struct mdp5_plane { ...@@ -24,6 +26,13 @@ struct mdp5_plane {
enum mdp5_pipe pipe; enum mdp5_pipe pipe;
spinlock_t pipe_lock; /* protect REG_MDP5_PIPE_* registers */
uint32_t reg_offset;
uint32_t flush_mask; /* used to commit pipe registers */
struct mdp5_overlay_info overlay_info;
uint32_t nformats; uint32_t nformats;
uint32_t formats[32]; uint32_t formats[32];
...@@ -95,6 +104,22 @@ static void mdp5_plane_destroy(struct drm_plane *plane) ...@@ -95,6 +104,22 @@ static void mdp5_plane_destroy(struct drm_plane *plane)
kfree(mdp5_plane); kfree(mdp5_plane);
} }
void mdp5_plane_set_overlay_info(struct drm_plane *plane,
const struct mdp5_overlay_info *overlay_info)
{
struct mdp5_plane *mdp5_plane = to_mdp5_plane(plane);
memcpy(&mdp5_plane->overlay_info, overlay_info, sizeof(*overlay_info));
}
struct mdp5_overlay_info *mdp5_plane_get_overlay_info(
struct drm_plane *plane)
{
struct mdp5_plane *mdp5_plane = to_mdp5_plane(plane);
return &mdp5_plane->overlay_info;
}
/* helper to install properties which are common to planes and crtcs */ /* helper to install properties which are common to planes and crtcs */
void mdp5_plane_install_properties(struct drm_plane *plane, void mdp5_plane_install_properties(struct drm_plane *plane,
struct drm_mode_object *obj) struct drm_mode_object *obj)
...@@ -116,35 +141,58 @@ static const struct drm_plane_funcs mdp5_plane_funcs = { ...@@ -116,35 +141,58 @@ static const struct drm_plane_funcs mdp5_plane_funcs = {
.set_property = mdp5_plane_set_property, .set_property = mdp5_plane_set_property,
}; };
void mdp5_plane_set_scanout(struct drm_plane *plane, static int get_fb_addr(struct drm_plane *plane, struct drm_framebuffer *fb,
struct drm_framebuffer *fb) uint32_t iova[MAX_PLANE])
{ {
struct mdp5_plane *mdp5_plane = to_mdp5_plane(plane);
struct mdp5_kms *mdp5_kms = get_kms(plane); struct mdp5_kms *mdp5_kms = get_kms(plane);
enum mdp5_pipe pipe = mdp5_plane->pipe;
uint32_t nplanes = drm_format_num_planes(fb->pixel_format); uint32_t nplanes = drm_format_num_planes(fb->pixel_format);
uint32_t iova[4];
int i; int i;
for (i = 0; i < nplanes; i++) { for (i = 0; i < nplanes; i++) {
struct drm_gem_object *bo = msm_framebuffer_bo(fb, i); struct drm_gem_object *bo = msm_framebuffer_bo(fb, i);
msm_gem_get_iova(bo, mdp5_kms->id, &iova[i]); msm_gem_get_iova(bo, mdp5_kms->id, &iova[i]);
} }
for (; i < 4; i++) for (; i < MAX_PLANE; i++)
iova[i] = 0; iova[i] = 0;
return 0;
}
static void set_scanout_locked(struct drm_plane *plane,
uint32_t pitches[MAX_PLANE], uint32_t src_addr[MAX_PLANE])
{
struct mdp5_plane *mdp5_plane = to_mdp5_plane(plane);
struct mdp5_kms *mdp5_kms = get_kms(plane);
enum mdp5_pipe pipe = mdp5_plane->pipe;
WARN_ON(!spin_is_locked(&mdp5_plane->pipe_lock));
mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC_STRIDE_A(pipe), mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC_STRIDE_A(pipe),
MDP5_PIPE_SRC_STRIDE_A_P0(fb->pitches[0]) | MDP5_PIPE_SRC_STRIDE_A_P0(pitches[0]) |
MDP5_PIPE_SRC_STRIDE_A_P1(fb->pitches[1])); MDP5_PIPE_SRC_STRIDE_A_P1(pitches[1]));
mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC_STRIDE_B(pipe), mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC_STRIDE_B(pipe),
MDP5_PIPE_SRC_STRIDE_B_P2(fb->pitches[2]) | MDP5_PIPE_SRC_STRIDE_B_P2(pitches[2]) |
MDP5_PIPE_SRC_STRIDE_B_P3(fb->pitches[3])); MDP5_PIPE_SRC_STRIDE_B_P3(pitches[3]));
mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC0_ADDR(pipe), src_addr[0]);
mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC1_ADDR(pipe), src_addr[1]);
mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC2_ADDR(pipe), src_addr[2]);
mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC3_ADDR(pipe), src_addr[3]);
}
void mdp5_plane_set_scanout(struct drm_plane *plane,
struct drm_framebuffer *fb)
{
struct mdp5_plane *mdp5_plane = to_mdp5_plane(plane);
uint32_t src_addr[MAX_PLANE];
unsigned long flags;
mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC0_ADDR(pipe), iova[0]); get_fb_addr(plane, fb, src_addr);
mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC1_ADDR(pipe), iova[1]);
mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC2_ADDR(pipe), iova[2]); spin_lock_irqsave(&mdp5_plane->pipe_lock, flags);
mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC3_ADDR(pipe), iova[3]); set_scanout_locked(plane, fb->pitches, src_addr);
spin_unlock_irqrestore(&mdp5_plane->pipe_lock, flags);
plane->fb = fb; plane->fb = fb;
} }
...@@ -163,6 +211,8 @@ int mdp5_plane_mode_set(struct drm_plane *plane, ...@@ -163,6 +211,8 @@ int mdp5_plane_mode_set(struct drm_plane *plane,
uint32_t nplanes, config = 0; uint32_t nplanes, config = 0;
uint32_t phasex_step = 0, phasey_step = 0; uint32_t phasex_step = 0, phasey_step = 0;
uint32_t hdecm = 0, vdecm = 0; uint32_t hdecm = 0, vdecm = 0;
uint32_t src_addr[MAX_PLANE];
unsigned long flags;
int ret; int ret;
nplanes = drm_format_num_planes(fb->pixel_format); nplanes = drm_format_num_planes(fb->pixel_format);
...@@ -205,6 +255,12 @@ int mdp5_plane_mode_set(struct drm_plane *plane, ...@@ -205,6 +255,12 @@ int mdp5_plane_mode_set(struct drm_plane *plane,
/* TODO calc phasey_step, vdecm */ /* TODO calc phasey_step, vdecm */
} }
ret = get_fb_addr(plane, fb, src_addr);
if (ret)
return ret;
spin_lock_irqsave(&mdp5_plane->pipe_lock, flags);
mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC_IMG_SIZE(pipe), mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC_IMG_SIZE(pipe),
MDP5_PIPE_SRC_IMG_SIZE_WIDTH(src_w) | MDP5_PIPE_SRC_IMG_SIZE_WIDTH(src_w) |
MDP5_PIPE_SRC_IMG_SIZE_HEIGHT(src_h)); MDP5_PIPE_SRC_IMG_SIZE_HEIGHT(src_h));
...@@ -225,8 +281,6 @@ int mdp5_plane_mode_set(struct drm_plane *plane, ...@@ -225,8 +281,6 @@ int mdp5_plane_mode_set(struct drm_plane *plane,
MDP5_PIPE_OUT_XY_X(crtc_x) | MDP5_PIPE_OUT_XY_X(crtc_x) |
MDP5_PIPE_OUT_XY_Y(crtc_y)); MDP5_PIPE_OUT_XY_Y(crtc_y));
mdp5_plane_set_scanout(plane, fb);
format = to_mdp_format(msm_framebuffer_format(fb)); format = to_mdp_format(msm_framebuffer_format(fb));
mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC_FORMAT(pipe), mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC_FORMAT(pipe),
...@@ -266,10 +320,14 @@ int mdp5_plane_mode_set(struct drm_plane *plane, ...@@ -266,10 +320,14 @@ int mdp5_plane_mode_set(struct drm_plane *plane,
MDP5_PIPE_SCALE_CONFIG_SCALEX_MAX_FILTER(SCALE_FILTER_NEAREST) | MDP5_PIPE_SCALE_CONFIG_SCALEX_MAX_FILTER(SCALE_FILTER_NEAREST) |
MDP5_PIPE_SCALE_CONFIG_SCALEY_MAX_FILTER(SCALE_FILTER_NEAREST)); MDP5_PIPE_SCALE_CONFIG_SCALEY_MAX_FILTER(SCALE_FILTER_NEAREST));
set_scanout_locked(plane, fb->pitches, src_addr);
spin_unlock_irqrestore(&mdp5_plane->pipe_lock, flags);
/* TODO detach from old crtc (if we had more than one) */ /* TODO detach from old crtc (if we had more than one) */
mdp5_crtc_attach(crtc, plane); ret = mdp5_crtc_attach(crtc, plane);
return 0; return ret;
} }
void mdp5_plane_complete_flip(struct drm_plane *plane) void mdp5_plane_complete_flip(struct drm_plane *plane)
...@@ -286,9 +344,16 @@ enum mdp5_pipe mdp5_plane_pipe(struct drm_plane *plane) ...@@ -286,9 +344,16 @@ enum mdp5_pipe mdp5_plane_pipe(struct drm_plane *plane)
return mdp5_plane->pipe; return mdp5_plane->pipe;
} }
uint32_t mdp5_plane_get_flush(struct drm_plane *plane)
{
struct mdp5_plane *mdp5_plane = to_mdp5_plane(plane);
return mdp5_plane->flush_mask;
}
/* initialize plane */ /* initialize plane */
struct drm_plane *mdp5_plane_init(struct drm_device *dev, struct drm_plane *mdp5_plane_init(struct drm_device *dev,
enum mdp5_pipe pipe, bool private_plane) enum mdp5_pipe pipe, bool private_plane, uint32_t reg_offset)
{ {
struct drm_plane *plane = NULL; struct drm_plane *plane = NULL;
struct mdp5_plane *mdp5_plane; struct mdp5_plane *mdp5_plane;
...@@ -309,6 +374,10 @@ struct drm_plane *mdp5_plane_init(struct drm_device *dev, ...@@ -309,6 +374,10 @@ struct drm_plane *mdp5_plane_init(struct drm_device *dev,
mdp5_plane->nformats = mdp5_get_formats(pipe, mdp5_plane->formats, mdp5_plane->nformats = mdp5_get_formats(pipe, mdp5_plane->formats,
ARRAY_SIZE(mdp5_plane->formats)); ARRAY_SIZE(mdp5_plane->formats));
mdp5_plane->flush_mask = mdp_ctl_flush_mask_pipe(pipe);
mdp5_plane->reg_offset = reg_offset;
spin_lock_init(&mdp5_plane->pipe_lock);
type = private_plane ? DRM_PLANE_TYPE_PRIMARY : DRM_PLANE_TYPE_OVERLAY; type = private_plane ? DRM_PLANE_TYPE_PRIMARY : DRM_PLANE_TYPE_OVERLAY;
drm_universal_plane_init(dev, plane, 0xff, &mdp5_plane_funcs, drm_universal_plane_init(dev, plane, 0xff, &mdp5_plane_funcs,
mdp5_plane->formats, mdp5_plane->nformats, mdp5_plane->formats, mdp5_plane->nformats,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment