Commit e4914867 authored by Sean Paul's avatar Sean Paul Committed by Rob Clark

drm/msm: dpu: Remove vblank_callback from encoder

The indirection of registering a callback and opaque pointer isn't reall
useful when there's only one callsite. So instead of having the
vblank_cb registration, just give encoder a crtc and let it directly
call the vblank handler.

In a later patch, we'll make use of this further.

Changes in v2:
- None

Cc: Jeykumar Sankaran <jsanka@codeaurora.org>
Reviewed-by: default avatarJeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: default avatarSean Paul <seanpaul@chromium.org>
Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
parent a9d629d7
...@@ -293,9 +293,8 @@ enum dpu_intf_mode dpu_crtc_get_intf_mode(struct drm_crtc *crtc) ...@@ -293,9 +293,8 @@ enum dpu_intf_mode dpu_crtc_get_intf_mode(struct drm_crtc *crtc)
return INTF_MODE_NONE; return INTF_MODE_NONE;
} }
static void dpu_crtc_vblank_cb(void *data) void dpu_crtc_vblank_callback(struct drm_crtc *crtc)
{ {
struct drm_crtc *crtc = (struct drm_crtc *)data;
struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc); struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc);
/* keep statistics on vblank callback - with auto reset via debugfs */ /* keep statistics on vblank callback - with auto reset via debugfs */
...@@ -786,8 +785,7 @@ static void _dpu_crtc_vblank_enable_no_lock( ...@@ -786,8 +785,7 @@ static void _dpu_crtc_vblank_enable_no_lock(
DRMID(enc), enable, DRMID(enc), enable,
dpu_crtc); dpu_crtc);
dpu_encoder_register_vblank_callback(enc, dpu_encoder_assign_crtc(enc, crtc);
dpu_crtc_vblank_cb, (void *)crtc);
} }
} else { } else {
list_for_each_entry(enc, &dev->mode_config.encoder_list, head) { list_for_each_entry(enc, &dev->mode_config.encoder_list, head) {
...@@ -798,7 +796,7 @@ static void _dpu_crtc_vblank_enable_no_lock( ...@@ -798,7 +796,7 @@ static void _dpu_crtc_vblank_enable_no_lock(
DRMID(enc), enable, DRMID(enc), enable,
dpu_crtc); dpu_crtc);
dpu_encoder_register_vblank_callback(enc, NULL, NULL); dpu_encoder_assign_crtc(enc, NULL);
} }
} }
} }
......
...@@ -270,6 +270,12 @@ static inline int dpu_crtc_frame_pending(struct drm_crtc *crtc) ...@@ -270,6 +270,12 @@ static inline int dpu_crtc_frame_pending(struct drm_crtc *crtc)
*/ */
int dpu_crtc_vblank(struct drm_crtc *crtc, bool en); int dpu_crtc_vblank(struct drm_crtc *crtc, bool en);
/**
* dpu_crtc_vblank_callback - called on vblank irq, issues completion events
* @crtc: Pointer to drm crtc object
*/
void dpu_crtc_vblank_callback(struct drm_crtc *crtc);
/** /**
* dpu_crtc_commit_kickoff - trigger kickoff of the commit for this crtc * dpu_crtc_commit_kickoff - trigger kickoff of the commit for this crtc
* @crtc: Pointer to drm crtc object * @crtc: Pointer to drm crtc object
......
...@@ -142,9 +142,11 @@ enum dpu_enc_rc_states { ...@@ -142,9 +142,11 @@ enum dpu_enc_rc_states {
* @intfs_swapped Whether or not the phys_enc interfaces have been swapped * @intfs_swapped Whether or not the phys_enc interfaces have been swapped
* for partial update right-only cases, such as pingpong * for partial update right-only cases, such as pingpong
* split where virtual pingpong does not generate IRQs * split where virtual pingpong does not generate IRQs
* @crtc_vblank_cb: Callback into the upper layer / CRTC for * @crtc: Pointer to the currently assigned crtc. Normally you
* notification of the VBLANK * would use crtc->state->encoder_mask to determine the
* @crtc_vblank_cb_data: Data from upper layer for VBLANK notification * link between encoder/crtc. However in this case we need
* to track crtc in the disable() hook which is called
* _after_ encoder_mask is cleared.
* @crtc_kickoff_cb: Callback into CRTC that will flush & start * @crtc_kickoff_cb: Callback into CRTC that will flush & start
* all CTL paths * all CTL paths
* @crtc_kickoff_cb_data: Opaque user data given to crtc_kickoff_cb * @crtc_kickoff_cb_data: Opaque user data given to crtc_kickoff_cb
...@@ -186,8 +188,7 @@ struct dpu_encoder_virt { ...@@ -186,8 +188,7 @@ struct dpu_encoder_virt {
bool intfs_swapped; bool intfs_swapped;
void (*crtc_vblank_cb)(void *); struct drm_crtc *crtc;
void *crtc_vblank_cb_data;
struct dentry *debugfs_root; struct dentry *debugfs_root;
struct mutex enc_lock; struct mutex enc_lock;
...@@ -1241,8 +1242,8 @@ static void dpu_encoder_vblank_callback(struct drm_encoder *drm_enc, ...@@ -1241,8 +1242,8 @@ static void dpu_encoder_vblank_callback(struct drm_encoder *drm_enc,
dpu_enc = to_dpu_encoder_virt(drm_enc); dpu_enc = to_dpu_encoder_virt(drm_enc);
spin_lock_irqsave(&dpu_enc->enc_spinlock, lock_flags); spin_lock_irqsave(&dpu_enc->enc_spinlock, lock_flags);
if (dpu_enc->crtc_vblank_cb) if (dpu_enc->crtc)
dpu_enc->crtc_vblank_cb(dpu_enc->crtc_vblank_cb_data); dpu_crtc_vblank_callback(dpu_enc->crtc);
spin_unlock_irqrestore(&dpu_enc->enc_spinlock, lock_flags); spin_unlock_irqrestore(&dpu_enc->enc_spinlock, lock_flags);
atomic_inc(&phy_enc->vsync_cnt); atomic_inc(&phy_enc->vsync_cnt);
...@@ -1262,15 +1263,14 @@ static void dpu_encoder_underrun_callback(struct drm_encoder *drm_enc, ...@@ -1262,15 +1263,14 @@ static void dpu_encoder_underrun_callback(struct drm_encoder *drm_enc,
DPU_ATRACE_END("encoder_underrun_callback"); DPU_ATRACE_END("encoder_underrun_callback");
} }
void dpu_encoder_register_vblank_callback(struct drm_encoder *drm_enc, void dpu_encoder_assign_crtc(struct drm_encoder *drm_enc, struct drm_crtc *crtc)
void (*vbl_cb)(void *), void *vbl_data)
{ {
struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(drm_enc); struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(drm_enc);
unsigned long lock_flags; unsigned long lock_flags;
bool enable; bool enable;
int i; int i;
enable = vbl_cb ? true : false; enable = crtc ? true : false;
if (!drm_enc) { if (!drm_enc) {
DPU_ERROR("invalid encoder\n"); DPU_ERROR("invalid encoder\n");
...@@ -1279,8 +1279,9 @@ void dpu_encoder_register_vblank_callback(struct drm_encoder *drm_enc, ...@@ -1279,8 +1279,9 @@ void dpu_encoder_register_vblank_callback(struct drm_encoder *drm_enc,
trace_dpu_enc_vblank_cb(DRMID(drm_enc), enable); trace_dpu_enc_vblank_cb(DRMID(drm_enc), enable);
spin_lock_irqsave(&dpu_enc->enc_spinlock, lock_flags); spin_lock_irqsave(&dpu_enc->enc_spinlock, lock_flags);
dpu_enc->crtc_vblank_cb = vbl_cb; /* crtc should always be cleared before re-assigning */
dpu_enc->crtc_vblank_cb_data = vbl_data; WARN_ON(crtc && dpu_enc->crtc);
dpu_enc->crtc = crtc;
spin_unlock_irqrestore(&dpu_enc->enc_spinlock, lock_flags); spin_unlock_irqrestore(&dpu_enc->enc_spinlock, lock_flags);
for (i = 0; i < dpu_enc->num_phys_encs; i++) { for (i = 0; i < dpu_enc->num_phys_encs; i++) {
......
...@@ -55,14 +55,12 @@ void dpu_encoder_get_hw_resources(struct drm_encoder *encoder, ...@@ -55,14 +55,12 @@ void dpu_encoder_get_hw_resources(struct drm_encoder *encoder,
struct dpu_encoder_hw_resources *hw_res); struct dpu_encoder_hw_resources *hw_res);
/** /**
* dpu_encoder_register_vblank_callback - provide callback to encoder that * dpu_encoder_assign_crtc - Link the encoder to the crtc it's assigned to
* will be called on the next vblank.
* @encoder: encoder pointer * @encoder: encoder pointer
* @cb: callback pointer, provide NULL to deregister and disable IRQs * @crtc: crtc pointer
* @data: user data provided to callback
*/ */
void dpu_encoder_register_vblank_callback(struct drm_encoder *encoder, void dpu_encoder_assign_crtc(struct drm_encoder *encoder,
void (*cb)(void *), void *data); struct drm_crtc *crtc);
/** /**
* dpu_encoder_register_frame_event_callback - provide callback to encoder that * dpu_encoder_register_frame_event_callback - provide callback to encoder that
......
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