drm/msm: rework the ties between KMS and GPU parts of the driver
Subsystems (4)
v2 cover drm/msm: rework the ties between KMS and GPU parts of the driver
Currently the KMS and GPU parts of the msm driver are pretty much intertwined. It is impossible to register a KMS-only device and registering a GPU-only DRM device requires modifying the DT. Not to mention that binding the GPU-only device creates an interim platform devices, which complicates IOMMU setup.
Rework the driver:
- Make it possible to disable KMS parts (if MDP4, MDP5 and DPU drivers are disabled).
- Register GPU-only devices without an interim platform device.
- Add module param that makes msm driver register GPU and KMS devices separately.
---
Changes in v2:
- Got rid of mdp4_crtc.id and msm_drm_private.num_crtcs
- Moved msm_drm_private.wq and msm_drm_private.event_thread to struct
msm_kms (Rob Clark)
- Moved HDMI / DSI / DP pointers to msm_kms (Abhinav)
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Dmitry Baryshkov (11):
drm/msm: move wq handling to KMS code
drm/msm: move helper calls to msm_kms.c drm/msm/mdp4: get rid of mdp4_crtc.id
drm/msm: get rid of msm_drm_private::num_crtcs drm/msm: move KMS driver data to msm_kms
drm/msm: make it possible to disable KMS-related code. drm/msm: bail out late_init_minor() if it is not a GPU device drm/msm: rearrange symbol selection
drm/msm: rework binding of Imageon GPUs
drm/msm: enable separate binding of GPU and display devices drm/msm: make it possible to disable GPU support
drivers/gpu/drm/msm/Kconfig | 54 ++++-- drivers/gpu/drm/msm/Makefile | 31 +-- drivers/gpu/drm/msm/adreno/adreno_device.c | 39 +--- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 4 +- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 13 +- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 35 ++-- drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c | 9 +- drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 13 +- drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.h | 2 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 2 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 17 +- drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c | 12 +- drivers/gpu/drm/msm/dp/dp_debug.c | 4 + drivers/gpu/drm/msm/dp/dp_display.c | 6 +- drivers/gpu/drm/msm/dsi/dsi.c | 4 +- drivers/gpu/drm/msm/hdmi/hdmi.c | 13 +- drivers/gpu/drm/msm/msm_debugfs.c | 222 ++++++++++++---------- drivers/gpu/drm/msm/msm_drv.c | 205 +++++++++++++------- drivers/gpu/drm/msm/msm_drv.h | 34 ++-- drivers/gpu/drm/msm/msm_gpu.h | 71 ++++++- drivers/gpu/drm/msm/msm_kms.c | 41 +++- drivers/gpu/drm/msm/msm_kms.h | 46 +++++ drivers/gpu/drm/msm/msm_submitqueue.c | 12 +- 23 files changed, 549 insertions(+), 340 deletions(-)
---
base-commit: 37ff6e9a2ce321b7932d3987701757fb4d87b0e6
change-id: 20250411-msm-gpu-split-2701e49e40f0
Best regards,
Signature · 1 line
Dmitry Baryshkov <[email protected]>
PATCH v2 1/11 drm/msm: move wq handling to KMS code
The global workqueue is only used for vblanks inside KMS code. Move allocation / flushing / deallcation of it to msm_kms.c
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 2 +- drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c | 2 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 2 +- drivers/gpu/drm/msm/msm_drv.c | 21 ++------------------- drivers/gpu/drm/msm/msm_drv.h | 2 -- drivers/gpu/drm/msm/msm_kms.c | 11 +++++++++-- drivers/gpu/drm/msm/msm_kms.h | 8 ++++++++ 7 files changed, 22 insertions(+), 26 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +1 -1
@@ -980,7 +980,7 @@ static int dpu_encoder_resource_control(struct drm_encoder *drm_enc,return 0 ; } -queue_delayed_work (priv->wq, &dpu_enc->delayed_off_work, +queue_delayed_work (priv->kms->wq, &dpu_enc->delayed_off_work,msecs_to_jiffies (dpu_enc->idle_timeout)); trace_dpu_enc_rc(DRMID(drm_enc), sw_event,
drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c +1 -1
@@ -511,7 +511,7 @@ static void mdp4_crtc_vblank_irq(struct mdp_irq *irq, uint32_t irqstatus)if (pending &PENDING_CURSOR ) {update_cursor (crtc); -drm_flip_work_commit (&mdp4_crtc->unref_cursor_work, priv->wq); +drm_flip_work_commit (&mdp4_crtc->unref_cursor_work, priv->kms->wq); } }
drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +1 -1
@@ -1196,7 +1196,7 @@ static void mdp5_crtc_vblank_irq(struct mdp_irq *irq, uint32_t irqstatus) }if (pending &PENDING_CURSOR ) -drm_flip_work_commit (&mdp5_crtc->unref_cursor_work, priv->wq); +drm_flip_work_commit (&mdp5_crtc->unref_cursor_work, priv->kms->wq); }static void mdp5_crtc_err_irq (struct mdp_irq *irq,uint32_t irqstatus)
drivers/gpu/drm/msm/msm_drv.c +2 -19
@@ -82,13 +82,6 @@ static int msm_drm_uninit(struct device *dev)drm_atomic_helper_shutdown (ddev); } -/* We must cancel and cleanup any pending vblank enable/disable -* work before msm_irq_uninstall() to avoid work re-enabling an -* irq after uninstall has disabled it. -*/ - -flush_workqueue (priv->wq); -msm_gem_shrinker_cleanup (ddev);msm_perf_debugfs_cleanup (priv);
@@ -104,8 +97,6 @@ static int msm_drm_uninit(struct device *dev) ddev->dev_private =NULL ;drm_dev_put (ddev); -destroy_workqueue (priv->wq); -return 0 ; }
@@ -227,12 +218,6 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) ddev->dev_private = priv; priv->dev = ddev; - priv->wq =alloc_ordered_workqueue ("msm" ,0 ); -if (!priv->wq) { - ret = -ENOMEM ; - goto err_put_dev; - } -INIT_LIST_HEAD (&priv->objects);mutex_init (&priv->obj_lock);
@@ -253,12 +238,12 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv)if (priv->kms_init) { ret =drmm_mode_config_init (ddev);if (ret) - goto err_destroy_wq; + goto err_put_dev; } ret =msm_init_vram (ddev);if (ret) - goto err_destroy_wq; + goto err_put_dev;dma_set_max_seg_size (dev,UINT_MAX );
@@ -304,8 +289,6 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) err_deinit_vram:msm_deinit_vram (ddev); -err_destroy_wq: -destroy_workqueue (priv->wq); err_put_dev:drm_dev_put (ddev);
drivers/gpu/drm/msm/msm_drv.h +0 -2
@@ -177,8 +177,6 @@ struct msm_drm_private {struct mutex lock; } lru; -struct workqueue_struct *wq; -unsigned int num_crtcs;struct msm_drm_thread event_thread[MAX_CRTCS ];
drivers/gpu/drm/msm/msm_kms.c +9 -2
@@ -137,7 +137,7 @@ static int vblank_ctrl_queue_work(struct msm_drm_private *priv, vbl_work->enable = enable; vbl_work->priv = priv; -queue_work (priv->wq, &vbl_work->work); +queue_work (priv->kms->wq, &vbl_work->work);return 0 ; }
@@ -227,6 +227,13 @@ void msm_drm_kms_uninit(struct device *dev)BUG_ON (!kms); +/* We must cancel and cleanup any pending vblank enable/disable +* work before msm_irq_uninstall() to avoid work re-enabling an +* irq after uninstall has disabled it. +*/ + +flush_workqueue (kms->wq); +/* clean up event worker threads */ for (i =0 ; i < priv->num_crtcs; i++) {if (priv->event_thread[i].worker)
@@ -261,7 +268,7 @@ int msm_drm_kms_init(struct device *dev, const struct drm_driver *drv) ret = priv->kms_init (ddev);if (ret) {DRM_DEV_ERROR (dev,"failed to load kms\n" ); -return ret; + goto err_msm_uninit; }/* Enable normalization of plane zpos */
drivers/gpu/drm/msm/msm_kms.h +8 -0
@@ -153,6 +153,8 @@ struct msm_kms {struct mutex commit_lock[MAX_CRTCS ];unsigned pending_crtc_mask;struct msm_pending_timer pending_timers[MAX_CRTCS ]; + +struct workqueue_struct *wq; }; static inline int msm_kms_init(struct msm_kms *kms,
@@ -165,6 +167,10 @@ static inline int msm_kms_init(struct msm_kms *kms, kms->funcs = funcs; + kms->wq =alloc_ordered_workqueue ("msm" ,0 ); +if (!kms->wq) +return -ENOMEM ; +for (i =0 ; i <ARRAY_SIZE (kms->pending_timers); i++) { ret =msm_atomic_init_pending_timer (&kms->pending_timers[i], kms, i);if (ret) {
@@ -181,6 +187,8 @@ static inline void msm_kms_destroy(struct msm_kms *kms)for (i =0 ; i <ARRAY_SIZE (kms->pending_timers); i++)msm_atomic_destroy_pending_timer (&kms->pending_timers[i]); + +destroy_workqueue (kms->wq); }#define for_each_crtc_mask (dev, crtc, crtc_mask) \
Signature · 1 line
2.39.5
PATCH v2 2/11 drm/msm: move helper calls to msm_kms.c
In reply to Dmitry BaryshkovExtract two more KMS-related codepieces to msm_kms.c, removing last pieces of KMS code from msm_drv.c.
--- drivers/gpu/drm/msm/msm_drv.c | 9 +++------ drivers/gpu/drm/msm/msm_kms.c | 20 ++++++++++++++++++++ drivers/gpu/drm/msm/msm_kms.h | 2 ++ 3 files changed, 25 insertions(+), 6 deletions(-)
drivers/gpu/drm/msm/msm_drv.c +3 -6
@@ -11,7 +11,6 @@#include <linux/of_address.h> #include <linux/uaccess.h> -#include <drm/clients/drm_client_setup.h> #include <drm/drm_drv.h> #include <drm/drm_file.h> #include <drm/drm_ioctl.h>
@@ -79,7 +78,7 @@ static int msm_drm_uninit(struct device *dev)if (ddev->registered) {drm_dev_unregister (ddev);if (priv->kms) -drm_atomic_helper_shutdown (ddev); +msm_drm_kms_unregister (dev); }msm_gem_shrinker_cleanup (ddev);
@@ -275,10 +274,8 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv)if (ret) goto err_msm_uninit; -if (priv->kms_init) { -drm_kms_helper_poll_init (ddev); -drm_client_setup (ddev,NULL ); - } +if (priv->kms_init) +msm_drm_kms_post_init (dev);return 0 ;
drivers/gpu/drm/msm/msm_kms.c +20 -0
@@ -13,6 +13,7 @@#include <drm/drm_drv.h> #include <drm/drm_mode_config.h> #include <drm/drm_vblank.h> +#include <drm/clients/drm_client_setup.h> #include "disp/msm_disp_snapshot.h" #include "msm_drv.h"
@@ -217,6 +218,15 @@ struct msm_gem_address_space *msm_kms_init_aspace(struct drm_device *dev)return aspace; } +void msm_drm_kms_unregister (struct device *dev) +{ +struct platform_device *pdev =to_platform_device (dev); +struct msm_drm_private *priv =platform_get_drvdata (pdev); +struct drm_device *ddev = priv->dev; + +drm_atomic_helper_shutdown (ddev); +} +void msm_drm_kms_uninit (struct device *dev) {struct platform_device *pdev =to_platform_device (dev);
@@ -366,3 +376,13 @@ void msm_kms_shutdown(struct platform_device *pdev)if (drm && drm->registered && priv->kms)drm_atomic_helper_shutdown (drm); } + +void msm_drm_kms_post_init (struct device *dev) +{ +struct platform_device *pdev =to_platform_device (dev); +struct msm_drm_private *priv =platform_get_drvdata (pdev); +struct drm_device *ddev = priv->dev; + +drm_kms_helper_poll_init (ddev); +drm_client_setup (ddev,NULL ); +}
drivers/gpu/drm/msm/msm_kms.h +2 -0
@@ -200,6 +200,8 @@ static inline void msm_kms_destroy(struct msm_kms *kms) for_each_if (drm_crtc_mask(crtc) & (crtc_mask))int msm_drm_kms_init (struct device *dev,const struct drm_driver *drv); +void msm_drm_kms_post_init (struct device *dev); +void msm_drm_kms_unregister (struct device *dev);void msm_drm_kms_uninit (struct device *dev);#endif /* __MSM_KMS_H__ */
Signature · 1 line
2.39.5
PATCH v2 3/11 drm/msm/mdp4: get rid of mdp4_crtc.id
In reply to Dmitry BaryshkovThere is no reason to store CRTC id, it's a part of the drm_crtc. Drop this member and use drm_crtc.name for the warning message.
--- drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c | 7 ++----- drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 2 +- drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.h | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-)
drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c +2 -5
@@ -17,7 +17,6 @@struct mdp4_crtc {struct drm_crtc base;char name[8 ]; -int id;int ovlp;enum mdp4_dma dma;bool enabled;
@@ -539,7 +538,7 @@ static void mdp4_crtc_wait_for_flush_done(struct drm_crtc *crtc) mdp4_crtc->flushed_mask), msecs_to_jiffies(50));if (ret <=0 ) -dev_warn (dev->dev,"vblank time out, crtc=%d\n" , mdp4_crtc->id); +dev_warn (dev->dev,"vblank time out, crtc=%s\n" , mdp4_crtc->base.name); mdp4_crtc->flushed_mask =0 ;
@@ -624,7 +623,7 @@ static void mdp4_crtc_flip_cleanup(struct drm_device *dev, void *ptr)/* initialize crtc */ struct drm_crtc *mdp4_crtc_init (struct drm_device *dev, -struct drm_plane *plane,int id,int ovlp_id, +struct drm_plane *plane,int ovlp_id,enum mdp4_dma dma_id) {struct drm_crtc *crtc =NULL ;
@@ -639,8 +638,6 @@ struct drm_crtc *mdp4_crtc_init(struct drm_device *dev, crtc = &mdp4_crtc->base; - mdp4_crtc->id = id; - mdp4_crtc->ovlp = ovlp_id; mdp4_crtc->dma = dma_id;
drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c +1 -1
@@ -338,7 +338,7 @@ static int modeset_init(struct mdp4_kms *mdp4_kms) goto fail; } - crtc =mdp4_crtc_init (dev, plane, priv->num_crtcs, i, + crtc =mdp4_crtc_init (dev, plane, i, mdp4_crtcs[i]);if (IS_ERR (crtc)) { DRM_DEV_ERROR(dev->dev, "failed to construct crtc for %s\n",
drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.h +1 -1
@@ -185,7 +185,7 @@ void mdp4_crtc_set_config(struct drm_crtc *crtc, uint32_t config);void mdp4_crtc_set_intf (struct drm_crtc *crtc,enum mdp4_intf intf,int mixer);void mdp4_crtc_wait_for_commit_done (struct drm_crtc *crtc);struct drm_crtc *mdp4_crtc_init (struct drm_device *dev, -struct drm_plane *plane,int id,int ovlp_id, +struct drm_plane *plane,int ovlp_id,enum mdp4_dma dma_id);long mdp4_dtv_round_pixclk (struct drm_encoder *encoder,unsigned long rate);
Signature · 1 line
2.39.5
PATCH v2 4/11 drm/msm: get rid of msm_drm_private::num_crtcs
In reply to Dmitry BaryshkovDrop superfluous msm_drm_private::num_crtcs in favour of using drm_mode_config::num_crtc or MAX_CRCS as appropriate.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 3 +-- drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 3 --- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 4 +--- drivers/gpu/drm/msm/msm_drv.h | 2 -- drivers/gpu/drm/msm/msm_kms.c | 4 ++-- 5 files changed, 4 insertions(+), 12 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +1 -2
@@ -874,12 +874,11 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms) ret =PTR_ERR (crtc);return ret; } - priv->num_crtcs++; }/* All CRTCs are compatible with all encoders */ drm_for_each_encoder (encoder, dev) - encoder->possible_crtcs = (1 << priv->num_crtcs) -1 ; + encoder->possible_crtcs = (1 << dev->mode_config.num_crtc) -1 ;return 0 ; }
drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c +0 -3
@@ -296,7 +296,6 @@ static int mdp4_modeset_init_intf(struct mdp4_kms *mdp4_kms,static int modeset_init (struct mdp4_kms *mdp4_kms) {struct drm_device *dev = mdp4_kms->dev; -struct msm_drm_private *priv = dev->dev_private;struct drm_plane *plane;struct drm_crtc *crtc;int i, ret;
@@ -346,8 +345,6 @@ static int modeset_init(struct mdp4_kms *mdp4_kms) ret =PTR_ERR (crtc); goto fail; } - - priv->num_crtcs++; }/*
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +1 -3
@@ -374,7 +374,6 @@ static int modeset_init_intf(struct mdp5_kms *mdp5_kms,static int modeset_init (struct mdp5_kms *mdp5_kms) {struct drm_device *dev = mdp5_kms->dev; -struct msm_drm_private *priv = dev->dev_private;unsigned int num_crtcs;int i, ret, pi =0 , ci =0 ;struct drm_plane *primary[MAX_BASES ] = {NULL };
@@ -442,7 +441,6 @@ static int modeset_init(struct mdp5_kms *mdp5_kms)DRM_DEV_ERROR (dev->dev,"failed to construct crtc %d (%d)\n" , i, ret); goto fail; } - priv->num_crtcs++; }/*
@@ -450,7 +448,7 @@ static int modeset_init(struct mdp5_kms *mdp5_kms)* crtcs for the encoders */ drm_for_each_encoder (encoder, dev) - encoder->possible_crtcs = (1 << priv->num_crtcs) -1 ; + encoder->possible_crtcs = (1 << dev->mode_config.num_crtc) -1 ;return 0 ;
drivers/gpu/drm/msm/msm_drv.h +0 -2
@@ -177,8 +177,6 @@ struct msm_drm_private {struct mutex lock; } lru; -unsigned int num_crtcs; -struct msm_drm_thread event_thread[MAX_CRTCS ];/* VRAM carveout, used when no IOMMU: */
drivers/gpu/drm/msm/msm_kms.c +2 -2
@@ -245,7 +245,7 @@ void msm_drm_kms_uninit(struct device *dev)flush_workqueue (kms->wq);/* clean up event worker threads */ -for (i =0 ; i < priv->num_crtcs; i++) { +for (i =0 ; i <MAX_CRTCS ; i++) {if (priv->event_thread[i].worker)kthread_destroy_worker (priv->event_thread[i].worker); }
@@ -313,7 +313,7 @@ int msm_drm_kms_init(struct device *dev, const struct drm_driver *drv)sched_set_fifo (ev_thread->worker->task); } - ret =drm_vblank_init (ddev, priv->num_crtcs); + ret =drm_vblank_init (ddev, ddev->mode_config.num_crtc);if (ret <0 ) {DRM_DEV_ERROR (dev,"failed to initialize vblank\n" ); goto err_msm_uninit;
Signature · 1 line
2.39.5
PATCH v2 5/11 drm/msm: move KMS driver data to msm_kms
In reply to Dmitry BaryshkovData for HDMI, DSI and DP blocks only makes sense for the KMS parts of the driver. Move corresponding data pointers from struct msm_drm_private to struct msm_kms.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 11 ++++---- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 32 +++++++++++------------ drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 8 +++--- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 13 ++++----- drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c | 12 ++++----- drivers/gpu/drm/msm/dp/dp_display.c | 6 ++--- drivers/gpu/drm/msm/dsi/dsi.c | 4 +-- drivers/gpu/drm/msm/hdmi/hdmi.c | 13 ++++----- drivers/gpu/drm/msm/msm_drv.h | 11 +------- drivers/gpu/drm/msm/msm_kms.h | 6 +++++ 10 files changed, 57 insertions(+), 59 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +6 -5
@@ -264,7 +264,7 @@ bool dpu_encoder_needs_periph_flush(struct dpu_encoder_phys *phys_enc) mode = &phys_enc->cached_mode;return phys_enc->hw_intf->cap->type ==INTF_DP && -msm_dp_needs_periph_flush (priv->dp[disp_info->h_tile_instance[0 ]], mode); +msm_dp_needs_periph_flush (priv->kms->dp[disp_info->h_tile_instance[0 ]], mode); }/**
@@ -283,9 +283,9 @@ bool dpu_encoder_is_widebus_enabled(const struct drm_encoder *drm_enc) index = disp_info->h_tile_instance[0 ];if (disp_info->intf_type ==INTF_DP ) -return msm_dp_wide_bus_available (priv->dp[index]); +return msm_dp_wide_bus_available (priv->kms->dp[index]);else if (disp_info->intf_type ==INTF_DSI ) -return msm_dsi_wide_bus_enabled (priv->dsi[index]); +return msm_dsi_wide_bus_enabled (priv->kms->dsi[index]);return false; }
@@ -647,7 +647,7 @@ struct drm_dsc_config *dpu_encoder_get_dsc_config(struct drm_encoder *drm_enc)int index = dpu_enc->disp_info.h_tile_instance[0 ];if (dpu_enc->disp_info.intf_type ==INTF_DSI ) -return msm_dsi_get_dsc_config (priv->dsi[index]); +return msm_dsi_get_dsc_config (priv->kms->dsi[index]);return NULL ; }
@@ -709,7 +709,8 @@ void dpu_encoder_update_topology(struct drm_encoder *drm_enc,if (fb &&MSM_FORMAT_IS_YUV (msm_framebuffer_format (fb))) topology->num_cdm++; }else if (disp_info->intf_type ==INTF_DP ) { -if (msm_dp_is_yuv_420_enabled (priv->dp[disp_info->h_tile_instance[0 ]], adj_mode)) +if (msm_dp_is_yuv_420_enabled (priv->kms->dp[disp_info->h_tile_instance[0 ]], + adj_mode)) topology->num_cdm++; } }
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +16 -16
@@ -582,7 +582,7 @@ static int _dpu_kms_initialize_dsi(struct drm_device *dev,struct msm_display_info info;int i, rc =0 ; -if (!(priv->dsi[0 ] || priv->dsi[1 ])) +if (!(priv->kms->dsi[0 ] || priv->kms->dsi[1 ]))return rc;/*
@@ -593,26 +593,26 @@ static int _dpu_kms_initialize_dsi(struct drm_device *dev,* * TODO: Support swapping DSI0 and DSI1 in the bonded setup. */ -for (i =0 ; i <ARRAY_SIZE (priv->dsi); i++) { +for (i =0 ; i <ARRAY_SIZE (priv->kms->dsi); i++) {int other = (i +1 ) %2 ; -if (!priv->dsi[i]) +if (!priv->kms->dsi[i])continue ; -if (msm_dsi_is_bonded_dsi (priv->dsi[i]) && - !msm_dsi_is_master_dsi (priv->dsi[i])) +if (msm_dsi_is_bonded_dsi (priv->kms->dsi[i]) && + !msm_dsi_is_master_dsi (priv->kms->dsi[i]))continue ;memset (&info,0 ,sizeof (info)); info.intf_type =INTF_DSI ; info.h_tile_instance[info.num_of_h_tiles++] = i; -if (msm_dsi_is_bonded_dsi (priv->dsi[i])) +if (msm_dsi_is_bonded_dsi (priv->kms->dsi[i])) info.h_tile_instance[info.num_of_h_tiles++] = other; - info.is_cmd_mode =msm_dsi_is_cmd_mode (priv->dsi[i]); + info.is_cmd_mode =msm_dsi_is_cmd_mode (priv->kms->dsi[i]); - rc =dpu_kms_dsi_set_te_source (&info, priv->dsi[i]); + rc =dpu_kms_dsi_set_te_source (&info, priv->kms->dsi[i]);if (rc) {DPU_ERROR ("failed to identify TE source for dsi display\n" );return rc;
@@ -624,15 +624,15 @@ static int _dpu_kms_initialize_dsi(struct drm_device *dev,return PTR_ERR (encoder); } - rc =msm_dsi_modeset_init (priv->dsi[i], dev, encoder); + rc =msm_dsi_modeset_init (priv->kms->dsi[i], dev, encoder);if (rc) {DPU_ERROR ("modeset_init failed for dsi[%d], rc = %d\n" , i, rc);break ; } -if (msm_dsi_is_bonded_dsi (priv->dsi[i]) && priv->dsi[other]) { - rc =msm_dsi_modeset_init (priv->dsi[other], dev, encoder); +if (msm_dsi_is_bonded_dsi (priv->kms->dsi[i]) && priv->kms->dsi[other]) { + rc =msm_dsi_modeset_init (priv->kms->dsi[other], dev, encoder);if (rc) {DPU_ERROR ("modeset_init failed for dsi[%d], rc = %d\n" , other, rc);
@@ -654,8 +654,8 @@ static int _dpu_kms_initialize_displayport(struct drm_device *dev,int rc;int i; -for (i =0 ; i <ARRAY_SIZE (priv->dp); i++) { -if (!priv->dp[i]) +for (i =0 ; i <ARRAY_SIZE (priv->kms->dp); i++) { +if (!priv->kms->dp[i])continue ;memset (&info,0 ,sizeof (info));
@@ -670,7 +670,7 @@ static int _dpu_kms_initialize_displayport(struct drm_device *dev, } yuv_supported = !!dpu_kms->catalog->cdm; - rc =msm_dp_modeset_init (priv->dp[i], dev, encoder, yuv_supported); + rc =msm_dp_modeset_init (priv->kms->dp[i], dev, encoder, yuv_supported);if (rc) {DPU_ERROR ("modeset_init failed for DP, rc = %d\n" , rc);return rc;
@@ -688,7 +688,7 @@ static int _dpu_kms_initialize_hdmi(struct drm_device *dev,struct msm_display_info info;int rc; -if (!priv->hdmi) +if (!priv->kms->hdmi)return 0 ;memset (&info,0 ,sizeof (info));
@@ -702,7 +702,7 @@ static int _dpu_kms_initialize_hdmi(struct drm_device *dev,return PTR_ERR (encoder); } - rc =msm_hdmi_modeset_init (priv->hdmi, dev, encoder); + rc =msm_hdmi_modeset_init (priv->kms->hdmi, dev, encoder);if (rc) {DPU_ERROR ("modeset_init failed for DP, rc = %d\n" , rc);return rc;
drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c +4 -4
@@ -249,9 +249,9 @@ static int mdp4_modeset_init_intf(struct mdp4_kms *mdp4_kms,/* DTV can be hooked to DMA_E: */ encoder->possible_crtcs =1 <<1 ; -if (priv->hdmi) { +if (priv->kms->hdmi) {/* Construct bridge/connector for HDMI: */ - ret =msm_hdmi_modeset_init (priv->hdmi, dev, encoder); + ret =msm_hdmi_modeset_init (priv->kms->hdmi, dev, encoder);if (ret) {DRM_DEV_ERROR (dev->dev,"failed to initialize HDMI: %d\n" , ret);return ret;
@@ -263,7 +263,7 @@ static int mdp4_modeset_init_intf(struct mdp4_kms *mdp4_kms,/* only DSI1 supported for now */ dsi_id =0 ; -if (!priv->dsi[dsi_id]) +if (!priv->kms->dsi[dsi_id])break ; encoder =mdp4_dsi_encoder_init (dev);
@@ -277,7 +277,7 @@ static int mdp4_modeset_init_intf(struct mdp4_kms *mdp4_kms,/* TODO: Add DMA_S later? */ encoder->possible_crtcs =1 <<DMA_P ; - ret =msm_dsi_modeset_init (priv->dsi[dsi_id], dev, encoder); + ret =msm_dsi_modeset_init (priv->kms->dsi[dsi_id], dev, encoder);if (ret) {DRM_DEV_ERROR (dev->dev,"failed to initialize DSI: %d\n" , ret);
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +7 -6
@@ -311,7 +311,7 @@ static int modeset_init_intf(struct mdp5_kms *mdp5_kms,DRM_DEV_INFO (dev->dev,"Skipping eDP interface %d\n" , intf->num);break ;case INTF_HDMI : -if (!priv->hdmi) +if (!priv->kms->hdmi)break ; ctl =mdp5_ctlm_request (ctlm, intf->num);
@@ -326,7 +326,7 @@ static int modeset_init_intf(struct mdp5_kms *mdp5_kms,break ; } - ret =msm_hdmi_modeset_init (priv->hdmi, dev, encoder); + ret =msm_hdmi_modeset_init (priv->kms->hdmi, dev, encoder);break ;case INTF_DSI : {
@@ -334,14 +334,14 @@ static int modeset_init_intf(struct mdp5_kms *mdp5_kms,mdp5_cfg_get_hw_config (mdp5_kms->cfg);int dsi_id =get_dsi_id_from_intf (hw_cfg, intf->num); -if ((dsi_id >=ARRAY_SIZE (priv->dsi)) || (dsi_id <0 )) { +if ((dsi_id >=ARRAY_SIZE (priv->kms->dsi)) || (dsi_id <0 )) {DRM_DEV_ERROR (dev->dev,"failed to find dsi from intf %d\n" , intf->num); ret = -EINVAL ;break ; } -if (!priv->dsi[dsi_id]) +if (!priv->kms->dsi[dsi_id])break ; ctl =mdp5_ctlm_request (ctlm, intf->num);
@@ -356,9 +356,10 @@ static int modeset_init_intf(struct mdp5_kms *mdp5_kms,break ; } - ret =msm_dsi_modeset_init (priv->dsi[dsi_id], dev, encoder); + ret =msm_dsi_modeset_init (priv->kms->dsi[dsi_id], dev, encoder);if (!ret) -mdp5_encoder_set_intf_mode (encoder,msm_dsi_is_cmd_mode (priv->dsi[dsi_id])); +mdp5_encoder_set_intf_mode (encoder, +msm_dsi_is_cmd_mode (priv->kms->dsi[dsi_id]));break ; }
drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c +6 -6
@@ -127,18 +127,18 @@ void msm_disp_snapshot_capture_state(struct msm_disp_state *disp_state) priv = drm_dev->dev_private; kms = priv->kms; -for (i =0 ; i <ARRAY_SIZE (priv->dp); i++) { -if (!priv->dp[i]) +for (i =0 ; i <ARRAY_SIZE (kms->dp); i++) { +if (!kms->dp[i])continue ; -msm_dp_snapshot (disp_state, priv->dp[i]); +msm_dp_snapshot (disp_state, kms->dp[i]); } -for (i =0 ; i <ARRAY_SIZE (priv->dsi); i++) { -if (!priv->dsi[i]) +for (i =0 ; i <ARRAY_SIZE (kms->dsi); i++) { +if (!kms->dsi[i])continue ; -msm_dsi_snapshot (disp_state, priv->dsi[i]); +msm_dsi_snapshot (disp_state, kms->dsi[i]); }if (kms->funcs->snapshot)
drivers/gpu/drm/msm/dp/dp_display.c +2 -4
@@ -277,9 +277,7 @@ static int msm_dp_display_bind(struct device *dev, struct device *master,struct drm_device *drm = priv->dev; dp->msm_dp_display.drm_dev = drm; - priv->dp[dp->id] = &dp->msm_dp_display; - - + priv->kms->dp[dp->id] = &dp->msm_dp_display; dp->drm_dev = drm; dp->aux->drm_dev = drm;
@@ -313,7 +311,7 @@ static void msm_dp_display_unbind(struct device *dev, struct device *master,msm_dp_aux_unregister (dp->aux); dp->drm_dev =NULL ; dp->aux->drm_dev =NULL ; - priv->dp[dp->id] =NULL ; + priv->kms->dp[dp->id] =NULL ; }static const struct component_ops msm_dp_display_comp_ops = {
drivers/gpu/drm/msm/dsi/dsi.c +2 -2
@@ -136,7 +136,7 @@ static int dsi_bind(struct device *dev, struct device *master, void *data) msm_dsi->next_bridge = ext_bridge; } - priv->dsi[msm_dsi->id] = msm_dsi; + priv->kms->dsi[msm_dsi->id] = msm_dsi;return 0 ; }
@@ -148,7 +148,7 @@ static void dsi_unbind(struct device *dev, struct device *master,struct msm_dsi *msm_dsi =dev_get_drvdata (dev);msm_dsi_tx_buf_free (msm_dsi->host); - priv->dsi[msm_dsi->id] =NULL ; + priv->kms->dsi[msm_dsi->id] =NULL ; }static const struct component_ops dsi_ops = {
drivers/gpu/drm/msm/hdmi/hdmi.c +7 -6
@@ -14,6 +14,7 @@#include <drm/drm_of.h> #include <drm/display/drm_hdmi_state_helper.h> +#include "msm_kms.h" #include "hdmi.h" void msm_hdmi_set_mode (struct hdmi *hdmi,bool power_on)
@@ -253,7 +254,7 @@ static int msm_hdmi_bind(struct device *dev, struct device *master, void *data) err =msm_hdmi_init (hdmi);if (err)return err; - priv->hdmi = hdmi; + priv->kms->hdmi = hdmi;return 0 ; }
@@ -263,12 +264,12 @@ static void msm_hdmi_unbind(struct device *dev, struct device *master, {struct msm_drm_private *priv =dev_get_drvdata (master); -if (priv->hdmi) { -if (priv->hdmi->bridge) -msm_hdmi_hpd_disable (priv->hdmi); +if (priv->kms->hdmi) { +if (priv->kms->hdmi->bridge) +msm_hdmi_hpd_disable (priv->kms->hdmi); -msm_hdmi_destroy (priv->hdmi); - priv->hdmi =NULL ; +msm_hdmi_destroy (priv->kms->hdmi); + priv->kms->hdmi =NULL ; } }
drivers/gpu/drm/msm/msm_drv.h +1 -10
@@ -88,16 +88,6 @@ struct msm_drm_private {/* subordinate devices, if present: */ struct platform_device *gpu_pdev; -/* possibly this should be in the kms component, but it is -* shared by both mdp4 and mdp5.. -*/ -struct hdmi *hdmi; - -/* DSI is shared by mdp4 and mdp5 */ -struct msm_dsi *dsi[MSM_DSI_CONTROLLER_COUNT ]; - -struct msm_dp *dp[MSM_DP_CONTROLLER_COUNT ]; -/* when we have more than one 'msm_gpu' these need to be an array: */ struct msm_gpu *gpu;
@@ -356,6 +346,7 @@ static inline const char *msm_dsi_get_te_source(struct msm_dsi *msm_dsi) }#endif +struct msm_dp ;#ifdef CONFIG_DRM_MSM_DP int __init msm_dp_register (void ); void __exit msm_dp_unregister(void);
drivers/gpu/drm/msm/msm_kms.h +6 -0
@@ -131,6 +131,12 @@ struct msm_kms {const struct msm_kms_funcs *funcs;struct drm_device *dev; +struct hdmi *hdmi; + +struct msm_dsi *dsi[MSM_DSI_CONTROLLER_COUNT ]; + +struct msm_dp *dp[MSM_DP_CONTROLLER_COUNT ]; +/* irq number to be passed on to msm_irq_install */ int irq;bool irq_requested;
Signature · 1 line
2.39.5
PATCH v2 6/11 drm/msm: make it possible to disable KMS-related code.
In reply to Dmitry BaryshkovIf the Adreno device is used in a headless mode, there is no need to build all KMS components. Build corresponding parts conditionally, only selecting them if modeset support is actually required.
--- drivers/gpu/drm/msm/Kconfig | 14 +++++ drivers/gpu/drm/msm/Makefile | 19 +++---- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 4 +- drivers/gpu/drm/msm/dp/dp_debug.c | 4 ++ drivers/gpu/drm/msm/msm_debugfs.c | 92 ++++++++++++++++++-------------- drivers/gpu/drm/msm/msm_drv.h | 10 +--- drivers/gpu/drm/msm/msm_kms.c | 6 +-- drivers/gpu/drm/msm/msm_kms.h | 30 +++++++++++ 8 files changed, 117 insertions(+), 62 deletions(-)
drivers/gpu/drm/msm/Kconfig +14 -0
@@ -66,6 +66,14 @@ config DRM_MSM_VALIDATE_XML Validate XML files with register definitions against rules-fd schema. This option is mostly targeting DRM MSM developers. If unsure, say N. +config DRM_MSM_KMS + def_bool n + depends on DRM_MSM + +config DRM_MSM_KMS_FBDEV + def_bool DRM_FBDEV_EMULATION + depends on DRM_MSM_KMS + config DRM_MSM_MDSS bool depends on DRM_MSM
@@ -74,6 +82,7 @@ config DRM_MSM_MDSS config DRM_MSM_MDP4 bool "Enable MDP4 support in MSM DRM driver" depends on DRM_MSM + select DRM_MSM_KMS default y help Compile in support for the Mobile Display Processor v4 (MDP4) in
@@ -84,6 +93,7 @@ config DRM_MSM_MDP5 bool "Enable MDP5 support in MSM DRM driver" depends on DRM_MSM select DRM_MSM_MDSS + select DRM_MSM_KMS default y help Compile in support for the Mobile Display Processor v5 (MDP5) in
@@ -94,6 +104,7 @@ config DRM_MSM_DPU bool "Enable DPU support in MSM DRM driver" depends on DRM_MSM select DRM_MSM_MDSS + select DRM_MSM_KMS select DRM_DISPLAY_DSC_HELPER default y help
@@ -104,6 +115,7 @@ config DRM_MSM_DPU config DRM_MSM_DP bool "Enable DisplayPort support in MSM DRM driver" depends on DRM_MSM + depends on DRM_MSM_KMS select DRM_DISPLAY_HDMI_AUDIO_HELPER select RATIONAL default y
@@ -115,6 +127,7 @@ config DRM_MSM_DP config DRM_MSM_DSI bool "Enable DSI support in MSM DRM driver" depends on DRM_MSM + depends on DRM_MSM_KMS select DRM_PANEL select DRM_MIPI_DSI select DRM_DISPLAY_DSC_HELPER
@@ -170,6 +183,7 @@ config DRM_MSM_DSI_7NM_PHY config DRM_MSM_HDMI bool "Enable HDMI support in MSM DRM driver" depends on DRM_MSM + depends on DRM_MSM_KMS default y select DRM_DISPLAY_HDMI_HELPER select DRM_DISPLAY_HDMI_STATE_HELPER
drivers/gpu/drm/msm/Makefile +10 -9
@@ -100,18 +100,15 @@ msm-display-$(CONFIG_DRM_MSM_DPU) += \ msm-display-$(CONFIG_DRM_MSM_MDSS) += \ msm_mdss.o \ -msm-display-y += \ +msm-display-$(CONFIG_DRM_MSM_KMS) += \ disp/mdp_format.o \ disp/mdp_kms.o \ disp/msm_disp_snapshot.o \ disp/msm_disp_snapshot_util.o \ msm-y += \ - msm_atomic.o \ - msm_atomic_tracepoints.o \ msm_debugfs.o \ msm_drv.o \ - msm_fb.o \ msm_fence.o \ msm_gem.o \ msm_gem_prime.o \
@@ -122,21 +119,24 @@ msm-y += \ msm_gpu_devfreq.o \ msm_io_utils.o \ msm_iommu.o \ - msm_kms.o \ msm_perf.o \ msm_rd.o \ msm_ringbuffer.o \ msm_submitqueue.o \ msm_gpu_tracepoints.o \ -msm-$(CONFIG_DRM_FBDEV_EMULATION) += msm_fbdev.o +msm-$(CONFIG_DRM_MSM_KMS) += \ + msm_atomic.o \ + msm_atomic_tracepoints.o \ + msm_fb.o \ + msm_kms.o \ -msm-display-$(CONFIG_DEBUG_FS) += \ - dp/dp_debug.o +msm-$(CONFIG_DRM_MSM_KMS_FBDEV) += msm_fbdev.o msm-display-$(CONFIG_DRM_MSM_DP)+= dp/dp_aux.o \ dp/dp_catalog.o \ dp/dp_ctrl.o \ + dp/dp_debug.o \ dp/dp_display.o \ dp/dp_drm.o \ dp/dp_link.o \
@@ -159,7 +159,8 @@ msm-display-$(CONFIG_DRM_MSM_DSI_14NM_PHY) += dsi/phy/dsi_phy_14nm.o msm-display-$(CONFIG_DRM_MSM_DSI_10NM_PHY) += dsi/phy/dsi_phy_10nm.o msm-display-$(CONFIG_DRM_MSM_DSI_7NM_PHY) += dsi/phy/dsi_phy_7nm.o -msm-y += $(adreno-y) $(msm-display-y) +msm-y += $(adreno-y) +msm-$(CONFIG_DRM_MSM_KMS) += $(msm-display-y) obj-$(CONFIG_DRM_MSM) += msm.o
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +2 -2
@@ -709,7 +709,7 @@ void dpu_crtc_frame_event_cb(struct drm_crtc *crtc, u32 event) fevent->event = event; fevent->crtc = crtc; fevent->ts =ktime_get (); -kthread_queue_work (priv->event_thread[crtc_id].worker, &fevent->work); +kthread_queue_work (priv->kms->event_thread[crtc_id].worker, &fevent->work); }/**
@@ -878,7 +878,7 @@ 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)) { +if (crtc->index >=ARRAY_SIZE (priv->kms->event_thread)) {DPU_ERROR ("invalid crtc index[%d]\n" , crtc->index);return ; }
drivers/gpu/drm/msm/dp/dp_debug.c +4 -0
@@ -5,6 +5,8 @@#define pr_fmt (fmt)"[drm-dp] %s: " fmt, __func__ +#ifdef CONFIG_DEBUG_FS +#include <linux/debugfs.h> #include <drm/drm_connector.h> #include <drm/drm_file.h>
@@ -235,3 +237,5 @@ int msm_dp_debug_init(struct device *dev, struct msm_dp_panel *panel, return 0; } + +#endif
drivers/gpu/drm/msm/msm_debugfs.c +53 -39
125 lines not on this page · raw message
drivers/gpu/drm/msm/msm_drv.h +1 -9
@@ -72,12 +72,6 @@ enum msm_dsi_controller {#define MSM_GPU_MAX_RINGS 4 -/* Commit/Event thread specific structure */ -struct msm_drm_thread { -struct drm_device *dev; -struct kthread_worker *worker; -}; -struct msm_drm_private {struct drm_device *dev;
@@ -167,8 +161,6 @@ struct msm_drm_private {struct mutex lock; } lru; -struct msm_drm_thread event_thread[MAX_CRTCS ]; -/* VRAM carveout, used when no IOMMU: */ struct {unsigned long size;
@@ -261,7 +253,7 @@ struct drm_framebuffer *msm_framebuffer_create(struct drm_device *dev,struct drm_framebuffer *msm_alloc_stolen_fb (struct drm_device *dev,int w,int h,int p,uint32_t format); -#ifdef CONFIG_DRM_FBDEV_EMULATION +#ifdef CONFIG_DRM_MSM_KMS_FBDEV int msm_fbdev_driver_fbdev_probe (struct drm_fb_helper *helper,struct drm_fb_helper_surface_size *sizes);#define MSM_FBDEV_DRIVER_OPS \
drivers/gpu/drm/msm/msm_kms.c +3 -3
@@ -246,8 +246,8 @@ void msm_drm_kms_uninit(struct device *dev)/* clean up event worker threads */ for (i =0 ; i <MAX_CRTCS ; i++) { -if (priv->event_thread[i].worker) -kthread_destroy_worker (priv->event_thread[i].worker); +if (kms->event_thread[i].worker) +kthread_destroy_worker (kms->event_thread[i].worker); }drm_kms_helper_poll_fini (ddev);
@@ -300,7 +300,7 @@ int msm_drm_kms_init(struct device *dev, const struct drm_driver *drv)struct msm_drm_thread *ev_thread;/* initialize event thread */ - ev_thread = &priv->event_thread[drm_crtc_index (crtc)]; + ev_thread = &kms->event_thread[drm_crtc_index (crtc)]; ev_thread->dev = ddev; ev_thread->worker =kthread_run_worker (0 ,"crtc_event:%d" , crtc->base.id);if (IS_ERR (ev_thread->worker)) {
drivers/gpu/drm/msm/msm_kms.h +30 -0
@@ -13,6 +13,8 @@#include "msm_drv.h" +#ifdef CONFIG_DRM_MSM_KMS +#define MAX_PLANE 4/* As there are different display controller blocks depending on the
@@ -127,6 +129,12 @@ struct msm_pending_timer {unsigned crtc_idx; }; +/* Commit/Event thread specific structure */ +struct msm_drm_thread { +struct drm_device *dev; +struct kthread_worker *worker; +}; +struct msm_kms {const struct msm_kms_funcs *funcs;struct drm_device *dev;
@@ -161,6 +169,7 @@ struct msm_kms {struct msm_pending_timer pending_timers[MAX_CRTCS ];struct workqueue_struct *wq; +struct msm_drm_thread event_thread[MAX_CRTCS ]; }; static inline int msm_kms_init(struct msm_kms *kms,
@@ -210,4 +219,25 @@ void msm_drm_kms_post_init(struct device *dev);void msm_drm_kms_unregister (struct device *dev);void msm_drm_kms_uninit (struct device *dev); +#else /* ! CONFIG_DRM_MSM_KMS */ + +static inline int msm_drm_kms_init (struct device *dev,const struct drm_driver *drv) +{ +return -ENODEV ; +} + +static inline void msm_drm_kms_post_init (struct device *dev) +{ +} + +static inline void msm_drm_kms_unregister (struct device *dev) +{ +} + +static inline void msm_drm_kms_uninit (struct device *dev) +{ +} + +#endif +#endif /* __MSM_KMS_H__ */
Signature · 1 line
2.39.5
PATCH v2 7/11 drm/msm: bail out late_init_minor() if it is not a GPU device
In reply to Dmitry BaryshkovBoth perf and hangrd make sense only for GPU devices. Bail out if we are registering a KMS-only device.
--- drivers/gpu/drm/msm/msm_debugfs.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/msm/msm_debugfs.c +5 -0
@@ -296,11 +296,16 @@ static struct drm_info_list msm_debugfs_list[] = {static int late_init_minor (struct drm_minor *minor) { +struct drm_device *dev = minor->dev; +struct msm_drm_private *priv = dev->dev_private;int ret;if (!minor)return 0 ; +if (!priv->gpu_pdev) +return 0 ; + ret =msm_rd_debugfs_init (minor);if (ret) {DRM_DEV_ERROR (minor->dev->dev,"could not install rd debugfs\n" );
Signature · 1 line
2.39.5
PATCH v2 8/11 drm/msm: rearrange symbol selection
In reply to Dmitry BaryshkovMove symbol selection to be more fine grained: select DP helpers only if DP driver is also enabled, move KMS and display helpers to the newly introduced DRM_MSM_KMS.
--- drivers/gpu/drm/msm/Kconfig | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/gpu/drm/msm/Kconfig +10 -10
@@ -15,18 +15,8 @@ config DRM_MSM select IOMMU_IO_PGTABLE select QCOM_MDT_LOADER if ARCH_QCOM select REGULATOR - select DRM_CLIENT_SELECTION - select DRM_DISPLAY_DP_AUX_BUS - select DRM_DISPLAY_DP_HELPER - select DRM_DISPLAY_HELPER - select DRM_BRIDGE_CONNECTOR select DRM_EXEC - select DRM_KMS_HELPER - select DRM_PANEL - select DRM_BRIDGE - select DRM_PANEL_BRIDGE select DRM_SCHED - select FB_SYSMEM_HELPERS if DRM_FBDEV_EMULATION select SHMEM select TMPFS select QCOM_SCM
@@ -69,10 +59,18 @@ config DRM_MSM_VALIDATE_XML config DRM_MSM_KMS def_bool n depends on DRM_MSM + select DRM_BRIDGE + select DRM_BRIDGE_CONNECTOR + select DRM_CLIENT_SELECTION + select DRM_DISPLAY_HELPER + select DRM_KMS_HELPER + select DRM_PANEL + select DRM_PANEL_BRIDGE config DRM_MSM_KMS_FBDEV def_bool DRM_FBDEV_EMULATION depends on DRM_MSM_KMS + select FB_SYSMEM_HELPERS config DRM_MSM_MDSS bool
@@ -118,6 +116,8 @@ config DRM_MSM_DP depends on DRM_MSM_KMS select DRM_DISPLAY_HDMI_AUDIO_HELPER select RATIONAL + select DRM_DISPLAY_DP_AUX_BUS + select DRM_DISPLAY_DP_HELPER default y help Compile in support for DP driver in MSM DRM driver. DP external
Signature · 1 line
2.39.5
PATCH v2 9/11 drm/msm: rework binding of Imageon GPUs
In reply to Dmitry BaryshkovCurrently the msm driver creates an extra interim platform device for Imageon GPUs. This is not ideal, as the device doesn't have corresponding OF node. If the headless mode is used for newer GPUs, then the msm_use_mmu() function can not detect corresponding IOMMU devices. Also the DRM device (although it's headless) is created with modesetting flags being set.
To solve all these issues, rework the way the Imageon devices are bound. Remove the interim device, don't register a component and instead use a cut-down version of the normal functions to probe or remove the driver.
--- drivers/gpu/drm/msm/adreno/adreno_device.c | 36 +++--------- drivers/gpu/drm/msm/msm_drv.c | 91 ++++++++++++++++++++---------- drivers/gpu/drm/msm/msm_drv.h | 4 ++ 3 files changed, 72 insertions(+), 59 deletions(-)
drivers/gpu/drm/msm/adreno/adreno_device.c +8 -28
@@ -241,42 +241,22 @@ static const struct component_ops a3xx_ops = { .unbind = adreno_unbind, }; -static void adreno_device_register_headless (void ) -{ -/* on imx5, we don't have a top-level mdp/dpu node -* this creates a dummy node for the driver for that case -*/ -struct platform_device_info dummy_info = { - .parent =NULL , - .name ="msm" , - .id =-1 , - .res =NULL , - .num_res =0 , - .data =NULL , - .size_data =0 , - .dma_mask = ~0 , - }; -platform_device_register_full (&dummy_info); -} -static int adreno_probe (struct platform_device *pdev) { - -int ret; - - ret =component_add (&pdev->dev, &a3xx_ops); -if (ret) -return ret; -if (of_device_is_compatible (pdev->dev.of_node,"amd,imageon" )) -adreno_device_register_headless (); +return msm_gpu_probe (pdev, &a3xx_ops); -return 0 ; +return component_add (&pdev->dev, &a3xx_ops); }static void adreno_remove (struct platform_device *pdev) { -component_del (&pdev->dev, &a3xx_ops); +struct msm_drm_private *priv =platform_get_drvdata (pdev); + +if (priv->kms_init) +component_del (&pdev->dev, &a3xx_ops); +else +msm_gpu_remove (pdev, &a3xx_ops); }static void adreno_shutdown (struct platform_device *pdev)
drivers/gpu/drm/msm/msm_drv.c +60 -31
166 lines not on this page · raw message
drivers/gpu/drm/msm/msm_drv.h +4 -0
@@ -532,6 +532,10 @@ extern const struct component_master_ops msm_drm_ops;int msm_kms_pm_prepare (struct device *dev);void msm_kms_pm_complete (struct device *dev); +int msm_gpu_probe (struct platform_device *pdev, +const struct component_ops *ops); +void msm_gpu_remove (struct platform_device *pdev, +const struct component_ops *ops);int msm_drv_probe (struct device *dev,int (*kms_init)(struct drm_device *dev),struct msm_kms *kms);
Signature · 1 line
2.39.5
PATCH v2 10/11 drm/msm: enable separate binding of GPU and display devices
In reply to Dmitry BaryshkovThere are cases when we want to have separate DRM devices for GPU and display pipelines.
One example is development, when it is beneficial to be able to bind the GPU driver separately, without the display pipeline (and without the hacks adding "amd,imageon" to the compatible string). Another example is some of Qualcomm platforms, which have two MDSS units, but only one GPU. With current approach it is next to impossible to support this usecase properly, while separate binding allows users to have three DRM devices: two for MDSS units and a single headless GPU.
Add kernel param msm.separate_gpu_drm, which if set to true forces creation of separate display and GPU DRM devices. Mesa supports this setup by using the kmsro wrapper.
The param is disabled by default, in order to be able to test userspace for the compatibility issues. Simple clients are able to handle this setup automatically.
--- drivers/gpu/drm/msm/adreno/adreno_device.c | 3 +- drivers/gpu/drm/msm/msm_drv.c | 49 +++++++++++++++++++++++++++--- drivers/gpu/drm/msm/msm_drv.h | 2 ++ 3 files changed, 49 insertions(+), 5 deletions(-)
drivers/gpu/drm/msm/adreno/adreno_device.c +2 -1
@@ -243,7 +243,8 @@ static const struct component_ops a3xx_ops = {static int adreno_probe (struct platform_device *pdev) { -if (of_device_is_compatible (pdev->dev.of_node,"amd,imageon" )) +if (of_device_is_compatible (pdev->dev.of_node,"amd,imageon" ) || +msm_gpu_no_components ())return msm_gpu_probe (pdev, &a3xx_ops);return component_add (&pdev->dev, &a3xx_ops);
drivers/gpu/drm/msm/msm_drv.c +45 -4
76 lines not on this page · raw message
drivers/gpu/drm/msm/msm_drv.h +2 -0
@@ -543,4 +543,6 @@ void msm_kms_shutdown(struct platform_device *pdev);bool msm_disp_drv_should_bind (struct device *dev,bool dpu_driver); +bool msm_gpu_no_components (void ); +#endif /* __MSM_DRV_H__ */
Signature · 1 line
2.39.5
Re: [PATCH v2 10/11] drm/msm: enable separate binding of GPU and display devices
Quoted 64 lines · Dmitry Baryshkov
There are cases when we want to have separate DRM devices for GPU and display pipelines.
One example is development, when it is beneficial to be able to bind the GPU driver separately, without the display pipeline (and without the hacks adding "amd,imageon" to the compatible string). Another example is some of Qualcomm platforms, which have two MDSS units, but only one GPU. With current approach it is next to impossible to support this usecase properly, while separate binding allows users to have three DRM devices: two for MDSS units and a single headless GPU.Add kernel param msm.separate_gpu_drm, which if set to true forces creation of separate display and GPU DRM devices. Mesa supports this setup by using the kmsro wrapper.
The param is disabled by default, in order to be able to test userspace for the compatibility issues. Simple clients are able to handle this setup automatically.
Signed-off-by Dmitry Baryshkov <[email protected]>--- drivers/gpu/drm/msm/adreno/adreno_device.c | 3 +- drivers/gpu/drm/msm/msm_drv.c | 49 +++++++++++++++++++++++++++--- drivers/gpu/drm/msm/msm_drv.h | 2 ++ 3 files changed, 49 insertions(+), 5 deletions(-)drivers/gpu/drm/msm/adreno/adreno_device.c +2
-1@@ -243,7 +243,8 @@ static const struct component_ops a3xx_ops = {static int adreno_probe (struct platform_device *pdev) { -if (of_device_is_compatible (pdev->dev.of_node,"amd,imageon" )) +if (of_device_is_compatible (pdev->dev.of_node,"amd,imageon" ) || +msm_gpu_no_components ())return msm_gpu_probe (pdev, &a3xx_ops);return component_add (&pdev->dev, &a3xx_ops);drivers/gpu/drm/msm/msm_drv.c +9
-0@@ -59,9 +59,18 @@ static bool modeset = true;MODULE_PARM_DESC (modeset,"Use kernel modesetting [KMS] (1=on (default), 0=disable)" );module_param (modeset, bool,0600 ); +static bool separate_gpu_drm; +MODULE_PARM_DESC (separate_gpu_drm,"Use separate DRM device for the GPU (0=single DRM device for both GPU and display (default), 1=two DRM devices)" ); +module_param (separate_gpu_drm, bool,0400 ); +DECLARE_FAULT_ATTR (fail_gem_alloc);DECLARE_FAULT_ATTR (fail_gem_iova); +bool msm_gpu_no_components (void ) +{ +return separate_gpu_drm; +} +static int msm_drm_uninit (struct device *dev,const struct component_ops *gpu_ops) {struct platform_device *pdev =to_platform_device (dev);
drivers/gpu/drm/msm/msm_drv.c static const struct drm_driver msm_driver = { · line 915
Quoted 9 lines
drivers/gpu/drm/msm/msm_drv.c +6
-0@@ -898,6 +907,32 @@ static const struct drm_driver msm_driver = { .patchlevel = MSM_VERSION_PATCHLEVEL, }; +static const struct drm_driver msm_kms_driver = { + .driver_features =DRIVER_GEM | +DRIVER_ATOMIC | +DRIVER_MODESET | +DRIVER_SYNCOBJ_TIMELINE | +DRIVER_SYNCOBJ ,
I think, drop DRIVER_SYNCOBJ + DRIVER_SYNCOBJ_TIMELINE, since kms only uses fence fd's. (Syncobj support is only in the SUBMIT and upcoming VM_BIND ioctls.. I don't think there is a use-case for being able to create syncobjs for KMS only drivers, and it doesn't look like any of the other kms-only drivers support this.)
Alternatively, we could use drm_device::driver_features to mask certain drm_driver::driver_features at runtime.. that would be a way to avoid having separate drm_driver tables.
BR,
-R
Quoted 66 lines
drivers/gpu/drm/msm/msm_drv.c +30
-4+ .open = msm_open, + .postclose = msm_postclose, + .dumb_create = msm_gem_dumb_create, + .dumb_map_offset = msm_gem_dumb_map_offset, + .gem_prime_import_sg_table = msm_gem_prime_import_sg_table, +#ifdef CONFIG_DEBUG_FS + .debugfs_init = msm_debugfs_init, +#endif + MSM_FBDEV_DRIVER_OPS, + .show_fdinfo = msm_show_fdinfo, + .ioctls = msm_ioctls, + .num_ioctls = ARRAY_SIZE(msm_ioctls), + .fops = &fops, + .name = "msm-kms", + .desc = "MSM Snapdragon DRM", + .major = MSM_VERSION_MAJOR, + .minor = MSM_VERSION_MINOR, + .patchlevel = MSM_VERSION_PATCHLEVEL, +}; + static const struct drm_driver msm_gpu_driver = { .driver_features = DRIVER_GEM | DRIVER_RENDER |@@ -1044,7 +1079,11 @@ static int add_gpu_components(struct device *dev,static int msm_drm_bind (struct device *dev) { -return msm_drm_init (dev, &msm_driver,NULL ); +return msm_drm_init (dev, +msm_gpu_no_components () ? + &msm_kms_driver : + &msm_driver, +NULL ); }static void msm_drm_unbind (struct device *dev)@@ -1080,9 +1119,11 @@ int msm_drv_probe(struct device *master_dev,return ret; } - ret =add_gpu_components (master_dev, &match); -if (ret) -return ret; +if (!msm_gpu_no_components ()) { + ret =add_gpu_components (master_dev, &match); +if (ret) +return ret; + }/* on all devices that I am aware of, iommu's which can map * any address the cpu can see are used: drivers/gpu/drm/msm/msm_drv.h +2
-1@@ -543,4 +543,6 @@ void msm_kms_shutdown(struct platform_device *pdev);bool msm_disp_drv_should_bind (struct device *dev,bool dpu_driver); +bool msm_gpu_no_components (void ); +#endif /* __MSM_DRV_H__ */ --2.39.5
Re: [PATCH v2 10/11] drm/msm: enable separate binding of GPU and display devices
Quoted 70 lines · Rob Clark
Quoted 67 lines · Dmitry Baryshkov
There are cases when we want to have separate DRM devices for GPU and display pipelines.
One example is development, when it is beneficial to be able to bind the GPU driver separately, without the display pipeline (and without the hacks adding "amd,imageon" to the compatible string). Another example is some of Qualcomm platforms, which have two MDSS units, but only one GPU. With current approach it is next to impossible to support this usecase properly, while separate binding allows users to have three DRM devices: two for MDSS units and a single headless GPU.Add kernel param msm.separate_gpu_drm, which if set to true forces creation of separate display and GPU DRM devices. Mesa supports this setup by using the kmsro wrapper.
The param is disabled by default, in order to be able to test userspace for the compatibility issues. Simple clients are able to handle this setup automatically.
Signed-off-by Dmitry Baryshkov <[email protected]>--- drivers/gpu/drm/msm/adreno/adreno_device.c | 3 +- drivers/gpu/drm/msm/msm_drv.c | 49 +++++++++++++++++++++++++++--- drivers/gpu/drm/msm/msm_drv.h | 2 ++ 3 files changed, 49 insertions(+), 5 deletions(-)drivers/gpu/drm/msm/adreno/adreno_device.c +2
-1@@ -243,7 +243,8 @@ static const struct component_ops a3xx_ops = {static int adreno_probe (struct platform_device *pdev) { -if (of_device_is_compatible (pdev->dev.of_node,"amd,imageon" )) +if (of_device_is_compatible (pdev->dev.of_node,"amd,imageon" ) || +msm_gpu_no_components ())return msm_gpu_probe (pdev, &a3xx_ops);return component_add (&pdev->dev, &a3xx_ops);drivers/gpu/drm/msm/msm_drv.c +9
-0@@ -59,9 +59,18 @@ static bool modeset = true;MODULE_PARM_DESC (modeset,"Use kernel modesetting [KMS] (1=on (default), 0=disable)" );module_param (modeset, bool,0600 ); +static bool separate_gpu_drm; +MODULE_PARM_DESC (separate_gpu_drm,"Use separate DRM device for the GPU (0=single DRM device for both GPU and display (default), 1=two DRM devices)" ); +module_param (separate_gpu_drm, bool,0400 ); +DECLARE_FAULT_ATTR (fail_gem_alloc);DECLARE_FAULT_ATTR (fail_gem_iova); +bool msm_gpu_no_components (void ) +{ +return separate_gpu_drm; +} +static int msm_drm_uninit (struct device *dev,const struct component_ops *gpu_ops) {struct platform_device *pdev =to_platform_device (dev);@@ -898,6 +907,32 @@ static const struct drm_driver msm_driver = { .patchlevel = MSM_VERSION_PATCHLEVEL, };
Quoted 9 lines
drivers/gpu/drm/msm/msm_drv.c static const struct drm_driver msm_driver = { · line 915
Quoted 6 lines
drivers/gpu/drm/msm/msm_drv.c +6
-0+static const struct drm_driver msm_kms_driver = { + .driver_features =DRIVER_GEM | +DRIVER_ATOMIC | +DRIVER_MODESET | +DRIVER_SYNCOBJ_TIMELINE | +DRIVER_SYNCOBJ ,I think, drop
DRIVER_SYNCOBJ+DRIVER_SYNCOBJ_TIMELINE, since kms only uses fence fd's.
Ack.
Quoted 8 lines
(Syncobj support is only in the SUBMIT and upcoming
VM_BINDioctls.. I don't think there is a use-case for being able to create syncobjs for KMS only drivers, and it doesn't look like any of the other kms-only drivers support this.)Alternatively, we could use
drm_device::driver_featuresto mask certaindrm_driver::driver_featuresat runtime.. that would be a way to avoid having separatedrm_drivertables.
Not really and that's a problem. DRIVER_RENDER is processed before driver_features can take place.
Also, the "msm-kms" name is required to prevent userspace from using it for GPU tasks.
So, at least a KMS-only structure needs to be present.
Quoted 70 lines
BR,
-RQuoted 66 lines
drivers/gpu/drm/msm/msm_drv.c +30
-4+ .open = msm_open, + .postclose = msm_postclose, + .dumb_create = msm_gem_dumb_create, + .dumb_map_offset = msm_gem_dumb_map_offset, + .gem_prime_import_sg_table = msm_gem_prime_import_sg_table, +#ifdef CONFIG_DEBUG_FS + .debugfs_init = msm_debugfs_init, +#endif + MSM_FBDEV_DRIVER_OPS, + .show_fdinfo = msm_show_fdinfo, + .ioctls = msm_ioctls, + .num_ioctls = ARRAY_SIZE(msm_ioctls), + .fops = &fops, + .name = "msm-kms", + .desc = "MSM Snapdragon DRM", + .major = MSM_VERSION_MAJOR, + .minor = MSM_VERSION_MINOR, + .patchlevel = MSM_VERSION_PATCHLEVEL, +}; + static const struct drm_driver msm_gpu_driver = { .driver_features = DRIVER_GEM | DRIVER_RENDER |@@ -1044,7 +1079,11 @@ static int add_gpu_components(struct device *dev,static int msm_drm_bind (struct device *dev) { -return msm_drm_init (dev, &msm_driver,NULL ); +return msm_drm_init (dev, +msm_gpu_no_components () ? + &msm_kms_driver : + &msm_driver, +NULL ); }static void msm_drm_unbind (struct device *dev)@@ -1080,9 +1119,11 @@ int msm_drv_probe(struct device *master_dev,return ret; } - ret =add_gpu_components (master_dev, &match); -if (ret) -return ret; +if (!msm_gpu_no_components ()) { + ret =add_gpu_components (master_dev, &match); +if (ret) +return ret; + }/* on all devices that I am aware of, iommu's which can map * any address the cpu can see are used: drivers/gpu/drm/msm/msm_drv.h +2
-1@@ -543,4 +543,6 @@ void msm_kms_shutdown(struct platform_device *pdev);bool msm_disp_drv_should_bind (struct device *dev,bool dpu_driver); +bool msm_gpu_no_components (void ); +#endif /* __MSM_DRV_H__ */ --2.39.5
Signature · 2 lines
With best wishes Dmitry
PATCH v2 11/11 drm/msm: make it possible to disable GPU support
In reply to Dmitry BaryshkovSome of the platforms don't have onboard GPU or don't provide support for the GPU in the drm/msm driver. Make it possible to disable the GPU part of the driver and build the KMS-only part.
--- drivers/gpu/drm/msm/Kconfig | 20 +++-- drivers/gpu/drm/msm/Makefile | 14 ++-- drivers/gpu/drm/msm/msm_debugfs.c | 135 ++++++++++++++++++---------------- drivers/gpu/drm/msm/msm_drv.c | 37 ++++++++-- drivers/gpu/drm/msm/msm_drv.h | 3 + drivers/gpu/drm/msm/msm_gpu.h | 71 +++++++++++++++--- drivers/gpu/drm/msm/msm_submitqueue.c | 12 +-- 7 files changed, 191 insertions(+), 101 deletions(-)
drivers/gpu/drm/msm/Kconfig +14 -6
@@ -15,29 +15,37 @@ config DRM_MSM select IOMMU_IO_PGTABLE select QCOM_MDT_LOADER if ARCH_QCOM select REGULATOR - select DRM_EXEC - select DRM_SCHED select SHMEM select TMPFS select QCOM_SCM select WANT_DEV_COREDUMP select SND_SOC_HDMI_CODEC if SND_SOC - select SYNC_FILE select PM_OPP - select NVMEM select PM_GENERIC_DOMAINS select TRACE_GPU_MEM help DRM/KMS driver for MSM/snapdragon. +config DRM_MSM_ADRENO + bool "Qualcomm Adreno GPU support" + default y + depends on DRM_MSM + select DRM_EXEC + select DRM_SCHED + select NVMEM + select SYNC_FILE + help + Enable support for the GPU present on most of Qualcomm Snapdragon + SoCs. If you are unsure, say Y. + config DRM_MSM_GPU_STATE bool - depends on DRM_MSM && (DEBUG_FS || DEV_COREDUMP) + depends on DRM_MSM_ADRENO && (DEBUG_FS || DEV_COREDUMP) default y config DRM_MSM_GPU_SUDO bool "Enable SUDO flag on submits" - depends on DRM_MSM && EXPERT + depends on DRM_MSM_ADRENO && EXPERT default n help Enable userspace that has CAP_SYS_RAWIO to submit GPU commands
drivers/gpu/drm/msm/Makefile +8 -6
@@ -109,21 +109,23 @@ msm-display-$(CONFIG_DRM_MSM_KMS) += \ msm-y += \ msm_debugfs.o \ msm_drv.o \ - msm_fence.o \ msm_gem.o \ msm_gem_prime.o \ msm_gem_shrinker.o \ - msm_gem_submit.o \ msm_gem_vma.o \ - msm_gpu.o \ - msm_gpu_devfreq.o \ msm_io_utils.o \ msm_iommu.o \ + msm_gpu_tracepoints.o \ + +msm-$(CONFIG_DRM_MSM_ADRENO) += \ + msm_fence.o \ + msm_gem_submit.o \ + msm_gpu.o \ + msm_gpu_devfreq.o \ msm_perf.o \ msm_rd.o \ msm_ringbuffer.o \ msm_submitqueue.o \ - msm_gpu_tracepoints.o \ msm-$(CONFIG_DRM_MSM_KMS) += \ msm_atomic.o \
@@ -159,7 +161,7 @@ msm-display-$(CONFIG_DRM_MSM_DSI_14NM_PHY) += dsi/phy/dsi_phy_14nm.o msm-display-$(CONFIG_DRM_MSM_DSI_10NM_PHY) += dsi/phy/dsi_phy_10nm.o msm-display-$(CONFIG_DRM_MSM_DSI_7NM_PHY) += dsi/phy/dsi_phy_7nm.o -msm-y += $(adreno-y) +msm-$(CONFIG_DRM_MSM_ADRENO) += $(adreno-y) msm-$(CONFIG_DRM_MSM_KMS) += $(msm-display-y) obj-$(CONFIG_DRM_MSM) += msm.o
drivers/gpu/drm/msm/msm_debugfs.c +71 -64
153 lines not on this page · raw message
drivers/gpu/drm/msm/msm_drv.c +29 -8
@@ -59,7 +59,11 @@ static bool modeset = true;MODULE_PARM_DESC (modeset,"Use kernel modesetting [KMS] (1=on (default), 0=disable)" );module_param (modeset, bool,0600 ); +#ifndef CONFIG_DRM_MSM_ADRENO +static bool separate_gpu_drm = true; +#else static bool separate_gpu_drm; +#endif MODULE_PARM_DESC (separate_gpu_drm,"Use separate DRM device for the GPU (0=single DRM device for both GPU and display (default), 1=two DRM devices)" );module_param (separate_gpu_drm, bool,0400 );
@@ -320,6 +324,22 @@ static void load_gpu(struct drm_device *dev)mutex_unlock (&init_lock); } +void __msm_file_private_destroy (struct kref *kref) +{ +struct msm_file_private *ctx =container_of (kref, + struct msm_file_private, ref); + +msm_submitqueue_fini (ctx); +msm_gem_address_space_put (ctx->aspace); + +#ifdef CONFIG_DRM_MSM_ADRENO +kfree (ctx->comm); +kfree (ctx->cmdline); +#endif + +kfree (ctx); +} +static int context_init (struct drm_device *dev,struct drm_file *file) {static atomic_t ident =ATOMIC_INIT (0 );
@@ -330,9 +350,6 @@ static int context_init(struct drm_device *dev, struct drm_file *file)if (!ctx)return -ENOMEM ; -INIT_LIST_HEAD (&ctx->submitqueues); -rwlock_init (&ctx->queuelock); -kref_init (&ctx->ref);msm_submitqueue_init (dev, ctx);
@@ -717,6 +734,7 @@ static int msm_ioctl_gem_info(struct drm_device *dev, void *data,return ret; } +#ifdef CONFIG_DRM_MSM_ADRENO static int wait_fence (struct msm_gpu_submitqueue *queue,uint32_t fence_id,ktime_t timeout,uint32_t flags) {
@@ -787,6 +805,7 @@ static int msm_ioctl_wait_fence(struct drm_device *dev, void *data, return ret; } +#endif static int msm_ioctl_gem_madvise (struct drm_device *dev,void *data,struct drm_file *file)
@@ -820,6 +839,7 @@ static int msm_ioctl_gem_madvise(struct drm_device *dev, void *data, } +#ifdef CONFIG_DRM_MSM_ADRENO static int msm_ioctl_submitqueue_new (struct drm_device *dev,void *data,struct drm_file *file) {
@@ -845,6 +865,7 @@ static int msm_ioctl_submitqueue_close(struct drm_device *dev, void *data,return msm_submitqueue_remove (file->driver_priv, id); } +#endif static const struct drm_ioctl_desc msm_ioctls[] = {DRM_IOCTL_DEF_DRV (MSM_GET_PARAM , msm_ioctl_get_param,DRM_RENDER_ALLOW ),
@@ -853,12 +874,14 @@ static const struct drm_ioctl_desc msm_ioctls[] = {DRM_IOCTL_DEF_DRV (MSM_GEM_INFO , msm_ioctl_gem_info,DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (MSM_GEM_CPU_PREP , msm_ioctl_gem_cpu_prep,DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (MSM_GEM_CPU_FINI , msm_ioctl_gem_cpu_fini,DRM_RENDER_ALLOW ), +DRM_IOCTL_DEF_DRV (MSM_GEM_MADVISE , msm_ioctl_gem_madvise,DRM_RENDER_ALLOW ), +#ifdef CONFIG_DRM_MSM_ADRENODRM_IOCTL_DEF_DRV (MSM_GEM_SUBMIT , msm_ioctl_gem_submit,DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (MSM_WAIT_FENCE , msm_ioctl_wait_fence,DRM_RENDER_ALLOW ), -DRM_IOCTL_DEF_DRV (MSM_GEM_MADVISE , msm_ioctl_gem_madvise,DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (MSM_SUBMITQUEUE_NEW , msm_ioctl_submitqueue_new,DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (MSM_SUBMITQUEUE_CLOSE , msm_ioctl_submitqueue_close,DRM_RENDER_ALLOW ), DRM_IOCTL_DEF_DRV(MSM_SUBMITQUEUE_QUERY, msm_ioctl_submitqueue_query, DRM_RENDER_ALLOW), +#endif };static void msm_show_fdinfo (struct drm_printer *p,struct drm_file *file)
@@ -866,10 +889,8 @@ static void msm_show_fdinfo(struct drm_printer *p, struct drm_file *file)struct drm_device *dev = file->minor->dev;struct msm_drm_private *priv = dev->dev_private; -if (!priv->gpu) -return ; - -msm_gpu_show_fdinfo (priv->gpu, file->driver_priv, p); +if (priv->gpu) +msm_gpu_show_fdinfo (priv->gpu, file->driver_priv, p);drm_show_memory_stats (p, file); }
drivers/gpu/drm/msm/msm_drv.h +3 -0
@@ -424,6 +424,9 @@ static inline void msm_mdss_unregister(void) {}#ifdef CONFIG_DEBUG_FS void msm_framebuffer_describe (struct drm_framebuffer *fb,struct seq_file *m); +#endif + +#if defined(CONFIG_DEBUG_FS ) && defined(CONFIG_DRM_MSM_ADRENO )int msm_debugfs_late_init (struct drm_device *dev);int msm_rd_debugfs_init (struct drm_minor *minor);void msm_rd_debugfs_cleanup (struct msm_drm_private *priv);
drivers/gpu/drm/msm/msm_gpu.h +62 -9
123 lines not on this page · raw message
drivers/gpu/drm/msm/msm_submitqueue.c +4 -8
@@ -46,10 +46,8 @@ int msm_file_private_set_sysprof(struct msm_file_private *ctx,return 0 ; } -void __msm_file_private_destroy (struct kref *kref) +void msm_submitqueue_fini (struct msm_file_private *ctx) { -struct msm_file_private *ctx =container_of (kref, - struct msm_file_private, ref);int i;for (i =0 ; i <ARRAY_SIZE (ctx->entities); i++) {
@@ -59,11 +57,6 @@ void __msm_file_private_destroy(struct kref *kref)drm_sched_entity_destroy (ctx->entities[i]);kfree (ctx->entities[i]); } - -msm_gem_address_space_put (ctx->aspace); -kfree (ctx->comm); -kfree (ctx->cmdline); -kfree (ctx); }void msm_submitqueue_destroy (struct kref *kref)
@@ -226,6 +219,9 @@ int msm_submitqueue_init(struct drm_device *drm, struct msm_file_private *ctx)struct msm_drm_private *priv = drm->dev_private;int default_prio, max_priority; +INIT_LIST_HEAD (&ctx->submitqueues); +rwlock_init (&ctx->queuelock); +if (!priv->gpu)return -ENODEV ;
Signature · 1 line
2.39.5
Re: [PATCH v2 11/11] drm/msm: make it possible to disable GPU support
Quoted 22 lines · Dmitry Baryshkov
Some of the platforms don't have onboard GPU or don't provide support for the GPU in the drm/msm driver. Make it possible to disable the GPU part of the driver and build the KMS-only part.
Signed-off-by Dmitry Baryshkov <[email protected]>--- drivers/gpu/drm/msm/Kconfig | 20 +++-- drivers/gpu/drm/msm/Makefile | 14 ++-- drivers/gpu/drm/msm/msm_debugfs.c | 135 ++++++++++++++++++---------------- drivers/gpu/drm/msm/msm_drv.c | 37 ++++++++-- drivers/gpu/drm/msm/msm_drv.h | 3 + drivers/gpu/drm/msm/msm_gpu.h | 71 +++++++++++++++--- drivers/gpu/drm/msm/msm_submitqueue.c | 12 +-- 7 files changed, 191 insertions(+), 101 deletions(-)drivers/gpu/drm/msm/Kconfig +0
-0@@ -15,29 +15,37 @@ config DRM_MSM select IOMMU_IO_PGTABLE
drivers/gpu/drm/msm/Kconfig config DRM_MSM · line 25
Quoted 10 lines
drivers/gpu/drm/msm/Kconfig +0
-3select QCOM_MDT_LOADER if ARCH_QCOM select REGULATOR - select DRM_EXEC - select DRM_SCHED select SHMEM select TMPFS select QCOM_SCM select WANT_DEV_COREDUMP select SND_SOC_HDMI_CODEC if SND_SOC - select SYNC_FILE
fwiw, atomic depends on SYNC_FILE... otoh it is selected at the toplevel by CONFIG_DRM
BR,
-R
Quoted 535 lines
drivers/gpu/drm/msm/Kconfig +14
-3select PM_OPP - select NVMEM select PM_GENERIC_DOMAINS select TRACE_GPU_MEM help DRM/KMS driver for MSM/snapdragon. +config DRM_MSM_ADRENO + bool "Qualcomm Adreno GPU support" + default y + depends on DRM_MSM + select DRM_EXEC + select DRM_SCHED + select NVMEM + select SYNC_FILE + help + Enable support for the GPU present on most of Qualcomm Snapdragon + SoCs. If you are unsure, say Y. + config DRM_MSM_GPU_STATE bool - depends on DRM_MSM && (DEBUG_FS || DEV_COREDUMP) + depends on DRM_MSM_ADRENO && (DEBUG_FS || DEV_COREDUMP) default y config DRM_MSM_GPU_SUDO bool "Enable SUDO flag on submits" - depends on DRM_MSM && EXPERT + depends on DRM_MSM_ADRENO && EXPERT default n help Enable userspace that has CAP_SYS_RAWIO to submit GPU commandsdrivers/gpu/drm/msm/Makefile +8
-6@@ -109,21 +109,23 @@ msm-display-$(CONFIG_DRM_MSM_KMS) += \ msm-y += \ msm_debugfs.o \ msm_drv.o \ - msm_fence.o \ msm_gem.o \ msm_gem_prime.o \ msm_gem_shrinker.o \ - msm_gem_submit.o \ msm_gem_vma.o \ - msm_gpu.o \ - msm_gpu_devfreq.o \ msm_io_utils.o \ msm_iommu.o \ + msm_gpu_tracepoints.o \ + +msm-$(CONFIG_DRM_MSM_ADRENO) += \ + msm_fence.o \ + msm_gem_submit.o \ + msm_gpu.o \ + msm_gpu_devfreq.o \ msm_perf.o \ msm_rd.o \ msm_ringbuffer.o \ msm_submitqueue.o \ - msm_gpu_tracepoints.o \ msm-$(CONFIG_DRM_MSM_KMS) += \ msm_atomic.o \@@ -159,7 +161,7 @@ msm-display-$(CONFIG_DRM_MSM_DSI_14NM_PHY) += dsi/phy/dsi_phy_14nm.o msm-display-$(CONFIG_DRM_MSM_DSI_10NM_PHY) += dsi/phy/dsi_phy_10nm.o msm-display-$(CONFIG_DRM_MSM_DSI_7NM_PHY) += dsi/phy/dsi_phy_7nm.o -msm-y += $(adreno-y) +msm-$(CONFIG_DRM_MSM_ADRENO) += $(adreno-y) msm-$(CONFIG_DRM_MSM_KMS) += $(msm-display-y) obj-$(CONFIG_DRM_MSM) += msm.odrivers/gpu/drm/msm/msm_debugfs.c +71
-64@@ -20,6 +20,7 @@#include "msm_debugfs.h" #include "disp/msm_disp_snapshot.h" +#ifdef CONFIG_DRM_MSM_ADRENO /* * GPU Snapshot: */ @@ -117,6 +118,76 @@ static const struct file_operations msm_gpu_fops = { .release = msm_gpu_release, }; +static void msm_debugfs_gpu_init (struct drm_minor *minor) +{ +struct drm_device *dev = minor->dev; +struct msm_drm_private *priv = dev->dev_private; +struct dentry *gpu_devfreq; + +debugfs_create_file ("gpu" ,0400 , minor->debugfs_root, + dev, &msm_gpu_fops); + +debugfs_create_u32 ("hangcheck_period_ms" ,0600 , minor->debugfs_root, + &priv->hangcheck_period); + +debugfs_create_bool ("disable_err_irq" ,0600 , minor->debugfs_root, + &priv->disable_err_irq); + + gpu_devfreq =debugfs_create_dir ("devfreq" , minor->debugfs_root); + +debugfs_create_bool ("idle_clamp" ,0600 , gpu_devfreq, + &priv->gpu_clamp_to_idle); + +debugfs_create_u32 ("upthreshold" ,0600 , gpu_devfreq, + &priv->gpu_devfreq_config.upthreshold); + +debugfs_create_u32 ("downdifferential" ,0600 , gpu_devfreq, + &priv->gpu_devfreq_config.downdifferential); +} + +static int late_init_minor (struct drm_minor *minor) +{ +struct drm_device *dev = minor->dev; +struct msm_drm_private *priv = dev->dev_private; +int ret; + +if (!minor) +return 0 ; + +if (!priv->gpu_pdev) +return 0 ; + + ret =msm_rd_debugfs_init (minor); +if (ret) { +DRM_DEV_ERROR (minor->dev->dev,"could not install rd debugfs\n" ); +return ret; + } + + ret =msm_perf_debugfs_init (minor); +if (ret) { +DRM_DEV_ERROR (minor->dev->dev,"could not install perf debugfs\n" ); +return ret; + } + +return 0 ; +} + +int msm_debugfs_late_init (struct drm_device *dev) +{ +int ret; + + ret =late_init_minor (dev->primary); +if (ret) +return ret; + ret =late_init_minor (dev->render); +return ret; +} +#else /* ! CONFIG_DRM_MSM_ADRENO */ +static void msm_debugfs_gpu_init (struct drm_minor *minor) +{ +} +#endif /* CONFIG_DRM_MSM_ADRENO */ +#ifdef CONFIG_DRM_MSM_KMS static int msm_fb_show (struct seq_file *m,void *arg) {@@ -294,70 +365,6 @@ static struct drm_info_list msm_debugfs_list[] = { { "mm", msm_mm_show }, }; -static int late_init_minor (struct drm_minor *minor) -{ -struct drm_device *dev = minor->dev; -struct msm_drm_private *priv = dev->dev_private; -int ret; - -if (!minor) -return 0 ; - -if (!priv->gpu_pdev) -return 0 ; - - ret =msm_rd_debugfs_init (minor); -if (ret) { -DRM_DEV_ERROR (minor->dev->dev,"could not install rd debugfs\n" ); -return ret; - } - - ret =msm_perf_debugfs_init (minor); -if (ret) { -DRM_DEV_ERROR (minor->dev->dev,"could not install perf debugfs\n" ); -return ret; - } - -return 0 ; -} - -int msm_debugfs_late_init (struct drm_device *dev) -{ -int ret; - ret =late_init_minor (dev->primary); -if (ret) -return ret; - ret =late_init_minor (dev->render); -return ret; -} - -static void msm_debugfs_gpu_init (struct drm_minor *minor) -{ -struct drm_device *dev = minor->dev; -struct msm_drm_private *priv = dev->dev_private; -struct dentry *gpu_devfreq; - -debugfs_create_file ("gpu" ,S_IRUSR , minor->debugfs_root, - dev, &msm_gpu_fops); - -debugfs_create_u32 ("hangcheck_period_ms" ,0600 , minor->debugfs_root, - &priv->hangcheck_period); - -debugfs_create_bool ("disable_err_irq" ,0600 , minor->debugfs_root, - &priv->disable_err_irq); - - gpu_devfreq =debugfs_create_dir ("devfreq" , minor->debugfs_root); - -debugfs_create_bool ("idle_clamp" ,0600 , gpu_devfreq, - &priv->gpu_clamp_to_idle); - -debugfs_create_u32 ("upthreshold" ,0600 , gpu_devfreq, - &priv->gpu_devfreq_config.upthreshold); - -debugfs_create_u32 ("downdifferential" ,0600 , gpu_devfreq, - &priv->gpu_devfreq_config.downdifferential); -} -void msm_debugfs_init (struct drm_minor *minor) {struct drm_device *dev = minor->dev;drivers/gpu/drm/msm/msm_drv.c +29
-8@@ -59,7 +59,11 @@ static bool modeset = true;MODULE_PARM_DESC (modeset,"Use kernel modesetting [KMS] (1=on (default), 0=disable)" );module_param (modeset, bool,0600 ); +#ifndef CONFIG_DRM_MSM_ADRENO +static bool separate_gpu_drm = true; +#else static bool separate_gpu_drm; +#endif MODULE_PARM_DESC (separate_gpu_drm,"Use separate DRM device for the GPU (0=single DRM device for both GPU and display (default), 1=two DRM devices)" );module_param (separate_gpu_drm, bool,0400 );@@ -320,6 +324,22 @@ static void load_gpu(struct drm_device *dev)mutex_unlock (&init_lock); } +void __msm_file_private_destroy (struct kref *kref) +{ +struct msm_file_private *ctx =container_of (kref, + struct msm_file_private, ref); + +msm_submitqueue_fini (ctx); +msm_gem_address_space_put (ctx->aspace); + +#ifdef CONFIG_DRM_MSM_ADRENO +kfree (ctx->comm); +kfree (ctx->cmdline); +#endif + +kfree (ctx); +} +static int context_init (struct drm_device *dev,struct drm_file *file) {static atomic_t ident =ATOMIC_INIT (0 );@@ -330,9 +350,6 @@ static int context_init(struct drm_device *dev, struct drm_file *file)if (!ctx)return -ENOMEM ; -INIT_LIST_HEAD (&ctx->submitqueues); -rwlock_init (&ctx->queuelock); -kref_init (&ctx->ref);msm_submitqueue_init (dev, ctx);@@ -717,6 +734,7 @@ static int msm_ioctl_gem_info(struct drm_device *dev, void *data,return ret; } +#ifdef CONFIG_DRM_MSM_ADRENO static int wait_fence (struct msm_gpu_submitqueue *queue,uint32_t fence_id,ktime_t timeout,uint32_t flags) {@@ -787,6 +805,7 @@ static int msm_ioctl_wait_fence(struct drm_device *dev, void *data, return ret; } +#endif static int msm_ioctl_gem_madvise (struct drm_device *dev,void *data,struct drm_file *file)@@ -820,6 +839,7 @@ static int msm_ioctl_gem_madvise(struct drm_device *dev, void *data, } +#ifdef CONFIG_DRM_MSM_ADRENO static int msm_ioctl_submitqueue_new (struct drm_device *dev,void *data,struct drm_file *file) {@@ -845,6 +865,7 @@ static int msm_ioctl_submitqueue_close(struct drm_device *dev, void *data,return msm_submitqueue_remove (file->driver_priv, id); } +#endif static const struct drm_ioctl_desc msm_ioctls[] = {DRM_IOCTL_DEF_DRV (MSM_GET_PARAM , msm_ioctl_get_param,DRM_RENDER_ALLOW ),@@ -853,12 +874,14 @@ static const struct drm_ioctl_desc msm_ioctls[] = {DRM_IOCTL_DEF_DRV (MSM_GEM_INFO , msm_ioctl_gem_info,DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (MSM_GEM_CPU_PREP , msm_ioctl_gem_cpu_prep,DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (MSM_GEM_CPU_FINI , msm_ioctl_gem_cpu_fini,DRM_RENDER_ALLOW ), +DRM_IOCTL_DEF_DRV (MSM_GEM_MADVISE , msm_ioctl_gem_madvise,DRM_RENDER_ALLOW ), +#ifdef CONFIG_DRM_MSM_ADRENODRM_IOCTL_DEF_DRV (MSM_GEM_SUBMIT , msm_ioctl_gem_submit,DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (MSM_WAIT_FENCE , msm_ioctl_wait_fence,DRM_RENDER_ALLOW ), -DRM_IOCTL_DEF_DRV (MSM_GEM_MADVISE , msm_ioctl_gem_madvise,DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (MSM_SUBMITQUEUE_NEW , msm_ioctl_submitqueue_new,DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (MSM_SUBMITQUEUE_CLOSE , msm_ioctl_submitqueue_close,DRM_RENDER_ALLOW ), DRM_IOCTL_DEF_DRV(MSM_SUBMITQUEUE_QUERY, msm_ioctl_submitqueue_query, DRM_RENDER_ALLOW), +#endif };static void msm_show_fdinfo (struct drm_printer *p,struct drm_file *file)@@ -866,10 +889,8 @@ static void msm_show_fdinfo(struct drm_printer *p, struct drm_file *file)struct drm_device *dev = file->minor->dev;struct msm_drm_private *priv = dev->dev_private; -if (!priv->gpu) -return ; - -msm_gpu_show_fdinfo (priv->gpu, file->driver_priv, p); +if (priv->gpu) +msm_gpu_show_fdinfo (priv->gpu, file->driver_priv, p);drm_show_memory_stats (p, file); }drivers/gpu/drm/msm/msm_drv.h +3
-0@@ -424,6 +424,9 @@ static inline void msm_mdss_unregister(void) {}#ifdef CONFIG_DEBUG_FS void msm_framebuffer_describe (struct drm_framebuffer *fb,struct seq_file *m); +#endif + +#if defined(CONFIG_DEBUG_FS ) && defined(CONFIG_DRM_MSM_ADRENO )int msm_debugfs_late_init (struct drm_device *dev);int msm_rd_debugfs_init (struct drm_minor *minor);void msm_rd_debugfs_cleanup (struct msm_drm_private *priv);drivers/gpu/drm/msm/msm_gpu.h +62
-9@@ -358,12 +358,13 @@ struct msm_gpu_perfcntr {* @seqno: unique per process seqno */ struct msm_file_private { -rwlock_t queuelock; -struct list_head submitqueues; -int queueid;struct msm_gem_address_space *aspace;struct kref ref;int seqno; +#ifdef CONFIG_DRM_MSM_ADRENO +rwlock_t queuelock; +struct list_head submitqueues; +int queueid;/** * sysprof: @@ -425,6 +426,7 @@ struct msm_file_private {* level. */ struct drm_sched_entity *entities[NR_SCHED_PRIORITIES *MSM_GPU_MAX_RINGS ]; +#endif /** * ctx_mem: @@ -559,6 +561,7 @@ struct msm_gpu_state {struct msm_gpu_state_bo *bos; }; +#ifdef CONFIG_DRM_MSM_ADRENO static inline void gpu_write (struct msm_gpu *gpu,u32 reg,u32 data) {writel (data, gpu->mmio + (reg <<2 ));@@ -612,6 +615,7 @@ void msm_gpu_show_fdinfo(struct msm_gpu *gpu, struct msm_file_private *ctx, struct drm_printer *p);int msm_submitqueue_init (struct drm_device *drm,struct msm_file_private *ctx); +void msm_submitqueue_fini (struct msm_file_private *ctx);struct msm_gpu_submitqueue *msm_submitqueue_get (struct msm_file_private *ctx,u32 id); int msm_submitqueue_create(struct drm_device *drm,@@ -624,8 +628,42 @@ void msm_submitqueue_close(struct msm_file_private *ctx);void msm_submitqueue_destroy (struct kref *kref); +static inline void msm_submitqueue_put (struct msm_gpu_submitqueue *queue) +{ +if (queue) +kref_put (&queue->ref, msm_submitqueue_destroy); +} +int msm_file_private_set_sysprof (struct msm_file_private *ctx,struct msm_gpu *gpu,int sysprof); +#else +static inline void msm_gpu_show_fdinfo (struct msm_gpu *gpu, +struct msm_file_private *ctx, +struct drm_printer *p) +{ +} + +static inline int msm_submitqueue_init (struct drm_device *drm,struct msm_file_private *ctx) +{ +return -ENXIO ; +} + +static inline void msm_submitqueue_fini (struct msm_file_private *ctx) +{ +} + +static inline void msm_submitqueue_close (struct msm_file_private *ctx) +{ +} + +static inline int msm_file_private_set_sysprof (struct msm_file_private *ctx, +struct msm_gpu *gpu, +int sysprof) +{ +return 0 ; +} +#endif +void __msm_file_private_destroy (struct kref *kref);static inline void msm_file_private_put (struct msm_file_private *ctx)@@ -640,6 +678,7 @@ static inline struct msm_file_private *msm_file_private_get(return ctx; } +#ifdef CONFIG_DRM_MSM_ADRENO void msm_devfreq_init (struct msm_gpu *gpu);void msm_devfreq_cleanup (struct msm_gpu *gpu);void msm_devfreq_resume (struct msm_gpu *gpu);@@ -671,12 +710,6 @@ struct msm_gpu *adreno_load_gpu(struct drm_device *dev);void __init adreno_register (void ); void __exit adreno_unregister(void); -static inline void msm_submitqueue_put (struct msm_gpu_submitqueue *queue) -{ -if (queue) -kref_put (&queue->ref, msm_submitqueue_destroy); -} -static inline struct msm_gpu_state *msm_gpu_crashstate_get (struct msm_gpu *gpu) {struct msm_gpu_state *state =NULL ;@@ -712,5 +745,25 @@ static inline void msm_gpu_crashstate_put(struct msm_gpu *gpu)#define check_apriv (gpu, flags) \ (((gpu)->hw_apriv ? MSM_BO_MAP_PRIV : 0) | (flags)) +#else /* ! CONFIG_DRM_MSM_ADRENO */ +static inline struct msm_gem_address_space * +msm_gpu_create_private_address_space (struct msm_gpu *gpu,struct task_struct *task) +{ +return NULL ; +} + +static inline struct msm_gpu *adreno_load_gpu (struct drm_device *dev) +{ +return NULL ; +} + +static inline void __init adreno_register (void ) +{ +} + +static inline void __exit adreno_unregister(void) +{ +} +#endif /* ! CONFIG_DRM_MSM_ADRENO */ #endif /* __MSM_GPU_H__ */ drivers/gpu/drm/msm/msm_submitqueue.c +4
-9@@ -46,10 +46,8 @@ int msm_file_private_set_sysprof(struct msm_file_private *ctx,return 0 ; } -void __msm_file_private_destroy (struct kref *kref) +void msm_submitqueue_fini (struct msm_file_private *ctx) { -struct msm_file_private *ctx =container_of (kref, - struct msm_file_private, ref);int i;for (i =0 ; i <ARRAY_SIZE (ctx->entities); i++) {@@ -59,11 +57,6 @@ void __msm_file_private_destroy(struct kref *kref)drm_sched_entity_destroy (ctx->entities[i]);kfree (ctx->entities[i]); } - -msm_gem_address_space_put (ctx->aspace); -kfree (ctx->comm); -kfree (ctx->cmdline); -kfree (ctx); }void msm_submitqueue_destroy (struct kref *kref)@@ -226,6 +219,9 @@ int msm_submitqueue_init(struct drm_device *drm, struct msm_file_private *ctx)struct msm_drm_private *priv = drm->dev_private;int default_prio, max_priority; +INIT_LIST_HEAD (&ctx->submitqueues); +rwlock_init (&ctx->queuelock); +if (!priv->gpu)return -ENODEV ; --2.39.5
Re: [PATCH v2 11/11] drm/msm: make it possible to disable GPU support
Quoted 29 lines · Rob Clark
Quoted 27 lines · Dmitry Baryshkov
Some of the platforms don't have onboard GPU or don't provide support for the GPU in the drm/msm driver. Make it possible to disable the GPU part of the driver and build the KMS-only part.
Signed-off-by Dmitry Baryshkov <[email protected]>--- drivers/gpu/drm/msm/Kconfig | 20 +++-- drivers/gpu/drm/msm/Makefile | 14 ++-- drivers/gpu/drm/msm/msm_debugfs.c | 135 ++++++++++++++++++---------------- drivers/gpu/drm/msm/msm_drv.c | 37 ++++++++-- drivers/gpu/drm/msm/msm_drv.h | 3 + drivers/gpu/drm/msm/msm_gpu.h | 71 +++++++++++++++--- drivers/gpu/drm/msm/msm_submitqueue.c | 12 +-- 7 files changed, 191 insertions(+), 101 deletions(-)drivers/gpu/drm/msm/Kconfig +0
-2@@ -15,29 +15,37 @@ config DRM_MSM select IOMMU_IO_PGTABLE select QCOM_MDT_LOADER if ARCH_QCOM select REGULATOR - select DRM_EXEC - select DRM_SCHED select SHMEM
Quoted 8 lines
drivers/gpu/drm/msm/Kconfig config DRM_MSM · line 25
Quoted 5 lines
drivers/gpu/drm/msm/Kconfig +0
-1select TMPFS select QCOM_SCM select WANT_DEV_COREDUMP select SND_SOC_HDMI_CODEC if SND_SOC - select SYNC_FILEfwiw, atomic depends on
SYNC_FILE... otoh it is selected at the toplevel byCONFIG_DRM
Within drm/msm it is only used by GEM_SUBMIT code, so I still think this is correct.
Signature · 2 lines
With best wishes Dmitry