MLK-19413-23 gpu: imx: dpu: Add constframe_framedimenstions_copy_prim() helper support

This patch adds constframe_framedimenstions_copy_prim() helper support
so that callers may may copy frame dimensions from a primary constframe
to the relevant secondary constframe.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
This commit is contained in:
Liu Ying
2018-06-27 16:29:51 +08:00
committed by Jason Liu
parent 2192e34d67
commit 2a1e654f53
2 changed files with 38 additions and 0 deletions

View File

@ -53,6 +53,11 @@ struct dpu_constframe {
shadow_load_req_t shdlreq;
};
static inline u32 dpu_cf_read(struct dpu_constframe *cf, unsigned int offset)
{
return readl(cf->base + offset);
}
static inline void dpu_cf_write(struct dpu_constframe *cf, u32 value,
unsigned int offset)
{
@ -84,6 +89,38 @@ void constframe_framedimensions(struct dpu_constframe *cf, unsigned int w,
}
EXPORT_SYMBOL_GPL(constframe_framedimensions);
void constframe_framedimensions_copy_prim(struct dpu_constframe *cf)
{
struct dpu_constframe *prim_cf = NULL;
unsigned int prim_id;
int i;
u32 val;
if (cf->id != 0 && cf->id != 1) {
dev_warn(cf->dpu->dev, "ConstFrame%d is not a secondary one\n",
cf->id);
return;
}
prim_id = cf->id + 4;
for (i = 0; i < ARRAY_SIZE(cf_ids); i++)
if (cf_ids[i] == prim_id)
prim_cf = cf->dpu->cf_priv[i];
if (!prim_cf) {
dev_warn(cf->dpu->dev, "cannot find ConstFrame%d's primary peer\n",
cf->id);
return;
}
mutex_lock(&cf->mutex);
val = dpu_cf_read(prim_cf, FRAMEDIMENSIONS);
dpu_cf_write(cf, val, FRAMEDIMENSIONS);
mutex_unlock(&cf->mutex);
}
EXPORT_SYMBOL_GPL(constframe_framedimensions_copy_prim);
void constframe_constantcolor(struct dpu_constframe *cf, unsigned int r,
unsigned int g, unsigned int b, unsigned int a)
{

View File

@ -506,6 +506,7 @@ struct dpu_constframe;
void constframe_shden(struct dpu_constframe *cf, bool enable);
void constframe_framedimensions(struct dpu_constframe *cf, unsigned int w,
unsigned int h);
void constframe_framedimensions_copy_prim(struct dpu_constframe *cf);
void constframe_constantcolor(struct dpu_constframe *cf, unsigned int r,
unsigned int g, unsigned int b, unsigned int a);
void constframe_controltrigger(struct dpu_constframe *cf, bool trigger);