Skip to content

Commit

Permalink
drm/msm/dpu: Drop encoder vsync_event
Browse files Browse the repository at this point in the history
Drop vsync_event and vsync_event_work handlers as they are unnecessary.
In addition drop the dpu_enc_ktime_template event class as it will be
unused after the vsync_event handlers are dropped.

Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/550983/
Link: https://lore.kernel.org/r/20230802-encoder-cleanup-v2-1-5bfdec0ce765@quicinc.com
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
  • Loading branch information
Jessica Zhang authored and Dmitry Baryshkov committed Aug 4, 2023
1 parent 57a1ca6 commit fdcb8fe
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 87 deletions.
65 changes: 1 addition & 64 deletions drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,13 @@ enum dpu_enc_rc_states {
* @crtc_frame_event_cb_data: callback handler private data
* @frame_done_timeout_ms: frame done timeout in ms
* @frame_done_timer: watchdog timer for frame done event
* @vsync_event_timer: vsync timer
* @disp_info: local copy of msm_display_info struct
* @idle_pc_supported: indicate if idle power collaps is supported
* @rc_lock: resource control mutex lock to protect
* virt encoder over various state changes
* @rc_state: resource controller state
* @delayed_off_work: delayed worker to schedule disabling of
* clks and resources after IDLE_TIMEOUT time.
* @vsync_event_work: worker to handle vsync event for autorefresh
* @topology: topology of the display
* @idle_timeout: idle timeout duration in milliseconds
* @wide_bus_en: wide bus is enabled on this interface
Expand Down Expand Up @@ -194,15 +192,13 @@ struct dpu_encoder_virt {

atomic_t frame_done_timeout_ms;
struct timer_list frame_done_timer;
struct timer_list vsync_event_timer;

struct msm_display_info disp_info;

bool idle_pc_supported;
struct mutex rc_lock;
enum dpu_enc_rc_states rc_state;
struct delayed_work delayed_off_work;
struct kthread_work vsync_event_work;
struct msm_display_topology topology;

u32 idle_timeout;
Expand Down Expand Up @@ -1770,49 +1766,6 @@ int dpu_encoder_vsync_time(struct drm_encoder *drm_enc, ktime_t *wakeup_time)
return 0;
}

static void dpu_encoder_vsync_event_handler(struct timer_list *t)
{
struct dpu_encoder_virt *dpu_enc = from_timer(dpu_enc, t,
vsync_event_timer);
struct drm_encoder *drm_enc = &dpu_enc->base;
struct msm_drm_private *priv;
struct msm_drm_thread *event_thread;

if (!drm_enc->dev || !drm_enc->crtc) {
DPU_ERROR("invalid parameters\n");
return;
}

priv = drm_enc->dev->dev_private;

if (drm_enc->crtc->index >= ARRAY_SIZE(priv->event_thread)) {
DPU_ERROR("invalid crtc index\n");
return;
}
event_thread = &priv->event_thread[drm_enc->crtc->index];
if (!event_thread) {
DPU_ERROR("event_thread not found for crtc:%d\n",
drm_enc->crtc->index);
return;
}

del_timer(&dpu_enc->vsync_event_timer);
}

static void dpu_encoder_vsync_event_work_handler(struct kthread_work *work)
{
struct dpu_encoder_virt *dpu_enc = container_of(work,
struct dpu_encoder_virt, vsync_event_work);
ktime_t wakeup_time;

if (dpu_encoder_vsync_time(&dpu_enc->base, &wakeup_time))
return;

trace_dpu_enc_vsync_event_work(DRMID(&dpu_enc->base), wakeup_time);
mod_timer(&dpu_enc->vsync_event_timer,
nsecs_to_jiffies(ktime_to_ns(wakeup_time)));
}

static u32
dpu_encoder_dsc_initial_line_calc(struct drm_dsc_config *dsc,
u32 enc_ip_width)
Expand Down Expand Up @@ -1972,7 +1925,6 @@ void dpu_encoder_kickoff(struct drm_encoder *drm_enc)
{
struct dpu_encoder_virt *dpu_enc;
struct dpu_encoder_phys *phys;
ktime_t wakeup_time;
unsigned long timeout_ms;
unsigned int i;

Expand All @@ -1998,14 +1950,6 @@ void dpu_encoder_kickoff(struct drm_encoder *drm_enc)
phys->ops.handle_post_kickoff(phys);
}

if (dpu_enc->disp_info.intf_type == INTF_DSI &&
!dpu_encoder_vsync_time(drm_enc, &wakeup_time)) {
trace_dpu_enc_early_kickoff(DRMID(drm_enc),
ktime_to_ms(wakeup_time));
mod_timer(&dpu_enc->vsync_event_timer,
nsecs_to_jiffies(ktime_to_ns(wakeup_time)));
}

DPU_ATRACE_END("encoder_kickoff");
}

Expand Down Expand Up @@ -2439,21 +2383,14 @@ struct drm_encoder *dpu_encoder_init(struct drm_device *dev,
timer_setup(&dpu_enc->frame_done_timer,
dpu_encoder_frame_done_timeout, 0);

if (disp_info->intf_type == INTF_DSI)
timer_setup(&dpu_enc->vsync_event_timer,
dpu_encoder_vsync_event_handler,
0);
else if (disp_info->intf_type == INTF_DP)
if (disp_info->intf_type == INTF_DP)
dpu_enc->wide_bus_en = msm_dp_wide_bus_available(
priv->dp[disp_info->h_tile_instance[0]]);

INIT_DELAYED_WORK(&dpu_enc->delayed_off_work,
dpu_encoder_off_work);
dpu_enc->idle_timeout = IDLE_TIMEOUT;

kthread_init_work(&dpu_enc->vsync_event_work,
dpu_encoder_vsync_event_work_handler);

memcpy(&dpu_enc->disp_info, disp_info, sizeof(*disp_info));

DPU_DEBUG_ENC(dpu_enc, "created\n");
Expand Down
23 changes: 0 additions & 23 deletions drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -453,29 +453,6 @@ TRACE_EVENT(dpu_enc_trigger_flush,
__entry->extra_flush_bits, __entry->pending_flush_ret)
);

DECLARE_EVENT_CLASS(dpu_enc_ktime_template,
TP_PROTO(uint32_t drm_id, ktime_t time),
TP_ARGS(drm_id, time),
TP_STRUCT__entry(
__field( uint32_t, drm_id )
__field( ktime_t, time )
),
TP_fast_assign(
__entry->drm_id = drm_id;
__entry->time = time;
),
TP_printk("id=%u, time=%lld", __entry->drm_id,
ktime_to_ms(__entry->time))
);
DEFINE_EVENT(dpu_enc_ktime_template, dpu_enc_vsync_event_work,
TP_PROTO(uint32_t drm_id, ktime_t time),
TP_ARGS(drm_id, time)
);
DEFINE_EVENT(dpu_enc_ktime_template, dpu_enc_early_kickoff,
TP_PROTO(uint32_t drm_id, ktime_t time),
TP_ARGS(drm_id, time)
);

DECLARE_EVENT_CLASS(dpu_id_event_template,
TP_PROTO(uint32_t drm_id, u32 event),
TP_ARGS(drm_id, event),
Expand Down

0 comments on commit fdcb8fe

Please sign in to comment.