1. 16 6月, 2017 1 次提交
    • R
      drm/msm/mdp5: kill pipe_lock · aa7cd242
      Rob Clark 提交于
      It serves no purpose, things should be sufficiently synchronized already
      by atomic framework.  And it is somewhat awkward to be holding a spinlock
      when msm_gem_iova() is going to start needing to grab a mutex.
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      aa7cd242
  2. 28 5月, 2017 2 次提交
    • R
      drm/msm/mdp5: release hwpipe(s) for unused planes · adcbae31
      Rob Clark 提交于
      Otherwise, if userspace doesn't re-use a given plane, it's hwpipe(s)
      could stay permanently assigned.
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      adcbae31
    • R
      drm/msm/mdp5: use __drm_atomic_helper_plane_duplicate_state() · 786813c3
      Rob Clark 提交于
      Somehow the helper was never retrofitted for mdp5.  Which meant when
      plane_state->fence was added, it could get copied into new state in
      mdp5_plane_duplicate_state().
      
      If an update to disable the plane (for example on rmfb) managed to sneak
      in after an nonblock update had swapped state, but before it was
      committed, we'd get a splat:
      
          WARNING: CPU: 1 PID: 69 at ../drivers/gpu/drm/drm_atomic_helper.c:1061 drm_atomic_helper_wait_for_fences+0xe0/0xf8
         Modules linked in:
      
         CPU: 1 PID: 69 Comm: kworker/1:1 Tainted: G        W       4.11.0-rc8+ #1187
         Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT)
         Workqueue: events drm_mode_rmfb_work_fn
         task: ffffffc036560d00 task.stack: ffffffc036550000
         PC is at drm_atomic_helper_wait_for_fences+0xe0/0xf8
         LR is at complete_commit.isra.1+0x44/0x1c0
         pc : [<ffffff80084f6040>] lr : [<ffffff800854176c>] pstate: 20000145
         sp : ffffffc036553b60
         x29: ffffffc036553b60 x28: ffffffc0264e6a00
         x27: ffffffc035659000 x26: 0000000000000000
         x25: ffffffc0240e8000 x24: 0000000000000038
         x23: 0000000000000000 x22: ffffff800858f200
         x21: ffffffc0240e8000 x20: ffffffc02f56a800
         x19: 0000000000000000 x18: 0000000000000000
         x17: 0000000000000000 x16: 0000000000000000
         x15: 0000000000000000 x14: ffffffc00a192700
         x13: 0000000000000004 x12: 0000000000000000
         x11: ffffff80089a1690 x10: 00000000000008f0
         x9 : ffffffc036553b20 x8 : ffffffc036561650
         x7 : ffffffc03fe6cb40 x6 : 0000000000000000
         x5 : 0000000000000001 x4 : 0000000000000002
         x3 : ffffffc035659000 x2 : ffffffc0240e8c80
         x1 : 0000000000000000 x0 : ffffffc02adbe588
      
         ---[ end trace 13aeec77c3fb55e2 ]---
         Call trace:
         Exception stack(0xffffffc036553990 to 0xffffffc036553ac0)
         3980:                                   0000000000000000 0000008000000000
         39a0: ffffffc036553b60 ffffff80084f6040 0000000000004ff0 0000000000000038
         39c0: ffffffc0365539d0 ffffff800857e098 ffffffc036553a00 ffffff800857e1b0
         39e0: ffffffc036553a10 ffffff800857c554 ffffffc0365e8400 ffffffc0365e8400
         3a00: ffffffc036553a20 ffffff8008103358 000000000001aad7 ffffff800851b72c
         3a20: ffffffc036553a50 ffffff80080e9228 ffffffc02adbe588 0000000000000000
         3a40: ffffffc0240e8c80 ffffffc035659000 0000000000000002 0000000000000001
         3a60: 0000000000000000 ffffffc03fe6cb40 ffffffc036561650 ffffffc036553b20
         3a80: 00000000000008f0 ffffff80089a1690 0000000000000000 0000000000000004
         3aa0: ffffffc00a192700 0000000000000000 0000000000000000 0000000000000000
         [<ffffff80084f6040>] drm_atomic_helper_wait_for_fences+0xe0/0xf8
         [<ffffff800854176c>] complete_commit.isra.1+0x44/0x1c0
         [<ffffff8008541c64>] msm_atomic_commit+0x32c/0x350
         [<ffffff8008516230>] drm_atomic_commit+0x50/0x60
         [<ffffff8008517548>] drm_atomic_remove_fb+0x158/0x250
         [<ffffff80085186d0>] drm_framebuffer_remove+0x50/0x158
         [<ffffff8008518818>] drm_mode_rmfb_work_fn+0x40/0x58
         [<ffffff80080d5668>] process_one_work+0x1d0/0x378
         [<ffffff80080d5a54>] worker_thread+0x244/0x488
         [<ffffff80080db7fc>] kthread+0xfc/0x128
         [<ffffff8008082ec0>] ret_from_fork+0x10/0x50
      
      Fixes: 96260142 ("drm/fence: add in-fences support")
      Cc: stable@vger.kernel.org
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Reported-by: NStanimir Varbanov <stanimir.varbanov@linaro.org>
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      786813c3
  3. 22 5月, 2017 1 次提交
  4. 08 4月, 2017 5 次提交
    • A
      drm/msm/mdp5: Configure 'right' hwpipe · c26b4f6c
      Archit Taneja 提交于
      Now that we have a right hwpipe in mdp5_plane_state, configure it
      mdp5_plane_mode_set(). The only parameters that vary between the
      left and right hwpipes are the src_w, src_img_w, src_x and crtc_x
      as we just even chop the fb into left and right halves.
      
      Add a mdp5_plane_right_pipe() which will be used by the crtc code
      to set up LM stages.
      Signed-off-by: NArchit Taneja <architt@codeaurora.org>
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      c26b4f6c
    • A
      drm/msm/mdp5: Assign a 'right hwpipe' to plane state · 7a10ee9b
      Archit Taneja 提交于
      If the drm_plane has a source width that's greater than the max width
      supported by a SSPP (2560 pixels on 8x96), then we assign a 'r_hwpipe'
      to it in mdp5_plane_atomic_check().
      
      TODO: There are a few scenarios where the hwpipe assignments aren't
      recommended by HW. For example, an assignment which results in a
      drm_plane to of two different types of hwpipes (say RGB0 on left
      and DMA1 on right) is not recommended.
      Also, hwpipes have a priority mapping, where the higher priority pipe
      needs to be staged on left LM, and the lower priority needs to be
      staged on the right LM. For example, the priority order for VIG pipes
      in decreasing order of priority is VIG0, VIG1, VIG2, and VIG3. So, VIG0
      on left and VIG1 on right is a correct configuration, but VIG1 on left
      and VIG0 on right isn't. These scenarios are ignored for now for the
      sake of simplicity.
      Signed-off-by: NArchit Taneja <architt@codeaurora.org>
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      7a10ee9b
    • A
      drm/msm/mdp5: Create mdp5_hwpipe_mode_set · 821be43f
      Archit Taneja 提交于
      Refactor mdp5_plane_mode_set to call mdp5_hwpipe_mode_set. The latter
      func takes in only the hwpipe and the parameters that need to be
      programmed into the hwpipe registers. All the code that calculates these
      parameters is left as is in mdp5_plane_mode_set.
      
      In the future, when we let drm_plane be comprised of 2 hwpipes, this func
      allow us to configure each pipe without adding redundant code.
      Signed-off-by: NArchit Taneja <architt@codeaurora.org>
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      821be43f
    • A
      drm/msm/mdp5: Remove mixer/intf pointers from mdp5_ctl · f316b25a
      Archit Taneja 提交于
      These are a part of CRTC state, it doesn't feel nice to leave them
      hanging in mdp5_ctl struct. Pass mdp5_pipeline pointer instead
      wherever it is needed.
      
      We still have some params in mdp5_ctl like start_mask etc which
      are derivative of atomic state, and should be rolled back if
      a commit fails, but it doesn't seem to cause much trouble.
      Signed-off-by: NArchit Taneja <architt@codeaurora.org>
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      f316b25a
    • A
      drm/msm/mdp5: Bring back pipe_lock to mdp5_plane struct · 01f8a969
      Archit Taneja 提交于
      We'd previously moved the pipe_lock spinlock to the hwpipe struct. Bring
      it back to mdp5_plane. We will need this because an mdp5_plane in the
      future could comprise of 2 hw pipes. It makes more sense to have a single
      lock to protect the registers for the hw pipes used by a plane, rather
      than trying to take individual locks per hwpipe when committing a
      configuration.
      Signed-off-by: NArchit Taneja <architt@codeaurora.org>
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      01f8a969
  5. 29 3月, 2017 1 次提交
  6. 07 2月, 2017 5 次提交
    • A
      drm/msm/mdp5: Add support for legacy cursor updates · 10967a06
      Archit Taneja 提交于
      This code has been more or less picked up from the vc4 and intel
      implementations of update_plane() funcs for cursor planes.
      
      The update_plane() func is usually the drm_atomic_helper_update_plane
      func that will issue an atomic commit with the plane updates. Such
      commits are not intended to be done faster than the vsync rate.
      
      The legacy cursor userspace API, on the other hand, expects the kernel
      to handle cursor updates immediately.
      
      Create a fast path in update_plane, which updates the cursor registers
      and flushes the configuration. The fast path is taken when there is only
      a change in the cursor's position in the crtc, or a change in the
      cursor's crop co-ordinates. For anything else, we go via the slow path.
      
      We take the slow path even when the fb changes, and when there is
      currently no fb tied to the plane. This should hopefully ensure that we
      always take a slow path for every new fb. This in turn should ensure that
      the fb is pinned/prepared.
      Signed-off-by: NArchit Taneja <architt@codeaurora.org>
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      10967a06
    • A
      drm/msm/mdp5: Refactor mdp5_plane_atomic_check · 9142364e
      Archit Taneja 提交于
      In mdp5_plane_atomic_check, we get crtc_state from drm_plane_state.
      
      Later, for cursor planes, we'll populate the update_plane() func that
      takes a fast asynchronous path to implement cursor movements. There, we
      would need to call a similar atomic_check func to validate the plane
      state, but crtc_state would need to be derived differently.
      
      Refactor mdp5_plane_atomic_check to mdp5_plane_atomic_check_with_state
      such that the latter takes crtc_state as an argument.
      
      This is similar to what the intel driver has done for async cursor
      updates.
      Signed-off-by: NArchit Taneja <architt@codeaurora.org>
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      9142364e
    • A
      drm/msm/mdp5: Misc cursor plane bits · 5798c8e0
      Archit Taneja 提交于
      These are various changes added in preparation for cursor planes:
      
      - Add a pipe_cursor block for 8x96 in mdp5_cfg.
      - Add a new pipe CAP called MDP_PIPE_CAP_CURSOR. Use this to ensure we
        assign a cursor SSPP for a drm_plane with type DRM_PLANE_TYPE_CURSOR.
      - Update mdp5_ctl_blend_mask/ext_blend_mask funcs to incorporate cursor
        SSPPs.
      - In mdp5_ctl_blend, iterate through MAX_STAGES instead of stage_cnt,
        we need to do this because we can now have empty stages in between.
      - In mdp5_crtc_atomic_check, make sure that the cursor plane has the
        highest zorder, and stage the cursor plane to the maximum stage #
        present on the HW.
      - Create drm_crtc_funcs that doesn't try to implement cursors using the
        older LM cursor HW.
      - Pass drm_plane_type in mdp5_plane_init instead of a bool telling
        whether plane is primary or not.
      Signed-off-by: NArchit Taneja <architt@codeaurora.org>
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      5798c8e0
    • A
      drm/msm/mdp5: Use plane helpers to configure src/dst rectangles · 3b6acf14
      Archit Taneja 提交于
      The MDP5 plane's atomic_check ops doesn't perform clipping tests.
      This didn't hurt us much in the past, but clipping becomes important
      with cursor planes.
      
      Use drm_plane_helper_check_state, the way rockchip/intel/mtk drivers
      already do. Use these drivers as reference.
      
      Clipping requires knowledge of the crtc width and height. This requires
      us to call drm_atomic_helper_check_modeset before
      drm_atomic_helper_check_planes in the driver's atomic_check op, because
      check_modetest will populate the mode for the crtc, needed to populate
      the clip rectangle.
      
      We update the plane_enabled(state) local helper to use state->visible,
      since state->visible and 'state->fb && state->crtc' represent the same
      thing.
      
      One issue with the existing code is that we don't have a way to disable
      the plane when it's completely clipped out. Until there isn't an update
      on the crtc (which would de-stage the plane), we would still see the
      plane in its last 'visible' configuration.
      Signed-off-by: NArchit Taneja <architt@codeaurora.org>
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      3b6acf14
    • A
      drm/msm/mdp5: Prepare CRTC/LM for empty stages · 106f9727
      Archit Taneja 提交于
      Use SSPP_NONE in mdp5_plane_pipe() if there is now hwpipe allocated for
      the drm_plane. Returning '0' means we are returning VIG0 pipe.
      
      Also, use the mdp5_pipe enum to pass around the stage array. Initialize
      the stage to SSPP_NONE by default.
      
      We do the above because 1) Cursor plane has to be staged at the topmost
      blender of the LM, which can result in empty stages in between 2) In
      the future, when we support multiple LMs per CRTC. We could have stages
      which don't have any pipe assigned to them.
      Signed-off-by: NArchit Taneja <architt@codeaurora.org>
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      106f9727
  7. 13 1月, 2017 1 次提交
    • R
      drm/msm/mdp5: rip out plane->pending tracking · c57a94ff
      Rob Clark 提交于
      It would race between userspace thread and commit worker.  Ie. vblank
      irq would trigger event and userspace could begin the next atomic
      update, before the commit worker had a chance to clear the pending
      flag.
      
      If we do end up needing something to prevent userspace from trying
      another pageflip before getting vblank event, it should probably be
      implemented as a pending_planes bitmask, similar to pending_crtcs.  See
      start_atomic() and end_atomic().
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      c57a94ff
  8. 15 12月, 2016 1 次提交
  9. 28 11月, 2016 8 次提交
    • R
      drm/msm/mdp5: move LM bounds check into plane->atomic_check() · 9708ebbe
      Rob Clark 提交于
      The mode_config->max_{width,height} is for the maximum size of a fb, not
      the max scanout limits (of the layer-mixer).  It is legal, and in fact
      common, to create a larger fb, only only scan-out a smaller part of it.
      For example multi-monitor configurations for x11, or android wallpaper
      layer (which is created larger than the screen resolution for fast
      scrolling by just changing the src x/y coordinates).
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      9708ebbe
    • R
      drm/msm/mdp5: handle SMP block allocations "atomically" · 49ec5b2e
      Rob Clark 提交于
      Previously, SMP block allocation was not checked in the plane's
      atomic_check() fxn, so we could fail allocation SMP block allocation at
      atomic_update() time.  Re-work the block allocation to request blocks
      during atomic_check(), but not update the hw until committing the atomic
      update.
      
      Since SMP blocks allocated at atomic_check() time, we need to manage the
      SMP state as part of mdp5_state (global atomic state).  This actually
      ends up significantly simplifying the SMP management, as the SMP module
      does not need to manage the intermediate state between assigning new
      blocks before setting flush bits and releasing old blocks after vblank.
      (The SMP registers and SMP allocation is not double-buffered, so newly
      allocated blocks need to be updated in kms->prepare_commit() released
      blocks in kms->complete_commit().)
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      49ec5b2e
    • R
      drm/msm/mdp5: dynamically assign hw pipes to planes · 4a0f012d
      Rob Clark 提交于
      (re)assign the hw pipes to planes based on required caps, and to handle
      situations where we could not modify an in-use plane (ie. SMP block
      reallocation).
      
      This means all planes advertise the superset of formats and properties.
      Userspace must (as always) use atomic TEST_ONLY step for atomic updates,
      as not all planes may be available for use on every frame.
      
      The mapping of hwpipe to plane is stored in mdp5_state, so that state
      updates are atomically committed in the same way that plane/etc state
      updates are managed.  This is needed because the mdp5_plane_state keeps
      a pointer to the hwpipe, and we don't want global state to become out
      of sync with the plane state if an atomic update fails, we hit deadlock/
      backoff scenario, etc.  The use of state_lock keeps multiple parallel
      updates which both re-assign hwpipes properly serialized.
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      4a0f012d
    • R
      drm/msm/mdp5: introduce mdp5_hw_pipe · c056b55d
      Rob Clark 提交于
      Split out the hardware pipe specifics from mdp5_plane.  To start, the hw
      pipes are statically assigned to planes, but next step is to assign the
      hw pipes during plane->atomic_check() based on requested caps (scaling,
      YUV, etc).  And then hw pipe re-assignment if required if required SMP
      blocks changes.
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      Reviewed-by: NArchit Taneja <architt@codeaurora.org>
      c056b55d
    • R
      drm/msm/mdp5: rip out mode_changed · f5903bad
      Rob Clark 提交于
      It wasn't really doing the right thing if, for example, position or
      height changed.
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      f5903bad
    • R
      drm/msm/mdp5: don't be so casty · 6ff3ddca
      Rob Clark 提交于
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      6ff3ddca
    • R
      drm/msm/mdp5: drop mdp5_plane::name · 0002d30f
      Rob Clark 提交于
      Just use plane->name now that it is a thing.  In a following patch, once
      we dynamically assign hw pipes to planes, it won't make sense to name
      planes the way we do, so this also partly reduces churn in following
      patch.
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      0002d30f
    • R
      drm/msm/mdp5: nuke mdp5_plane_complete_flip() · a2100695
      Rob Clark 提交于
      We can do this all from mdp5_plane_complete_commit(), so simplify things
      a bit and drop mdp5_plane_complete_flip().
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      a2100695
  10. 27 11月, 2016 2 次提交
  11. 09 11月, 2016 1 次提交
  12. 02 11月, 2016 1 次提交
  13. 22 10月, 2016 2 次提交
  14. 16 9月, 2016 1 次提交
  15. 19 8月, 2016 1 次提交
  16. 09 8月, 2016 1 次提交
  17. 11 12月, 2015 1 次提交
    • V
      drm: Pass 'name' to drm_universal_plane_init() · b0b3b795
      Ville Syrjälä 提交于
      Done with coccinelle for the most part. It choked on
      msm/mdp/mdp5/mdp5_plane.c like so:
      "BAD:!!!!!  enum drm_plane_type type;"
      No idea how to deal with that, so I just fixed that up
      by hand.
      
      Also it thinks '...' is part of the semantic patch, so I put an
      'int DOTDOTDOT' placeholder in its place and got rid of it with
      sed afterwards.
      
      I didn't convert drm_plane_init() since passing the varargs through
      would mean either cpp macros or va_list, and I figured we don't
      care about these legacy functions enough to warrant the extra pain.
      
      @@
      typedef uint32_t;
      identifier dev, plane, possible_crtcs, funcs, formats, format_count, type;
      @@
       int drm_universal_plane_init(struct drm_device *dev,
                                    struct drm_plane *plane,
                                    unsigned long possible_crtcs,
                                    const struct drm_plane_funcs *funcs,
                                    const uint32_t *formats,
                                    unsigned int format_count,
                                    enum drm_plane_type type
      +                             ,const char *name, int DOTDOTDOT
                                    )
      { ... }
      
      @@
      identifier dev, plane, possible_crtcs, funcs, formats, format_count, type;
      @@
       int drm_universal_plane_init(struct drm_device *dev,
                                    struct drm_plane *plane,
                                    unsigned long possible_crtcs,
                                    const struct drm_plane_funcs *funcs,
                                    const uint32_t *formats,
                                    unsigned int format_count,
                                    enum drm_plane_type type
      +                             ,const char *name, int DOTDOTDOT
                                    );
      
      @@
      expression E1, E2, E3, E4, E5, E6, E7;
      @@
       drm_universal_plane_init(E1, E2, E3, E4, E5, E6, E7
      +                         ,NULL
                                )
      
      v2: Split crtc and plane changes apart
          Pass NUL for no-name instead of ""
          Leave drm_plane_init() alone
      v3: Add ', or NULL...' to @name kernel doc (Jani)
          Annotate the function with __printf() attribute (Jani)
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/1449670795-2853-1-git-send-email-ville.syrjala@linux.intel.com
      b0b3b795
  18. 23 10月, 2015 3 次提交
  19. 08 9月, 2015 1 次提交
  20. 16 8月, 2015 1 次提交