drm/msm/mdp4: add lcdc-align-lsb flag to control lane alignment
Subsystems (7)
PATCH v4 1/5 drm/msm/mdp4: add lcdc-align-lsb flag to control lane alignment
This allows controlling which of the 8 lanes are used for 6 bit color.
---
v3: removed empty line and added documentation
.../devicetree/bindings/display/msm/mdp4.txt | 2 ++ .../gpu/drm/msm/disp/mdp4/mdp4_lcdc_encoder.c | 21 ++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-)
Documentation/devicetree/bindings/display/msm/mdp4.txt +2 -0
@@ -38,6 +38,8 @@ Required properties: Optional properties: - clock-names: the following clocks are optional: * "lut_clk" +- qcom,lcdc-align-lsb: Boolean value indicating that LSB alignment should be + used for LCDC. This is only valid for 18bpp panels. Example:
drivers/gpu/drm/msm/disp/mdp4/mdp4_lcdc_encoder.c +13 -8
@@ -377,20 +377,25 @@ static void mdp4_lcdc_encoder_enable(struct drm_encoder *encoder)unsigned long pc = mdp4_lcdc_encoder->pixclock;struct mdp4_kms *mdp4_kms =get_kms (encoder);struct drm_panel *panel; +uint32_t config;int i, ret;if (WARN_ON (mdp4_lcdc_encoder->enabled))return ;/* TODO: hard-coded for 18bpp: */ -mdp4_crtc_set_config (encoder->crtc, -MDP4_DMA_CONFIG_R_BPC (BPC6 ) | -MDP4_DMA_CONFIG_G_BPC (BPC6 ) | -MDP4_DMA_CONFIG_B_BPC (BPC6 ) | -MDP4_DMA_CONFIG_PACK_ALIGN_MSB | -MDP4_DMA_CONFIG_PACK (0x21 ) | -MDP4_DMA_CONFIG_DEFLKR_EN | -MDP4_DMA_CONFIG_DITHER_EN ); + config = +MDP4_DMA_CONFIG_R_BPC (BPC6 ) | +MDP4_DMA_CONFIG_G_BPC (BPC6 ) | +MDP4_DMA_CONFIG_B_BPC (BPC6 ) | +MDP4_DMA_CONFIG_PACK (0x21 ) | +MDP4_DMA_CONFIG_DEFLKR_EN | +MDP4_DMA_CONFIG_DITHER_EN ; + +if (!of_property_read_bool (dev->dev->of_node,"qcom,lcdc-align-lsb" )) + config |=MDP4_DMA_CONFIG_PACK_ALIGN_MSB ; + +mdp4_crtc_set_config (encoder->crtc, config);mdp4_crtc_set_intf (encoder->crtc,INTF_LCDC_DTV ,0 );bs_set (mdp4_lcdc_encoder,1 );
Signature · 6 lines
2.17.1 _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
PATCH v4 2/5 drm/msm: add headless gpu device for imx5
This patch allows using drm/msm without qcom display hardware. It adds a amd,imageon compatible, which is used instead of qcom,adreno, but does not require a top level msm node.
---
v3: reworked to work with only a amd,imageon node
drivers/gpu/drm/msm/Kconfig | 4 +-- drivers/gpu/drm/msm/adreno/adreno_device.c | 35 ++++++++++++++++++++-- drivers/gpu/drm/msm/msm_debugfs.c | 2 +- drivers/gpu/drm/msm/msm_drv.c | 21 +++++++------ 4 files changed, 46 insertions(+), 16 deletions(-)
drivers/gpu/drm/msm/Kconfig +2 -2
@@ -2,7 +2,7 @@ config DRM_MSM tristate "MSM DRM" depends on DRM - depends on ARCH_QCOM || (ARM && COMPILE_TEST) + depends on ARCH_QCOM || SOC_IMX5 || (ARM && COMPILE_TEST) depends on OF && COMMON_CLK depends on MMU select QCOM_MDT_LOADER if ARCH_QCOM
@@ -11,7 +11,7 @@ config DRM_MSM select DRM_PANEL select SHMEM select TMPFS - select QCOM_SCM + select QCOM_SCM if ARCH_QCOM select WANT_DEV_COREDUMP select SND_SOC_HDMI_CODEC if SND_SOC select SYNC_FILE
drivers/gpu/drm/msm/adreno/adreno_device.c +33 -2
@@ -271,7 +271,8 @@ static int find_chipid(struct device *dev, struct adreno_rev *rev)if (ret ==0 ) {unsigned int r, patch; -if (sscanf (compat,"qcom,adreno-%u.%u" , &r, &patch) ==2 ) { +if (sscanf (compat,"qcom,adreno-%u.%u" , &r, &patch) ==2 || +sscanf (compat,"amd,imageon-%u.%u" , &r, &patch) ==2 ) { rev->core = r /100 ; r %=100 ; rev->major = r /10 ;
@@ -356,9 +357,37 @@ 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) { -return component_add (&pdev->dev, &a3xx_ops); + +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 0 ; }static int adreno_remove (struct platform_device *pdev)
@@ -370,6 +399,8 @@ static int adreno_remove(struct platform_device *pdev)static const struct of_device_id dt_match[] = { { .compatible ="qcom,adreno" }, { .compatible ="qcom,adreno-3xx" }, +/* for compatibility with imx5 gpu: */ + { .compatible ="amd,imageon" },/* for backwards compat w/ downstream kgsl DT files: */ { .compatible ="qcom,kgsl-3d0" }, {}
drivers/gpu/drm/msm/msm_debugfs.c +1 -1
@@ -242,7 +242,7 @@ int msm_debugfs_init(struct drm_minor *minor)debugfs_create_file ("gpu" ,S_IRUSR , minor->debugfs_root, dev, &msm_gpu_fops); -if (priv->kms->funcs->debugfs_init) { +if (priv->kms && priv->kms->funcs->debugfs_init) { ret = priv->kms->funcs->debugfs_init (priv->kms, minor);if (ret)return ret;
drivers/gpu/drm/msm/msm_drv.c +10 -11
@@ -510,17 +510,13 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv) priv->kms = kms;break ;default : - kms =ERR_PTR (-ENODEV ); +/* valid only for the dummy headless case, where of_node=NULL */ +WARN_ON (dev->of_node); + kms =NULL ;break ; }if (IS_ERR (kms)) { -/* -* NOTE: once we have GPU support, having no kms should not -* be considered fatal.. ideally we would still support gpu -* and (for example) use dmabuf/prime to share buffers with -* imx drm driver on iMX5 -*/ DRM_DEV_ERROR (dev,"failed to load kms\n" ); ret =PTR_ERR (kms); priv->kms =NULL ;
@@ -620,7 +616,7 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)drm_mode_config_reset (ddev);#ifdef CONFIG_DRM_FBDEV_EMULATION -if (fbdev) +if (kms && fbdev) priv->fbdev =msm_fbdev_init (ddev);#endif
@@ -1302,6 +1298,7 @@ static int add_display_components(struct device *dev,static const struct of_device_id msm_gpu_match[] = { { .compatible ="qcom,adreno" }, { .compatible ="qcom,adreno-3xx" }, + { .compatible ="amd,imageon" }, { .compatible ="qcom,kgsl-3d0" }, { }, };
@@ -1346,9 +1343,11 @@ static int msm_pdev_probe(struct platform_device *pdev)struct component_match *match =NULL ;int ret; - ret =add_display_components (&pdev->dev, &match); -if (ret) -return ret; +if (get_mdp_ver (pdev)) { + ret =add_display_components (&pdev->dev, &match); +if (ret) +return ret; + } ret =add_gpu_components (&pdev->dev, &match);if (ret)
Signature · 6 lines
2.17.1 _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
PATCH v4 3/5 drm/msm: implement a2xx mmu
In reply to Jonathan MarekA2XX has its own very simple MMU.
Added a msm_use_mmu() function because we can't rely on iommu_present to decide to use MMU or not.
---
v3: rebased on msm-next-staging and moved is_a2xx initialization earlier
drivers/gpu/drm/msm/Makefile | 3 +- drivers/gpu/drm/msm/adreno/a2xx_gpu.c | 50 ++++++++- drivers/gpu/drm/msm/adreno/adreno_device.c | 3 + drivers/gpu/drm/msm/adreno/adreno_gpu.c | 3 + drivers/gpu/drm/msm/msm_drv.c | 11 +- drivers/gpu/drm/msm/msm_drv.h | 8 ++ drivers/gpu/drm/msm/msm_gem.c | 4 +- drivers/gpu/drm/msm/msm_gem_vma.c | 23 ++++ drivers/gpu/drm/msm/msm_gpu.c | 31 ++++-- drivers/gpu/drm/msm/msm_gpummu.c | 122 +++++++++++++++++++++ drivers/gpu/drm/msm/msm_mmu.h | 3 + 11 files changed, 241 insertions(+), 20 deletions(-) create mode 100644 drivers/gpu/drm/msm/msm_gpummu.c
drivers/gpu/drm/msm/Makefile +2 -1
@@ -93,7 +93,8 @@ msm-y := \ msm_rd.o \ msm_ringbuffer.o \ msm_submitqueue.o \ - msm_gpu_tracepoints.o + msm_gpu_tracepoints.o \ + msm_gpummu.o msm-$(CONFIG_DEBUG_FS) += adreno/a5xx_debugfs.o \ disp/dpu1/dpu_dbg.o
drivers/gpu/drm/msm/adreno/a2xx_gpu.c +46 -4
79 lines not on this page · raw message
drivers/gpu/drm/msm/adreno/adreno_device.c +3 -0
@@ -308,6 +308,7 @@ static int adreno_bind(struct device *dev, struct device *master, void *data)static struct adreno_platform_config config = {};const struct adreno_info *info;struct drm_device *drm =dev_get_drvdata (master); +struct msm_drm_private *priv = drm->dev_private;struct msm_gpu *gpu;int ret;
@@ -330,6 +331,8 @@ static int adreno_bind(struct device *dev, struct device *master, void *data)DBG ("Found GPU: %u.%u.%u.%u" , config.rev.core, config.rev.major, config.rev.minor, config.rev.patchid); + priv->is_a2xx = config.rev.core ==2 ; + gpu = info->init (drm);if (IS_ERR (gpu)) {dev_warn (drm->dev,"failed to load adreno gpu\n" );
drivers/gpu/drm/msm/adreno/adreno_gpu.c +3 -0
@@ -769,6 +769,9 @@ int adreno_gpu_init(struct drm_device *drm, struct platform_device *pdev, adreno_gpu_config.va_start =SZ_16M ; adreno_gpu_config.va_end =0xffffffff ; +/* maximum range of a2xx mmu */ +if (adreno_is_a2xx (adreno_gpu)) + adreno_gpu_config.va_end =SZ_16M +0xfff *SZ_64K ; adreno_gpu_config.nr_rings = nr_rings;
drivers/gpu/drm/msm/msm_drv.c +10 -1
@@ -26,6 +26,7 @@#include "msm_gem.h" #include "msm_gpu.h" #include "msm_kms.h" +#include "adreno/adreno_gpu.h" /*
@@ -360,6 +361,14 @@ static int get_mdp_ver(struct platform_device *pdev)#include <linux/of_address.h> +bool msm_use_mmu (struct drm_device *dev) +{ +struct msm_drm_private *priv = dev->dev_private; + +/* a2xx comes with its own MMU */ +return priv->is_a2xx ||iommu_present (&platform_bus_type); +} +static int msm_init_vram (struct drm_device *dev) {struct msm_drm_private *priv = dev->dev_private;
@@ -398,7 +407,7 @@ static int msm_init_vram(struct drm_device *dev)* Grab the entire CMA chunk carved out in early startup in * mach-msm: */ - }else if (!iommu_present (&platform_bus_type)) { + }else if (!msm_use_mmu (dev)) {DRM_INFO ("using %s VRAM carveout\n" , vram); size =memparse (vram,NULL ); }
drivers/gpu/drm/msm/msm_drv.h +8 -0
@@ -179,6 +179,8 @@ struct msm_drm_private {/* when we have more than one 'msm_gpu' these need to be an array: */ struct msm_gpu *gpu;struct msm_file_private *lastctx; +/* gpu is only set on open(), but we need this info earlier */ +bool is_a2xx;struct drm_fb_helper *fbdev;
@@ -258,9 +260,15 @@ struct msm_gem_address_space * msm_gem_address_space_create(struct device *dev, struct iommu_domain *domain, const char *name); +struct msm_gem_address_space * +msm_gem_address_space_create_a2xx (struct device *dev,struct msm_gpu *gpu, +const char *name,uint64_t va_start,uint64_t va_end); +int msm_register_mmu (struct drm_device *dev,struct msm_mmu *mmu);void msm_unregister_mmu (struct drm_device *dev,struct msm_mmu *mmu); +bool msm_use_mmu (struct drm_device *dev); +void msm_gem_submit_free (struct msm_gem_submit *submit);int msm_ioctl_gem_submit (struct drm_device *dev,void *data,struct drm_file *file);
drivers/gpu/drm/msm/msm_gem.c +2 -2
@@ -975,7 +975,7 @@ static struct drm_gem_object *_msm_gem_new(struct drm_device *dev, size =PAGE_ALIGN (size); -if (!iommu_present (&platform_bus_type)) +if (!msm_use_mmu (dev)) use_vram = true;else if ((flags & (MSM_BO_STOLEN |MSM_BO_SCANOUT )) && priv->vram.size) use_vram = true;
@@ -1052,7 +1052,7 @@ struct drm_gem_object *msm_gem_import(struct drm_device *dev,int ret, npages;/* if we don't have IOMMU, don't bother pretending we can import: */ -if (!iommu_present (&platform_bus_type)) { +if (!msm_use_mmu (dev)) {DRM_DEV_ERROR (dev->dev,"cannot import without IOMMU\n" );return ERR_PTR (-EINVAL ); }
drivers/gpu/drm/msm/msm_gem_vma.c +23 -0
@@ -159,3 +159,26 @@ msm_gem_address_space_create(struct device *dev, struct iommu_domain *domain,return aspace; } + +struct msm_gem_address_space * +msm_gem_address_space_create_a2xx (struct device *dev,struct msm_gpu *gpu, +const char *name,uint64_t va_start,uint64_t va_end) +{ +struct msm_gem_address_space *aspace; +u64 size = va_end - va_start; + + aspace =kzalloc (sizeof (*aspace),GFP_KERNEL ); +if (!aspace) +return ERR_PTR (-ENOMEM ); + +spin_lock_init (&aspace->lock); + aspace->name = name; + aspace->mmu =msm_gpummu_new (dev, gpu); + +drm_mm_init (&aspace->mm, (va_start >>PAGE_SHIFT ), + size >>PAGE_SHIFT ); + +kref_init (&aspace->kref); + +return aspace; +}
drivers/gpu/drm/msm/msm_gpu.c +19 -12
@@ -20,6 +20,7 @@#include "msm_mmu.h" #include "msm_fence.h" #include "msm_gpu_trace.h" +#include "adreno/adreno_gpu.h" #include <generated/utsrelease.h> #include <linux/string_helpers.h>
@@ -825,7 +826,6 @@ static struct msm_gem_address_space * msm_gpu_create_address_space(struct msm_gpu *gpu, struct platform_device *pdev, uint64_t va_start, uint64_t va_end) { - struct iommu_domain *iommu; struct msm_gem_address_space *aspace;int ret;
@@ -834,20 +834,27 @@ msm_gpu_create_address_space(struct msm_gpu *gpu, struct platform_device *pdev,* and have separate page tables per context. For now, to keep things * simple and to get something working, just use a single address space: */ - iommu =iommu_domain_alloc (&platform_bus_type); -if (!iommu) -return NULL ; - - iommu->geometry.aperture_start = va_start; - iommu->geometry.aperture_end = va_end; - -DRM_DEV_INFO (gpu->dev->dev,"%s: using IOMMU\n" , gpu->name); +if (!adreno_is_a2xx (to_adreno_gpu (gpu))) { +struct iommu_domain *iommu =iommu_domain_alloc (&platform_bus_type); +if (!iommu) +return NULL ; + + iommu->geometry.aperture_start = va_start; + iommu->geometry.aperture_end = va_end; + +DRM_DEV_INFO (gpu->dev->dev,"%s: using IOMMU\n" , gpu->name); + + aspace =msm_gem_address_space_create (&pdev->dev, iommu,"gpu" ); +if (IS_ERR (aspace)) +iommu_domain_free (iommu); + }else { + aspace =msm_gem_address_space_create_a2xx (&pdev->dev, gpu,"gpu" , + va_start, va_end); + } - aspace =msm_gem_address_space_create (&pdev->dev, iommu,"gpu" );if (IS_ERR (aspace)) { -DRM_DEV_ERROR (gpu->dev->dev,"failed to init iommu: %ld\n" , +DRM_DEV_ERROR (gpu->dev->dev,"failed to init mmu: %ld\n" ,PTR_ERR (aspace)); -iommu_domain_free (iommu);return ERR_CAST (aspace); }
drivers/gpu/drm/msm/msm_gpummu.c new file +122 -0
122 lines not on this page · raw message
drivers/gpu/drm/msm/msm_mmu.h +3 -0
@@ -53,4 +53,7 @@ static inline void msm_mmu_set_fault_handler(struct msm_mmu *mmu, void *arg, mmu->handler = handler; } +void msm_gpummu_params (struct msm_mmu *mmu,dma_addr_t *pt_base, +dma_addr_t *tran_error); +#endif /* __MSM_MMU_H__ */
Signature · 1 line
2.17.1
PATCH v4 4/5 ARM: dts: imx5: add gpu nodes
In reply to Jonathan MarekThis adds the gpu nodes for the adreno 200 GPU on iMX51 and iMX53, now supported by the freedreno driver.
The compatible for the iMX51 uses a patchid of 1, which is used by drm/msm driver to identify the smaller 128KiB GMEM size.
---
v4:
added commit message
moved to follow address order
removed frequencies, they are not needed as clocks have fixed rate
arch/arm/boot/dts/imx51.dtsi | 10 ++++++++++ arch/arm/boot/dts/imx53.dtsi | 10 ++++++++++ 2 files changed, 20 insertions(+)
arch/arm/boot/dts/imx51.dtsi +10 -0
@@ -123,6 +123,16 @@ reg = <0x1ffe0000 0x20000>; }; + gpu: gpu@30000000 { + compatible = "amd,imageon-200.1", "amd,imageon"; + reg = <0x30000000 0x20000>; + reg-names = "kgsl_3d0_reg_memory"; + interrupts = <12>; + interrupt-names = "kgsl_3d0_irq"; + clocks = <&clks IMX5_CLK_GPU3D_GATE>, <&clks IMX5_CLK_GARB_GATE>; + clock-names = "core_clk", "mem_iface_clk"; + }; + ipu: ipu@40000000 { #address-cells = <1>; #size-cells = <0>;
arch/arm/boot/dts/imx53.dtsi +10 -0
@@ -209,6 +209,16 @@ }; }; + gpu: gpu@30000000 { + compatible = "amd,imageon-200.0", "amd,imageon"; + reg = <0x30000000 0x20000>; + reg-names = "kgsl_3d0_reg_memory"; + interrupts = <12>; + interrupt-names = "kgsl_3d0_irq"; + clocks = <&clks IMX5_CLK_GPU3D_GATE>, <&clks IMX5_CLK_GARB_GATE>; + clock-names = "core_clk", "mem_iface_clk"; + }; + aips@50000000 { /* AIPS1 */ compatible = "fsl,aips-bus", "simple-bus"; #address-cells = <1>;
Signature · 6 lines
2.17.1 _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
Re: [PATCH v4 4/5] ARM: dts: imx5: add gpu nodes
Quoted 8 lines · Jonathan Marek
This adds the gpu nodes for the adreno 200 GPU on iMX51 and iMX53, now supported by the freedreno driver.
The compatible for the iMX51 uses a patchid of 1, which is used by drm/msm driver to identify the smaller 128KiB GMEM size.
Signed-off-by Jonathan Marek <[email protected]>
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno
Re: [PATCH v4 4/5] ARM: dts: imx5: add gpu nodes
In reply to Jonathan MarekQuoted 7 lines · Jonathan Marek
This adds the gpu nodes for the adreno 200 GPU on iMX51 and iMX53, now supported by the freedreno driver.
The compatible for the iMX51 uses a patchid of 1, which is used by drm/msm driver to identify the smaller 128KiB GMEM size.
Signed-off-by Jonathan Marek <[email protected]>
Applied, thanks.
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno
PATCH v4 5/5 dt-bindings: display: msm/gpu: document amd,imageon compatible
In reply to Jonathan MarekDocument the new amd,imageon compatible, used for non-qcom hardware that uses the drm/msm driver (iMX5).
--- Documentation/devicetree/bindings/display/msm/gpu.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/display/msm/gpu.txt +3 -1
@@ -1,11 +1,13 @@ Qualcomm adreno/snapdragon GPU Required properties: -- compatible: "qcom,adreno-XYZ.W", "qcom,adreno" +- compatible: "qcom,adreno-XYZ.W", "qcom,adreno" or + "amd,imageon-XYZ.W", "amd,imageon" for example: "qcom,adreno-306.0", "qcom,adreno" Note that you need to list the less specific "qcom,adreno" (since this is what the device is matched on), in addition to the more specific with the chip-id. + If "amd,imageon" is used, there should be no top level msm device. - reg: Physical base address and length of the controller's registers. - interrupts: The interrupt signal from the gpu. - clocks: device clocks
Signature · 6 lines
2.17.1 _______________________________________________ Freedreno mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/freedreno
Re: [PATCH v4 5/5] dt-bindings: display: msm/gpu: document amd,imageon compatible
Quoted 8 lines · Jonathan Marek
Document the new amd,imageon compatible, used for non-qcom hardware that uses the drm/msm driver (iMX5).
Signed-off-by Jonathan Marek <[email protected]>--- Documentation/devicetree/bindings/display/msm/gpu.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 10 lines · Jonathan Marek
This allows controlling which of the 8 lanes are used for 6 bit color.
Signed-off-by Jonathan Marek <[email protected]>---
v3: removed empty line and added documentation.../devicetree/bindings/display/msm/mdp4.txt | 2 ++ .../gpu/drm/msm/disp/mdp4/mdp4_lcdc_encoder.c | 21 ++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-)
_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno