]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] media: ti-vpe: vpe: configure line mode separately
authorNikhil Devshatwar <nikhil.nd@ti.com>
Fri, 18 Nov 2016 23:20:25 +0000 (21:20 -0200)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Tue, 22 Nov 2016 09:56:02 +0000 (07:56 -0200)
Current driver configures the line mode of the DEI clients
from the open function directly. Even if the newly created context
is not yet scheduled, it updates some of the VPDMA registers.
This causes a problem in multi instance use case where just opening
the m2m device second time causes the running job to stall. This
happens especially if the source buffers used are NV12.

While all other configuration is being written to context specific
shadow registers, only line mode configuration is happening directly.

As there is no shadow register for line mode configuration, it's better
to separate the config_mode setting and line_mode setting. Call the
new "set_line_modes" functions only when actually loading the mmrs.
This makes sure that no non-running job will write to the registers
directly.

Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/platform/ti-vpe/vpe.c

index 6fcdd0ea50e481c9ec25711854fe777a1de2e6bf..c79137b404eaeb7e778f6539f76ebf862e012823 100644 (file)
@@ -660,14 +660,13 @@ static void set_us_coefficients(struct vpe_ctx *ctx)
 /*
  * Set the upsampler config mode and the VPDMA line mode in the shadow MMRs.
  */
-static void set_cfg_and_line_modes(struct vpe_ctx *ctx)
+static void set_cfg_modes(struct vpe_ctx *ctx)
 {
        struct vpe_fmt *fmt = ctx->q_data[Q_DATA_SRC].fmt;
        struct vpe_mmr_adb *mmr_adb = ctx->mmr_adb.addr;
        u32 *us1_reg0 = &mmr_adb->us1_regs[0];
        u32 *us2_reg0 = &mmr_adb->us2_regs[0];
        u32 *us3_reg0 = &mmr_adb->us3_regs[0];
-       int line_mode = 1;
        int cfg_mode = 1;
 
        /*
@@ -675,15 +674,24 @@ static void set_cfg_and_line_modes(struct vpe_ctx *ctx)
         * Cfg Mode 1: YUV422 source, disable upsampler, DEI is de-interlacing.
         */
 
-       if (fmt->fourcc == V4L2_PIX_FMT_NV12) {
+       if (fmt->fourcc == V4L2_PIX_FMT_NV12)
                cfg_mode = 0;
-               line_mode = 0;          /* double lines to line buffer */
-       }
 
        write_field(us1_reg0, cfg_mode, VPE_US_MODE_MASK, VPE_US_MODE_SHIFT);
        write_field(us2_reg0, cfg_mode, VPE_US_MODE_MASK, VPE_US_MODE_SHIFT);
        write_field(us3_reg0, cfg_mode, VPE_US_MODE_MASK, VPE_US_MODE_SHIFT);
 
+       ctx->load_mmrs = true;
+}
+
+static void set_line_modes(struct vpe_ctx *ctx)
+{
+       struct vpe_fmt *fmt = ctx->q_data[Q_DATA_SRC].fmt;
+       int line_mode = 1;
+
+       if (fmt->fourcc == V4L2_PIX_FMT_NV12)
+               line_mode = 0;          /* double lines to line buffer */
+
        /* regs for now */
        vpdma_set_line_mode(ctx->dev->vpdma, line_mode, VPE_CHAN_CHROMA1_IN);
        vpdma_set_line_mode(ctx->dev->vpdma, line_mode, VPE_CHAN_CHROMA2_IN);
@@ -708,8 +716,6 @@ static void set_cfg_and_line_modes(struct vpe_ctx *ctx)
        /* frame start for MV in client */
        vpdma_set_frame_start_event(ctx->dev->vpdma, VPDMA_FSEVENT_CHANNEL_ACTIVE,
                VPE_CHAN_MV_IN);
-
-       ctx->load_mmrs = true;
 }
 
 /*
@@ -868,7 +874,7 @@ static int set_srcdst_params(struct vpe_ctx *ctx)
        if (ret)
                return ret;
 
-       set_cfg_and_line_modes(ctx);
+       set_cfg_modes(ctx);
        set_dei_regs(ctx);
 
        csc_set_coeff(ctx->dev->csc, &mmr_adb->csc_regs[0],
@@ -1184,6 +1190,9 @@ static void device_run(void *priv)
        if (ctx->dev->loaded_mmrs != ctx->mmr_adb.dma_addr || ctx->load_mmrs) {
                vpdma_map_desc_buf(ctx->dev->vpdma, &ctx->mmr_adb);
                vpdma_add_cfd_adb(&ctx->desc_list, CFD_MMR_CLIENT, &ctx->mmr_adb);
+
+               set_line_modes(ctx);
+
                ctx->dev->loaded_mmrs = ctx->mmr_adb.dma_addr;
                ctx->load_mmrs = false;
        }