This patch is removing a bunch more dpu changes that touch msm core. I'm pretty sure the event_thread stuff can go, but I might be wrong about that aspect. Signed-off-by: Sean Paul <seanpaul@xxxxxxxxxxxx> --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 242 +--------------- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 102 +------ drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h | 10 - drivers/gpu/drm/msm/msm_atomic.c | 3 +- drivers/gpu/drm/msm/msm_drv.c | 299 ++------------------ drivers/gpu/drm/msm/msm_drv.h | 158 +---------- drivers/gpu/drm/msm/msm_kms.h | 8 +- drivers/gpu/drm/msm/msm_rd.c | 55 +--- include/drm/drm_mipi_dsi.h | 4 - include/linux/msm_ext_display.h | 182 ------------ include/uapi/drm/msm_drm.h | 78 ----- 11 files changed, 43 insertions(+), 1098 deletions(-) delete mode 100644 include/linux/msm_ext_display.h diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index 86ed8cb45cee..f54c1aceb17a 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -563,12 +563,6 @@ void dpu_crtc_res_put(struct drm_crtc_state *state, u32 type, u64 tag) _dpu_crtc_rp_put(rp, type, tag); } -static void _dpu_crtc_deinit_events(struct dpu_crtc *dpu_crtc) -{ - if (!dpu_crtc) - return; -} - static void dpu_crtc_destroy(struct drm_crtc *crtc) { struct dpu_crtc *dpu_crtc = to_dpu_crtc(crtc); @@ -578,7 +572,6 @@ static void dpu_crtc_destroy(struct drm_crtc *crtc) if (!crtc) return; - _dpu_crtc_deinit_events(dpu_crtc); dpu_crtc->phandle = NULL; drm_crtc_cleanup(crtc); @@ -842,47 +835,6 @@ static void dpu_crtc_vblank_cb(void *data) trace_dpu_crtc_vblank_cb(DRMID(crtc)); } -/* _dpu_crtc_idle_notify - signal idle timeout to client */ -static void _dpu_crtc_idle_notify(struct dpu_crtc *dpu_crtc) -{ - struct drm_crtc *crtc; - struct drm_event event; - int ret = 0; - - if (!dpu_crtc) { - DPU_ERROR("invalid dpu crtc\n"); - return; - } - - crtc = &dpu_crtc->base; - event.type = DRM_EVENT_IDLE_NOTIFY; - event.length = sizeof(u32); - msm_mode_object_event_notify(&crtc->base, crtc->dev, &event, - (u8 *)&ret); - - DPU_DEBUG("crtc:%d idle timeout notified\n", crtc->base.id); -} - -/* - * dpu_crtc_handle_event - crtc frame event handle. - * This API must manage only non-IRQ context events. - */ -static bool _dpu_crtc_handle_event(struct dpu_crtc *dpu_crtc, u32 event) -{ - bool event_processed = false; - - /** - * idle events are originated from commit thread and can be processed - * in same context - */ - if (event & DPU_ENCODER_FRAME_EVENT_IDLE) { - _dpu_crtc_idle_notify(dpu_crtc); - event_processed = true; - } - - return event_processed; -} - static void dpu_crtc_frame_event_work(struct kthread_work *work) { struct msm_drm_private *priv; @@ -960,58 +912,6 @@ static void dpu_crtc_frame_event_work(struct kthread_work *work) DPU_ATRACE_END("crtc_frame_event"); } -/* - * dpu_crtc_frame_event_cb - crtc frame event callback API. CRTC module - * registers this API to encoder for all frame event callbacks like - * frame_error, frame_done, idle_timeout, etc. Encoder may call different events - * from different context - IRQ, user thread, commit_thread, etc. Each event - * should be carefully reviewed and should be processed in proper task context - * to avoid schedulin delay or properly manage the irq context's bottom half - * processing. - */ -static void dpu_crtc_frame_event_cb(void *data, u32 event) -{ - struct drm_crtc *crtc = (struct drm_crtc *)data; - struct dpu_crtc *dpu_crtc; - struct msm_drm_private *priv; - struct dpu_crtc_frame_event *fevent; - unsigned long flags; - u32 crtc_id; - bool event_processed = false; - - if (!crtc || !crtc->dev || !crtc->dev->dev_private) { - DPU_ERROR("invalid parameters\n"); - return; - } - dpu_crtc = to_dpu_crtc(crtc); - priv = crtc->dev->dev_private; - crtc_id = drm_crtc_index(crtc); - - trace_dpu_crtc_frame_event_cb(DRMID(crtc), event); - - /* try to process the event in caller context */ - event_processed = _dpu_crtc_handle_event(dpu_crtc, event); - if (event_processed) - return; - - spin_lock_irqsave(&dpu_crtc->spin_lock, flags); - fevent = list_first_entry_or_null(&dpu_crtc->frame_event_list, - struct dpu_crtc_frame_event, list); - if (fevent) - list_del_init(&fevent->list); - spin_unlock_irqrestore(&dpu_crtc->spin_lock, flags); - - if (!fevent) { - DRM_ERROR("crtc%d event %d overflow\n", crtc->base.id, event); - return; - } - - fevent->event = event; - fevent->crtc = crtc; - fevent->ts = ktime_get(); - kthread_queue_work(&priv->event_thread[crtc_id].worker, &fevent->work); -} - void dpu_crtc_complete_commit(struct drm_crtc *crtc, struct drm_crtc_state *old_state) { @@ -1200,7 +1100,6 @@ static void dpu_crtc_atomic_flush(struct drm_crtc *crtc, struct drm_device *dev; struct drm_plane *plane; struct msm_drm_private *priv; - struct msm_drm_thread *event_thread; unsigned long flags; struct dpu_crtc_state *cstate; @@ -1222,13 +1121,6 @@ static void dpu_crtc_atomic_flush(struct drm_crtc *crtc, dev = crtc->dev; priv = dev->dev_private; - if (crtc->index >= ARRAY_SIZE(priv->event_thread)) { - DPU_ERROR("invalid crtc index[%d]\n", crtc->index); - return; - } - - event_thread = &priv->event_thread[crtc->index]; - if (dpu_crtc->event) { DPU_DEBUG("already received dpu_crtc->event\n"); } else { @@ -1663,10 +1555,7 @@ static void dpu_crtc_disable(struct drm_crtc *crtc) struct dpu_crtc *dpu_crtc; struct dpu_crtc_state *cstate; struct drm_display_mode *mode; - struct drm_encoder *encoder; struct msm_drm_private *priv; - struct drm_event event; - u32 power_on; int ret; if (!crtc || !crtc->dev || !crtc->dev->dev_private || !crtc->state) { @@ -1685,13 +1574,6 @@ static void dpu_crtc_disable(struct drm_crtc *crtc) mutex_lock(&dpu_crtc->crtc_lock); - /* update color processing on suspend */ - event.type = DRM_EVENT_CRTC_POWER; - event.length = sizeof(u32); - power_on = 0; - msm_mode_object_event_notify(&crtc->base, crtc->dev, &event, - (u8 *)&power_on); - /* wait for frame_event_done completion */ if (_dpu_crtc_wait_for_frame_done(crtc)) DPU_ERROR("crtc%d wait for frame done failed;frame_pending%d\n", @@ -1717,12 +1599,6 @@ static void dpu_crtc_disable(struct drm_crtc *crtc) dpu_core_perf_crtc_update(crtc, 0, true); - drm_for_each_encoder(encoder, crtc->dev) { - if (encoder->crtc != crtc) - continue; - dpu_encoder_register_frame_event_callback(encoder, NULL, NULL); - } - if (dpu_crtc->power_event) dpu_power_handle_unregister_event(dpu_crtc->phandle, dpu_crtc->power_event); @@ -1743,10 +1619,7 @@ static void dpu_crtc_enable(struct drm_crtc *crtc, struct drm_crtc_state *old_crtc_state) { struct dpu_crtc *dpu_crtc; - struct drm_encoder *encoder; struct msm_drm_private *priv; - struct drm_event event; - u32 power_on; int ret; if (!crtc || !crtc->dev || !crtc->dev->dev_private) { @@ -1758,13 +1631,6 @@ static void dpu_crtc_enable(struct drm_crtc *crtc, DRM_DEBUG_KMS("crtc%d\n", crtc->base.id); dpu_crtc = to_dpu_crtc(crtc); - drm_for_each_encoder(encoder, crtc->dev) { - if (encoder->crtc != crtc) - continue; - dpu_encoder_register_frame_event_callback(encoder, - dpu_crtc_frame_event_cb, (void *)crtc); - } - mutex_lock(&dpu_crtc->crtc_lock); trace_dpu_crtc_enable(DRMID(crtc), true, dpu_crtc); if (!dpu_crtc->enabled && !dpu_crtc->suspend && @@ -1776,13 +1642,6 @@ static void dpu_crtc_enable(struct drm_crtc *crtc, } dpu_crtc->enabled = true; - /* update color processing on resume */ - event.type = DRM_EVENT_CRTC_POWER; - event.length = sizeof(u32); - power_on = 1; - msm_mode_object_event_notify(&crtc->base, crtc->dev, &event, - (u8 *)&power_on); - mutex_unlock(&dpu_crtc->crtc_lock); dpu_crtc->power_event = dpu_power_handle_register_event( @@ -2436,97 +2295,6 @@ static const struct drm_crtc_helper_funcs dpu_crtc_helper_funcs = { .atomic_flush = dpu_crtc_atomic_flush, }; -static void _dpu_crtc_event_cb(struct kthread_work *work) -{ - struct dpu_crtc_event *event; - struct dpu_crtc *dpu_crtc; - unsigned long irq_flags; - - if (!work) { - DPU_ERROR("invalid work item\n"); - return; - } - - event = container_of(work, struct dpu_crtc_event, kt_work); - - /* set dpu_crtc to NULL for static work structures */ - dpu_crtc = event->dpu_crtc; - if (!dpu_crtc) - return; - - if (event->cb_func) - event->cb_func(&dpu_crtc->base, event->usr); - - spin_lock_irqsave(&dpu_crtc->event_lock, irq_flags); - list_add_tail(&event->list, &dpu_crtc->event_free_list); - spin_unlock_irqrestore(&dpu_crtc->event_lock, irq_flags); -} - -int dpu_crtc_event_queue(struct drm_crtc *crtc, - void (*func)(struct drm_crtc *crtc, void *usr), void *usr) -{ - unsigned long irq_flags; - struct dpu_crtc *dpu_crtc; - struct msm_drm_private *priv; - struct dpu_crtc_event *event = NULL; - u32 crtc_id; - - if (!crtc || !crtc->dev || !crtc->dev->dev_private || !func) { - DPU_ERROR("invalid parameters\n"); - return -EINVAL; - } - dpu_crtc = to_dpu_crtc(crtc); - priv = crtc->dev->dev_private; - crtc_id = drm_crtc_index(crtc); - - /* - * Obtain an event struct from the private cache. This event - * queue may be called from ISR contexts, so use a private - * cache to avoid calling any memory allocation functions. - */ - spin_lock_irqsave(&dpu_crtc->event_lock, irq_flags); - if (!list_empty(&dpu_crtc->event_free_list)) { - event = list_first_entry(&dpu_crtc->event_free_list, - struct dpu_crtc_event, list); - list_del_init(&event->list); - } - spin_unlock_irqrestore(&dpu_crtc->event_lock, irq_flags); - - if (!event) - return -ENOMEM; - - /* populate event node */ - event->dpu_crtc = dpu_crtc; - event->cb_func = func; - event->usr = usr; - - /* queue new event request */ - kthread_init_work(&event->kt_work, _dpu_crtc_event_cb); - kthread_queue_work(&priv->event_thread[crtc_id].worker, - &event->kt_work); - - return 0; -} - -static int _dpu_crtc_init_events(struct dpu_crtc *dpu_crtc) -{ - int i, rc = 0; - - if (!dpu_crtc) { - DPU_ERROR("invalid crtc\n"); - return -EINVAL; - } - - spin_lock_init(&dpu_crtc->event_lock); - - INIT_LIST_HEAD(&dpu_crtc->event_free_list); - for (i = 0; i < DPU_CRTC_MAX_EVENT_COUNT; ++i) - list_add_tail(&dpu_crtc->event_cache[i].list, - &dpu_crtc->event_free_list); - - return rc; -} - /* initialize crtc */ struct drm_crtc *dpu_crtc_init(struct drm_device *dev, struct drm_plane *plane) { @@ -2534,7 +2302,7 @@ struct drm_crtc *dpu_crtc_init(struct drm_device *dev, struct drm_plane *plane) struct dpu_crtc *dpu_crtc = NULL; struct msm_drm_private *priv = NULL; struct dpu_kms *kms = NULL; - int i, rc; + int i; priv = dev->dev_private; kms = to_dpu_kms(priv->kms); @@ -2574,14 +2342,6 @@ struct drm_crtc *dpu_crtc_init(struct drm_device *dev, struct drm_plane *plane) /* save user friendly CRTC name for later */ snprintf(dpu_crtc->name, DPU_CRTC_NAME_SIZE, "crtc%u", crtc->base.id); - /* initialize event handling */ - rc = _dpu_crtc_init_events(dpu_crtc); - if (rc) { - drm_crtc_cleanup(crtc); - kfree(dpu_crtc); - return ERR_PTR(rc); - } - dpu_crtc->phandle = &kms->phandle; DPU_DEBUG("%s: successfully initialized crtc\n", dpu_crtc->name); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index ce4faee12adc..4aa9aea23d22 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -155,11 +155,8 @@ enum dpu_enc_rc_states { * @frame_busy_mask: Bitmask tracking which phys_enc we are still * busy processing current command. * Bit0 = phys_encs[0] etc. - * @crtc_frame_event_cb: callback handler for frame event - * @crtc_frame_event_cb_data: callback handler private data * @frame_done_timeout: frame done timeout in Hz * @frame_done_timer: watchdog timer for frame done event - * @vsync_event_timer: vsync timer * @disp_info: local copy of msm_display_info struct * @misr_enable: misr enable/disable status * @misr_frame_count: misr frame count before start capturing the data @@ -169,7 +166,6 @@ enum dpu_enc_rc_states { * @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 * @mode_set_complete: flag to indicate modeset completion * @idle_timeout: idle timeout duration in milliseconds @@ -194,12 +190,9 @@ struct dpu_encoder_virt { struct dentry *debugfs_root; struct mutex enc_lock; DECLARE_BITMAP(frame_busy_mask, MAX_PHYS_ENCODERS_PER_VIRTUAL); - void (*crtc_frame_event_cb)(void *, u32 event); - void *crtc_frame_event_cb_data; atomic_t frame_done_timeout; struct timer_list frame_done_timer; - struct timer_list vsync_event_timer; struct msm_display_info disp_info; bool misr_enable; @@ -209,7 +202,6 @@ struct dpu_encoder_virt { struct mutex rc_lock; enum dpu_enc_rc_states rc_state; struct kthread_delayed_work delayed_off_work; - struct kthread_work vsync_event_work; struct msm_display_topology topology; bool mode_set_complete; @@ -1348,28 +1340,6 @@ void dpu_encoder_register_vblank_callback(struct drm_encoder *drm_enc, } } -void dpu_encoder_register_frame_event_callback(struct drm_encoder *drm_enc, - void (*frame_event_cb)(void *, u32 event), - void *frame_event_cb_data) -{ - struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(drm_enc); - unsigned long lock_flags; - bool enable; - - enable = frame_event_cb ? true : false; - - if (!drm_enc) { - DPU_ERROR("invalid encoder\n"); - return; - } - trace_dpu_enc_frame_event_cb(DRMID(drm_enc), enable); - - spin_lock_irqsave(&dpu_enc->enc_spinlock, lock_flags); - dpu_enc->crtc_frame_event_cb = frame_event_cb; - dpu_enc->crtc_frame_event_cb_data = frame_event_cb_data; - spin_unlock_irqrestore(&dpu_enc->enc_spinlock, lock_flags); -} - static void dpu_encoder_frame_done_callback( struct drm_encoder *drm_enc, struct dpu_encoder_phys *ready_phys, u32 event) @@ -1406,16 +1376,7 @@ static void dpu_encoder_frame_done_callback( dpu_encoder_resource_control(drm_enc, DPU_ENC_RC_EVENT_FRAME_DONE); - - if (dpu_enc->crtc_frame_event_cb) - dpu_enc->crtc_frame_event_cb( - dpu_enc->crtc_frame_event_cb_data, - event); } - } else { - if (dpu_enc->crtc_frame_event_cb) - dpu_enc->crtc_frame_event_cb( - dpu_enc->crtc_frame_event_cb_data, event); } } @@ -1769,55 +1730,6 @@ static int _dpu_encoder_wakeup_time(struct drm_encoder *drm_enc, 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->dev->dev_private || - !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_enc) { - DPU_ERROR("invalid dpu encoder\n"); - return; - } - - if (_dpu_encoder_wakeup_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))); -} - void dpu_encoder_prepare_for_kickoff(struct drm_encoder *drm_enc, struct dpu_encoder_kickoff_params *params) { @@ -1896,8 +1808,6 @@ void dpu_encoder_kickoff(struct drm_encoder *drm_enc) !_dpu_encoder_wakeup_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"); @@ -2395,7 +2305,7 @@ static void dpu_encoder_frame_done_timeout(struct timer_list *t) } priv = drm_enc->dev->dev_private; - if (!dpu_enc->frame_busy_mask[0] || !dpu_enc->crtc_frame_event_cb) { + if (!dpu_enc->frame_busy_mask[0]) { DRM_DEBUG_KMS("id:%u invalid timeout frame_busy_mask=%lu\n", DRMID(drm_enc), dpu_enc->frame_busy_mask[0]); return; @@ -2408,7 +2318,6 @@ static void dpu_encoder_frame_done_timeout(struct timer_list *t) event = DPU_ENCODER_FRAME_EVENT_ERROR; trace_dpu_enc_frame_done_timeout(DRMID(drm_enc), event); - dpu_enc->crtc_frame_event_cb(dpu_enc->crtc_frame_event_cb_data, event); } static const struct drm_encoder_helper_funcs dpu_encoder_helper_funcs = { @@ -2452,20 +2361,11 @@ int dpu_encoder_setup(struct drm_device *dev, struct drm_encoder *enc, timer_setup(&dpu_enc->frame_done_timer, dpu_encoder_frame_done_timeout, 0); - if (disp_info->intf_type == DRM_MODE_CONNECTOR_DSI) - timer_setup(&dpu_enc->vsync_event_timer, - dpu_encoder_vsync_event_handler, - 0); - - mutex_init(&dpu_enc->rc_lock); kthread_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"); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h index ce92901ed227..8a4db88fdf72 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h @@ -72,16 +72,6 @@ void dpu_encoder_get_hw_resources(struct drm_encoder *encoder, void dpu_encoder_register_vblank_callback(struct drm_encoder *encoder, void (*cb)(void *), void *data); -/** - * dpu_encoder_register_frame_event_callback - provide callback to encoder that - * will be called after the request is complete, or other events. - * @encoder: encoder pointer - * @cb: callback pointer, provide NULL to deregister - * @data: user data provided to callback - */ -void dpu_encoder_register_frame_event_callback(struct drm_encoder *encoder, - void (*cb)(void *, u32), void *data); - /** * dpu_encoder_prepare_for_kickoff - schedule double buffer flip of the ctl * path (i.e. ctl flush and start) at next appropriate time. diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c index 4ee794831c97..c1f1779c980f 100644 --- a/drivers/gpu/drm/msm/msm_atomic.c +++ b/drivers/gpu/drm/msm/msm_atomic.c @@ -1,5 +1,4 @@ /* - * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. * Copyright (C) 2014 Red Hat * Author: Rob Clark <robdclark@xxxxxxxxx> * @@ -21,7 +20,7 @@ #include "msm_kms.h" static void msm_atomic_wait_for_commit_done(struct drm_device *dev, - struct drm_atomic_state *old_state) + struct drm_atomic_state *old_state) { struct drm_crtc *crtc; struct drm_crtc_state *new_crtc_state; diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 70c4727fe98a..f866e2d757d9 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -15,27 +15,6 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see <http://www.gnu.org/licenses/>. */ -/* - * Copyright (c) 2016 Intel Corporation - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting documentation, and - * that the name of the copyright holders not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. The copyright holders make no representations - * about the suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ #include <linux/debugfs.h> #include <linux/of_address.h> @@ -137,8 +116,7 @@ void __iomem *msm_ioremap(struct platform_device *pdev, const char *name, res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { - dev_warn(&pdev->dev, "memory resource: %s not available\n", - name); + dev_err(&pdev->dev, "failed to get memory resource: %s\n", name); return ERR_PTR(-EINVAL); } @@ -189,7 +167,6 @@ void msm_writel(u32 data, void __iomem *addr) u32 msm_readl(const void __iomem *addr) { u32 val = readl(addr); - if (reglog) pr_err("IO:R %p %08x\n", addr, val); return val; @@ -283,12 +260,6 @@ static int msm_drm_uninit(struct device *dev) kthread_stop(priv->disp_thread[i].thread); priv->disp_thread[i].thread = NULL; } - - if (priv->event_thread[i].thread) { - kthread_flush_worker(&priv->event_thread[i].worker); - kthread_stop(priv->event_thread[i].thread); - priv->event_thread[i].thread = NULL; - } } msm_gem_shrinker_cleanup(ddev); @@ -340,10 +311,10 @@ static int msm_drm_uninit(struct device *dev) mdss->funcs->destroy(ddev); ddev->dev_private = NULL; - kfree(priv); - drm_dev_unref(ddev); + kfree(priv); + return 0; } @@ -464,9 +435,9 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv) struct sched_param param; ddev = drm_dev_alloc(drv, dev); - if (!ddev) { + if (IS_ERR(ddev)) { dev_err(dev, "failed to allocate drm_device\n"); - return -ENOMEM; + return PTR_ERR(ddev); } platform_set_drvdata(pdev, ddev); @@ -499,7 +470,6 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv) priv->wq = alloc_ordered_workqueue("msm", 0); - INIT_LIST_HEAD(&priv->client_event_list); INIT_LIST_HEAD(&priv->inactive_list); INIT_LIST_HEAD(&priv->vblank_ctrl.event_list); kthread_init_work(&priv->vblank_ctrl.work, vblank_ctrl_worker); @@ -550,22 +520,12 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv) * and (for example) use dmabuf/prime to share buffers with * imx drm driver on iMX5 */ - priv->kms = NULL; dev_err(dev, "failed to load kms\n"); ret = PTR_ERR(kms); goto fail; } priv->kms = kms; - /** - * Since kms->funcs->hw_init(kms) might call - * drm_object_property_set_value we need to make sure - * mode_config.funcs is initialized first to avoid dereferencing - * an unset value during call to drm_drv_uses_atomic_modeset() - */ - ddev->mode_config.funcs = &mode_config_funcs; - ddev->mode_config.helper_private = &mode_config_helper_funcs; - /* Enable normalization of plane zpos */ ddev->mode_config.normalize_zpos = true; @@ -577,6 +537,9 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv) } } + ddev->mode_config.funcs = &mode_config_funcs; + ddev->mode_config.helper_private = &mode_config_helper_funcs; + /** * this priority was found during empiric testing to have appropriate * realtime scheduling to process display updates and interact with @@ -603,51 +566,6 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv) dev_err(dev, "failed to create crtc_commit kthread\n"); priv->disp_thread[i].thread = NULL; } - - /* initialize event thread */ - priv->event_thread[i].crtc_id = priv->crtcs[i]->base.id; - kthread_init_worker(&priv->event_thread[i].worker); - priv->event_thread[i].dev = ddev; - priv->event_thread[i].thread = - kthread_run(kthread_worker_fn, - &priv->event_thread[i].worker, - "crtc_event:%d", priv->event_thread[i].crtc_id); - /** - * event thread should also run at same priority as disp_thread - * because it is handling frame_done events. A lower priority - * event thread and higher priority disp_thread can causes - * frame_pending counters beyond 2. This can lead to commit - * failure at crtc commit level. - */ - ret = sched_setscheduler(priv->event_thread[i].thread, - SCHED_FIFO, ¶m); - if (ret) - pr_warn("display event thread priority update failed: %d\n", - ret); - - if (IS_ERR(priv->event_thread[i].thread)) { - dev_err(dev, "failed to create crtc_event kthread\n"); - priv->event_thread[i].thread = NULL; - } - - if ((!priv->disp_thread[i].thread) || - !priv->event_thread[i].thread) { - /* clean up previously created threads if any */ - for ( ; i >= 0; i--) { - if (priv->disp_thread[i].thread) { - kthread_stop( - priv->disp_thread[i].thread); - priv->disp_thread[i].thread = NULL; - } - - if (priv->event_thread[i].thread) { - kthread_stop( - priv->event_thread[i].thread); - priv->event_thread[i].thread = NULL; - } - } - goto fail; - } } ret = drm_vblank_init(ddev, priv->num_crtcs); @@ -733,11 +651,6 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv) * DRM operations: */ -#ifdef CONFIG_QCOM_KGSL -static void load_gpu(struct drm_device *dev) -{ -} -#else static void load_gpu(struct drm_device *dev) { static DEFINE_MUTEX(init_lock); @@ -750,7 +663,6 @@ static void load_gpu(struct drm_device *dev) mutex_unlock(&init_lock); } -#endif static int context_init(struct drm_device *dev, struct drm_file *file) { @@ -821,7 +733,6 @@ static irqreturn_t msm_irq(int irq, void *arg) struct drm_device *dev = arg; struct msm_drm_private *priv = dev->dev_private; struct msm_kms *kms = priv->kms; - BUG_ON(!kms); return kms->funcs->irq(kms); } @@ -830,7 +741,6 @@ static void msm_irq_preinstall(struct drm_device *dev) { struct msm_drm_private *priv = dev->dev_private; struct msm_kms *kms = priv->kms; - BUG_ON(!kms); kms->funcs->irq_preinstall(kms); } @@ -839,7 +749,6 @@ static int msm_irq_postinstall(struct drm_device *dev) { struct msm_drm_private *priv = dev->dev_private; struct msm_kms *kms = priv->kms; - BUG_ON(!kms); return kms->funcs->irq_postinstall(kms); } @@ -848,7 +757,6 @@ static void msm_irq_uninstall(struct drm_device *dev) { struct msm_drm_private *priv = dev->dev_private; struct msm_kms *kms = priv->kms; - BUG_ON(!kms); kms->funcs->irq_uninstall(kms); } @@ -857,7 +765,6 @@ static int msm_enable_vblank(struct drm_device *dev, unsigned int pipe) { struct msm_drm_private *priv = dev->dev_private; struct msm_kms *kms = priv->kms; - if (!kms) return -ENXIO; DBG("dev=%p, crtc=%u", dev, pipe); @@ -868,7 +775,6 @@ static void msm_disable_vblank(struct drm_device *dev, unsigned int pipe) { struct msm_drm_private *priv = dev->dev_private; struct msm_kms *kms = priv->kms; - if (!kms) return; DBG("dev=%p, crtc=%u", dev, pipe); @@ -1090,164 +996,6 @@ static int msm_ioctl_submitqueue_close(struct drm_device *dev, void *data, return msm_submitqueue_remove(file->driver_priv, id); } -void msm_mode_object_event_notify(struct drm_mode_object *obj, - struct drm_device *dev, struct drm_event *event, u8 *payload) -{ - struct msm_drm_private *priv = NULL; - unsigned long flags; - struct msm_drm_event *notify, *node; - int len = 0, ret; - - if (!obj || !event || !event->length || !payload) { - DRM_ERROR("err param obj %pK event %pK len %d payload %pK\n", - obj, event, ((event) ? (event->length) : -1), - payload); - return; - } - priv = (dev) ? dev->dev_private : NULL; - if (!dev || !priv) { - DRM_ERROR("invalid dev %pK priv %pK\n", dev, priv); - return; - } - - spin_lock_irqsave(&dev->event_lock, flags); - list_for_each_entry(node, &priv->client_event_list, base.link) { - if (node->event.type != event->type || - obj->id != node->info.object_id) - continue; - len = event->length + sizeof(struct drm_msm_event_resp); - if (node->base.file_priv->event_space < len) { - DRM_ERROR("Insufficient space to notify\n"); - continue; - } - notify = kzalloc(len, GFP_ATOMIC); - if (!notify) - continue; - notify->base.file_priv = node->base.file_priv; - notify->base.event = ¬ify->event; - notify->event.type = node->event.type; - notify->event.length = len; - memcpy(¬ify->info, &node->info, sizeof(notify->info)); - memcpy(notify->data, payload, event->length); - ret = drm_event_reserve_init_locked(dev, node->base.file_priv, - ¬ify->base, ¬ify->event); - if (ret) { - kfree(notify); - continue; - } - drm_send_event_locked(dev, ¬ify->base); - } - spin_unlock_irqrestore(&dev->event_lock, flags); -} - -static int msm_release(struct inode *inode, struct file *filp) -{ - return drm_release(inode, filp); -} - -/** - * msm_drv_framebuffer_remove - remove and unreference a framebuffer object - * @fb: framebuffer to remove - */ -void msm_drv_framebuffer_remove(struct drm_framebuffer *fb) -{ - struct drm_device *dev; - - if (!fb) - return; - - dev = fb->dev; - - WARN_ON(!list_empty(&fb->filp_head)); - - drm_framebuffer_unreference(fb); -} - -struct msm_drv_rmfb2_work { - struct work_struct work; - struct list_head fbs; -}; - -static void msm_drv_rmfb2_work_fn(struct work_struct *w) -{ - struct msm_drv_rmfb2_work *arg = container_of(w, typeof(*arg), work); - - while (!list_empty(&arg->fbs)) { - struct drm_framebuffer *fb = - list_first_entry(&arg->fbs, typeof(*fb), filp_head); - - list_del_init(&fb->filp_head); - msm_drv_framebuffer_remove(fb); - } -} - -/** - * msm_ioctl_rmfb2 - remove an FB from the configuration - * @dev: drm device for the ioctl - * @data: data pointer for the ioctl - * @file_priv: drm file for the ioctl call - * - * Remove the FB specified by the user. - * - * Called by the user via ioctl. - * - * Returns: - * Zero on success, negative errno on failure. - */ -int msm_ioctl_rmfb2(struct drm_device *dev, void *data, - struct drm_file *file_priv) -{ - struct drm_framebuffer *fb = NULL; - struct drm_framebuffer *fbl = NULL; - uint32_t *id = data; - int found = 0; - - if (!drm_core_check_feature(dev, DRIVER_MODESET)) - return -EINVAL; - - fb = drm_framebuffer_lookup(dev, file_priv, *id); - if (!fb) - return -ENOENT; - - /* drop extra ref from traversing drm_framebuffer_lookup */ - drm_framebuffer_unreference(fb); - - mutex_lock(&file_priv->fbs_lock); - list_for_each_entry(fbl, &file_priv->fbs, filp_head) - if (fb == fbl) - found = 1; - if (!found) { - mutex_unlock(&file_priv->fbs_lock); - return -ENOENT; - } - - list_del_init(&fb->filp_head); - mutex_unlock(&file_priv->fbs_lock); - - /* - * we now own the reference that was stored in the fbs list - * - * drm_framebuffer_remove may fail with -EINTR on pending signals, - * so run this in a separate stack as there's no way to correctly - * handle this after the fb is already removed from the lookup table. - */ - if (drm_framebuffer_read_refcount(fb) > 1) { - struct msm_drv_rmfb2_work arg; - - INIT_WORK_ONSTACK(&arg.work, msm_drv_rmfb2_work_fn); - INIT_LIST_HEAD(&arg.fbs); - list_add_tail(&fb->filp_head, &arg.fbs); - - schedule_work(&arg.work); - flush_work(&arg.work); - destroy_work_on_stack(&arg.work); - } else - drm_framebuffer_unreference(fb); - - return 0; -} -EXPORT_SYMBOL(msm_ioctl_rmfb2); - static const struct drm_ioctl_desc msm_ioctls[] = { DRM_IOCTL_DEF_DRV(MSM_GET_PARAM, msm_ioctl_get_param, DRM_AUTH|DRM_RENDER_ALLOW), DRM_IOCTL_DEF_DRV(MSM_GEM_NEW, msm_ioctl_gem_new, DRM_AUTH|DRM_RENDER_ALLOW), @@ -1259,8 +1007,6 @@ static const struct drm_ioctl_desc msm_ioctls[] = { DRM_IOCTL_DEF_DRV(MSM_GEM_MADVISE, msm_ioctl_gem_madvise, DRM_AUTH|DRM_RENDER_ALLOW), DRM_IOCTL_DEF_DRV(MSM_SUBMITQUEUE_NEW, msm_ioctl_submitqueue_new, DRM_AUTH|DRM_RENDER_ALLOW), DRM_IOCTL_DEF_DRV(MSM_SUBMITQUEUE_CLOSE, msm_ioctl_submitqueue_close, DRM_AUTH|DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(MSM_RMFB2, msm_ioctl_rmfb2, - DRM_CONTROL_ALLOW|DRM_UNLOCKED), }; static const struct vm_operations_struct vm_ops = { @@ -1272,7 +1018,7 @@ static const struct vm_operations_struct vm_ops = { static const struct file_operations fops = { .owner = THIS_MODULE, .open = drm_open, - .release = msm_release, + .release = drm_release, .unlocked_ioctl = drm_ioctl, .compat_ioctl = drm_compat_ioctl, .poll = drm_poll, @@ -1335,10 +1081,10 @@ static int msm_pm_suspend(struct device *dev) struct msm_drm_private *priv = ddev->dev_private; struct msm_kms *kms = priv->kms; + /* TODO: Use atomic helper suspend/resume */ if (kms && kms->funcs && kms->funcs->pm_suspend) return kms->funcs->pm_suspend(dev); - /* disable hot-plug polling */ drm_kms_helper_poll_disable(ddev); priv->pm_state = drm_atomic_helper_suspend(ddev); @@ -1356,12 +1102,12 @@ static int msm_pm_resume(struct device *dev) struct msm_drm_private *priv = ddev->dev_private; struct msm_kms *kms = priv->kms; + /* TODO: Use atomic helper suspend/resume */ if (kms && kms->funcs && kms->funcs->pm_resume) return kms->funcs->pm_resume(dev); drm_atomic_helper_resume(ddev, priv->pm_state); - /* enable hot-plug polling */ drm_kms_helper_poll_enable(ddev); return 0; @@ -1487,7 +1233,7 @@ static int compare_name_mdp(struct device *dev, void *data) static int add_display_components(struct device *dev, struct component_match **matchptr) { - struct device *mdp_dev = NULL; + struct device *mdp_dev; int ret; /* @@ -1497,7 +1243,7 @@ static int add_display_components(struct device *dev, * the interfaces to our components list. */ if (of_device_is_compatible(dev->of_node, "qcom,mdss") || - of_device_is_compatible(dev->of_node, "qcom,dpu-mdss")) { + of_device_is_compatible(dev->of_node, "qcom,dpu-mdss")) { ret = of_platform_populate(dev->of_node, NULL, NULL, dev); if (ret) { dev_err(dev, "failed to populate children devices\n"); @@ -1515,7 +1261,7 @@ static int add_display_components(struct device *dev, /* add the MDP component itself */ drm_of_component_match_add(dev, matchptr, compare_of, - mdp_dev->of_node); + mdp_dev->of_node); } else { /* MDP4 */ mdp_dev = dev; @@ -1540,13 +1286,6 @@ static const struct of_device_id msm_gpu_match[] = { { }, }; -#ifdef CONFIG_QCOM_KGSL -static int add_gpu_components(struct device *dev, - struct component_match **matchptr) -{ - return 0; -} -#else static int add_gpu_components(struct device *dev, struct component_match **matchptr) { @@ -1562,7 +1301,6 @@ static int add_gpu_components(struct device *dev, return 0; } -#endif static int msm_drm_bind(struct device *dev) { @@ -1585,8 +1323,8 @@ static const struct component_master_ops msm_drm_ops = { static int msm_pdev_probe(struct platform_device *pdev) { - int ret; struct component_match *match = NULL; + int ret; ret = add_display_components(&pdev->dev, &match); if (ret) @@ -1596,7 +1334,12 @@ static int msm_pdev_probe(struct platform_device *pdev) if (ret) return ret; - pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); + /* on all devices that I am aware of, iommu's which can map + * any address the cpu can see are used: + */ + ret = dma_set_mask_and_coherent(&pdev->dev, ~0); + if (ret) + return ret; return component_master_add_with_match(&pdev->dev, &msm_drm_ops, match); } diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index dc7b2c1f2f46..b11fbeaf477b 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -76,9 +76,9 @@ struct msm_file_private { enum msm_mdp_plane_property { /* range properties */ PLANE_PROP_ZPOS, - - /* total # of properties */ - PLANE_PROP_COUNT + PLANE_PROP_ALPHA, + PLANE_PROP_PREMULTIPLIED, + PLANE_PROP_MAX_NUM, }; struct msm_vblank_ctrl { @@ -90,16 +90,6 @@ struct msm_vblank_ctrl { #define MSM_GPU_MAX_RINGS 4 #define MAX_H_TILES_PER_DISPLAY 2 -/** - * enum msm_display_compression_type - compression method used for pixel stream - * @MSM_DISPLAY_COMPRESSION_NONE: Pixel data is not compressed - * @MSM_DISPLAY_COMPRESSION_DSC: DSC compresison is used - */ -enum msm_display_compression_type { - MSM_DISPLAY_COMPRESSION_NONE, - MSM_DISPLAY_COMPRESSION_DSC, -}; - /** * enum msm_display_caps - features/capabilities supported by displays * @MSM_DISPLAY_CAP_VID_MODE: Video or "active" mode supported @@ -126,111 +116,6 @@ enum msm_event_wait { MSM_ENC_VBLANK, }; -/** - * struct msm_display_dsc_info - defines dsc configuration - * @version: DSC version. - * @scr_rev: DSC revision. - * @pic_height: Picture height in pixels. - * @pic_width: Picture width in pixels. - * @initial_lines: Number of initial lines stored in encoder. - * @pkt_per_line: Number of packets per line. - * @bytes_in_slice: Number of bytes in slice. - * @eol_byte_num: Valid bytes at the end of line. - * @pclk_per_line: Compressed width. - * @full_frame_slices: Number of slice per interface. - * @slice_height: Slice height in pixels. - * @slice_width: Slice width in pixels. - * @chunk_size: Chunk size in bytes for slice multiplexing. - * @slice_last_group_size: Size of last group in pixels. - * @bpp: Target bits per pixel. - * @bpc: Number of bits per component. - * @line_buf_depth: Line buffer bit depth. - * @block_pred_enable: Block prediction enabled/disabled. - * @vbr_enable: VBR mode. - * @enable_422: Indicates if input uses 4:2:2 sampling. - * @convert_rgb: DSC color space conversion. - * @input_10_bits: 10 bit per component input. - * @slice_per_pkt: Number of slices per packet. - * @initial_dec_delay: Initial decoding delay. - * @initial_xmit_delay: Initial transmission delay. - * @initial_scale_value: Scale factor value at the beginning of a slice. - * @scale_decrement_interval: Scale set up at the beginning of a slice. - * @scale_increment_interval: Scale set up at the end of a slice. - * @first_line_bpg_offset: Extra bits allocated on the first line of a slice. - * @nfl_bpg_offset: Slice specific settings. - * @slice_bpg_offset: Slice specific settings. - * @initial_offset: Initial offset at the start of a slice. - * @final_offset: Maximum end-of-slice value. - * @rc_model_size: Number of bits in RC model. - * @det_thresh_flatness: Flatness threshold. - * @max_qp_flatness: Maximum QP for flatness adjustment. - * @min_qp_flatness: Minimum QP for flatness adjustment. - * @edge_factor: Ratio to detect presence of edge. - * @quant_incr_limit0: QP threshold. - * @quant_incr_limit1: QP threshold. - * @tgt_offset_hi: Upper end of variability range. - * @tgt_offset_lo: Lower end of variability range. - * @buf_thresh: Thresholds in RC model - * @range_min_qp: Min QP allowed. - * @range_max_qp: Max QP allowed. - * @range_bpg_offset: Bits per group adjustment. - */ -struct msm_display_dsc_info { - u8 version; - u8 scr_rev; - - int pic_height; - int pic_width; - int slice_height; - int slice_width; - - int initial_lines; - int pkt_per_line; - int bytes_in_slice; - int bytes_per_pkt; - int eol_byte_num; - int pclk_per_line; - int full_frame_slices; - int slice_last_group_size; - int bpp; - int bpc; - int line_buf_depth; - - int slice_per_pkt; - int chunk_size; - bool block_pred_enable; - int vbr_enable; - int enable_422; - int convert_rgb; - int input_10_bits; - - int initial_dec_delay; - int initial_xmit_delay; - int initial_scale_value; - int scale_decrement_interval; - int scale_increment_interval; - int first_line_bpg_offset; - int nfl_bpg_offset; - int slice_bpg_offset; - int initial_offset; - int final_offset; - - int rc_model_size; - int det_thresh_flatness; - int max_qp_flatness; - int min_qp_flatness; - int edge_factor; - int quant_incr_limit0; - int quant_incr_limit1; - int tgt_offset_hi; - int tgt_offset_lo; - - u32 *buf_thresh; - char *range_min_qp; - char *range_max_qp; - char *range_bpg_offset; -}; - /** * struct msm_display_topology - defines a display topology pipeline * @num_lm: number of layer mixers used @@ -261,21 +146,6 @@ struct msm_display_info { bool is_te_using_watchdog_timer; }; -/** - * struct msm_drm_event - defines custom event notification struct - * @base: base object required for event notification by DRM framework. - * @event: event object required for event notification by DRM framework. - * @info: contains information of DRM object for which events has been - * requested. - * @data: memory location which contains response payload for event. - */ -struct msm_drm_event { - struct drm_pending_event base; - struct drm_event event; - struct drm_msm_event_req info; - u8 data[]; -}; - /* Commit/Event thread specific structure */ struct msm_drm_thread { struct drm_device *dev; @@ -332,7 +202,6 @@ struct msm_drm_private { struct drm_crtc *crtcs[MAX_CRTCS]; struct msm_drm_thread disp_thread[MAX_CRTCS]; - struct msm_drm_thread event_thread[MAX_CRTCS]; unsigned int num_encoders; struct drm_encoder *encoders[MAX_ENCODERS]; @@ -344,10 +213,7 @@ struct msm_drm_private { struct drm_connector *connectors[MAX_CONNECTORS]; /* Properties */ - struct drm_property *plane_property[PLANE_PROP_COUNT]; - - /* Color processing properties for the crtc */ - struct drm_property **cp_property; + struct drm_property *plane_property[PLANE_PROP_MAX_NUM]; /* VRAM carveout, used when no IOMMU: */ struct { @@ -366,9 +232,6 @@ struct msm_drm_private { struct msm_vblank_ctrl vblank_ctrl; struct drm_atomic_state *pm_state; - /* list of clients waiting for events */ - struct list_head client_event_list; - /* whether registered and drm_dev_unregister should be called */ bool registered; @@ -442,7 +305,7 @@ void msm_gem_prime_unpin(struct drm_gem_object *obj); void *msm_gem_get_vaddr(struct drm_gem_object *obj); void *msm_gem_get_vaddr_active(struct drm_gem_object *obj); void msm_gem_put_vaddr(struct drm_gem_object *obj); -int msm_gem_madvise(struct drm_gem_object *obj, unsigned int madv); +int msm_gem_madvise(struct drm_gem_object *obj, unsigned madv); int msm_gem_sync_object(struct drm_gem_object *obj, struct msm_fence_context *fctx, bool exclusive); void msm_gem_move_to_active(struct drm_gem_object *obj, @@ -481,7 +344,7 @@ struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev, struct drm_gem_object **bos); struct drm_framebuffer *msm_framebuffer_create(struct drm_device *dev, struct drm_file *file, const struct drm_mode_fb_cmd2 *mode_cmd); -struct drm_framebuffer *msm_alloc_stolen_fb(struct drm_device *dev, +struct drm_framebuffer * msm_alloc_stolen_fb(struct drm_device *dev, int w, int h, int p, uint32_t format); struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev); @@ -501,15 +364,6 @@ int msm_edp_modeset_init(struct msm_edp *edp, struct drm_device *dev, struct msm_dsi; -/* * - * msm_mode_object_event_notify - notify user-space clients of drm object - * events. - * @obj: mode object (crtc/connector) that is generating the event. - * @event: event that needs to be notified. - * @payload: payload for the event. - */ -void msm_mode_object_event_notify(struct drm_mode_object *obj, - struct drm_device *dev, struct drm_event *event, u8 *payload); #ifdef CONFIG_DRM_MSM_DSI void __init msm_dsi_register(void); void __exit msm_dsi_unregister(void); diff --git a/drivers/gpu/drm/msm/msm_kms.h b/drivers/gpu/drm/msm/msm_kms.h index e3967695650b..9dbebe6a63bf 100644 --- a/drivers/gpu/drm/msm/msm_kms.h +++ b/drivers/gpu/drm/msm/msm_kms.h @@ -43,13 +43,9 @@ struct msm_kms_funcs { int (*enable_vblank)(struct msm_kms *kms, struct drm_crtc *crtc); void (*disable_vblank)(struct msm_kms *kms, struct drm_crtc *crtc); /* modeset, bracketing atomic_commit(): */ - void (*prepare_fence)(struct msm_kms *kms, - struct drm_atomic_state *state); - void (*prepare_commit)(struct msm_kms *kms, - struct drm_atomic_state *state); + void (*prepare_commit)(struct msm_kms *kms, struct drm_atomic_state *state); void (*commit)(struct msm_kms *kms, struct drm_atomic_state *state); - void (*complete_commit)(struct msm_kms *kms, - struct drm_atomic_state *state); + void (*complete_commit)(struct msm_kms *kms, struct drm_atomic_state *state); /* functions to wait for atomic commit completed on each CRTC */ void (*wait_for_crtc_commit_done)(struct msm_kms *kms, struct drm_crtc *crtc); diff --git a/drivers/gpu/drm/msm/msm_rd.c b/drivers/gpu/drm/msm/msm_rd.c index f4b4481909c4..deb490b475e1 100644 --- a/drivers/gpu/drm/msm/msm_rd.c +++ b/drivers/gpu/drm/msm/msm_rd.c @@ -108,13 +108,9 @@ struct msm_rd_state { static void rd_write(struct msm_rd_state *rd, const void *buf, int sz) { - struct circ_buf *fifo; + struct circ_buf *fifo = &rd->fifo; const char *ptr = buf; - if (!rd || !buf) - return; - - fifo = &rd->fifo; while (sz > 0) { char *fptr = &fifo->buf[fifo->head]; int n; @@ -147,18 +143,11 @@ static void rd_write_section(struct msm_rd_state *rd, static ssize_t rd_read(struct file *file, char __user *buf, size_t sz, loff_t *ppos) { - struct msm_rd_state *rd; - struct circ_buf *fifo; - const char *fptr; + struct msm_rd_state *rd = file->private_data; + struct circ_buf *fifo = &rd->fifo; + const char *fptr = &fifo->buf[fifo->tail]; int n = 0, ret = 0; - if (!file || !file->private_data || !buf || !ppos) - return -EINVAL; - - rd = file->private_data; - fifo = &rd->fifo; - fptr = &fifo->buf[fifo->tail]; - mutex_lock(&rd->read_lock); ret = wait_event_interruptible(rd->fifo_event, @@ -190,26 +179,14 @@ static ssize_t rd_read(struct file *file, char __user *buf, static int rd_open(struct inode *inode, struct file *file) { - struct msm_rd_state *rd; - struct drm_device *dev; - struct msm_drm_private *priv; - struct msm_gpu *gpu; + struct msm_rd_state *rd = inode->i_private; + struct drm_device *dev = rd->dev; + struct msm_drm_private *priv = dev->dev_private; + struct msm_gpu *gpu = priv->gpu; uint64_t val; uint32_t gpu_id; int ret = 0; - if (!file || !inode || !inode->i_private) - return -EINVAL; - - rd = inode->i_private; - dev = rd->dev; - - if (!dev || !dev->dev_private) - return -EINVAL; - - priv = dev->dev_private; - gpu = priv->gpu; - mutex_lock(&dev->struct_mutex); if (rd->open || !gpu) { @@ -238,12 +215,7 @@ static int rd_open(struct inode *inode, struct file *file) static int rd_release(struct inode *inode, struct file *file) { - struct msm_rd_state *rd; - - if (!inode || !inode->i_private) - return -EINVAL; - - rd = inode->i_private; + struct msm_rd_state *rd = inode->i_private; rd->open = false; return 0; } @@ -380,17 +352,12 @@ static void snapshot_buf(struct msm_rd_state *rd, void msm_rd_dump_submit(struct msm_rd_state *rd, struct msm_gem_submit *submit, const char *fmt, ...) { - struct drm_device *dev; + struct drm_device *dev = submit->dev; struct task_struct *task; char msg[256]; int i, n; - if (!submit || !submit->dev || !submit->dev->dev_private) - return; - - dev = submit->dev; - - if (!rd || !rd->open) + if (!rd->open) return; /* writing into fifo is serialized by caller, and diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index f5678aa4cdf0..4fef19064b0f 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -21,15 +21,12 @@ struct mipi_dsi_device; #define MIPI_DSI_MSG_REQ_ACK BIT(0) /* use Low Power Mode to transmit message */ #define MIPI_DSI_MSG_USE_LPM BIT(1) -/* read mipi_dsi_msg.ctrl and unicast to only that ctrls */ -#define MIPI_DSI_MSG_UNICAST BIT(2) /** * struct mipi_dsi_msg - read/write DSI buffer * @channel: virtual channel id * @type: payload data type * @flags: flags controlling this message transmission - * @ctrl: ctrl index to transmit on * @tx_len: length of @tx_buf * @tx_buf: data to be written * @rx_len: length of @rx_buf @@ -39,7 +36,6 @@ struct mipi_dsi_msg { u8 channel; u8 type; u16 flags; - u32 ctrl; size_t tx_len; const void *tx_buf; diff --git a/include/linux/msm_ext_display.h b/include/linux/msm_ext_display.h deleted file mode 100644 index 08e0defba760..000000000000 --- a/include/linux/msm_ext_display.h +++ /dev/null @@ -1,182 +0,0 @@ -/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 and - * only version 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#ifndef _MSM_EXT_DISPLAY_H_ -#define _MSM_EXT_DISPLAY_H_ - -#include <linux/device.h> -#include <linux/platform_device.h> -#include <linux/extcon.h> - -#define AUDIO_ACK_SET_ENABLE BIT(5) -#define AUDIO_ACK_ENABLE BIT(4) -#define AUDIO_ACK_CONNECT BIT(0) - -/* - * Flags to be used with the HPD operation of the external display - * interface: - * MSM_EXT_DISP_HPD_AUDIO: audio will be routed to external display - * MSM_EXT_DISP_HPD_VIDEO: video will be routed to external display - */ -#define MSM_EXT_DISP_HPD_AUDIO BIT(0) -#define MSM_EXT_DISP_HPD_VIDEO BIT(1) - -/** - * struct ext_disp_cable_notify - cable notify handler structure - * @link: a link for the linked list - * @status: current status of HDMI/DP cable connection - * @hpd_notify: callback function to provide cable status - */ -struct ext_disp_cable_notify { - struct list_head link; - int status; - void (*hpd_notify)(struct ext_disp_cable_notify *h); -}; - -struct msm_ext_disp_audio_edid_blk { - u8 *audio_data_blk; - unsigned int audio_data_blk_size; /* in bytes */ - u8 *spk_alloc_data_blk; - unsigned int spk_alloc_data_blk_size; /* in bytes */ -}; - -struct msm_ext_disp_audio_setup_params { - u32 sample_rate_hz; - u32 num_of_channels; - u32 channel_allocation; - u32 level_shift; - bool down_mix; - u32 sample_present; -}; - -/* - * External Display identifier for use to determine which interface - * the audio driver is interacting with. - */ -enum msm_ext_disp_type { - EXT_DISPLAY_TYPE_HDMI = EXTCON_DISP_HDMI, - EXT_DISPLAY_TYPE_DP = EXTCON_DISP_DP, - EXT_DISPLAY_TYPE_MAX = 0xFFFFFFFF -}; - -/* - * External Display cable state used by display interface to indicate - * connect/disconnect of interface. - */ -enum msm_ext_disp_cable_state { - EXT_DISPLAY_CABLE_DISCONNECT, - EXT_DISPLAY_CABLE_CONNECT, - EXT_DISPLAY_CABLE_STATE_MAX -}; - -/** - * External Display power state used by display interface to indicate - * power on/off of the interface. - */ -enum msm_ext_disp_power_state { - EXT_DISPLAY_POWER_OFF, - EXT_DISPLAY_POWER_ON, - EXT_DISPLAY_POWER_MAX -}; - -/** - * struct msm_ext_disp_intf_ops - operations exposed to display interface - * @audio_config: configures the audio operations exposed to codec driver - * @audio_notify: notifies the audio connection state to user modules. - * @video_notify: notifies the video connection state to user modules. - */ -struct msm_ext_disp_intf_ops { - int (*audio_config)(struct platform_device *pdev, - enum msm_ext_disp_type type, - enum msm_ext_disp_cable_state state); - - int (*audio_notify)(struct platform_device *pdev, - enum msm_ext_disp_type type, - enum msm_ext_disp_cable_state state); - - - int (*video_notify)(struct platform_device *pdev, - enum msm_ext_disp_type type, - enum msm_ext_disp_cable_state state); -}; - -/** - * struct msm_ext_disp_audio_codec_ops - operations exposed to audio codec - * @audio_info_setup: configure audio on interface - * @get_audio_edid_blk: retrieve audio edid block - * @cable_status: cable connected/disconnected - * @get_intf_id: id of connected interface - * @teardown_done: audio session teardown done by qdsp - * @acknowledge: acknowledge audio status received by user modules - */ -struct msm_ext_disp_audio_codec_ops { - int (*audio_info_setup)(struct platform_device *pdev, - struct msm_ext_disp_audio_setup_params *params); - int (*get_audio_edid_blk)(struct platform_device *pdev, - struct msm_ext_disp_audio_edid_blk *blk); - int (*cable_status)(struct platform_device *pdev, u32 vote); - int (*get_intf_id)(struct platform_device *pdev); - void (*teardown_done)(struct platform_device *pdev); - int (*acknowledge)(struct platform_device *pdev, u32 ack); -}; - -/** - * struct msm_ext_disp_init_data - data needed to register a display interface - * @type: external display type - * @intf_ops: external display interface operations - * @codec_ops: audio codec operations - * @pdev: platform device instance of the interface driver - * @intf_data: interface specific data - */ -struct msm_ext_disp_init_data { - enum msm_ext_disp_type type; - struct msm_ext_disp_intf_ops intf_ops; - struct msm_ext_disp_audio_codec_ops codec_ops; - struct platform_device *pdev; - void *intf_data; -}; - -/** - * struct msm_ext_disp_data - data needed by interface modules - * @intf_pdev: platform device instance of the interface - * @intf_data: data related to interface module - */ -struct msm_ext_disp_data { - struct platform_device *intf_pdev; - void *intf_data; -}; - -/** - * msm_ext_disp_register_audio_codec() - audio codec registration - * @pdev: platform device pointer - * @codec_ops: audio codec operations - */ -int msm_ext_disp_register_audio_codec(struct platform_device *pdev, - struct msm_ext_disp_audio_codec_ops *ops); - -/** - * msm_hdmi_register_audio_codec() - wrapper for hdmi audio codec - * registration - * @pdev: platform device pointer - * @codec_ops: audio codec operations - */ -int msm_hdmi_register_audio_codec(struct platform_device *pdev, - struct msm_ext_disp_audio_codec_ops *ops); - -/** - * msm_ext_disp_register_intf() - display interface registration - * @init_data: data needed to register the display interface - */ -int msm_ext_disp_register_intf(struct platform_device *pdev, - struct msm_ext_disp_init_data *init_data); - -#endif /*_MSM_EXT_DISPLAY_H_*/ diff --git a/include/uapi/drm/msm_drm.h b/include/uapi/drm/msm_drm.h index 60b1a3014ca4..c06d0a5bdd80 100644 --- a/include/uapi/drm/msm_drm.h +++ b/include/uapi/drm/msm_drm.h @@ -273,63 +273,6 @@ struct drm_msm_submitqueue { __u32 id; /* out, identifier */ }; -/* HDR WRGB x and y index */ -#define DISPLAY_PRIMARIES_WX 0 -#define DISPLAY_PRIMARIES_WY 1 -#define DISPLAY_PRIMARIES_RX 2 -#define DISPLAY_PRIMARIES_RY 3 -#define DISPLAY_PRIMARIES_GX 4 -#define DISPLAY_PRIMARIES_GY 5 -#define DISPLAY_PRIMARIES_BX 6 -#define DISPLAY_PRIMARIES_BY 7 -#define DISPLAY_PRIMARIES_MAX 8 - -struct drm_panel_hdr_properties { - __u32 hdr_enabled; - - /* WRGB X and y values arrayed in format */ - /* [WX, WY, RX, RY, GX, GY, BX, BY] */ - __u32 display_primaries[DISPLAY_PRIMARIES_MAX]; - - /* peak brightness supported by panel */ - __u32 peak_brightness; - /* Blackness level supported by panel */ - __u32 blackness_level; -}; - -/** - * struct drm_msm_event_req - Payload to event enable/disable ioctls. - * @object_id: DRM object id. e.g.: for crtc pass crtc id. - * @object_type: DRM object type. e.g.: for crtc set it to DRM_MODE_OBJECT_CRTC. - * @event: Event for which notification is being enabled/disabled. - * e.g.: for Histogram set - DRM_EVENT_HISTOGRAM. - * @client_context: Opaque pointer that will be returned during event response - * notification. - * @index: Object index(e.g.: crtc index), optional for user-space to set. - * Driver will override value based on object_id and object_type. - */ -struct drm_msm_event_req { - __u32 object_id; - __u32 object_type; - __u32 event; - __u64 client_context; - __u32 index; -}; - -/** - * struct drm_msm_event_resp - payload returned when read is called for - * custom notifications. - * @base: Event type and length of complete notification payload. - * @info: Contains information about DRM that which raised this event. - * @data: Custom payload that driver returns for event type. - * size of data = base.length - (sizeof(base) + sizeof(info)) - */ -struct drm_msm_event_resp { - struct drm_event base; - struct drm_msm_event_req info; - __u8 data[]; -}; - #define DRM_MSM_GET_PARAM 0x00 /* placeholder: #define DRM_MSM_SET_PARAM 0x01 @@ -347,19 +290,6 @@ struct drm_msm_event_resp { #define DRM_MSM_SUBMITQUEUE_NEW 0x0A #define DRM_MSM_SUBMITQUEUE_CLOSE 0x0B -#define DRM_DPU_WB_CONFIG 0x40 -#define DRM_MSM_REGISTER_EVENT 0x41 -#define DRM_MSM_DEREGISTER_EVENT 0x42 -#define DRM_MSM_RMFB2 0x43 - -/* dpu custom events */ -#define DRM_EVENT_HISTOGRAM 0x80000000 -#define DRM_EVENT_AD_BACKLIGHT 0x80000001 -#define DRM_EVENT_CRTC_POWER 0x80000002 -#define DRM_EVENT_SYS_BACKLIGHT 0x80000003 -#define DRM_EVENT_DPU_POWER 0x80000004 -#define DRM_EVENT_IDLE_NOTIFY 0x80000005 - #define DRM_IOCTL_MSM_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GET_PARAM, struct drm_msm_param) #define DRM_IOCTL_MSM_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_NEW, struct drm_msm_gem_new) #define DRM_IOCTL_MSM_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_INFO, struct drm_msm_gem_info) @@ -370,14 +300,6 @@ struct drm_msm_event_resp { #define DRM_IOCTL_MSM_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_MADVISE, struct drm_msm_gem_madvise) #define DRM_IOCTL_MSM_SUBMITQUEUE_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_SUBMITQUEUE_NEW, struct drm_msm_submitqueue) #define DRM_IOCTL_MSM_SUBMITQUEUE_CLOSE DRM_IOW (DRM_COMMAND_BASE + DRM_MSM_SUBMITQUEUE_CLOSE, __u32) -#define DRM_IOCTL_DPU_WB_CONFIG \ - DRM_IOW((DRM_COMMAND_BASE + DRM_DPU_WB_CONFIG), struct dpu_drm_wb_cfg) -#define DRM_IOCTL_MSM_REGISTER_EVENT DRM_IOW((DRM_COMMAND_BASE + \ - DRM_MSM_REGISTER_EVENT), struct drm_msm_event_req) -#define DRM_IOCTL_MSM_DEREGISTER_EVENT DRM_IOW((DRM_COMMAND_BASE + \ - DRM_MSM_DEREGISTER_EVENT), struct drm_msm_event_req) -#define DRM_IOCTL_MSM_RMFB2 DRM_IOW((DRM_COMMAND_BASE + \ - DRM_MSM_RMFB2), unsigned int) #if defined(__cplusplus) } -- Sean Paul, Software Engineer, Google / Chromium OS -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html