1. 18 3月, 2019 11 次提交
  2. 01 3月, 2019 1 次提交
  3. 19 2月, 2019 1 次提交
  4. 17 1月, 2019 1 次提交
  5. 04 12月, 2018 1 次提交
  6. 18 9月, 2018 7 次提交
  7. 12 9月, 2018 1 次提交
  8. 08 8月, 2018 1 次提交
  9. 04 8月, 2018 10 次提交
  10. 30 7月, 2018 1 次提交
    • L
      media: v4l: vsp1: Fix deadlock in VSPDL DRM pipelines · 8eb0e642
      Laurent Pinchart 提交于
      The VSP uses a lock to protect the BRU and BRS assignment when
      configuring pipelines. The lock is taken in vsp1_du_atomic_begin() and
      released in vsp1_du_atomic_flush(), as well as taken and released in
      vsp1_du_setup_lif(). This guards against multiple pipelines trying to
      assign the same BRU and BRS at the same time.
      
      The DRM framework calls the .atomic_begin() operations in a loop over
      all CRTCs included in an atomic commit. On a VSPDL (the only VSP type
      where this matters), a single VSP instance handles two CRTCs, with a
      single lock. This results in a deadlock when the .atomic_begin()
      operation is called on the second CRTC.
      
      The DRM framework serializes atomic commits that affect the same CRTCs,
      but doesn't know about two CRTCs sharing the same VSPDL. Two commits
      affecting the VSPDL LIF0 and LIF1 respectively can thus race each other,
      hence the need for a lock.
      
      This could be fixed on the DRM side by forcing serialization of commits
      affecting CRTCs backed by the same VSPDL, but that would negatively
      affect performances, as the locking is only needed when the BRU and BRS
      need to be reassigned, which is an uncommon case.
      
      The lock protects the whole .atomic_begin() to .atomic_flush() sequence.
      The only operation that can occur in-between is vsp1_du_atomic_update(),
      which doesn't touch the BRU and BRS, and thus doesn't need to be
      protected by the lock. We can thus only take the lock around the
      pipeline setup calls in vsp1_du_atomic_flush(), which fixes the
      deadlock.
      
      Fixes: f81f9adc ("media: v4l: vsp1: Assign BRU and BRS to pipelines dynamically")
      Signed-off-by: NLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
      Reviewed-by: NKieran Bingham <kieran.bingham+renesas@ideasonboard.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      8eb0e642
  11. 27 7月, 2018 1 次提交
  12. 13 6月, 2018 1 次提交
    • K
      treewide: devm_kzalloc() -> devm_kcalloc() · a86854d0
      Kees Cook 提交于
      The devm_kzalloc() function has a 2-factor argument form, devm_kcalloc().
      This patch replaces cases of:
      
              devm_kzalloc(handle, a * b, gfp)
      
      with:
              devm_kcalloc(handle, a * b, gfp)
      
      as well as handling cases of:
      
              devm_kzalloc(handle, a * b * c, gfp)
      
      with:
      
              devm_kzalloc(handle, array3_size(a, b, c), gfp)
      
      as it's slightly less ugly than:
      
              devm_kcalloc(handle, array_size(a, b), c, gfp)
      
      This does, however, attempt to ignore constant size factors like:
      
              devm_kzalloc(handle, 4 * 1024, gfp)
      
      though any constants defined via macros get caught up in the conversion.
      
      Any factors with a sizeof() of "unsigned char", "char", and "u8" were
      dropped, since they're redundant.
      
      Some manual whitespace fixes were needed in this patch, as Coccinelle
      really liked to write "=devm_kcalloc..." instead of "= devm_kcalloc...".
      
      The Coccinelle script used for this was:
      
      // Fix redundant parens around sizeof().
      @@
      expression HANDLE;
      type TYPE;
      expression THING, E;
      @@
      
      (
        devm_kzalloc(HANDLE,
      -	(sizeof(TYPE)) * E
      +	sizeof(TYPE) * E
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	(sizeof(THING)) * E
      +	sizeof(THING) * E
        , ...)
      )
      
      // Drop single-byte sizes and redundant parens.
      @@
      expression HANDLE;
      expression COUNT;
      typedef u8;
      typedef __u8;
      @@
      
      (
        devm_kzalloc(HANDLE,
      -	sizeof(u8) * (COUNT)
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(__u8) * (COUNT)
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(char) * (COUNT)
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(unsigned char) * (COUNT)
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(u8) * COUNT
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(__u8) * COUNT
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(char) * COUNT
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(unsigned char) * COUNT
      +	COUNT
        , ...)
      )
      
      // 2-factor product with sizeof(type/expression) and identifier or constant.
      @@
      expression HANDLE;
      type TYPE;
      expression THING;
      identifier COUNT_ID;
      constant COUNT_CONST;
      @@
      
      (
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(TYPE) * (COUNT_ID)
      +	COUNT_ID, sizeof(TYPE)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(TYPE) * COUNT_ID
      +	COUNT_ID, sizeof(TYPE)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(TYPE) * (COUNT_CONST)
      +	COUNT_CONST, sizeof(TYPE)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(TYPE) * COUNT_CONST
      +	COUNT_CONST, sizeof(TYPE)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(THING) * (COUNT_ID)
      +	COUNT_ID, sizeof(THING)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(THING) * COUNT_ID
      +	COUNT_ID, sizeof(THING)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(THING) * (COUNT_CONST)
      +	COUNT_CONST, sizeof(THING)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(THING) * COUNT_CONST
      +	COUNT_CONST, sizeof(THING)
        , ...)
      )
      
      // 2-factor product, only identifiers.
      @@
      expression HANDLE;
      identifier SIZE, COUNT;
      @@
      
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	SIZE * COUNT
      +	COUNT, SIZE
        , ...)
      
      // 3-factor product with 1 sizeof(type) or sizeof(expression), with
      // redundant parens removed.
      @@
      expression HANDLE;
      expression THING;
      identifier STRIDE, COUNT;
      type TYPE;
      @@
      
      (
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE) * (COUNT) * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE) * (COUNT) * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE) * COUNT * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE) * COUNT * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(THING) * (COUNT) * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(THING) * (COUNT) * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(THING) * COUNT * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(THING) * COUNT * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      )
      
      // 3-factor product with 2 sizeof(variable), with redundant parens removed.
      @@
      expression HANDLE;
      expression THING1, THING2;
      identifier COUNT;
      type TYPE1, TYPE2;
      @@
      
      (
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE1) * sizeof(TYPE2) * COUNT
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(THING1) * sizeof(THING2) * COUNT
      +	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(THING1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE1) * sizeof(THING2) * COUNT
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
        , ...)
      )
      
      // 3-factor product, only identifiers, with redundant parens removed.
      @@
      expression HANDLE;
      identifier STRIDE, SIZE, COUNT;
      @@
      
      (
        devm_kzalloc(HANDLE,
      -	(COUNT) * STRIDE * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	COUNT * (STRIDE) * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	COUNT * STRIDE * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	(COUNT) * (STRIDE) * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	COUNT * (STRIDE) * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	(COUNT) * STRIDE * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	(COUNT) * (STRIDE) * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	COUNT * STRIDE * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      )
      
      // Any remaining multi-factor products, first at least 3-factor products,
      // when they're not all constants...
      @@
      expression HANDLE;
      expression E1, E2, E3;
      constant C1, C2, C3;
      @@
      
      (
        devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
      |
        devm_kzalloc(HANDLE,
      -	(E1) * E2 * E3
      +	array3_size(E1, E2, E3)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	(E1) * (E2) * E3
      +	array3_size(E1, E2, E3)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	(E1) * (E2) * (E3)
      +	array3_size(E1, E2, E3)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	E1 * E2 * E3
      +	array3_size(E1, E2, E3)
        , ...)
      )
      
      // And then all remaining 2 factors products when they're not all constants,
      // keeping sizeof() as the second factor argument.
      @@
      expression HANDLE;
      expression THING, E1, E2;
      type TYPE;
      constant C1, C2, C3;
      @@
      
      (
        devm_kzalloc(HANDLE, sizeof(THING) * C2, ...)
      |
        devm_kzalloc(HANDLE, sizeof(TYPE) * C2, ...)
      |
        devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
      |
        devm_kzalloc(HANDLE, C1 * C2, ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(TYPE) * (E2)
      +	E2, sizeof(TYPE)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(TYPE) * E2
      +	E2, sizeof(TYPE)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(THING) * (E2)
      +	E2, sizeof(THING)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(THING) * E2
      +	E2, sizeof(THING)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	(E1) * E2
      +	E1, E2
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	(E1) * (E2)
      +	E1, E2
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	E1 * E2
      +	E1, E2
        , ...)
      )
      Signed-off-by: NKees Cook <keescook@chromium.org>
      a86854d0
  13. 26 5月, 2018 3 次提交
    • K
      media: vsp1: Move video configuration to a cached dlb · e646e177
      Kieran Bingham 提交于
      We are now able to configure a pipeline directly into a local display
      list body. Take advantage of this fact, and create a cacheable body to
      store the configuration of the pipeline in the pipeline object.
      
      vsp1_video_pipeline_run() is now the last user of the pipe->dl object.
      Convert this function to use the cached pipe->stream_config body and
      obtain a local display list reference.
      
      Attach the pipe->stream_config body to the display list when needed
      before committing to hardware.
      
      Use a flag 'configured' to know when we should attach our stream_config
      to the next outgoing display list to reconfigure the hardware in the
      event of our first frame, or the first frame following a suspend/resume
      cycle.
      
      Our video DL usage now looks like the below output:
      
      dl->body0 contains our disposable runtime configuration. Max 41.
      dl_child->body0 is our partition specific configuration. Max 12.
      dl->bodies shows our constant configuration and LUTs.
      
        These two are LUT/CLU:
           * dl->bodies[x]->num_entries 256 / max 256
           * dl->bodies[x]->num_entries 4914 / max 4914
      
      Which shows that our 'constant' configuration cache is currently
      utilised to a maximum of 64 entries.
      
      trace-cmd report | \
      
        dl->body0->num_entries 13 / max 128
        dl->body0->num_entries 14 / max 128
        dl->body0->num_entries 16 / max 128
        dl->body0->num_entries 20 / max 128
        dl->body0->num_entries 27 / max 128
        dl->body0->num_entries 34 / max 128
        dl->body0->num_entries 41 / max 128
        dl_child->body0->num_entries 10 / max 128
        dl_child->body0->num_entries 12 / max 128
        dl->bodies[x]->num_entries 15 / max 128
        dl->bodies[x]->num_entries 16 / max 128
        dl->bodies[x]->num_entries 17 / max 128
        dl->bodies[x]->num_entries 18 / max 128
        dl->bodies[x]->num_entries 20 / max 128
        dl->bodies[x]->num_entries 21 / max 128
        dl->bodies[x]->num_entries 256 / max 256
        dl->bodies[x]->num_entries 31 / max 128
        dl->bodies[x]->num_entries 32 / max 128
        dl->bodies[x]->num_entries 39 / max 128
        dl->bodies[x]->num_entries 40 / max 128
        dl->bodies[x]->num_entries 47 / max 128
        dl->bodies[x]->num_entries 48 / max 128
        dl->bodies[x]->num_entries 4914 / max 4914
        dl->bodies[x]->num_entries 55 / max 128
        dl->bodies[x]->num_entries 56 / max 128
        dl->bodies[x]->num_entries 63 / max 128
        dl->bodies[x]->num_entries 64 / max 128
      Signed-off-by: NKieran Bingham <kieran.bingham+renesas@ideasonboard.com>
      Signed-off-by: NLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      e646e177
    • K
      media: vsp1: Adapt entities to configure into a body · 12832dd9
      Kieran Bingham 提交于
      Currently the entities store their configurations into a display list.
      Adapt this such that the code can be configured into a body directly,
      allowing greater flexibility and control of the content.
      
      All users of vsp1_dl_list_write() are removed in this process, thus it
      too is removed.
      
      A helper, vsp1_dl_list_get_body0() is provided to access the internal body0
      from the display list.
      
      [laurent.pinchart+renesas@ideasonboard.com: Don't remove blank line unnecessarily]
      Signed-off-by: NKieran Bingham <kieran.bingham+renesas@ideasonboard.com>
      Signed-off-by: NLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      12832dd9
    • K
      media: vsp1: Refactor display list configure operations · 46ce3639
      Kieran Bingham 提交于
      The entities provide a single .configure operation which configures the
      object into the target display list, based on the vsp1_entity_params
      selection.
      
      Split the configure function into three parts, '.configure_stream()',
      '.configure_frame()', and '.configure_partition()' to facilitate
      splitting the configuration of each parameter class into separate
      display list bodies.
      
      [laurent.pinchart+renesas@ideasonboard.com: Blank line reformatting, remote unneeded local variable initialization]
      Signed-off-by: NKieran Bingham <kieran.bingham+renesas@ideasonboard.com>
      Signed-off-by: NLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
      Signed-off-by: NMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      46ce3639