Re: [PATCH v2 6/6] drm/tinydrm: Embed the mode in tinydrm_connector
On Tue, Jan 09, 2018 at 09:09:32PM -0600, David Lechner wrote: > On 01/09/2018 08:05 AM, Noralf Trønnes wrote: > > > > Den 09.01.2018 11.08, skrev Daniel Vetter: > > > On Mon, Jan 08, 2018 at 07:46:27PM -0600, David Lechner wrote: > > > > On 01/07/2018 11:44 AM, Noralf Trønnes wrote: > > > > > Embed the mode in tinydrm_connector instead of doing an devm_ > > > > > allocation. > > > > > Remove unnecessary use of ret variable at the end of > > > > > tinydrm_display_pipe_init(). > > > > > > > > > > Signed-off-by: Noralf Trønnes > > > > > --- > > > > Reviewed-by: David Lechner > > > Since you two work together quit a bit, should we add David as drm-misc > > > committer? > > > > I would love that. What do you say David? > > This would mean that you will commit your own work after getting ack/rb. > > Well... I suppose that would be alright. Please request a freedesktop account for the drm-misc group per https://www.freedesktop.org/wiki/AccountRequests/ We use a few scripts to handle technicalities and prevent oopsies: https://01.org/linuxgraphics/gfx-docs/maintainer-tools/dim.html#quickstart For questions just ping Noralf or any of the other drm-misc maintainers/committers - #dri-devel on freenode is a good place. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 04/11] drm/bridge/synopsys: dw-hdmi: Export some PHY related functions
Hi Laurent, Dne torek, 09. januar 2018 ob 17:08:55 CET je Laurent Pinchart napisal(a): > Hello, > > On Tuesday, 9 January 2018 17:58:46 EET Jernej Škrabec wrote: > > Dne torek, 09. januar 2018 ob 11:43:08 CET je Archit Taneja napisal(a): > > > On 12/31/2017 02:31 AM, Jernej Skrabec wrote: > > >> Parts of PHY code could be useful also for custom PHYs. For example, > > >> Allwinner A83T has custom PHY which is probably Synopsys gen2 PHY > > >> with few additional memory mapped registers, so most of the Synopsys > > >> PHY > > >> related code could be reused. > > >> > > >> It turns out that even completely custom HDMI PHYs, such as the one > > >> found in Allwinner H3, can reuse some of those functions. This would > > >> suggest that (some?) functions exported in this commit are actually > > >> part > > >> of generic PHY interface and not really specific to Synopsys PHYs. > > >> > > >> Export useful PHY functions. > > >> > > >> Signed-off-by: Jernej Skrabec > > >> --- > > >> > > >> drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 45 +--- > > >> drivers/gpu/drm/bridge/synopsys/dw-hdmi.h | 2 ++ > > >> include/drm/bridge/dw_hdmi.h | 10 +++ > > >> 3 files changed, 44 insertions(+), 13 deletions(-) > > >> > > >> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c > > >> b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index > > >> 7ca14d7325b5..67467d0b683a 100644 > > >> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c > > >> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c > > [snip] > > > >> @@ -1065,6 +1067,23 @@ static void > > >> dw_hdmi_phy_sel_interface_control(struct dw_hdmi *hdmi, u8 enable) > > >> > > >> HDMI_PHY_CONF0_SELDIPIF_MASK); > > >> > > >> } > > >> > > >> +void dw_hdmi_phy_gen2_reset(struct dw_hdmi *hdmi, u8 enable) > > >> +{ > > >> +hdmi_mask_writeb(hdmi, enable, HDMI_MC_PHYRSTZ, > > >> + HDMI_MC_PHYRSTZ_PHYRSTZ_OFFSET, > > >> + HDMI_MC_PHYRSTZ_PHYRSTZ_MASK); > > >> +} > > >> +EXPORT_SYMBOL_GPL(dw_hdmi_phy_gen2_reset); > > I don't remember the details, is the reset signal Gen2-specific ? According to this comment: /* PHY reset. The reset signal is active high on Gen2 PHYs. */ I would guess that it is not specific to Gen2, otherwise the comment wouldn't be needed. I will remove "gen2" from the name. > > How about asserting and deasserting the reset signal in the same call > instead of having to call this function twice ? It works on A83T if reset signal is asserted and deasserted immediately. I will change function according to your proposal. Best regards, Jernej > > > >> +void dw_hdmi_phy_set_slave_addr(struct dw_hdmi *hdmi) > > >> +{ > > >> +hdmi_phy_test_clear(hdmi, 1); > > >> +hdmi_writeb(hdmi, HDMI_PHY_I2CM_SLAVE_ADDR_PHY_GEN2, > > >> +HDMI_PHY_I2CM_SLAVE_ADDR); > > >> +hdmi_phy_test_clear(hdmi, 0); > > >> +} > > >> +EXPORT_SYMBOL_GPL(dw_hdmi_phy_set_slave_addr); > > > > > > Should this be called dw_hdmi_phy_gen2_set_slave_addr? > > > > Probably. I will rename it in v2 to be consistent with other phy > > functions. > > The I2C write function is called dw_hdmi_phy_i2c_write(). If we want to be > conosistent we should either rename this one to dw_hdmi_phy_i2c_set_addr() > or rename them both to dw_hdmi_phy_gen2_i2c_write() and > dw_hdmi_phy_gen2_i2c_set_addr(). I think I'd prefer the former, and we could > even drop gen2 from dw_hdmi_phy_gen2_pddq() and dw_hdmi_phy_gen2_txpwron() > if desired. > > > > Looks good otherwise. Same for patches 3 and 4 in this series. > > > > > >> + > > >> > > >> static void dw_hdmi_phy_power_off(struct dw_hdmi *hdmi) > > >> { > > >> > > >> const struct dw_hdmi_phy_data *phy = hdmi->phy.data; > > [snip] > > -- > Regards, > > Laurent Pinchart ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v5 6/6] drm/msm: iommu: Replace runtime calls with runtime suppliers
While handling the concerned iommu, there should not be a need to power control the drm devices from iommu interface. If these drm devices need to be powered around this time, the respective drivers should take care of this. Replace the pm_runtime_get/put_sync() with pm_runtime_get/put_suppliers() calls, to power-up the connected iommu through the device link interface. In case the device link is not setup these get/put_suppliers() calls will be a no-op, and the iommu driver should take care of powering on its devices accordingly. Signed-off-by: Vivek Gautam --- * New patch added in this series for client side change for using pm_runtime_get_suppliers() and pm_runtime_put_suppliers(). drivers/gpu/drm/msm/msm_iommu.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_iommu.c b/drivers/gpu/drm/msm/msm_iommu.c index b23d33622f37..1ab629bbee69 100644 --- a/drivers/gpu/drm/msm/msm_iommu.c +++ b/drivers/gpu/drm/msm/msm_iommu.c @@ -40,9 +40,9 @@ static int msm_iommu_attach(struct msm_mmu *mmu, const char * const *names, struct msm_iommu *iommu = to_msm_iommu(mmu); int ret; - pm_runtime_get_sync(mmu->dev); + pm_runtime_get_suppliers(mmu->dev); ret = iommu_attach_device(iommu->domain, mmu->dev); - pm_runtime_put_sync(mmu->dev); + pm_runtime_put_suppliers(mmu->dev); return ret; } @@ -52,9 +52,9 @@ static void msm_iommu_detach(struct msm_mmu *mmu, const char * const *names, { struct msm_iommu *iommu = to_msm_iommu(mmu); - pm_runtime_get_sync(mmu->dev); + pm_runtime_get_suppliers(mmu->dev); iommu_detach_device(iommu->domain, mmu->dev); - pm_runtime_put_sync(mmu->dev); + pm_runtime_put_suppliers(mmu->dev); } static int msm_iommu_map(struct msm_mmu *mmu, uint64_t iova, @@ -63,9 +63,9 @@ static int msm_iommu_map(struct msm_mmu *mmu, uint64_t iova, struct msm_iommu *iommu = to_msm_iommu(mmu); size_t ret; -// pm_runtime_get_sync(mmu->dev); + pm_runtime_get_suppliers(mmu->dev); ret = iommu_map_sg(iommu->domain, iova, sgt->sgl, sgt->nents, prot); -// pm_runtime_put_sync(mmu->dev); + pm_runtime_put_suppliers(mmu->dev); WARN_ON(ret < 0); return (ret == len) ? 0 : -EINVAL; @@ -76,9 +76,9 @@ static int msm_iommu_unmap(struct msm_mmu *mmu, uint64_t iova, { struct msm_iommu *iommu = to_msm_iommu(mmu); - pm_runtime_get_sync(mmu->dev); + pm_runtime_get_suppliers(mmu->dev); iommu_unmap(iommu->domain, iova, len); - pm_runtime_put_sync(mmu->dev); + pm_runtime_put_suppliers(mmu->dev); return 0; } -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v5 2/6] iommu/arm-smmu: Add pm_runtime/sleep ops
From: Sricharan R The smmu needs to be functional only when the respective master's using it are active. The device_link feature helps to track such functional dependencies, so that the iommu gets powered when the master device enables itself using pm_runtime. So by adapting the smmu driver for runtime pm, above said dependency can be addressed. This patch adds the pm runtime/sleep callbacks to the driver and also the functions to parse the smmu clocks from DT and enable them in resume/suspend. Signed-off-by: Sricharan R Signed-off-by: Archit Taneja [vivek: Clock rework to request bulk of clocks] Signed-off-by: Vivek Gautam --- drivers/iommu/arm-smmu.c | 55 ++-- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 78d4c6b8f1ba..21acffe91a1c 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -48,6 +48,7 @@ #include #include #include +#include #include #include @@ -205,6 +206,9 @@ struct arm_smmu_device { u32 num_global_irqs; u32 num_context_irqs; unsigned int*irqs; + struct clk_bulk_data*clocks; + int num_clks; + const char * const *clk_names; u32 cavium_id_base; /* Specific to Cavium */ @@ -1685,6 +1689,25 @@ static int arm_smmu_id_size_to_bits(int size) } } +static int arm_smmu_init_clocks(struct arm_smmu_device *smmu) +{ + int i; + int num = smmu->num_clks; + + if (num < 1) + return 0; + + smmu->clocks = devm_kcalloc(smmu->dev, num, + sizeof(*smmu->clocks), GFP_KERNEL); + if (!smmu->clocks) + return -ENOMEM; + + for (i = 0; i < num; i++) + smmu->clocks[i].id = smmu->clk_names[i]; + + return devm_clk_bulk_get(smmu->dev, num, smmu->clocks); +} + static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu) { unsigned long size; @@ -1897,10 +1920,12 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu) struct arm_smmu_match_data { enum arm_smmu_arch_version version; enum arm_smmu_implementation model; + const char * const *clks; + int num_clks; }; #define ARM_SMMU_MATCH_DATA(name, ver, imp)\ -static struct arm_smmu_match_data name = { .version = ver, .model = imp } +static const struct arm_smmu_match_data name = { .version = ver, .model = imp } ARM_SMMU_MATCH_DATA(smmu_generic_v1, ARM_SMMU_V1, GENERIC_SMMU); ARM_SMMU_MATCH_DATA(smmu_generic_v2, ARM_SMMU_V2, GENERIC_SMMU); @@ -2001,6 +2026,8 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev, data = of_device_get_match_data(dev); smmu->version = data->version; smmu->model = data->model; + smmu->clk_names = data->clks; + smmu->num_clks = data->num_clks; parse_driver_options(smmu); @@ -2099,6 +2126,10 @@ static int arm_smmu_device_probe(struct platform_device *pdev) smmu->irqs[i] = irq; } + err = arm_smmu_init_clocks(smmu); + if (err) + return err; + err = arm_smmu_device_cfg_probe(smmu); if (err) return err; @@ -2197,7 +2228,27 @@ static int __maybe_unused arm_smmu_pm_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(arm_smmu_pm_ops, NULL, arm_smmu_pm_resume); +static int __maybe_unused arm_smmu_runtime_resume(struct device *dev) +{ + struct arm_smmu_device *smmu = dev_get_drvdata(dev); + + return clk_bulk_prepare_enable(smmu->num_clks, smmu->clocks); +} + +static int __maybe_unused arm_smmu_runtime_suspend(struct device *dev) +{ + struct arm_smmu_device *smmu = dev_get_drvdata(dev); + + clk_bulk_disable_unprepare(smmu->num_clks, smmu->clocks); + + return 0; +} + +static const struct dev_pm_ops arm_smmu_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(NULL, arm_smmu_pm_resume) + SET_RUNTIME_PM_OPS(arm_smmu_runtime_suspend, + arm_smmu_runtime_resume, NULL) +}; static struct platform_driver arm_smmu_driver = { .driver = { -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v5 0/6] iommu/arm-smmu: Add runtime pm/sleep support
On 01/09/2018 04:53 PM, Rafael J. Wysocki wrote: On Tuesday, January 9, 2018 11:01:43 AM CET Vivek Gautam wrote: This series provides the support for turning on the arm-smmu's clocks/power domains using runtime pm. This is done using the recently introduced device links patches, which lets the smmu's runtime to follow the master's runtime pm, so the smmu remains powered only when the masters use it. It also adds support for Qcom's arm-smmu-v2 variant that has different clocks and power requirements. Took some reference from the exynos runtime patches [2]. Previous version of the patchset [1]. After much discussion [4] over the use of pm_runtime_get/put() in .unmap op path for the arm-smmu, and after disussing over more than a couple of approaches to address this, we are putting forward the changes *without* using pm_runtime APIs in 'unmap'. Rather, letting the client device take the control of powering on/off the connected iommu through pm_runtime_get(put)_suppliers() APIs for the scnerios when the iommu power can't be directly controlled by clients through device links. Rafael has agreed to export the suppliers APIs [5]. [V5] * Dropped runtime pm calls from "arm_smmu_unmap" op as discussed over the list [4] for the last patch series. * Added a patch to export pm_runtime_get/put_suppliers() APIs to the series as agreed with Rafael [5]. * Added the related patch for msm drm iommu layer to use pm_runtime_get/put_suppliers() APIs in msm_mmu_funcs. * Dropped arm-mmu500 clock patch since that would break existing platforms. * Changed compatible 'qcom,msm8996-smmu-v2' to 'qcom,smmu-v2' to reflect the IP version rather than the platform on which it is used. The same IP is used across multiple platforms including msm8996, and sdm845 etc. * Using clock bulk APIs to handle the clocks available to the IP as suggested by Stephen Boyd. * The first patch in v4 version of the patch-series: ("iommu/arm-smmu: Fix the error path in arm_smmu_add_device") has already made it to mainline. [V4] * Reworked the clock handling part. We now take clock names as data in the driver for supported compatible versions, and loop over them to get, enable, and disable the clocks. * Using qcom,msm8996 based compatibles for bindings instead of a generic qcom compatible. * Refactor MMU500 patch to just add the necessary clock names data and corresponding bindings. * Added the pm_runtime_get/put() calls in .unmap iommu op (fix added by Stanimir on top of previous patch version. * Added a patch to fix error path in arm_smmu_add_device() * Removed patch 3/5 of V3 patch series that added qcom,smmu-v2 bindings. [V3] * Reworked the patches to keep the clocks init/enabling function separately for each compatible. * Added clocks bindings for MMU40x/500. * Added a new compatible for qcom,smmu-v2 implementation and the clock bindings for the same. * Rebased on top of 4.11-rc1 [V2] * Split the patches little differently. * Addressed comments. * Removed the patch #4 [3] from previous post for arm-smmu context save restore. Planning to post this separately after reworking/addressing Robin's feedback. * Reversed the sequence to disable clocks than enabling. This was required for those cases where the clocks are populated in a dependent order from DT. [1] https://www.spinics.net/lists/arm-kernel/msg567488.html [2] https://lkml.org/lkml/2016/10/20/70 [3] https://patchwork.kernel.org/patch/9389717/ [4] https://patchwork.kernel.org/patch/9827825/ [5] https://patchwork.kernel.org/patch/10102445/ Sricharan R (3): iommu/arm-smmu: Add pm_runtime/sleep ops iommu/arm-smmu: Invoke pm_runtime during probe, add/remove device iommu/arm-smmu: Add the device_link between masters and smmu Vivek Gautam (3): base: power: runtime: Export pm_runtime_get/put_suppliers iommu/arm-smmu: Add support for qcom,smmu-v2 variant drm/msm: iommu: Replace runtime calls with runtime suppliers .../devicetree/bindings/iommu/arm,smmu.txt | 35 ++ drivers/base/power/runtime.c | 2 + drivers/gpu/drm/msm/msm_iommu.c| 16 +-- drivers/iommu/arm-smmu.c | 124 - 4 files changed, 163 insertions(+), 14 deletions(-) I need some time to review the series. Sure, thanks Rafael. regards Vivek Thanks, Rafael -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedeskt
[PATCH v7 8/8] drm/rockchip: dw_hdmi: Fix error handling path
From: Jeffy Chen Add missing clk_disable_unprepare() in bind()'s error handling path and unbind(). Also inline clk_prepare_enable() with bind(). Fixes: 12b9f204e804 ("drm: bridge/dw_hdmi: add rockchip rk3288 support") Signed-off-by: Jeffy Chen Signed-off-by: Thierry Escande --- drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c index 791ab938f998..0b2c1a5dd1e6 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c @@ -193,13 +193,6 @@ static int rockchip_hdmi_parse_dt(struct rockchip_hdmi *hdmi) return PTR_ERR(hdmi->grf_clk); } - ret = clk_prepare_enable(hdmi->vpll_clk); - if (ret) { - DRM_DEV_ERROR(hdmi->dev, - "Failed to enable HDMI vpll: %d\n", ret); - return ret; - } - return 0; } @@ -374,6 +367,13 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, return ret; } + ret = clk_prepare_enable(hdmi->vpll_clk); + if (ret) { + DRM_DEV_ERROR(hdmi->dev, "Failed to enable HDMI vpll: %d\n", + ret); + return ret; + } + drm_encoder_helper_add(encoder, &dw_hdmi_rockchip_encoder_helper_funcs); drm_encoder_init(drm, encoder, &dw_hdmi_rockchip_encoder_funcs, DRM_MODE_ENCODER_TMDS, NULL); @@ -381,6 +381,7 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, hdmi->hdmi = dw_hdmi_bind(pdev, encoder, plat_data); if (IS_ERR(hdmi->hdmi)) { encoder->funcs->destroy(encoder); + clk_disable_unprepare(hdmi->vpll_clk); return PTR_ERR(hdmi->hdmi); } @@ -396,6 +397,7 @@ static void dw_hdmi_rockchip_unbind(struct device *dev, struct device *master, dw_hdmi_unbind(hdmi->hdmi); hdmi->encoder.funcs->destroy(&hdmi->encoder); + clk_disable_unprepare(hdmi->vpll_clk); } static const struct component_ops dw_hdmi_rockchip_ops = { -- 2.14.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v7 1/8] drm/bridge: analogix: Do not use device's drvdata
From: Jeffy Chen The driver that instantiates the bridge should own the drvdata, as all driver model callbacks (probe, remove, shutdown, PM ops, etc.) are also owned by its driver struct. Moreover, storing two different pointer types in driver data depending on driver initialization status is barely a good practice and in fact has led to many bugs in this driver. Let's clean up this mess and change Analogix entry points to simply accept some opaque struct pointer, adjusting their users at the same time to avoid breaking the compilation. Signed-off-by: Tomasz Figa Signed-off-by: Jeffy Chen Signed-off-by: Thierry Escande Reviewed-by: Andrzej Hajda Reviewed-by: Sean Paul Acked-by: Jingoo Han Acked-by: Archit Taneja --- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 50 +- drivers/gpu/drm/exynos/exynos_dp.c | 26 ++- drivers/gpu/drm/rockchip/analogix_dp-rockchip.c| 48 - include/drm/bridge/analogix_dp.h | 19 4 files changed, 74 insertions(+), 69 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index a8905049b9da..878f61b65cb2 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -98,17 +98,15 @@ static int analogix_dp_detect_hpd(struct analogix_dp_device *dp) return 0; } -int analogix_dp_psr_supported(struct device *dev) +int analogix_dp_psr_supported(struct analogix_dp_device *dp) { - struct analogix_dp_device *dp = dev_get_drvdata(dev); return dp->psr_support; } EXPORT_SYMBOL_GPL(analogix_dp_psr_supported); -int analogix_dp_enable_psr(struct device *dev) +int analogix_dp_enable_psr(struct analogix_dp_device *dp) { - struct analogix_dp_device *dp = dev_get_drvdata(dev); struct edp_vsc_psr psr_vsc; if (!dp->psr_support) @@ -129,9 +127,8 @@ int analogix_dp_enable_psr(struct device *dev) } EXPORT_SYMBOL_GPL(analogix_dp_enable_psr); -int analogix_dp_disable_psr(struct device *dev) +int analogix_dp_disable_psr(struct analogix_dp_device *dp) { - struct analogix_dp_device *dp = dev_get_drvdata(dev); struct edp_vsc_psr psr_vsc; int ret; @@ -1283,8 +1280,9 @@ static ssize_t analogix_dpaux_transfer(struct drm_dp_aux *aux, return analogix_dp_transfer(dp, msg); } -int analogix_dp_bind(struct device *dev, struct drm_device *drm_dev, -struct analogix_dp_plat_data *plat_data) +struct analogix_dp_device * +analogix_dp_bind(struct device *dev, struct drm_device *drm_dev, +struct analogix_dp_plat_data *plat_data) { struct platform_device *pdev = to_platform_device(dev); struct analogix_dp_device *dp; @@ -1294,14 +1292,12 @@ int analogix_dp_bind(struct device *dev, struct drm_device *drm_dev, if (!plat_data) { dev_err(dev, "Invalided input plat_data\n"); - return -EINVAL; + return ERR_PTR(-EINVAL); } dp = devm_kzalloc(dev, sizeof(struct analogix_dp_device), GFP_KERNEL); if (!dp) - return -ENOMEM; - - dev_set_drvdata(dev, dp); + return ERR_PTR(-ENOMEM); dp->dev = &pdev->dev; dp->dpms_mode = DRM_MODE_DPMS_OFF; @@ -1318,7 +1314,7 @@ int analogix_dp_bind(struct device *dev, struct drm_device *drm_dev, ret = analogix_dp_dt_parse_pdata(dp); if (ret) - return ret; + return ERR_PTR(ret); dp->phy = devm_phy_get(dp->dev, "dp"); if (IS_ERR(dp->phy)) { @@ -1332,14 +1328,14 @@ int analogix_dp_bind(struct device *dev, struct drm_device *drm_dev, if (ret == -ENOSYS || ret == -ENODEV) dp->phy = NULL; else - return ret; + return ERR_PTR(ret); } } dp->clock = devm_clk_get(&pdev->dev, "dp"); if (IS_ERR(dp->clock)) { dev_err(&pdev->dev, "failed to get clock\n"); - return PTR_ERR(dp->clock); + return ERR_CAST(dp->clock); } clk_prepare_enable(dp->clock); @@ -1348,7 +1344,7 @@ int analogix_dp_bind(struct device *dev, struct drm_device *drm_dev, dp->reg_base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(dp->reg_base)) - return PTR_ERR(dp->reg_base); + return ERR_CAST(dp->reg_base); dp->force_hpd = of_property_read_bool(dev->of_node, "force-hpd"); @@ -1369,7 +1365,7 @@ int analogix_dp_bind(struct device *dev, struct drm_device *drm_dev, "hpd_gpio"); if (ret) { dev_err(&pdev->dev, "failed to get hpd gpio\n"); - return ret; +
[PATCH v5 3/6] iommu/arm-smmu: Invoke pm_runtime during probe, add/remove device
From: Sricharan R The smmu device probe/remove and add/remove master device callbacks gets called when the smmu is not linked to its master, that is without the context of the master device. So calling runtime apis in those places separately. Signed-off-by: Sricharan R [vivek: Cleanup pm runtime calls] Signed-off-by: Vivek Gautam --- drivers/iommu/arm-smmu.c | 45 + 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 21acffe91a1c..95478bfb182c 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -914,11 +914,15 @@ static void arm_smmu_destroy_domain_context(struct iommu_domain *domain) struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain); struct arm_smmu_device *smmu = smmu_domain->smmu; struct arm_smmu_cfg *cfg = &smmu_domain->cfg; - int irq; + int ret, irq; if (!smmu || domain->type == IOMMU_DOMAIN_IDENTITY) return; + ret = pm_runtime_get_sync(smmu->dev); + if (ret) + return; + /* * Disable the context bank and free the page tables before freeing * it. @@ -933,6 +937,8 @@ static void arm_smmu_destroy_domain_context(struct iommu_domain *domain) free_io_pgtable_ops(smmu_domain->pgtbl_ops); __arm_smmu_free_bitmap(smmu->context_map, cfg->cbndx); + + pm_runtime_put_sync(smmu->dev); } static struct iommu_domain *arm_smmu_domain_alloc(unsigned type) @@ -1408,12 +1414,20 @@ static int arm_smmu_add_device(struct device *dev) while (i--) cfg->smendx[i] = INVALID_SMENDX; - ret = arm_smmu_master_alloc_smes(dev); + ret = pm_runtime_get_sync(smmu->dev); if (ret) goto out_cfg_free; + ret = arm_smmu_master_alloc_smes(dev); + if (ret) { + pm_runtime_put_sync(smmu->dev); + goto out_cfg_free; + } + iommu_device_link(&smmu->iommu, dev); + pm_runtime_put_sync(smmu->dev); + return 0; out_cfg_free: @@ -1428,7 +1442,7 @@ static void arm_smmu_remove_device(struct device *dev) struct iommu_fwspec *fwspec = dev->iommu_fwspec; struct arm_smmu_master_cfg *cfg; struct arm_smmu_device *smmu; - + int ret; if (!fwspec || fwspec->ops != &arm_smmu_ops) return; @@ -1436,8 +1450,21 @@ static void arm_smmu_remove_device(struct device *dev) cfg = fwspec->iommu_priv; smmu = cfg->smmu; + /* +* The device link between the master device and +* smmu is already purged at this point. +* So enable the power to smmu explicitly. +*/ + + ret = pm_runtime_get_sync(smmu->dev); + if (ret) + return; + iommu_device_unlink(&smmu->iommu, dev); arm_smmu_master_free_smes(fwspec); + + pm_runtime_put_sync(smmu->dev); + iommu_group_remove_device(dev); kfree(fwspec->iommu_priv); iommu_fwspec_free(dev); @@ -2130,6 +2157,14 @@ static int arm_smmu_device_probe(struct platform_device *pdev) if (err) return err; + platform_set_drvdata(pdev, smmu); + + pm_runtime_enable(dev); + + err = pm_runtime_get_sync(dev); + if (err) + return err; + err = arm_smmu_device_cfg_probe(smmu); if (err) return err; @@ -2171,9 +2206,9 @@ static int arm_smmu_device_probe(struct platform_device *pdev) return err; } - platform_set_drvdata(pdev, smmu); arm_smmu_device_reset(smmu); arm_smmu_test_smr_masks(smmu); + pm_runtime_put_sync(dev); /* * For ACPI and generic DT bindings, an SMMU will be probed before @@ -2212,6 +2247,8 @@ static int arm_smmu_device_remove(struct platform_device *pdev) /* Turn the thing off */ writel(sCR0_CLIENTPD, ARM_SMMU_GR0_NS(smmu) + ARM_SMMU_GR0_sCR0); + pm_runtime_force_suspend(smmu->dev); + return 0; } -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v7 6/8] drm/bridge/synopsys: dw-hdmi: Add missing bridge detach
From: Jeffy Chen We inited connector in attach(), so need a detach() to cleanup. Also fix wrong use of dw_hdmi_remove() in bind(). Signed-off-by: Jeffy Chen Signed-off-by: Thierry Escande --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index a38db40ce990..1cc63a18b7d5 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -1967,6 +1967,13 @@ static int dw_hdmi_bridge_attach(struct drm_bridge *bridge) return 0; } +static void dw_hdmi_bridge_detach(struct drm_bridge *bridge) +{ + struct dw_hdmi *hdmi = bridge->driver_private; + + drm_connector_cleanup(&hdmi->connector); +} + static enum drm_mode_status dw_hdmi_bridge_mode_valid(struct drm_bridge *bridge, const struct drm_display_mode *mode) @@ -2023,6 +2030,7 @@ static void dw_hdmi_bridge_enable(struct drm_bridge *bridge) static const struct drm_bridge_funcs dw_hdmi_bridge_funcs = { .attach = dw_hdmi_bridge_attach, + .detach = dw_hdmi_bridge_detach, .enable = dw_hdmi_bridge_enable, .disable = dw_hdmi_bridge_disable, .mode_set = dw_hdmi_bridge_mode_set, @@ -2616,7 +2624,7 @@ int dw_hdmi_bind(struct platform_device *pdev, struct drm_encoder *encoder, ret = drm_bridge_attach(encoder, &hdmi->bridge, NULL); if (ret) { - dw_hdmi_remove(pdev); + __dw_hdmi_remove(hdmi); DRM_ERROR("Failed to initialize bridge with drm\n"); return ret; } -- 2.14.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v7 5/8] drm/rockchip: inno_hdmi: Fix error handling path
From: Jeffy Chen Add missing error handling in bind(). Fixes: 412d4ae6b7a5 ("drm/rockchip: hdmi: add Innosilicon HDMI support") Signed-off-by: Jeffy Chen Signed-off-by: Thierry Escande --- drivers/gpu/drm/rockchip/inno_hdmi.c | 22 +- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index fab30927a889..b775283d7363 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -852,8 +852,10 @@ static int inno_hdmi_bind(struct device *dev, struct device *master, } irq = platform_get_irq(pdev, 0); - if (irq < 0) - return irq; + if (irq < 0) { + ret = irq; + goto err_disable_clk; + } inno_hdmi_reset(hdmi); @@ -861,7 +863,7 @@ static int inno_hdmi_bind(struct device *dev, struct device *master, if (IS_ERR(hdmi->ddc)) { ret = PTR_ERR(hdmi->ddc); hdmi->ddc = NULL; - return ret; + goto err_disable_clk; } /* @@ -875,7 +877,7 @@ static int inno_hdmi_bind(struct device *dev, struct device *master, ret = inno_hdmi_register(drm, hdmi); if (ret) - return ret; + goto err_put_adapter; dev_set_drvdata(dev, hdmi); @@ -885,7 +887,17 @@ static int inno_hdmi_bind(struct device *dev, struct device *master, ret = devm_request_threaded_irq(dev, irq, inno_hdmi_hardirq, inno_hdmi_irq, IRQF_SHARED, dev_name(dev), hdmi); + if (ret < 0) + goto err_cleanup_hdmi; + return 0; +err_cleanup_hdmi: + hdmi->connector.funcs->destroy(&hdmi->connector); + hdmi->encoder.funcs->destroy(&hdmi->encoder); +err_put_adapter: + i2c_put_adapter(hdmi->ddc); +err_disable_clk: + clk_disable_unprepare(hdmi->pclk); return ret; } @@ -897,8 +909,8 @@ static void inno_hdmi_unbind(struct device *dev, struct device *master, hdmi->connector.funcs->destroy(&hdmi->connector); hdmi->encoder.funcs->destroy(&hdmi->encoder); - clk_disable_unprepare(hdmi->pclk); i2c_put_adapter(hdmi->ddc); + clk_disable_unprepare(hdmi->pclk); } static const struct component_ops inno_hdmi_ops = { -- 2.14.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v5 0/6] iommu/arm-smmu: Add runtime pm/sleep support
This series provides the support for turning on the arm-smmu's clocks/power domains using runtime pm. This is done using the recently introduced device links patches, which lets the smmu's runtime to follow the master's runtime pm, so the smmu remains powered only when the masters use it. It also adds support for Qcom's arm-smmu-v2 variant that has different clocks and power requirements. Took some reference from the exynos runtime patches [2]. Previous version of the patchset [1]. After much discussion [4] over the use of pm_runtime_get/put() in .unmap op path for the arm-smmu, and after disussing over more than a couple of approaches to address this, we are putting forward the changes *without* using pm_runtime APIs in 'unmap'. Rather, letting the client device take the control of powering on/off the connected iommu through pm_runtime_get(put)_suppliers() APIs for the scnerios when the iommu power can't be directly controlled by clients through device links. Rafael has agreed to export the suppliers APIs [5]. [V5] * Dropped runtime pm calls from "arm_smmu_unmap" op as discussed over the list [4] for the last patch series. * Added a patch to export pm_runtime_get/put_suppliers() APIs to the series as agreed with Rafael [5]. * Added the related patch for msm drm iommu layer to use pm_runtime_get/put_suppliers() APIs in msm_mmu_funcs. * Dropped arm-mmu500 clock patch since that would break existing platforms. * Changed compatible 'qcom,msm8996-smmu-v2' to 'qcom,smmu-v2' to reflect the IP version rather than the platform on which it is used. The same IP is used across multiple platforms including msm8996, and sdm845 etc. * Using clock bulk APIs to handle the clocks available to the IP as suggested by Stephen Boyd. * The first patch in v4 version of the patch-series: ("iommu/arm-smmu: Fix the error path in arm_smmu_add_device") has already made it to mainline. [V4] * Reworked the clock handling part. We now take clock names as data in the driver for supported compatible versions, and loop over them to get, enable, and disable the clocks. * Using qcom,msm8996 based compatibles for bindings instead of a generic qcom compatible. * Refactor MMU500 patch to just add the necessary clock names data and corresponding bindings. * Added the pm_runtime_get/put() calls in .unmap iommu op (fix added by Stanimir on top of previous patch version. * Added a patch to fix error path in arm_smmu_add_device() * Removed patch 3/5 of V3 patch series that added qcom,smmu-v2 bindings. [V3] * Reworked the patches to keep the clocks init/enabling function separately for each compatible. * Added clocks bindings for MMU40x/500. * Added a new compatible for qcom,smmu-v2 implementation and the clock bindings for the same. * Rebased on top of 4.11-rc1 [V2] * Split the patches little differently. * Addressed comments. * Removed the patch #4 [3] from previous post for arm-smmu context save restore. Planning to post this separately after reworking/addressing Robin's feedback. * Reversed the sequence to disable clocks than enabling. This was required for those cases where the clocks are populated in a dependent order from DT. [1] https://www.spinics.net/lists/arm-kernel/msg567488.html [2] https://lkml.org/lkml/2016/10/20/70 [3] https://patchwork.kernel.org/patch/9389717/ [4] https://patchwork.kernel.org/patch/9827825/ [5] https://patchwork.kernel.org/patch/10102445/ Sricharan R (3): iommu/arm-smmu: Add pm_runtime/sleep ops iommu/arm-smmu: Invoke pm_runtime during probe, add/remove device iommu/arm-smmu: Add the device_link between masters and smmu Vivek Gautam (3): base: power: runtime: Export pm_runtime_get/put_suppliers iommu/arm-smmu: Add support for qcom,smmu-v2 variant drm/msm: iommu: Replace runtime calls with runtime suppliers .../devicetree/bindings/iommu/arm,smmu.txt | 35 ++ drivers/base/power/runtime.c | 2 + drivers/gpu/drm/msm/msm_iommu.c| 16 +-- drivers/iommu/arm-smmu.c | 124 - 4 files changed, 163 insertions(+), 14 deletions(-) -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v7 3/8] drm/rockchip: analogix_dp: Add a sanity check for rockchip_drm_psr_register()
From: Jeffy Chen The rockchip_drm_psr_register() can fail, so add a sanity check for that. Also reorder the calls in unbind() to match bind(). Signed-off-by: Jeffy Chen Signed-off-by: Thierry Escande --- drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c index 37250ab63bd7..eb88c52336a7 100644 --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c @@ -354,15 +354,22 @@ static int rockchip_dp_bind(struct device *dev, struct device *master, dp->psr_state = ~EDP_VSC_PSR_STATE_ACTIVE; INIT_WORK(&dp->psr_work, analogix_dp_psr_work); - rockchip_drm_psr_register(&dp->encoder, analogix_dp_psr_set); + ret = rockchip_drm_psr_register(&dp->encoder, analogix_dp_psr_set); + if (ret < 0) + goto err_cleanup_encoder; dp->adp = analogix_dp_bind(dev, dp->drm_dev, &dp->plat_data); if (IS_ERR(dp->adp)) { - dp->encoder.funcs->destroy(&dp->encoder); - return PTR_ERR(dp->adp); + ret = PTR_ERR(dp->adp); + goto err_unreg_psr; } return 0; +err_unreg_psr: + rockchip_drm_psr_unregister(&dp->encoder); +err_cleanup_encoder: + dp->encoder.funcs->destroy(&dp->encoder); + return ret; } static void rockchip_dp_unbind(struct device *dev, struct device *master, @@ -370,8 +377,8 @@ static void rockchip_dp_unbind(struct device *dev, struct device *master, { struct rockchip_dp_device *dp = dev_get_drvdata(dev); - rockchip_drm_psr_unregister(&dp->encoder); analogix_dp_unbind(dp->adp); + rockchip_drm_psr_unregister(&dp->encoder); dp->encoder.funcs->destroy(&dp->encoder); } -- 2.14.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v6 4/9] drm: Add some HDCP related #defines
Sean, On Mon, Jan 8, 2018 at 8:55 PM, Sean Paul wrote: > In preparation for implementing HDCP in i915, add some HDCP related > register offsets and defines. The dpcd register offsets will go in > drm_dp_helper.h whereas the ddc offsets along with generic HDCP stuff > will get stuffed in drm_hdcp.h, which is new. > > Changes in v2: > - drm_hdcp.h gets MIT license (Daniel) > Changes in v3: > - None > Changes in v4: > - None > Changes in v5: > - None > Changes in v6: > - SPDX license > > Cc: Daniel Vetter > Reviewed-by: Ramalingam C > Signed-off-by: Sean Paul > --- /dev/null > +++ b/include/drm/drm_hdcp.h > @@ -0,0 +1,39 @@ > +/* SPDX-License-Identifier: MIT */ > +/* > + * Copyright (C) 2017 Google, Inc. > + * > + * Authors: > + * Sean Paul > + */ Thank you++ for using the SPDX tags! Acked-by: Philippe Ombredanne -- Cordially Philippe Ombredanne ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v7 00/10] rockchip: kevin: Enable edp display
Hi, This patchset makes edp display work on Chromebook kevin. This patchset has been originally posted by Jeffy Chen and the 2 first commits from the previous version (v6) are already merged in mainline. This v7 has been rebased on top of next-20180108 and a few conflicts have been fixed as well. v7: Rebased on top of next-20180108 and fixed conflicts Fixed a few warnings reported by checkpatch Jeffy Chen (10): arm64: dts: rockchip: Enable edp disaplay on kevin drm/rockchip: analogix_dp: Remove unnecessary init code drm/bridge: analogix: Do not use device's drvdata drm/bridge: analogix_dp: Fix connector and encoder cleanup drm/rockchip: analogix_dp: Add a sanity check for rockchip_drm_psr_register() drm/rockchip: dw-mipi-dsi: Fix error handling path drm/rockchip: inno_hdmi: Fix error handling path drm/bridge/synopsys: dw-hdmi: Add missing bridge detach drm/bridge/synopsys: dw-hdmi: Do not use device's drvdata drm/rockchip: dw_hdmi: Fix error handling path arch/arm64/boot/dts/rockchip/rk3399-gru-kevin.dts | 29 +++ arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi | 16 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 52 +--- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 53 ++-- drivers/gpu/drm/exynos/exynos_dp.c | 29 --- drivers/gpu/drm/imx/dw_hdmi-imx.c | 22 +++-- drivers/gpu/drm/meson/meson_dw_hdmi.c | 20 +++-- drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c | 14 +++- drivers/gpu/drm/rockchip/analogix_dp-rockchip.c| 95 +++--- drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 21 +++-- drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c| 39 + drivers/gpu/drm/rockchip/inno_hdmi.c | 22 +++-- include/drm/bridge/analogix_dp.h | 19 +++-- include/drm/bridge/dw_hdmi.h | 17 ++-- 14 files changed, 265 insertions(+), 183 deletions(-) -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v5 4/6] iommu/arm-smmu: Add the device_link between masters and smmu
From: Sricharan R Finally add the device link between the master device and smmu, so that the smmu gets runtime enabled/disabled only when the master needs it. This is done from add_device callback which gets called once when the master is added to the smmu. Signed-off-by: Sricharan R --- drivers/iommu/arm-smmu.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 95478bfb182c..33bbcfedb896 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -1367,6 +1367,7 @@ static int arm_smmu_add_device(struct device *dev) struct arm_smmu_device *smmu; struct arm_smmu_master_cfg *cfg; struct iommu_fwspec *fwspec = dev->iommu_fwspec; + struct device_link *link; int i, ret; if (using_legacy_binding) { @@ -1428,6 +1429,16 @@ static int arm_smmu_add_device(struct device *dev) pm_runtime_put_sync(smmu->dev); + /* +* Establish the link between smmu and master, so that the +* smmu gets runtime enabled/disabled as per the master's +* needs. +*/ + link = device_link_add(dev, smmu->dev, DL_FLAG_PM_RUNTIME); + if (!link) + dev_warn(smmu->dev, "Unable to create device link between %s and %s\n", +dev_name(smmu->dev), dev_name(dev)); + return 0; out_cfg_free: -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 04/11] drm/bridge/synopsys: dw-hdmi: Export some PHY related functions
Hi, Dne torek, 09. januar 2018 ob 17:08:55 CET je Laurent Pinchart napisal(a): > Hello, > > On Tuesday, 9 January 2018 17:58:46 EET Jernej Škrabec wrote: > > Dne torek, 09. januar 2018 ob 11:43:08 CET je Archit Taneja napisal(a): > > > On 12/31/2017 02:31 AM, Jernej Skrabec wrote: > > >> Parts of PHY code could be useful also for custom PHYs. For example, > > >> Allwinner A83T has custom PHY which is probably Synopsys gen2 PHY > > >> with few additional memory mapped registers, so most of the Synopsys > > >> PHY > > >> related code could be reused. > > >> > > >> It turns out that even completely custom HDMI PHYs, such as the one > > >> found in Allwinner H3, can reuse some of those functions. This would > > >> suggest that (some?) functions exported in this commit are actually > > >> part > > >> of generic PHY interface and not really specific to Synopsys PHYs. > > >> > > >> Export useful PHY functions. > > >> > > >> Signed-off-by: Jernej Skrabec > > >> --- > > >> > > >> drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 45 +--- > > >> drivers/gpu/drm/bridge/synopsys/dw-hdmi.h | 2 ++ > > >> include/drm/bridge/dw_hdmi.h | 10 +++ > > >> 3 files changed, 44 insertions(+), 13 deletions(-) > > >> > > >> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c > > >> b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index > > >> 7ca14d7325b5..67467d0b683a 100644 > > >> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c > > >> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c > > [snip] > > > >> @@ -1065,6 +1067,23 @@ static void > > >> dw_hdmi_phy_sel_interface_control(struct dw_hdmi *hdmi, u8 enable) > > >> > > >> HDMI_PHY_CONF0_SELDIPIF_MASK); > > >> > > >> } > > >> > > >> +void dw_hdmi_phy_gen2_reset(struct dw_hdmi *hdmi, u8 enable) > > >> +{ > > >> +hdmi_mask_writeb(hdmi, enable, HDMI_MC_PHYRSTZ, > > >> + HDMI_MC_PHYRSTZ_PHYRSTZ_OFFSET, > > >> + HDMI_MC_PHYRSTZ_PHYRSTZ_MASK); > > >> +} > > >> +EXPORT_SYMBOL_GPL(dw_hdmi_phy_gen2_reset); > > I don't remember the details, is the reset signal Gen2-specific ? I don't know, since there is not much documentation. Should I remove "gen2" from the name? > > How about asserting and deasserting the reset signal in the same call > instead of having to call this function twice ? A83T BSP driver clears txpwron and sets pddq between asserting and deasserting reset. I'll test if it works with your proposal. > > > >> +void dw_hdmi_phy_set_slave_addr(struct dw_hdmi *hdmi) > > >> +{ > > >> +hdmi_phy_test_clear(hdmi, 1); > > >> +hdmi_writeb(hdmi, HDMI_PHY_I2CM_SLAVE_ADDR_PHY_GEN2, > > >> +HDMI_PHY_I2CM_SLAVE_ADDR); > > >> +hdmi_phy_test_clear(hdmi, 0); > > >> +} > > >> +EXPORT_SYMBOL_GPL(dw_hdmi_phy_set_slave_addr); > > > > > > Should this be called dw_hdmi_phy_gen2_set_slave_addr? > > > > Probably. I will rename it in v2 to be consistent with other phy > > functions. > > The I2C write function is called dw_hdmi_phy_i2c_write(). If we want to be > conosistent we should either rename this one to dw_hdmi_phy_i2c_set_addr() > or rename them both to dw_hdmi_phy_gen2_i2c_write() and > dw_hdmi_phy_gen2_i2c_set_addr(). I think I'd prefer the former, and we could > even drop gen2 from dw_hdmi_phy_gen2_pddq() and dw_hdmi_phy_gen2_txpwron() > if desired. Ok, then I'll name it dw_hdmi_phy_i2c_set_addr(). I'll leave other names as they are. Best regards, Jernej > > > > Looks good otherwise. Same for patches 3 and 4 in this series. > > > > > >> + > > >> > > >> static void dw_hdmi_phy_power_off(struct dw_hdmi *hdmi) > > >> { > > >> > > >> const struct dw_hdmi_phy_data *phy = hdmi->phy.data; > > [snip] > > -- > Regards, > > Laurent Pinchart ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 04/11] drm/bridge/synopsys: dw-hdmi: Export some PHY related functions
Hi Archit, Dne torek, 09. januar 2018 ob 11:43:08 CET je Archit Taneja napisal(a): > On 12/31/2017 02:31 AM, Jernej Skrabec wrote: > > Parts of PHY code could be useful also for custom PHYs. For example, > > Allwinner A83T has custom PHY which is probably Synopsys gen2 PHY > > with few additional memory mapped registers, so most of the Synopsys PHY > > related code could be reused. > > > > It turns out that even completely custom HDMI PHYs, such as the one > > found in Allwinner H3, can reuse some of those functions. This would > > suggest that (some?) functions exported in this commit are actually part > > of generic PHY interface and not really specific to Synopsys PHYs. > > > > Export useful PHY functions. > > > > Signed-off-by: Jernej Skrabec > > --- > > > > drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 45 > > ++- > > drivers/gpu/drm/bridge/synopsys/dw-hdmi.h | 2 ++ > > include/drm/bridge/dw_hdmi.h | 10 +++ > > 3 files changed, 44 insertions(+), 13 deletions(-) > > > > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c > > b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index > > 7ca14d7325b5..67467d0b683a 100644 > > --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c > > +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c > > @@ -1037,19 +1037,21 @@ static void dw_hdmi_phy_enable_svsret(struct > > dw_hdmi *hdmi, u8 enable)> > > HDMI_PHY_CONF0_SVSRET_MASK); > > > > } > > > > -static void dw_hdmi_phy_gen2_pddq(struct dw_hdmi *hdmi, u8 enable) > > +void dw_hdmi_phy_gen2_pddq(struct dw_hdmi *hdmi, u8 enable) > > > > { > > > > hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0, > > > > HDMI_PHY_CONF0_GEN2_PDDQ_OFFSET, > > HDMI_PHY_CONF0_GEN2_PDDQ_MASK); > > > > } > > > > +EXPORT_SYMBOL_GPL(dw_hdmi_phy_gen2_pddq); > > > > -static void dw_hdmi_phy_gen2_txpwron(struct dw_hdmi *hdmi, u8 enable) > > +void dw_hdmi_phy_gen2_txpwron(struct dw_hdmi *hdmi, u8 enable) > > > > { > > > > hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0, > > > > HDMI_PHY_CONF0_GEN2_TXPWRON_OFFSET, > > HDMI_PHY_CONF0_GEN2_TXPWRON_MASK); > > > > } > > > > +EXPORT_SYMBOL_GPL(dw_hdmi_phy_gen2_txpwron); > > > > static void dw_hdmi_phy_sel_data_en_pol(struct dw_hdmi *hdmi, u8 enable) > > { > > > > @@ -1065,6 +1067,23 @@ static void > > dw_hdmi_phy_sel_interface_control(struct dw_hdmi *hdmi, u8 enable)> > > HDMI_PHY_CONF0_SELDIPIF_MASK); > > > > } > > > > +void dw_hdmi_phy_gen2_reset(struct dw_hdmi *hdmi, u8 enable) > > +{ > > + hdmi_mask_writeb(hdmi, enable, HDMI_MC_PHYRSTZ, > > +HDMI_MC_PHYRSTZ_PHYRSTZ_OFFSET, > > +HDMI_MC_PHYRSTZ_PHYRSTZ_MASK); > > +} > > +EXPORT_SYMBOL_GPL(dw_hdmi_phy_gen2_reset); > > + > > +void dw_hdmi_phy_set_slave_addr(struct dw_hdmi *hdmi) > > +{ > > + hdmi_phy_test_clear(hdmi, 1); > > + hdmi_writeb(hdmi, HDMI_PHY_I2CM_SLAVE_ADDR_PHY_GEN2, > > + HDMI_PHY_I2CM_SLAVE_ADDR); > > + hdmi_phy_test_clear(hdmi, 0); > > +} > > +EXPORT_SYMBOL_GPL(dw_hdmi_phy_set_slave_addr); > > Should this be called dw_hdmi_phy_gen2_set_slave_addr? Probably. I will rename it in v2 to be consistent with other phy functions. Best regards, Jernej > > Looks good otherwise. Same for patches 3 and 4 in this series. > > Thanks, > Archit > > > + > > > > static void dw_hdmi_phy_power_off(struct dw_hdmi *hdmi) > > { > > > > const struct dw_hdmi_phy_data *phy = hdmi->phy.data; > > > > @@ -1204,15 +1223,12 @@ static int hdmi_phy_configure(struct dw_hdmi > > *hdmi) > > > > dw_hdmi_phy_enable_svsret(hdmi, 1); > > > > /* PHY reset. The reset signal is active high on Gen2 PHYs. */ > > > > - hdmi_writeb(hdmi, HDMI_MC_PHYRSTZ_PHYRSTZ, HDMI_MC_PHYRSTZ); > > - hdmi_writeb(hdmi, 0, HDMI_MC_PHYRSTZ); > > + dw_hdmi_phy_gen2_reset(hdmi, 1); > > + dw_hdmi_phy_gen2_reset(hdmi, 0); > > > > hdmi_writeb(hdmi, HDMI_MC_HEACPHY_RST_ASSERT, HDMI_MC_HEACPHY_RST); > > > > - hdmi_phy_test_clear(hdmi, 1); > > - hdmi_writeb(hdmi, HDMI_PHY_I2CM_SLAVE_ADDR_PHY_GEN2, > > - HDMI_PHY_I2CM_SLAVE_ADDR); > > - hdmi_phy_test_clear(hdmi, 0); > > + dw_hdmi_phy_set_slave_addr(hdmi); > > > > /* Write to the PHY as configured by the platform */ > > if (pdata->configure_phy) > > > > @@ -1251,15 +1267,16 @@ static void dw_hdmi_phy_disable(struct dw_hdmi > > *hdmi, void *data)> > > dw_hdmi_phy_power_off(hdmi); > > > > } > > > > -static enum drm_connector_status dw_hdmi_phy_read_hpd(struct dw_hdmi > > *hdmi, - void *data) > > +enum drm_connector_status dw_hdmi_phy_read_hpd(struct dw_hdmi *hdmi, > > + void *data) > > > > { > > > > return hdmi_readb(hdmi, HDMI_PHY_STAT0) & HDMI_PHY_HPD ? > > > > c
Re: [linux-sunxi] Re: [PATCH 01/11] clk: sunxi-ng: Don't set k if width is 0 for nkmp plls
Hi Chen-Yu, Dne ponedeljek, 08. januar 2018 ob 10:19:47 CET je Chen-Yu Tsai napisal(a): > On Fri, Jan 5, 2018 at 3:28 AM, Jernej Škrabec wrote: > > Hi, > > > > Dne četrtek, 04. januar 2018 ob 15:45:18 CET je Chen-Yu Tsai napisal(a): > >> On Sun, Dec 31, 2017 at 5:01 AM, Jernej Skrabec > > > > wrote: > >> > For example, A83T have nmp plls which are modelled as nkmp plls. Since > >> > k > >> > is not specified, it has offset 0, shift 0 and lowest value 1. This > >> > means that LSB bit is always set to 1, which may change clock rate. > >> > > >> > Fix that by applying k factor only if k width is greater than 0. > >> > > >> > Signed-off-by: Jernej Skrabec > >> > --- > >> > > >> > drivers/clk/sunxi-ng/ccu_nkmp.c | 21 + > >> > 1 file changed, 13 insertions(+), 8 deletions(-) > >> > > >> > diff --git a/drivers/clk/sunxi-ng/ccu_nkmp.c > >> > b/drivers/clk/sunxi-ng/ccu_nkmp.c index e58c95787f94..709f528af2b3 > >> > 100644 > >> > --- a/drivers/clk/sunxi-ng/ccu_nkmp.c > >> > +++ b/drivers/clk/sunxi-ng/ccu_nkmp.c > >> > @@ -81,7 +81,7 @@ static unsigned long ccu_nkmp_recalc_rate(struct > >> > clk_hw > >> > *hw,> > >> > > >> > unsigned long parent_rate) > >> > > >> > { > >> > > >> > struct ccu_nkmp *nkmp = hw_to_ccu_nkmp(hw); > >> > > >> > - unsigned long n, m, k, p; > >> > + unsigned long n, m, k = 1, p; > >> > > >> > u32 reg; > >> > > >> > reg = readl(nkmp->common.base + nkmp->common.reg); > >> > > >> > @@ -92,11 +92,13 @@ static unsigned long ccu_nkmp_recalc_rate(struct > >> > clk_hw *hw,> > >> > > >> > if (!n) > >> > > >> > n++; > >> > > >> > - k = reg >> nkmp->k.shift; > >> > - k &= (1 << nkmp->k.width) - 1; > >> > - k += nkmp->k.offset; > >> > - if (!k) > >> > - k++; > >> > + if (nkmp->k.width) { > >> > + k = reg >> nkmp->k.shift; > >> > + k &= (1 << nkmp->k.width) - 1; > >> > + k += nkmp->k.offset; > >> > + if (!k) > >> > + k++; > >> > + } > >> > >> The conditional shouldn't be necessary. With nkmp->k.width = 0, > >> you'd simply get k & 0, which is 0, which then gets bumped up to 1, > >> unless k.offset > 1, which would be a bug. > >> > >> > m = reg >> nkmp->m.shift; > >> > m &= (1 << nkmp->m.width) - 1; > >> > > >> > @@ -153,12 +155,15 @@ static int ccu_nkmp_set_rate(struct clk_hw *hw, > >> > unsigned long rate,> > >> > > >> > reg = readl(nkmp->common.base + nkmp->common.reg); > >> > reg &= ~GENMASK(nkmp->n.width + nkmp->n.shift - 1, > >> > nkmp->n.shift); > >> > > >> > - reg &= ~GENMASK(nkmp->k.width + nkmp->k.shift - 1, > >> > nkmp->k.shift); > >> > + if (nkmp->k.width) > >> > + reg &= ~GENMASK(nkmp->k.width + nkmp->k.shift - 1, > >> > + nkmp->k.shift); > >> > > >> > reg &= ~GENMASK(nkmp->m.width + nkmp->m.shift - 1, > >> > nkmp->m.shift); > >> > reg &= ~GENMASK(nkmp->p.width + nkmp->p.shift - 1, > >> > nkmp->p.shift); > >> > > >> > reg |= (_nkmp.n - nkmp->n.offset) << nkmp->n.shift; > >> > > >> > - reg |= (_nkmp.k - nkmp->k.offset) << nkmp->k.shift; > >> > + if (nkmp->k.width) > >> > + reg |= (_nkmp.k - nkmp->k.offset) << nkmp->k.shift; > >> > >> I think a better way would be > >> > >> reg |= ((_nkmp.k - nkmp->k.offset) << nkmp->k.shift) & > >> > >>GENMASK(nkmp->k.width + nkmp->k.shift - 1, nkmp->k.shift); > >> > >> And do this for all the factors, not just k. This pattern is what > >> regmap_update_bits does, which seems much safer. I wonder what > >> GENMASK() with a negative value would do though... > > > > You're right, GENMASK(-1, 0) equals 0 (calculated by hand, not tested). > > This seems much more elegant solution. > > > > Semi-related question: All nmp PLLs have much wider N range than real nkmp > > PLLs. This causes integer overflow when using nkmp formula from datasheet. > > Usually, N is 1-256 for nmp PLLs, which means that for very high N > > factors, it overflows. This also causes issue that M factor is never > > higher than 1. > Sounds like we can't use u8 for storing the factors. At least the > intermediate values we use to calculate the rates. Only issue with u8 could be max field in struct ccu_mult_internal for K factor. But since it's not used, there is no issue. All intermediate variables in ccu_nkmp are wider. > > > I was wondering, if patch would be acceptable which would change this > > formula: > > > > RATE = (24MHz * N * K) / (M * P) > > > > to this: > > > > RATE ((24MHz / M) * N * K) / P > > > > I checked all M factors and are all in 1-4 or 1-2 range, which means it > > wouldn't have any impact for real nkmp PLLs when parent is 24 MHz clock > > which is probably always. > >
[PATCH v5 1/6] base: power: runtime: Export pm_runtime_get/put_suppliers
The device link allows the pm framework to tie the supplier and consumer. So, whenever the consumer is powered-on the supplier is powered-on first. There are however cases in which the consumer wants to power-on the supplier, but not itself. E.g., A Graphics or multimedia driver wants to power-on the SMMU to unmap a buffer and finish the TLB operations without powering on itself. Some of these unmap requests are coming from the user space when the controller itself is not powered-up, and it can be huge penalty in terms of power and latency to power-up the graphics/mm controllers. There can be an argument that the supplier should handle this case on its own and there should not be a need for the consumer to power-on the supplier. But as discussed on the thread [1] about ARM-SMMU runtime pm, we don't want to introduce runtime pm calls in atomic path in arm_smmu_unmap. [1] https://patchwork.kernel.org/patch/9827825/ Signed-off-by: Vivek Gautam --- * This is v2 of the patch [1]. Adding it to this patch series. [1] https://patchwork.kernel.org/patch/10102447/ drivers/base/power/runtime.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 6e89b51ea3d9..06a2a88fe866 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c @@ -1579,6 +1579,7 @@ void pm_runtime_get_suppliers(struct device *dev) device_links_read_unlock(idx); } +EXPORT_SYMBOL_GPL(pm_runtime_get_suppliers); /** * pm_runtime_put_suppliers - Drop references to supplier devices. @@ -1597,6 +1598,7 @@ void pm_runtime_put_suppliers(struct device *dev) device_links_read_unlock(idx); } +EXPORT_SYMBOL_GPL(pm_runtime_put_suppliers); void pm_runtime_new_link(struct device *dev) { -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v5 5/6] iommu/arm-smmu: Add support for qcom,smmu-v2 variant
qcom,smmu-v2 is an arm,smmu-v2 implementation with specific clock and power requirements. This smmu core is used with multiple masters on msm8996, viz. mdss, video, etc. Add bindings for the same. Signed-off-by: Vivek Gautam --- * Major change in this patch - Changed compatible string from 'qcom,msm8996-smmu-v2' to 'qcom,smmu-v2' to reflect the IP version rather than the platform on which it is used. The same IP is used across multiple platforms including msm8996, and sdm845 etc. .../devicetree/bindings/iommu/arm,smmu.txt | 35 ++ drivers/iommu/arm-smmu.c | 13 2 files changed, 48 insertions(+) diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.txt b/Documentation/devicetree/bindings/iommu/arm,smmu.txt index 8a6ffce12af5..e4951288c87c 100644 --- a/Documentation/devicetree/bindings/iommu/arm,smmu.txt +++ b/Documentation/devicetree/bindings/iommu/arm,smmu.txt @@ -17,6 +17,7 @@ conditions. "arm,mmu-401" "arm,mmu-500" "cavium,smmu-v2" +"qcom,smmu-v2" depending on the particular implementation and/or the version of the architecture implemented. @@ -71,6 +72,23 @@ conditions. or using stream matching with #iommu-cells = <2>, and may be ignored if present in such cases. +- clock-names:Should be "bus", and "iface" for "qcom,smmu-v2" + implementation. + + "bus" clock for "qcom,smmu-v2" is required for downstream + bus access and for the smmu ptw. + + "iface" clock is required to access smmu's registers through + the TCU's programming interface. + +- clocks: Phandles for respective clocks described by clock-names. + +- power-domains: Phandles to SMMU's power domain specifier. This is + required even if SMMU belongs to the master's power + domain, as the SMMU will have to be enabled and + accessed before master gets enabled and linked to its + SMMU. + ** Deprecated properties: - mmu-masters (deprecated in favour of the generic "iommus" binding) : @@ -137,3 +155,20 @@ conditions. iommu-map = <0 &smmu3 0 0x400>; ... }; + + /* Qcom's arm,smmu-v2 implementation */ + smmu4: iommu { + compatible = "qcom,smmu-v2"; + reg = <0xd0 0x1>; + + #global-interrupts = <1>; + interrupts = , +, +; + #iommu-cells = <1>; + power-domains = <&mmcc MDSS_GDSC>; + + clocks = <&mmcc SMMU_MDP_AXI_CLK>, +<&mmcc SMMU_MDP_AHB_CLK>; + clock-names = "bus", "iface"; + }; diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 33bbcfedb896..2ade214c41bc 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -119,6 +119,7 @@ enum arm_smmu_implementation { GENERIC_SMMU, ARM_MMU500, CAVIUM_SMMUV2, + QCOM_SMMUV2, }; struct arm_smmu_s2cr { @@ -1971,6 +1972,17 @@ struct arm_smmu_match_data { ARM_SMMU_MATCH_DATA(arm_mmu500, ARM_SMMU_V2, ARM_MMU500); ARM_SMMU_MATCH_DATA(cavium_smmuv2, ARM_SMMU_V2, CAVIUM_SMMUV2); +static const char * const qcom_smmuv2_clks[] = { + "bus", "iface", +}; + +static const struct arm_smmu_match_data qcom_smmuv2 = { + .version = ARM_SMMU_V2, + .model = QCOM_SMMUV2, + .clks = qcom_smmuv2_clks, + .num_clks = ARRAY_SIZE(qcom_smmuv2_clks), +}; + static const struct of_device_id arm_smmu_of_match[] = { { .compatible = "arm,smmu-v1", .data = &smmu_generic_v1 }, { .compatible = "arm,smmu-v2", .data = &smmu_generic_v2 }, @@ -1978,6 +1990,7 @@ struct arm_smmu_match_data { { .compatible = "arm,mmu-401", .data = &arm_mmu401 }, { .compatible = "arm,mmu-500", .data = &arm_mmu500 }, { .compatible = "cavium,smmu-v2", .data = &cavium_smmuv2 }, + { .compatible = "qcom,smmu-v2", .data = &qcom_smmuv2 }, { }, }; MODULE_DEVICE_TABLE(of, arm_smmu_of_match); -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v7 2/8] drm/bridge: analogix_dp: Fix connector and encoder cleanup
From: Jeffy Chen Since we are initing connector in the core driver and encoder in the plat driver, let's clean them up in the right places. Signed-off-by: Jeffy Chen Signed-off-by: Thierry Escande Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 2 -- drivers/gpu/drm/exynos/exynos_dp.c | 7 +-- drivers/gpu/drm/rockchip/analogix_dp-rockchip.c| 12 +--- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index 878f61b65cb2..cb5e18d6ba04 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -1411,7 +1411,6 @@ analogix_dp_bind(struct device *dev, struct drm_device *drm_dev, ret = analogix_dp_create_bridge(drm_dev, dp); if (ret) { DRM_ERROR("failed to create bridge (%d)\n", ret); - drm_encoder_cleanup(dp->encoder); goto err_disable_pm_runtime; } @@ -1434,7 +1433,6 @@ void analogix_dp_unbind(struct analogix_dp_device *dp) { analogix_dp_bridge_disable(dp->bridge); dp->connector.funcs->destroy(&dp->connector); - dp->encoder->funcs->destroy(dp->encoder); if (dp->plat_data->panel) { if (drm_panel_unprepare(dp->plat_data->panel)) diff --git a/drivers/gpu/drm/exynos/exynos_dp.c b/drivers/gpu/drm/exynos/exynos_dp.c index f7e5b2c405ed..33319a858f3a 100644 --- a/drivers/gpu/drm/exynos/exynos_dp.c +++ b/drivers/gpu/drm/exynos/exynos_dp.c @@ -185,8 +185,10 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data) dp->plat_data.encoder = encoder; dp->adp = analogix_dp_bind(dev, dp->drm_dev, &dp->plat_data); - if (IS_ERR(dp->adp)) + if (IS_ERR(dp->adp)) { + dp->encoder.funcs->destroy(&dp->encoder); return PTR_ERR(dp->adp); + } return 0; } @@ -196,7 +198,8 @@ static void exynos_dp_unbind(struct device *dev, struct device *master, { struct exynos_dp_device *dp = dev_get_drvdata(dev); - return analogix_dp_unbind(dp->adp); + analogix_dp_unbind(dp->adp); + dp->encoder.funcs->destroy(&dp->encoder); } static const struct component_ops exynos_dp_ops = { diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c index 8a58ad80f509..37250ab63bd7 100644 --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c @@ -259,13 +259,8 @@ static struct drm_encoder_helper_funcs rockchip_dp_encoder_helper_funcs = { .atomic_check = rockchip_dp_drm_encoder_atomic_check, }; -static void rockchip_dp_drm_encoder_destroy(struct drm_encoder *encoder) -{ - drm_encoder_cleanup(encoder); -} - static struct drm_encoder_funcs rockchip_dp_encoder_funcs = { - .destroy = rockchip_dp_drm_encoder_destroy, + .destroy = drm_encoder_cleanup, }; static int rockchip_dp_of_probe(struct rockchip_dp_device *dp) @@ -362,8 +357,10 @@ static int rockchip_dp_bind(struct device *dev, struct device *master, rockchip_drm_psr_register(&dp->encoder, analogix_dp_psr_set); dp->adp = analogix_dp_bind(dev, dp->drm_dev, &dp->plat_data); - if (IS_ERR(dp->adp)) + if (IS_ERR(dp->adp)) { + dp->encoder.funcs->destroy(&dp->encoder); return PTR_ERR(dp->adp); + } return 0; } @@ -375,6 +372,7 @@ static void rockchip_dp_unbind(struct device *dev, struct device *master, rockchip_drm_psr_unregister(&dp->encoder); analogix_dp_unbind(dp->adp); + dp->encoder.funcs->destroy(&dp->encoder); } static const struct component_ops rockchip_dp_component_ops = { -- 2.14.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v7 7/8] drm/bridge/synopsys: dw-hdmi: Do not use device's drvdata
From: Jeffy Chen Let plat drivers own the drvdata, so that they could cleanup resources in their unbind(). Signed-off-by: Jeffy Chen Signed-off-by: Thierry Escande Reviewed-by: Neil Armstrong --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 43 ++--- drivers/gpu/drm/imx/dw_hdmi-imx.c | 22 +-- drivers/gpu/drm/meson/meson_dw_hdmi.c | 20 ++ drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c | 14 -- drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 23 --- include/drm/bridge/dw_hdmi.h| 17 ++-- 6 files changed, 77 insertions(+), 62 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 1cc63a18b7d5..f0380bcae513 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2073,7 +2073,7 @@ static irqreturn_t dw_hdmi_hardirq(int irq, void *dev_id) return ret; } -void __dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense) +void dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense) { mutex_lock(&hdmi->mutex); @@ -2099,13 +2099,6 @@ void __dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense) } mutex_unlock(&hdmi->mutex); } - -void dw_hdmi_setup_rx_sense(struct device *dev, bool hpd, bool rx_sense) -{ - struct dw_hdmi *hdmi = dev_get_drvdata(dev); - - __dw_hdmi_setup_rx_sense(hdmi, hpd, rx_sense); -} EXPORT_SYMBOL_GPL(dw_hdmi_setup_rx_sense); static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) @@ -2141,9 +2134,8 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) */ if (intr_stat & (HDMI_IH_PHY_STAT0_RX_SENSE | HDMI_IH_PHY_STAT0_HPD)) { - __dw_hdmi_setup_rx_sense(hdmi, -phy_stat & HDMI_PHY_HPD, -phy_stat & HDMI_PHY_RX_SENSE); + dw_hdmi_setup_rx_sense(hdmi, phy_stat & HDMI_PHY_HPD, + phy_stat & HDMI_PHY_RX_SENSE); if ((phy_stat & (HDMI_PHY_RX_SENSE | HDMI_PHY_HPD)) == 0) cec_notifier_set_phys_addr(hdmi->cec_notifier, @@ -2533,8 +2525,6 @@ __dw_hdmi_probe(struct platform_device *pdev, if (hdmi->i2c) dw_hdmi_i2c_init(hdmi); - platform_set_drvdata(pdev, hdmi); - return hdmi; err_iahb: @@ -2584,25 +2574,23 @@ static void __dw_hdmi_remove(struct dw_hdmi *hdmi) /* - * Probe/remove API, used from platforms based on the DRM bridge API. */ -int dw_hdmi_probe(struct platform_device *pdev, - const struct dw_hdmi_plat_data *plat_data) +struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev, + const struct dw_hdmi_plat_data *plat_data) { struct dw_hdmi *hdmi; hdmi = __dw_hdmi_probe(pdev, plat_data); if (IS_ERR(hdmi)) - return PTR_ERR(hdmi); + return hdmi; drm_bridge_add(&hdmi->bridge); - return 0; + return hdmi; } EXPORT_SYMBOL_GPL(dw_hdmi_probe); -void dw_hdmi_remove(struct platform_device *pdev) +void dw_hdmi_remove(struct dw_hdmi *hdmi) { - struct dw_hdmi *hdmi = platform_get_drvdata(pdev); - drm_bridge_remove(&hdmi->bridge); __dw_hdmi_remove(hdmi); @@ -2612,31 +2600,30 @@ EXPORT_SYMBOL_GPL(dw_hdmi_remove); /* - * Bind/unbind API, used from platforms based on the component framework. */ -int dw_hdmi_bind(struct platform_device *pdev, struct drm_encoder *encoder, -const struct dw_hdmi_plat_data *plat_data) +struct dw_hdmi *dw_hdmi_bind(struct platform_device *pdev, +struct drm_encoder *encoder, +const struct dw_hdmi_plat_data *plat_data) { struct dw_hdmi *hdmi; int ret; hdmi = __dw_hdmi_probe(pdev, plat_data); if (IS_ERR(hdmi)) - return PTR_ERR(hdmi); + return hdmi; ret = drm_bridge_attach(encoder, &hdmi->bridge, NULL); if (ret) { __dw_hdmi_remove(hdmi); DRM_ERROR("Failed to initialize bridge with drm\n"); - return ret; + return ERR_PTR(ret); } - return 0; + return hdmi; } EXPORT_SYMBOL_GPL(dw_hdmi_bind); -void dw_hdmi_unbind(struct device *dev) +void dw_hdmi_unbind(struct dw_hdmi *hdmi) { - struct dw_hdmi *hdmi = dev_get_drvdata(dev); - __dw_hdmi_remove(hdmi); } EXPORT_SYMBOL_GPL(dw_hdmi_unbind); diff --git a/drivers/gpu/drm/imx/dw_hdmi-imx.c b/drivers/gpu/drm/imx/dw_hdmi-imx.c index b62763aa8706..b01d03e02ce0 100644 --- a/drivers/gpu/drm/imx/dw_hdmi-imx.c +++ b/drivers/gpu/drm/im
Re: [PATCH 04/11] drm/bridge/synopsys: dw-hdmi: Export some PHY related functions
Hi Laurent, Dne torek, 09. januar 2018 ob 14:30:22 CET je Laurent Pinchart napisal(a): > Hi Jernej, > > Thank you for the patch. > > On Saturday, 30 December 2017 23:01:56 EET Jernej Skrabec wrote: > > Parts of PHY code could be useful also for custom PHYs. For example, > > Allwinner A83T has custom PHY which is probably Synopsys gen2 PHY > > with few additional memory mapped registers, so most of the Synopsys PHY > > related code could be reused. > > > > It turns out that even completely custom HDMI PHYs, such as the one > > found in Allwinner H3, can reuse some of those functions. This would > > suggest that (some?) functions exported in this commit are actually part > > of generic PHY interface and not really specific to Synopsys PHYs. > > That's correct, those functions control the interface between the HDMI > controller and the PHY. They're not specific to Synopsys PHYs, but they're > specific to the PHY interface as designed by Synopsys. Ok, I'll update commit message. > > > Export useful PHY functions. > > > > Signed-off-by: Jernej Skrabec > > --- > > > > drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 45 > > --- > > drivers/gpu/drm/bridge/synopsys/dw-hdmi.h | 2 ++ > > include/drm/bridge/dw_hdmi.h | 10 +++ > > 3 files changed, 44 insertions(+), 13 deletions(-) > > > > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c > > b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index > > 7ca14d7325b5..67467d0b683a 100644 > > --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c > > +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c > > @@ -1037,19 +1037,21 @@ static void dw_hdmi_phy_enable_svsret(struct > > dw_hdmi *hdmi, u8 enable) HDMI_PHY_CONF0_SVSRET_MASK); > > > > } > > > > -static void dw_hdmi_phy_gen2_pddq(struct dw_hdmi *hdmi, u8 enable) > > +void dw_hdmi_phy_gen2_pddq(struct dw_hdmi *hdmi, u8 enable) > > > > { > > > > hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0, > > > > HDMI_PHY_CONF0_GEN2_PDDQ_OFFSET, > > HDMI_PHY_CONF0_GEN2_PDDQ_MASK); > > > > } > > > > +EXPORT_SYMBOL_GPL(dw_hdmi_phy_gen2_pddq); > > > > -static void dw_hdmi_phy_gen2_txpwron(struct dw_hdmi *hdmi, u8 enable) > > +void dw_hdmi_phy_gen2_txpwron(struct dw_hdmi *hdmi, u8 enable) > > > > { > > > > hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0, > > > > HDMI_PHY_CONF0_GEN2_TXPWRON_OFFSET, > > HDMI_PHY_CONF0_GEN2_TXPWRON_MASK); > > > > } > > > > +EXPORT_SYMBOL_GPL(dw_hdmi_phy_gen2_txpwron); > > > > static void dw_hdmi_phy_sel_data_en_pol(struct dw_hdmi *hdmi, u8 enable) > > { > > > > @@ -1065,6 +1067,23 @@ static void > > dw_hdmi_phy_sel_interface_control(struct > > dw_hdmi *hdmi, u8 enable) HDMI_PHY_CONF0_SELDIPIF_MASK); > > > > } > > > > +void dw_hdmi_phy_gen2_reset(struct dw_hdmi *hdmi, u8 enable) > > +{ > > + hdmi_mask_writeb(hdmi, enable, HDMI_MC_PHYRSTZ, > > +HDMI_MC_PHYRSTZ_PHYRSTZ_OFFSET, > > +HDMI_MC_PHYRSTZ_PHYRSTZ_MASK); > > +} > > +EXPORT_SYMBOL_GPL(dw_hdmi_phy_gen2_reset); > > + > > +void dw_hdmi_phy_set_slave_addr(struct dw_hdmi *hdmi) > > +{ > > + hdmi_phy_test_clear(hdmi, 1); > > + hdmi_writeb(hdmi, HDMI_PHY_I2CM_SLAVE_ADDR_PHY_GEN2, > > + HDMI_PHY_I2CM_SLAVE_ADDR); > > + hdmi_phy_test_clear(hdmi, 0); > > +} > > +EXPORT_SYMBOL_GPL(dw_hdmi_phy_set_slave_addr); > > Should the I2C address be passed as an argument ? Yes, I already planned to do that for v2. Best regards, Jernej > > > static void dw_hdmi_phy_power_off(struct dw_hdmi *hdmi) > > { > > > > const struct dw_hdmi_phy_data *phy = hdmi->phy.data; > > > > @@ -1204,15 +1223,12 @@ static int hdmi_phy_configure(struct dw_hdmi > > *hdmi) > > > > dw_hdmi_phy_enable_svsret(hdmi, 1); > > > > /* PHY reset. The reset signal is active high on Gen2 PHYs. */ > > > > - hdmi_writeb(hdmi, HDMI_MC_PHYRSTZ_PHYRSTZ, HDMI_MC_PHYRSTZ); > > - hdmi_writeb(hdmi, 0, HDMI_MC_PHYRSTZ); > > + dw_hdmi_phy_gen2_reset(hdmi, 1); > > + dw_hdmi_phy_gen2_reset(hdmi, 0); > > > > hdmi_writeb(hdmi, HDMI_MC_HEACPHY_RST_ASSERT, HDMI_MC_HEACPHY_RST); > > > > - hdmi_phy_test_clear(hdmi, 1); > > - hdmi_writeb(hdmi, HDMI_PHY_I2CM_SLAVE_ADDR_PHY_GEN2, > > - HDMI_PHY_I2CM_SLAVE_ADDR); > > - hdmi_phy_test_clear(hdmi, 0); > > + dw_hdmi_phy_set_slave_addr(hdmi); > > > > /* Write to the PHY as configured by the platform */ > > if (pdata->configure_phy) > > > > @@ -1251,15 +1267,16 @@ static void dw_hdmi_phy_disable(struct dw_hdmi > > *hdmi, void *data) dw_hdmi_phy_power_off(hdmi); > > > > } > > > > -static enum drm_connector_status dw_hdmi_phy_read_hpd(struct dw_hdmi > > *hdmi, - void *data) > > +enum drm_connector_status dw_hdmi_phy_read_hpd(struct dw_hdmi *hdmi, > > + void *data) > > > > { > > > > retur
[PATCH v7 4/8] drm/rockchip: dw-mipi-dsi: Fix error handling path
From: Jeffy Chen Add missing pm_runtime_disable() in bind()'s error handling path. Also cleanup encoder & connector in unbind(). Fixes: 80a9a059d4e4 ("drm/rockchip/dsi: add dw-mipi power domain support") Signed-off-by: Jeffy Chen Signed-off-by: Thierry Escande --- drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c index b1fe0639227e..78e6b7919bf7 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c @@ -1282,7 +1282,7 @@ static int dw_mipi_dsi_bind(struct device *dev, struct device *master, ret = dw_mipi_dsi_register(drm, dsi); if (ret) { DRM_DEV_ERROR(dev, "Failed to register mipi_dsi: %d\n", ret); - goto err_pllref; + goto err_disable_pllref; } dsi->dsi_host.ops = &dw_mipi_dsi_host_ops; @@ -1290,24 +1290,25 @@ static int dw_mipi_dsi_bind(struct device *dev, struct device *master, ret = mipi_dsi_host_register(&dsi->dsi_host); if (ret) { DRM_DEV_ERROR(dev, "Failed to register MIPI host: %d\n", ret); - goto err_cleanup; + goto err_disable_pm_runtime; } if (!dsi->panel) { ret = -EPROBE_DEFER; - goto err_mipi_dsi_host; + goto err_unreg_mipi_dsi_host; } dev_set_drvdata(dev, dsi); pm_runtime_enable(dev); return 0; -err_mipi_dsi_host: +err_unreg_mipi_dsi_host: mipi_dsi_host_unregister(&dsi->dsi_host); -err_cleanup: - drm_encoder_cleanup(&dsi->encoder); - drm_connector_cleanup(&dsi->connector); -err_pllref: +err_disable_pm_runtime: + pm_runtime_disable(dev); + dsi->connector.funcs->destroy(&dsi->connector); + dsi->encoder.funcs->destroy(&dsi->encoder); +err_disable_pllref: clk_disable_unprepare(dsi->pllref_clk); return ret; } @@ -1319,6 +1320,10 @@ static void dw_mipi_dsi_unbind(struct device *dev, struct device *master, mipi_dsi_host_unregister(&dsi->dsi_host); pm_runtime_disable(dev); + + dsi->connector.funcs->destroy(&dsi->connector); + dsi->encoder.funcs->destroy(&dsi->encoder); + clk_disable_unprepare(dsi->pllref_clk); } -- 2.14.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [RFC][PATCH 2/5] drm_hwcomposer: glworker: Add build time options for certain shader feature names
On Tue, Jan 09, 2018 at 10:05:42PM -0800, John Stultz wrote: > In order to get the hikey960, which uses the mali bifrost driver > working with drm_hwcomposer, its needed to tweak some extension > and funciton names used in the shaders. > > Specifically: > * GL_OES_EGL_image_external_essl3 instead of > GL_OES_EGL_image_external > * texture() instead of texture2D() > > Which is configured using a build time definition. Build time is kinda uncool, at least in the spirit of multiarch kernels :-) Can't we try a few alternatives until the glsl compiler takes it? For extensions you could/should even query them upfront and then pick the right one. -Daniel > Credit to Matt Szczesiak for suggesting these changes to get > hikey960 working! > > I'm a bit new to all this, and I expect there may be a better > way to do this, so I'd love any feedback or comments! > > Change-Id: I2c8f08341ad086479b66241b903c79b00f2a0feb > Cc: Marissa Wall > Cc: Sean Paul > Cc: Dmitry Shmidt > Cc: Robert Foss > Cc: Matt Szczesiak > Cc: Liviu Dudau > Cc: David Hanna > Cc: Rob Herring > Signed-off-by: John Stutlz > --- > glworker.cpp | 15 +-- > 1 file changed, 13 insertions(+), 2 deletions(-) > > diff --git a/glworker.cpp b/glworker.cpp > index ca726bf..c35d1b6 100644 > --- a/glworker.cpp > +++ b/glworker.cpp > @@ -41,6 +41,17 @@ > > #define MAX_OVERLAPPING_LAYERS 64 > > +#ifdef USE_TEXTURE_FN > + #define TEXTURE_STR "texture" > +#else > + #define TEXTURE_STR "texture2D" > +#endif > + > +#ifdef USE_IMAGE_EXTERNAL_ESSL3 > + #define IMAGE_EXTERNAL_STR "GL_OES_EGL_image_external_essl3" > +#else > + #define IMAGE_EXTERNAL_STR "GL_OES_EGL_image_external" > +#endif > namespace android { > > // clang-format off > @@ -237,7 +248,7 @@ static std::string GenerateFragmentShader(int > layer_count) { >std::ostringstream fragment_shader_stream; >fragment_shader_stream << "#version 300 es\n" > << "#define LAYER_COUNT " << layer_count << "\n" > - << "#extension GL_OES_EGL_image_external : > require\n" > + << "#extension " << IMAGE_EXTERNAL_STR << " : > require\n" > << "precision mediump float;\n"; >for (int i = 0; i < layer_count; ++i) { > fragment_shader_stream << "uniform samplerExternalOES uLayerTexture" << i > @@ -257,7 +268,7 @@ static std::string GenerateFragmentShader(int > layer_count) { >fragment_shader_stream << " if (alphaCover > 0.5/255.0) {\n"; > // clang-format off > fragment_shader_stream > -<< " texSample = texture2D(uLayerTexture" << i << ",\n" > +<< " texSample = " << TEXTURE_STR << "(uLayerTexture" << i << ",\n" > << "fTexCoords[" << i << "]);\n" > << " multRgb = texSample.rgb *\n" > << "max(texSample.a, uLayerPremult[" << i << "]);\n" > -- > 2.7.4 > > ___ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse
On Tue, Jan 09, 2018 at 01:13:08PM -0500, Alex Deucher wrote: > On Tue, Jan 9, 2018 at 10:56 AM, Deucher, Alexander > wrote: > > I'll can push this and a few other misc patches today. > > > > Pushed to drm-misc-next. One thing I just noticed: Some kerneldoc for the newly exported functions and maybe a small update to the intro section to explain what to do with this would be neat. -Daniel > > Thanks, > > Alex > > > > > > Alex > > > > From: amd-gfx on behalf of Li, > > Samuel > > Sent: Tuesday, January 9, 2018 10:20 AM > > To: Daniel Vetter; Koenig, Christian > > Cc: amd-...@lists.freedesktop.org; dri-devel@lists.freedesktop.org > > Subject: RE: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse > > > > Yes, please hush this for me. > > > > Regards, > > Samuel Li > > > > > >> -Original Message- > >> From: Daniel Vetter [mailto:daniel.vet...@ffwll.ch] On Behalf Of Daniel > >> Vetter > >> Sent: Tuesday, January 09, 2018 4:22 AM > >> To: Koenig, Christian > >> Cc: Li, Samuel ; dri-devel@lists.freedesktop.org; amd- > >> g...@lists.freedesktop.org > >> Subject: Re: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse > >> > >> On Fri, Jan 05, 2018 at 10:16:04AM +0100, Christian König wrote: > >> > Am 04.01.2018 um 22:12 schrieb Samuel Li: > >> > > Change-Id: I03c22a890d2305f3243d88019d1a28bddd4ddda7 > >> > > Signed-off-by: Samuel Li > >> > > >> > Reviewed-by: Christian König > >> > >> Want to push to drm-misc or some other plan with this? > >> -Daniel > >> > >> > > >> > > --- > >> > > drivers/gpu/drm/drm_prime.c | 53 ++--- > >> > >> > > include/drm/drm_prime.h | 22 +++ > >> > > 2 files changed, 53 insertions(+), 22 deletions(-) > >> > > > >> > > diff --git a/drivers/gpu/drm/drm_prime.c > >> > > b/drivers/gpu/drm/drm_prime.c index 8de93a2..68a69e9 100644 > >> > > --- a/drivers/gpu/drm/drm_prime.c > >> > > +++ b/drivers/gpu/drm/drm_prime.c > >> > > @@ -180,9 +180,8 @@ static int drm_prime_lookup_buf_handle(struct > >> drm_prime_file_private *prime_fpri > >> > >return -ENOENT; > >> > > } > >> > > -static int drm_gem_map_attach(struct dma_buf *dma_buf, > >> > > - struct device *target_dev, > >> > > - struct dma_buf_attachment *attach) > >> > > +int drm_gem_map_attach(struct dma_buf *dma_buf, struct device > >> *target_dev, > >> > > +struct dma_buf_attachment *attach) > >> > > { > >> > >struct drm_prime_attachment *prime_attach; > >> > >struct drm_gem_object *obj = dma_buf->priv; @@ -200,9 +199,10 > >> @@ > >> > > static int drm_gem_map_attach(struct dma_buf *dma_buf, > >> > >return dev->driver->gem_prime_pin(obj); > >> > > } > >> > > +EXPORT_SYMBOL(drm_gem_map_attach); > >> > > -static void drm_gem_map_detach(struct dma_buf *dma_buf, > >> > > -struct dma_buf_attachment *attach) > >> > > +void drm_gem_map_detach(struct dma_buf *dma_buf, > >> > > + struct dma_buf_attachment *attach) > >> > > { > >> > >struct drm_prime_attachment *prime_attach = attach->priv; > >> > >struct drm_gem_object *obj = dma_buf->priv; @@ -227,6 +227,7 > >> @@ > >> > > static void drm_gem_map_detach(struct dma_buf *dma_buf, > >> > >kfree(prime_attach); > >> > >attach->priv = NULL; > >> > > } > >> > > +EXPORT_SYMBOL(drm_gem_map_detach); > >> > > void drm_prime_remove_buf_handle_locked(struct > >> drm_prime_file_private *prime_fpriv, > >> > >struct dma_buf *dma_buf) > >> > > @@ -253,8 +254,8 @@ void > >> drm_prime_remove_buf_handle_locked(struct drm_prime_file_private > >> *prime_fpr > >> > >} > >> > > } > >> > > -static struct sg_table *drm_gem_map_dma_buf(struct > >> dma_buf_attachment *attach, > >> > > - enum dma_data_direction dir) > >> > > +struct sg_table *drm_gem_map_dma_buf(struct dma_buf_attachment > >> *attach, > >> > > + enum dma_data_direction dir) > >> > > { > >> > >struct drm_prime_attachment *prime_attach = attach->priv; > >> > >struct drm_gem_object *obj = attach->dmabuf->priv; @@ -289,13 > >> > > +290,15 @@ static struct sg_table *drm_gem_map_dma_buf(struct > >> dma_buf_attachment *attach, > >> > >return sgt; > >> > > } > >> > > +EXPORT_SYMBOL(drm_gem_map_dma_buf); > >> > > -static void drm_gem_unmap_dma_buf(struct dma_buf_attachment > >> *attach, > >> > > - struct sg_table *sgt, > >> > > - enum dma_data_direction dir) > >> > > +void drm_gem_unmap_dma_buf(struct dma_buf_attachment *attach, > >> > > +struct sg_table *sgt, > >> > > +enum dma_data_direction dir) > >> > > { > >> > >/* nothing to be done here */ > >> > > } > >> > > +EXPORT_SYMBOL(drm_gem_unmap_dma_buf); > >> > > /** > >> > >* drm_gem_dmabuf_export - dma_buf export imp
[PATCH] radeon: completely remove lut leftovers
This is an oversight from commit 42585395ebc1034a98937702849669f17eadb35f Author: Peter Rosin Date: Thu Jul 13 18:25:36 2017 +0200 drm: radeon: remove dead code and pointless local lut storage Cc: Peter Rosin Cc: Alex Deucher Cc: Michel Dänzer Signed-off-by: Daniel Vetter --- drivers/gpu/drm/radeon/radeon_display.c | 6 -- drivers/gpu/drm/radeon/radeon_mode.h| 1 - 2 files changed, 7 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index dfda5e0ed166..d22f4b6a8828 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c @@ -698,12 +698,6 @@ static void radeon_crtc_init(struct drm_device *dev, int index) radeon_crtc->mode_set.num_connectors = 0; #endif - for (i = 0; i < 256; i++) { - radeon_crtc->lut_r[i] = i << 2; - radeon_crtc->lut_g[i] = i << 2; - radeon_crtc->lut_b[i] = i << 2; - } - if (rdev->is_atom_bios && (ASIC_IS_AVIVO(rdev) || radeon_r4xx_atom)) radeon_atombios_init_crtc(dev, radeon_crtc); else diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index 3243e5e01432..5f61facafe36 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h @@ -328,7 +328,6 @@ enum radeon_flip_status { struct radeon_crtc { struct drm_crtc base; int crtc_id; - u16 lut_r[256], lut_g[256], lut_b[256]; bool enabled; bool can_tile; bool cursor_out_of_bounds; -- 2.15.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v7 6/8] drm/bridge/synopsys: dw-hdmi: Add missing bridge detach
On 01/09/2018 08:18 PM, Thierry Escande wrote: From: Jeffy Chen We inited connector in attach(), so need a detach() to cleanup. Also fix wrong use of dw_hdmi_remove() in bind(). Signed-off-by: Jeffy Chen Signed-off-by: Thierry Escande Reviewed-by: Archit Taneja --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index a38db40ce990..1cc63a18b7d5 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -1967,6 +1967,13 @@ static int dw_hdmi_bridge_attach(struct drm_bridge *bridge) return 0; } +static void dw_hdmi_bridge_detach(struct drm_bridge *bridge) +{ + struct dw_hdmi *hdmi = bridge->driver_private; + + drm_connector_cleanup(&hdmi->connector); +} + static enum drm_mode_status dw_hdmi_bridge_mode_valid(struct drm_bridge *bridge, const struct drm_display_mode *mode) @@ -2023,6 +2030,7 @@ static void dw_hdmi_bridge_enable(struct drm_bridge *bridge) static const struct drm_bridge_funcs dw_hdmi_bridge_funcs = { .attach = dw_hdmi_bridge_attach, + .detach = dw_hdmi_bridge_detach, .enable = dw_hdmi_bridge_enable, .disable = dw_hdmi_bridge_disable, .mode_set = dw_hdmi_bridge_mode_set, @@ -2616,7 +2624,7 @@ int dw_hdmi_bind(struct platform_device *pdev, struct drm_encoder *encoder, ret = drm_bridge_attach(encoder, &hdmi->bridge, NULL); if (ret) { - dw_hdmi_remove(pdev); + __dw_hdmi_remove(hdmi); DRM_ERROR("Failed to initialize bridge with drm\n"); return ret; } -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/atomic: Fix memleak on ERESTARTSYS during non-blocking commits
On Tue, Jan 09, 2018 at 01:13:33PM -0500, Alex Deucher wrote: > On Mon, Jan 8, 2018 at 4:30 PM, Harry Wentland wrote: > > On 2018-01-04 02:47 PM, sunpeng...@amd.com wrote: > >> From: "Leo (Sunpeng) Li" > >> > >> During a non-blocking commit, it is possible to return before the > >> commit_tail work is queued (-ERESTARTSYS, for example). > >> > >> Since a reference on the crtc commit object is obtained for the pending > >> vblank event when preparing the commit, the above situation will leave > >> us with an extra reference. > >> > >> Therefore, if the commit_tail worker has not consumed the event at the > >> end of a commit, release it's reference. > >> > >> Signed-off-by: Leo (Sunpeng) Li > > > > No expert on this but looks sane to me. > > > > Acked-by: Harry Wentland > > > Pushed to drm-misc-next. This blows up all over the place in our CI: https://bugs.freedesktop.org/show_bug.cgi?id=104566 I think as a leak fix it should also be pushed to -fixes. And we didn't really figure out what's wrong, so we're going with the quick revert until you folks are all awake. Cheers, Daniel > > Thanks, > > Alex > > > > > Harry > > > >> --- > >> drivers/gpu/drm/drm_atomic_helper.c | 9 + > >> 1 file changed, 9 insertions(+) > >> > >> diff --git a/drivers/gpu/drm/drm_atomic_helper.c > >> b/drivers/gpu/drm/drm_atomic_helper.c > >> index ab40321..4253f57 100644 > >> --- a/drivers/gpu/drm/drm_atomic_helper.c > >> +++ b/drivers/gpu/drm/drm_atomic_helper.c > >> @@ -3421,6 +3421,15 @@ > >> EXPORT_SYMBOL(drm_atomic_helper_crtc_duplicate_state); > >> void __drm_atomic_helper_crtc_destroy_state(struct drm_crtc_state *state) > >> { > >> if (state->commit) { > >> + /* > >> + * In the event that a non-blocking commit returns > >> + * -ERESTARTSYS before the commit_tail work is queued, we > >> will > >> + * have an extra reference to the commit object. Release it, > >> if > >> + * the event has not been consumed by the worker. > >> + */ > >> + if (state->event) > >> + drm_crtc_commit_put(state->commit); > >> + > >> kfree(state->commit->event); > >> state->commit->event = NULL; > >> drm_crtc_commit_put(state->commit); > >> > > ___ > > dri-devel mailing list > > dri-devel@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/dri-devel > ___ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v7 7/8] drm/bridge/synopsys: dw-hdmi: Do not use device's drvdata
On 01/09/2018 08:18 PM, Thierry Escande wrote: From: Jeffy Chen Let plat drivers own the drvdata, so that they could cleanup resources in their unbind(). Signed-off-by: Jeffy Chen Signed-off-by: Thierry Escande Reviewed-by: Neil Armstrong Reviewed-by: Archit Taneja --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 43 ++--- drivers/gpu/drm/imx/dw_hdmi-imx.c | 22 +-- drivers/gpu/drm/meson/meson_dw_hdmi.c | 20 ++ drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c | 14 -- drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 23 --- include/drm/bridge/dw_hdmi.h| 17 ++-- 6 files changed, 77 insertions(+), 62 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 1cc63a18b7d5..f0380bcae513 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2073,7 +2073,7 @@ static irqreturn_t dw_hdmi_hardirq(int irq, void *dev_id) return ret; } -void __dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense) +void dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense) { mutex_lock(&hdmi->mutex); @@ -2099,13 +2099,6 @@ void __dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense) } mutex_unlock(&hdmi->mutex); } - -void dw_hdmi_setup_rx_sense(struct device *dev, bool hpd, bool rx_sense) -{ - struct dw_hdmi *hdmi = dev_get_drvdata(dev); - - __dw_hdmi_setup_rx_sense(hdmi, hpd, rx_sense); -} EXPORT_SYMBOL_GPL(dw_hdmi_setup_rx_sense); static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) @@ -2141,9 +2134,8 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) */ if (intr_stat & (HDMI_IH_PHY_STAT0_RX_SENSE | HDMI_IH_PHY_STAT0_HPD)) { - __dw_hdmi_setup_rx_sense(hdmi, -phy_stat & HDMI_PHY_HPD, -phy_stat & HDMI_PHY_RX_SENSE); + dw_hdmi_setup_rx_sense(hdmi, phy_stat & HDMI_PHY_HPD, + phy_stat & HDMI_PHY_RX_SENSE); if ((phy_stat & (HDMI_PHY_RX_SENSE | HDMI_PHY_HPD)) == 0) cec_notifier_set_phys_addr(hdmi->cec_notifier, @@ -2533,8 +2525,6 @@ __dw_hdmi_probe(struct platform_device *pdev, if (hdmi->i2c) dw_hdmi_i2c_init(hdmi); - platform_set_drvdata(pdev, hdmi); - return hdmi; err_iahb: @@ -2584,25 +2574,23 @@ static void __dw_hdmi_remove(struct dw_hdmi *hdmi) /* - * Probe/remove API, used from platforms based on the DRM bridge API. */ -int dw_hdmi_probe(struct platform_device *pdev, - const struct dw_hdmi_plat_data *plat_data) +struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev, + const struct dw_hdmi_plat_data *plat_data) { struct dw_hdmi *hdmi; hdmi = __dw_hdmi_probe(pdev, plat_data); if (IS_ERR(hdmi)) - return PTR_ERR(hdmi); + return hdmi; drm_bridge_add(&hdmi->bridge); - return 0; + return hdmi; } EXPORT_SYMBOL_GPL(dw_hdmi_probe); -void dw_hdmi_remove(struct platform_device *pdev) +void dw_hdmi_remove(struct dw_hdmi *hdmi) { - struct dw_hdmi *hdmi = platform_get_drvdata(pdev); - drm_bridge_remove(&hdmi->bridge); __dw_hdmi_remove(hdmi); @@ -2612,31 +2600,30 @@ EXPORT_SYMBOL_GPL(dw_hdmi_remove); /* - * Bind/unbind API, used from platforms based on the component framework. */ -int dw_hdmi_bind(struct platform_device *pdev, struct drm_encoder *encoder, -const struct dw_hdmi_plat_data *plat_data) +struct dw_hdmi *dw_hdmi_bind(struct platform_device *pdev, +struct drm_encoder *encoder, +const struct dw_hdmi_plat_data *plat_data) { struct dw_hdmi *hdmi; int ret; hdmi = __dw_hdmi_probe(pdev, plat_data); if (IS_ERR(hdmi)) - return PTR_ERR(hdmi); + return hdmi; ret = drm_bridge_attach(encoder, &hdmi->bridge, NULL); if (ret) { __dw_hdmi_remove(hdmi); DRM_ERROR("Failed to initialize bridge with drm\n"); - return ret; + return ERR_PTR(ret); } - return 0; + return hdmi; } EXPORT_SYMBOL_GPL(dw_hdmi_bind); -void dw_hdmi_unbind(struct device *dev) +void dw_hdmi_unbind(struct dw_hdmi *hdmi) { - struct dw_hdmi *hdmi = dev_get_drvdata(dev); - __dw_hdmi_remove(hdmi); } EXPORT_SYMBOL_GPL(dw_hdmi_unbind); diff --git a/drivers/gpu/drm/imx/dw_hdmi-imx.c b/drivers/gpu/drm/imx/dw_hdmi-imx.c index b62763aa8706.
[PATCH] drm/vmwgfx: Potential off by one in vmw_view_add()
The vmw_view_cmd_to_type() function returns vmw_view_max (3) on error. It's one element beyond the end of the vmw_view_cotables[] table. My read on this is that it's possible to hit this failure. header->id comes from vmw_cmd_check() and it's a user controlled number between 1040 and 1225 so we can hit that error. But I don't have the hardware to test this code. Fixes: d80efd5cb3de ("drm/vmwgfx: Initial DX support") Signed-off-by: Dan Carpenter diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c index b700667f6f0b..c9d5cc237124 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c @@ -2731,6 +2731,8 @@ static int vmw_cmd_dx_view_define(struct vmw_private *dev_priv, } view_type = vmw_view_cmd_to_type(header->id); + if (view_type == vmw_view_max) + return -EINVAL; cmd = container_of(header, typeof(*cmd), header); ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, user_surface_converter, ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/atomic: Fix memleak on ERESTARTSYS during non-blocking commits
Op 08-01-18 om 22:30 schreef Harry Wentland: > On 2018-01-04 02:47 PM, sunpeng...@amd.com wrote: >> From: "Leo (Sunpeng) Li" >> >> During a non-blocking commit, it is possible to return before the >> commit_tail work is queued (-ERESTARTSYS, for example). >> >> Since a reference on the crtc commit object is obtained for the pending >> vblank event when preparing the commit, the above situation will leave >> us with an extra reference. >> >> Therefore, if the commit_tail worker has not consumed the event at the >> end of a commit, release it's reference. >> >> Signed-off-by: Leo (Sunpeng) Li > No expert on this but looks sane to me. > > Acked-by: Harry Wentland > > Harry Hey, I've reverted the patch for now. I planned to apply it to the drm-misc-fixes branch with the appropriate commits referenced, but it is causing crashes on the kms_flip testcase. https://bugs.freedesktop.org/show_bug.cgi?id=104566 I'll investigate it some more then send out a fixed patch. :) ~Maarten ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v7 00/10] rockchip: kevin: Enable edp display
On 01/09/2018 08:18 PM, Thierry Escande wrote: Hi, This patchset makes edp display work on Chromebook kevin. This patchset has been originally posted by Jeffy Chen and the 2 first commits from the previous version (v6) are already merged in mainline. This v7 has been rebased on top of next-20180108 and a few conflicts have been fixed as well. v7: Rebased on top of next-20180108 and fixed conflicts Fixed a few warnings reported by checkpatch Jeffy Chen (10): arm64: dts: rockchip: Enable edp disaplay on kevin drm/rockchip: analogix_dp: Remove unnecessary init code drm/bridge: analogix: Do not use device's drvdata drm/bridge: analogix_dp: Fix connector and encoder cleanup drm/rockchip: analogix_dp: Add a sanity check for rockchip_drm_psr_register() drm/rockchip: dw-mipi-dsi: Fix error handling path drm/rockchip: inno_hdmi: Fix error handling path drm/bridge/synopsys: dw-hdmi: Add missing bridge detach drm/bridge/synopsys: dw-hdmi: Do not use device's drvdata drm/rockchip: dw_hdmi: Fix error handling path I think all the bridge related patches (#s 1, 2, 6 and 7)have been reviewed. I tried to build a kernel with just the 4 of these, and I get a build error with patch #7 (drm/bridge/synopsys: dw-hdmi: Do not use device's drvdata). Applying patch #8 (drm/rockchip: dw_hdmi: Fix error handling path) fixes this. Could you make these 2 patches independent of each other so that the kernel builds successfully after each commit? I don't know if the rest of the rockchip patches in the series depend on the 4 bridge patches. If they do, the rockchip maintainer can queue both rockchip and bridge patches. If not, I can pick up the bridge patches. Thanks, Archit arch/arm64/boot/dts/rockchip/rk3399-gru-kevin.dts | 29 +++ arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi | 16 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 52 +--- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 53 ++-- drivers/gpu/drm/exynos/exynos_dp.c | 29 --- drivers/gpu/drm/imx/dw_hdmi-imx.c | 22 +++-- drivers/gpu/drm/meson/meson_dw_hdmi.c | 20 +++-- drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c | 14 +++- drivers/gpu/drm/rockchip/analogix_dp-rockchip.c| 95 +++--- drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 21 +++-- drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c| 39 + drivers/gpu/drm/rockchip/inno_hdmi.c | 22 +++-- include/drm/bridge/analogix_dp.h | 19 +++-- include/drm/bridge/dw_hdmi.h | 17 ++-- 14 files changed, 265 insertions(+), 183 deletions(-) -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v7 3/3] drm/rockchip: Add ROCKCHIP DW MIPI DSI controller driver
On 12/12/2017 06:40 AM, Nickey Yang wrote: Add the ROCKCHIP DSI controller driver that uses the Synopsys DesignWare MIPI DSI host controller bridge. Reviewed-by: Archit Taneja Signed-off-by: Nickey Yang Signed-off-by: Brian Norris Reviewed-by: Brian Norris Reviewed-by: Sean Paul --- changes: v2: add err_pllref, remove unnecessary encoder.enable & disable correct spelling mistakes v3: call dw_mipi_dsi_unbind() in dw_mipi_dsi_rockchip_unbind() fix typo, use of_device_get_match_data(), change some ‘bind()’ logic into 'probe()' add 'dev_set_drvdata()' v4: return -EINVAL when can not get best_freq add a clarifying comment when get vco add review tag v5: keep our power domain enabled while touching GRF v6: change func name dw_mipi_encoder_disable to dw_mipi_dsi_encoder_disable drivers/gpu/drm/rockchip/Kconfig|2 +- drivers/gpu/drm/rockchip/Makefile |2 +- drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 1349 --- drivers/gpu/drm/rockchip/dw-mipi-dsi_rockchip.c | 785 + drivers/gpu/drm/rockchip/rockchip_drm_drv.c |2 +- drivers/gpu/drm/rockchip/rockchip_drm_drv.h |2 +- 6 files changed, 789 insertions(+), 1353 deletions(-) delete mode 100644 drivers/gpu/drm/rockchip/dw-mipi-dsi.c create mode 100644 drivers/gpu/drm/rockchip/dw-mipi-dsi_rockchip.c diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig index 0ccc762..9eb4795 100644 --- a/drivers/gpu/drm/rockchip/Kconfig +++ b/drivers/gpu/drm/rockchip/Kconfig @@ -7,7 +7,7 @@ config DRM_ROCKCHIP select VIDEOMODE_HELPERS select DRM_ANALOGIX_DP if ROCKCHIP_ANALOGIX_DP select DRM_DW_HDMI if ROCKCHIP_DW_HDMI - select DRM_MIPI_DSI if ROCKCHIP_DW_MIPI_DSI + select DRM_DW_MIPI_DSI if ROCKCHIP_DW_MIPI_DSI select SND_SOC_HDMI_CODEC if ROCKCHIP_CDN_DP && SND_SOC help Choose this option if you have a Rockchip soc chipset. diff --git a/drivers/gpu/drm/rockchip/Makefile b/drivers/gpu/drm/rockchip/Makefile index a314e21..c05fe47 100644 --- a/drivers/gpu/drm/rockchip/Makefile +++ b/drivers/gpu/drm/rockchip/Makefile @@ -11,7 +11,7 @@ rockchipdrm-$(CONFIG_DRM_FBDEV_EMULATION) += rockchip_drm_fbdev.o rockchipdrm-$(CONFIG_ROCKCHIP_ANALOGIX_DP) += analogix_dp-rockchip.o rockchipdrm-$(CONFIG_ROCKCHIP_CDN_DP) += cdn-dp-core.o cdn-dp-reg.o rockchipdrm-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o -rockchipdrm-$(CONFIG_ROCKCHIP_DW_MIPI_DSI) += dw-mipi-dsi.o +rockchipdrm-$(CONFIG_ROCKCHIP_DW_MIPI_DSI) += dw-mipi-dsi_rockchip.o rockchipdrm-$(CONFIG_ROCKCHIP_INNO_HDMI) += inno_hdmi.o rockchipdrm-$(CONFIG_ROCKCHIP_LVDS) += rockchip_lvds.o diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c deleted file mode 100644 index b15755b..000 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c +++ /dev/null @@ -1,1349 +0,0 @@ -/* - * Copyright (c) 2016, Fuzhou Rockchip Electronics Co., Ltd - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "rockchip_drm_drv.h" -#include "rockchip_drm_vop.h" - -#define DRIVER_NAME"dw-mipi-dsi" - -#define RK3288_GRF_SOC_CON60x025c -#define RK3288_DSI0_SEL_VOP_LITBIT(6) -#define RK3288_DSI1_SEL_VOP_LITBIT(9) - -#define RK3399_GRF_SOC_CON20 0x6250 -#define RK3399_DSI0_SEL_VOP_LITBIT(0) -#define RK3399_DSI1_SEL_VOP_LITBIT(4) - -/* disable turnrequest, turndisable, forcetxstopmode, forcerxmode */ -#define RK3399_GRF_SOC_CON22 0x6258 -#define RK3399_GRF_DSI_MODE0x - -#define DSI_VERSION0x00 -#define DSI_PWR_UP 0x04 -#define RESET 0 -#define POWERUPBIT(0) - -#define DSI_CLKMGR_CFG 0x08 -#define TO_CLK_DIVIDSION(div) (((div) & 0xff) << 8) -#define TX_ESC_CLK_DIVIDSION(div) (((div) & 0xff) << 0) - -#define DSI_DPI_VCID 0x0c -#define DPI_VID(vid) (((vid) & 0x3) << 0) - -#define DSI_DPI_COLOR_CODING 0x10 -#define EN18_LOOSELY BIT(8) -#define DPI_COLOR_CODING_16BIT_1 0x0 -#define DPI_COLOR_CODING_16BIT_2 0x1 -#define DPI_COLOR_CODING_16BIT_3 0x2 -#define DPI_COLOR_CODING_18BIT_1 0x3 -#define DPI_COLOR_CODING_18BIT_2 0x4 -#define DPI_COLOR_CODING_24BIT 0x5 - -#define DSI_DPI_CFG_POL0x14 -#define COLORM_ACT
Re: [PATCH v7 4/8] drm/rockchip: dw-mipi-dsi: Fix error handling path
On 01/09/2018 08:18 PM, Thierry Escande wrote: From: Jeffy Chen Add missing pm_runtime_disable() in bind()'s error handling path. Also cleanup encoder & connector in unbind(). I guess you'll need to drop this commit if this patch goes in first: https://patchwork.kernel.org/patch/10106105/ Thanks, Archit Fixes: 80a9a059d4e4 ("drm/rockchip/dsi: add dw-mipi power domain support") Signed-off-by: Jeffy Chen Signed-off-by: Thierry Escande --- drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c index b1fe0639227e..78e6b7919bf7 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c @@ -1282,7 +1282,7 @@ static int dw_mipi_dsi_bind(struct device *dev, struct device *master, ret = dw_mipi_dsi_register(drm, dsi); if (ret) { DRM_DEV_ERROR(dev, "Failed to register mipi_dsi: %d\n", ret); - goto err_pllref; + goto err_disable_pllref; } dsi->dsi_host.ops = &dw_mipi_dsi_host_ops; @@ -1290,24 +1290,25 @@ static int dw_mipi_dsi_bind(struct device *dev, struct device *master, ret = mipi_dsi_host_register(&dsi->dsi_host); if (ret) { DRM_DEV_ERROR(dev, "Failed to register MIPI host: %d\n", ret); - goto err_cleanup; + goto err_disable_pm_runtime; } if (!dsi->panel) { ret = -EPROBE_DEFER; - goto err_mipi_dsi_host; + goto err_unreg_mipi_dsi_host; } dev_set_drvdata(dev, dsi); pm_runtime_enable(dev); return 0; -err_mipi_dsi_host: +err_unreg_mipi_dsi_host: mipi_dsi_host_unregister(&dsi->dsi_host); -err_cleanup: - drm_encoder_cleanup(&dsi->encoder); - drm_connector_cleanup(&dsi->connector); -err_pllref: +err_disable_pm_runtime: + pm_runtime_disable(dev); + dsi->connector.funcs->destroy(&dsi->connector); + dsi->encoder.funcs->destroy(&dsi->encoder); +err_disable_pllref: clk_disable_unprepare(dsi->pllref_clk); return ret; } @@ -1319,6 +1320,10 @@ static void dw_mipi_dsi_unbind(struct device *dev, struct device *master, mipi_dsi_host_unregister(&dsi->dsi_host); pm_runtime_disable(dev); + + dsi->connector.funcs->destroy(&dsi->connector); + dsi->encoder.funcs->destroy(&dsi->encoder); + clk_disable_unprepare(dsi->pllref_clk); } -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] radeon: completely remove lut leftovers
On 2018-01-10 09:18 AM, Daniel Vetter wrote: > This is an oversight from > > commit 42585395ebc1034a98937702849669f17eadb35f > Author: Peter Rosin > Date: Thu Jul 13 18:25:36 2017 +0200 > > drm: radeon: remove dead code and pointless local lut storage > > Cc: Peter Rosin > Cc: Alex Deucher > Cc: Michel Dänzer > Signed-off-by: Daniel Vetter > --- > drivers/gpu/drm/radeon/radeon_display.c | 6 -- > drivers/gpu/drm/radeon/radeon_mode.h| 1 - > 2 files changed, 7 deletions(-) > > diff --git a/drivers/gpu/drm/radeon/radeon_display.c > b/drivers/gpu/drm/radeon/radeon_display.c > index dfda5e0ed166..d22f4b6a8828 100644 > --- a/drivers/gpu/drm/radeon/radeon_display.c > +++ b/drivers/gpu/drm/radeon/radeon_display.c > @@ -698,12 +698,6 @@ static void radeon_crtc_init(struct drm_device *dev, int > index) > radeon_crtc->mode_set.num_connectors = 0; > #endif > > - for (i = 0; i < 256; i++) { > - radeon_crtc->lut_r[i] = i << 2; > - radeon_crtc->lut_g[i] = i << 2; > - radeon_crtc->lut_b[i] = i << 2; > - } > - > if (rdev->is_atom_bios && (ASIC_IS_AVIVO(rdev) || radeon_r4xx_atom)) > radeon_atombios_init_crtc(dev, radeon_crtc); > else > diff --git a/drivers/gpu/drm/radeon/radeon_mode.h > b/drivers/gpu/drm/radeon/radeon_mode.h > index 3243e5e01432..5f61facafe36 100644 > --- a/drivers/gpu/drm/radeon/radeon_mode.h > +++ b/drivers/gpu/drm/radeon/radeon_mode.h > @@ -328,7 +328,6 @@ enum radeon_flip_status { > struct radeon_crtc { > struct drm_crtc base; > int crtc_id; > - u16 lut_r[256], lut_g[256], lut_b[256]; > bool enabled; > bool can_tile; > bool cursor_out_of_bounds; > I posted a more complete patch (also removing the now unused local i) for this in https://lists.freedesktop.org/archives/dri-devel/2017-December/161116.html . I'd like to only apply this once the problem discussed in that thread is fixed though, but unfortunately the other patch I attached there doesn't seem to fix it. What's the current plan for fixing this issue? -- Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/atomic: Fix memleak on ERESTARTSYS during non-blocking commits, v2.
From: "Leo (Sunpeng) Li" During a non-blocking commit, it is possible to return before the commit_tail work is queued (-ERESTARTSYS, for example). Since a reference on the crtc commit object is obtained for the pending vblank event when preparing the commit, the above situation will leave us with an extra reference. Therefore, if the commit_tail worker has not consumed the event at the end of a commit, release it's reference. Changes since v1: - Also check for state->event->base.completion being set, to handle the case where stall_checks() fails in setup_crtc_commit(). Fixes: 24835e442f28 ("drm: reference count event->completion") Cc: # v4.11+ Signed-off-by: Leo (Sunpeng) Li Acked-by: Harry Wentland #v1 Signed-off-by: Maarten Lankhorst --- drivers/gpu/drm/drm_atomic_helper.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index b16f1d69a0bb..1d43f3e85a7d 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -3327,6 +3327,15 @@ EXPORT_SYMBOL(drm_atomic_helper_crtc_duplicate_state); void __drm_atomic_helper_crtc_destroy_state(struct drm_crtc_state *state) { if (state->commit) { + /* +* In the event that a non-blocking commit returns +* -ERESTARTSYS before the commit_tail work is queued, we will +* have an extra reference to the commit object. Release it, if +* the event has not been consumed by the worker. +*/ + if (state->event && state->event->base.completion) + drm_crtc_commit_put(state->commit); + kfree(state->commit->event); state->commit->event = NULL; drm_crtc_commit_put(state->commit); -- 2.15.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/tegra: sor: Fix hang on Tegra124 eDP
From: Thierry Reding The SOR0 found on Tegra124 and Tegra210 only supports eDP and LVDS and therefore has a slightly different clock tree than the SOR1 which does not support eDP, but HDMI and DP instead. Commit e1335e2f0cfc ("drm/tegra: sor: Reimplement pad clock") breaks setups with eDP because the sor->clk_out clock is uninitialized and therefore setting the parent clock (either the safe clock or either of the display PLLs) fails, which can cause hangs later on since there is no clock driving the module. Fix this by falling back to the module clock for sor->clk_out on those setups. This guarantees that the module will always be clocked by an enabled clock and hence prevents those hangs. Fixes: e1335e2f0cfc ("drm/tegra: sor: Reimplement pad clock") Reported-by: Guillaume Tucker Tested-by: Jon Hunter Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/sor.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index b0a1dedac802..476079f1255f 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -2656,6 +2656,9 @@ static int tegra_sor_probe(struct platform_device *pdev) name, err); goto remove; } + } else { + /* fall back to the module clock on SOR0 (eDP/LVDS only) */ + sor->clk_out = sor->clk; } sor->clk_parent = devm_clk_get(&pdev->dev, "parent"); -- 2.15.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [RFC PATCH v2 1/1] drm/tegra: sor: Fix hang on tegra124 due to NULL clk_out
On Tue, Jan 02, 2018 at 06:32:11PM +, Jon Hunter wrote: > > On 20/12/17 18:15, Thierry Reding wrote: > > On Wed, Dec 20, 2017 at 11:32:23AM +, Guillaume Tucker wrote: > >> When neither HDMI nor DP is supported such as on the tegra124, the > >> sor->clk_out is not initialised and remains NULL. In this case, the > >> parent clock can't be assigned to it so revert to the previous > >> behaviour of assigning it to the main sor->clk instead. > >> > >> This fixes a kernel hang on tegra124 and should also affect tegra210 > >> as they both don't support HDMI and DP. Tested on tegra124 only. > >> > >> Fixes: e1335e2f0cfc ("drm/tegra: sor: Reimplement pad clock") > >> Signed-off-by: Guillaume Tucker > >> CC: Thierry Reding > >> --- > >> drivers/gpu/drm/tegra/sor.c | 2 +- > >> 1 file changed, 1 insertion(+), 1 deletion(-) > > > > How about just the below instead? It's one more line than your patch, > > but it will automatically handle all occurrences of clk_out properly. > > > > --- >8 --- > > diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c > > index f6313c4d612e..4be9edf9c6fe 100644 > > --- a/drivers/gpu/drm/tegra/sor.c > > +++ b/drivers/gpu/drm/tegra/sor.c > > @@ -3047,6 +3047,8 @@ static int tegra_sor_probe(struct platform_device > > *pdev) > > name, err); > > goto remove; > > } > > + } else { > > + sor->clk_out = sor->clk; > > } > > > > sor->clk_parent = devm_clk_get(&pdev->dev, "parent"); > > --- >8 --- > > > > That said, I suspect the SOR might be compatible from a clock point of > > view with later versions and perhaps we just didn't implement clocks > > correctly back in the Tegra124 timeframe. > > > > Maybe Peter knows. > > So the above change from Thierry works for me and we need this for v4.15 > (otherwise nyan-big does not boot) so you can have my ... > > Tested-by: Jon Hunter > > However, would be good to have Peter's ACK, especially seeing that > Tegra210 sor0 does not support HDMI and DP. So we need to make sure this > is correct for Tegra210 as well (although I have not seen any > regressions for Tegra210). There are no Tegra210 boards with eDP or LVDS support, which are the only setups that are impacted by this. I've sent out the above as a proper patch. I'll submit this for a late fixes pull request. Thierry signature.asc Description: PGP signature ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Bug 198123] Console is the wrong color at boot with radeon 6670
On Sun, Jan 07, 2018 at 07:14:41PM +, Deposite Pirate wrote: > December 22, 2017 4:35 PM, "Michel Dänzer" wrote: > > > "Deposite Pirate", do the attached (only compile tested) patches work? > > Hi, > > Sorry for the delay. I was not at home for a while. So, I've compiled and > booted a kernel with both > of these patches and > the issue is still present. Below a revised version of Michel's first patch. This one should work I hope. -Daniel diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index d22f4b6a8828..dc0abdf8be00 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c @@ -213,9 +213,6 @@ void radeon_crtc_load_lut(struct drm_crtc *crtc) struct drm_device *dev = crtc->dev; struct radeon_device *rdev = dev->dev_private; - if (!crtc->enabled) - return; - if (ASIC_IS_DCE5(rdev)) dce5_crtc_load_lut(crtc); else if (ASIC_IS_DCE4(rdev)) @@ -702,6 +699,8 @@ static void radeon_crtc_init(struct drm_device *dev, int index) radeon_atombios_init_crtc(dev, radeon_crtc); else radeon_legacy_init_crtc(dev, radeon_crtc); + + radeon_crtc_load_lut(&radeon_crtc->base); } static const char *encoder_names[38] = { -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Nouveau] [PATCH] drm/nouveau/bar/gk20a: Avoid bar teardown during init
On Thu, Jan 04, 2018 at 11:29:09AM +, Jon Hunter wrote: > Commit bbb163e18960 ("drm/nouveau/bar: implement bar1 teardown") > introduced add a teardown helper function for BAR1. During > initialisation of the Nouveau, initially all the teardown helpers are > called once, before calling their init counterparts. For gk20a, after > the BAR1 teardown function is called, the device is hanging during the > initialisation of the FB sub-device. At this point it is unclear why > this is happening and this is still under investigation. However, this > change is preventing Tegra124 devices from booting when Nouveau is > enabled. To allow Tegra124 to boot, remove the teardown helper for > gk20a. > > This is based upon a previous patch by Guillaume Tucker but limits > the workaround to only gk20a GPUs. > > Fixes: bbb163e18960 ("drm/nouveau/bar: implement bar1 teardown") > Reported-by: Guillaume Tucker > Signed-off-by: Jon Hunter > --- > I am not happy that we do not yet fully understand the cause of > the hang, but I am talking with a few people at NVIDIA about this > and have a few things to look into. However, given that we are > close to v4.15 being released and I am not sure we will have a > proper fix in place before, I think it is best to workaround > this for now. > > drivers/gpu/drm/nouveau/nvkm/subdev/bar/base.c | 3 ++- > drivers/gpu/drm/nouveau/nvkm/subdev/bar/gk20a.c | 1 - > 2 files changed, 2 insertions(+), 2 deletions(-) Acked-by: Thierry Reding signature.asc Description: PGP signature ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] dma-buf: make returning the exclusive fence optional
Change reservation_object_get_fences_rcu to make the exclusive fence pointer optional. If not specified the exclusive fence is put into the fence array as well. This is helpful for a couple of cases where we need all fences in a single array. Signed-off-by: Christian König --- drivers/dma-buf/reservation.c | 31 ++- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c index b759a569b7b8..461afa9febd4 100644 --- a/drivers/dma-buf/reservation.c +++ b/drivers/dma-buf/reservation.c @@ -374,8 +374,9 @@ EXPORT_SYMBOL(reservation_object_copy_fences); * @pshared: the array of shared fence ptrs returned (array is krealloc'd to * the required size, and must be freed by caller) * - * RETURNS - * Zero or -errno + * Retrieve all fences from the reservation object. If the pointer for the + * exclusive fence is not specified the fence is put into the array of the + * shared fences as well. Returns either zero or -ENOMEM. */ int reservation_object_get_fences_rcu(struct reservation_object *obj, struct dma_fence **pfence_excl, @@ -389,8 +390,8 @@ int reservation_object_get_fences_rcu(struct reservation_object *obj, do { struct reservation_object_list *fobj; - unsigned seq; - unsigned int i; + unsigned int i, seq; + size_t sz = 0; shared_count = i = 0; @@ -402,9 +403,14 @@ int reservation_object_get_fences_rcu(struct reservation_object *obj, goto unlock; fobj = rcu_dereference(obj->fence); - if (fobj) { + if (fobj) + sz += sizeof(*shared) * fobj->shared_max; + + if (!pfence_excl && fence_excl) + sz += sizeof(*shared); + + if (sz) { struct dma_fence **nshared; - size_t sz = sizeof(*shared) * fobj->shared_max; nshared = krealloc(shared, sz, GFP_NOWAIT | __GFP_NOWARN); @@ -420,13 +426,19 @@ int reservation_object_get_fences_rcu(struct reservation_object *obj, break; } shared = nshared; - shared_count = fobj->shared_count; - + shared_count = fobj ? fobj->shared_count : 0; for (i = 0; i < shared_count; ++i) { shared[i] = rcu_dereference(fobj->shared[i]); if (!dma_fence_get_rcu(shared[i])) break; } + + if (!pfence_excl && fence_excl) { + shared[i] = fence_excl; + fence_excl = NULL; + ++i; + ++shared_count; + } } if (i != shared_count || read_seqcount_retry(&obj->seq, seq)) { @@ -448,7 +460,8 @@ int reservation_object_get_fences_rcu(struct reservation_object *obj, *pshared_count = shared_count; *pshared = shared; - *pfence_excl = fence_excl; + if (pfence_excl) + *pfence_excl = fence_excl; return ret; } -- 2.14.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Intel-gfx] [PATCH 7/8] drm: Check that the plane supports the request format+modifier combo
On Fri, Dec 22, 2017 at 09:22:30PM +0200, Ville Syrjala wrote: > From: Ville Syrjälä > > Currently we only check that the plane supports the pixel format of the > fb we're about to feed to it. Extend it to check also the modifier, and > more specifically that the combination of the format and modifier is > supported. > > Cc: dri-devel@lists.freedesktop.org > Cc: Ben Widawsky > Cc: Jason Ekstrand > Cc: Daniel Stone > Signed-off-by: Ville Syrjälä Reviewed-by: Daniel Vetter > --- > drivers/gpu/drm/drm_atomic.c| 10 ++ > drivers/gpu/drm/drm_crtc.c | 10 ++ > drivers/gpu/drm/drm_crtc_internal.h | 4 ++-- > drivers/gpu/drm/drm_plane.c | 33 ++--- > 4 files changed, 40 insertions(+), 17 deletions(-) > > diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c > index b76d49218cf1..6e5c3ea1e43b 100644 > --- a/drivers/gpu/drm/drm_atomic.c > +++ b/drivers/gpu/drm/drm_atomic.c > @@ -882,12 +882,14 @@ static int drm_atomic_plane_check(struct drm_plane > *plane, > } > > /* Check whether this plane supports the fb pixel format. */ > - ret = drm_plane_check_pixel_format(plane, state->fb->format->format); > + ret = drm_plane_check_pixel_format(plane, state->fb->format->format, > +state->fb->modifier); > if (ret) { > struct drm_format_name_buf format_name; > - DRM_DEBUG_ATOMIC("Invalid pixel format %s\n", > - drm_get_format_name(state->fb->format->format, > - &format_name)); > + DRM_DEBUG_ATOMIC("Invalid pixel format %s, modifier 0x%llx\n", > + drm_get_format_name(state->fb->format->format, > + &format_name), > + state->fb->modifier); > return ret; > } > > diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c > index f0556e654116..816c30a0f030 100644 > --- a/drivers/gpu/drm/drm_crtc.c > +++ b/drivers/gpu/drm/drm_crtc.c > @@ -625,12 +625,14 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, >*/ > if (!crtc->primary->format_default) { > ret = drm_plane_check_pixel_format(crtc->primary, > -fb->format->format); > +fb->format->format, > +fb->modifier); > if (ret) { > struct drm_format_name_buf format_name; > - DRM_DEBUG_KMS("Invalid pixel format %s\n", > - > drm_get_format_name(fb->format->format, > - > &format_name)); > + DRM_DEBUG_KMS("Invalid pixel format %s, > modifier 0x%llx\n", > + > drm_get_format_name(fb->format->format, > + &format_name), > + fb->modifier); > goto out; > } > } > diff --git a/drivers/gpu/drm/drm_crtc_internal.h > b/drivers/gpu/drm/drm_crtc_internal.h > index af00f42ba269..860968a64ae7 100644 > --- a/drivers/gpu/drm/drm_crtc_internal.h > +++ b/drivers/gpu/drm/drm_crtc_internal.h > @@ -196,8 +196,8 @@ int drm_mode_atomic_ioctl(struct drm_device *dev, > /* drm_plane.c */ > int drm_plane_register_all(struct drm_device *dev); > void drm_plane_unregister_all(struct drm_device *dev); > -int drm_plane_check_pixel_format(const struct drm_plane *plane, > - u32 format); > +int drm_plane_check_pixel_format(struct drm_plane *plane, > + u32 format, u64 modifier); > > /* drm_bridge.c */ > void drm_bridge_detach(struct drm_bridge *bridge); > diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c > index 2c90519576a3..8ac19379fe99 100644 > --- a/drivers/gpu/drm/drm_plane.c > +++ b/drivers/gpu/drm/drm_plane.c > @@ -545,16 +545,33 @@ int drm_mode_getplane(struct drm_device *dev, void > *data, > return 0; > } > > -int drm_plane_check_pixel_format(const struct drm_plane *plane, u32 format) > +int drm_plane_check_pixel_format(struct drm_plane *plane, > + u32 format, u64 modifier) > { > unsigned int i; > > for (i = 0; i < plane->format_count; i++) { > if (format == plane->format_types[i]) > - return 0; > + break; > + } > + if (i == plane->format_count) > + return -EINVAL; > + > + if (!plane->modifier_count) > + return 0; > + > + for (i =
Re: [Linaro-mm-sig] [PATCH] dma-buf: make returning the exclusive fence optional
On Wed, Jan 10, 2018 at 01:53:41PM +0100, Christian König wrote: > Change reservation_object_get_fences_rcu to make the exclusive fence > pointer optional. > > If not specified the exclusive fence is put into the fence array as > well. > > This is helpful for a couple of cases where we need all fences in a > single array. > > Signed-off-by: Christian König Seeing the use-case for this would be a lot more interesting ... -Daniel > --- > drivers/dma-buf/reservation.c | 31 ++- > 1 file changed, 22 insertions(+), 9 deletions(-) > > diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c > index b759a569b7b8..461afa9febd4 100644 > --- a/drivers/dma-buf/reservation.c > +++ b/drivers/dma-buf/reservation.c > @@ -374,8 +374,9 @@ EXPORT_SYMBOL(reservation_object_copy_fences); > * @pshared: the array of shared fence ptrs returned (array is krealloc'd to > * the required size, and must be freed by caller) > * > - * RETURNS > - * Zero or -errno > + * Retrieve all fences from the reservation object. If the pointer for the > + * exclusive fence is not specified the fence is put into the array of the > + * shared fences as well. Returns either zero or -ENOMEM. > */ > int reservation_object_get_fences_rcu(struct reservation_object *obj, > struct dma_fence **pfence_excl, > @@ -389,8 +390,8 @@ int reservation_object_get_fences_rcu(struct > reservation_object *obj, > > do { > struct reservation_object_list *fobj; > - unsigned seq; > - unsigned int i; > + unsigned int i, seq; > + size_t sz = 0; > > shared_count = i = 0; > > @@ -402,9 +403,14 @@ int reservation_object_get_fences_rcu(struct > reservation_object *obj, > goto unlock; > > fobj = rcu_dereference(obj->fence); > - if (fobj) { > + if (fobj) > + sz += sizeof(*shared) * fobj->shared_max; > + > + if (!pfence_excl && fence_excl) > + sz += sizeof(*shared); > + > + if (sz) { > struct dma_fence **nshared; > - size_t sz = sizeof(*shared) * fobj->shared_max; > > nshared = krealloc(shared, sz, > GFP_NOWAIT | __GFP_NOWARN); > @@ -420,13 +426,19 @@ int reservation_object_get_fences_rcu(struct > reservation_object *obj, > break; > } > shared = nshared; > - shared_count = fobj->shared_count; > - > + shared_count = fobj ? fobj->shared_count : 0; > for (i = 0; i < shared_count; ++i) { > shared[i] = rcu_dereference(fobj->shared[i]); > if (!dma_fence_get_rcu(shared[i])) > break; > } > + > + if (!pfence_excl && fence_excl) { > + shared[i] = fence_excl; > + fence_excl = NULL; > + ++i; > + ++shared_count; > + } > } > > if (i != shared_count || read_seqcount_retry(&obj->seq, seq)) { > @@ -448,7 +460,8 @@ int reservation_object_get_fences_rcu(struct > reservation_object *obj, > > *pshared_count = shared_count; > *pshared = shared; > - *pfence_excl = fence_excl; > + if (pfence_excl) > + *pfence_excl = fence_excl; > > return ret; > } > -- > 2.14.1 > > ___ > Linaro-mm-sig mailing list > linaro-mm-...@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/linaro-mm-sig -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Linaro-mm-sig] [PATCH] dma-buf: make returning the exclusive fence optional
Am 10.01.2018 um 14:21 schrieb Daniel Vetter: On Wed, Jan 10, 2018 at 01:53:41PM +0100, Christian König wrote: Change reservation_object_get_fences_rcu to make the exclusive fence pointer optional. If not specified the exclusive fence is put into the fence array as well. This is helpful for a couple of cases where we need all fences in a single array. Signed-off-by: Christian König Seeing the use-case for this would be a lot more interesting ... Yeah, sorry the use case is a 20 patches set on amd-gfx. Didn't wanted to post all those here as well. Christian. -Daniel --- drivers/dma-buf/reservation.c | 31 ++- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c index b759a569b7b8..461afa9febd4 100644 --- a/drivers/dma-buf/reservation.c +++ b/drivers/dma-buf/reservation.c @@ -374,8 +374,9 @@ EXPORT_SYMBOL(reservation_object_copy_fences); * @pshared: the array of shared fence ptrs returned (array is krealloc'd to * the required size, and must be freed by caller) * - * RETURNS - * Zero or -errno + * Retrieve all fences from the reservation object. If the pointer for the + * exclusive fence is not specified the fence is put into the array of the + * shared fences as well. Returns either zero or -ENOMEM. */ int reservation_object_get_fences_rcu(struct reservation_object *obj, struct dma_fence **pfence_excl, @@ -389,8 +390,8 @@ int reservation_object_get_fences_rcu(struct reservation_object *obj, do { struct reservation_object_list *fobj; - unsigned seq; - unsigned int i; + unsigned int i, seq; + size_t sz = 0; shared_count = i = 0; @@ -402,9 +403,14 @@ int reservation_object_get_fences_rcu(struct reservation_object *obj, goto unlock; fobj = rcu_dereference(obj->fence); - if (fobj) { + if (fobj) + sz += sizeof(*shared) * fobj->shared_max; + + if (!pfence_excl && fence_excl) + sz += sizeof(*shared); + + if (sz) { struct dma_fence **nshared; - size_t sz = sizeof(*shared) * fobj->shared_max; nshared = krealloc(shared, sz, GFP_NOWAIT | __GFP_NOWARN); @@ -420,13 +426,19 @@ int reservation_object_get_fences_rcu(struct reservation_object *obj, break; } shared = nshared; - shared_count = fobj->shared_count; - + shared_count = fobj ? fobj->shared_count : 0; for (i = 0; i < shared_count; ++i) { shared[i] = rcu_dereference(fobj->shared[i]); if (!dma_fence_get_rcu(shared[i])) break; } + + if (!pfence_excl && fence_excl) { + shared[i] = fence_excl; + fence_excl = NULL; + ++i; + ++shared_count; + } } if (i != shared_count || read_seqcount_retry(&obj->seq, seq)) { @@ -448,7 +460,8 @@ int reservation_object_get_fences_rcu(struct reservation_object *obj, *pshared_count = shared_count; *pshared = shared; - *pfence_excl = fence_excl; + if (pfence_excl) + *pfence_excl = fence_excl; return ret; } -- 2.14.1 ___ Linaro-mm-sig mailing list linaro-mm-...@lists.linaro.org https://lists.linaro.org/mailman/listinfo/linaro-mm-sig ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] libdrm: intel/Android.mk: Filter libdrm_intel library requirements on x86
On Tue, Jan 9, 2018 at 11:25 PM, John Stultz wrote: > When building AOSP after updating libdrm project to the > freedesktop/master branch, I've seen the following build errors: > > external/libdrm/intel/Android.mk: error: libdrm_intel This is only needed for i915 (not i965) now BTW. I'm not sure at what point we stop caring about i915. > (SHARED_LIBRARIES android-arm64) missing libpciaccess > (SHARED_LIBRARIES android-arm64) You can set > ALLOW_MISSING_DEPENDENCIES=true in your environment if this is > intentional, but that may defer real problems until later in the > build. > > Using ALLOW_MISSING_DEPENDENCIES=true when building allows > things to function properly, but is not ideal. > > So basically, while I'm not including the libdrm_intel package > into the build, just the fact that the Android.mk file references > libpciaccess which isn't a repo included in AOSP causes the build > failure. > > So it seems we need some sort of conditional filter in the > Android.mk to skip over it if we're not building for intel. > > This is my initial attempt at solving this. > > Feedback would be greatly appreciated! > > I note that in the AOSP version of libdrm, the reference to > libpciaccess has been removed. See: > > https://android.googlesource.com/platform/external/libdrm/+/f6a1130dffae8de9ddd0c379066daf1df27fc8af%5E%21/ > So I wonder if it make sense to instead remove this upstream as > well? Only if we drop i915. > > While this patch addresses upstream's Andorid.mk, I also notice > that the AOSP version of libdrm has converted to Android.bp files: > > https://android.googlesource.com/platform/external/libdrm/+/fa32e29a1fe81e5472aabc65d3aa25a5af5aec55%5E%21/ > and wonder if getting that conversion upstream would be a good > idea here? No, because we still support Android versions back to L. There's also some desire to get meson builds to work in Android build system so we don't have to support multiple build systems. > > Cc: Emil Velikov > Cc: Chad Versace > Cc: Marissa Wall > Cc: Sean Paul > Cc: Rob Herring > Cc: Dan Willemsen > Cc: Tomasz Figa > Signed-off-by: John Stultz > --- > intel/Android.mk | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/intel/Android.mk b/intel/Android.mk > index 5407ff3..d834692 100644 > --- a/intel/Android.mk > +++ b/intel/Android.mk > @@ -21,6 +21,7 @@ > # IN THE SOFTWARE. > # > > +ifeq ($(TARGET_ARCH), x86) This doesn't work for x86_64. i915 and 64-bit may not be a valid combination, not sure, but we do at least build test that. ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Linaro-mm-sig] [PATCH] dma-buf: make returning the exclusive fence optional
On Wed, Jan 10, 2018 at 02:46:32PM +0100, Christian König wrote: > Am 10.01.2018 um 14:21 schrieb Daniel Vetter: > > On Wed, Jan 10, 2018 at 01:53:41PM +0100, Christian König wrote: > > > Change reservation_object_get_fences_rcu to make the exclusive fence > > > pointer optional. > > > > > > If not specified the exclusive fence is put into the fence array as > > > well. > > > > > > This is helpful for a couple of cases where we need all fences in a > > > single array. > > > > > > Signed-off-by: Christian König > > Seeing the use-case for this would be a lot more interesting ... > > Yeah, sorry the use case is a 20 patches set on amd-gfx. > > Didn't wanted to post all those here as well. Imo better to spam more lists instead of splitting up discussions ... It's at least what we tend to do for i915 stuff, and no one seems to complain. -Daniel > > Christian. > > > -Daniel > > > > > --- > > > drivers/dma-buf/reservation.c | 31 ++- > > > 1 file changed, 22 insertions(+), 9 deletions(-) > > > > > > diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c > > > index b759a569b7b8..461afa9febd4 100644 > > > --- a/drivers/dma-buf/reservation.c > > > +++ b/drivers/dma-buf/reservation.c > > > @@ -374,8 +374,9 @@ EXPORT_SYMBOL(reservation_object_copy_fences); > > >* @pshared: the array of shared fence ptrs returned (array is > > > krealloc'd to > > >* the required size, and must be freed by caller) > > >* > > > - * RETURNS > > > - * Zero or -errno > > > + * Retrieve all fences from the reservation object. If the pointer for > > > the > > > + * exclusive fence is not specified the fence is put into the array of > > > the > > > + * shared fences as well. Returns either zero or -ENOMEM. > > >*/ > > > int reservation_object_get_fences_rcu(struct reservation_object *obj, > > > struct dma_fence **pfence_excl, > > > @@ -389,8 +390,8 @@ int reservation_object_get_fences_rcu(struct > > > reservation_object *obj, > > > do { > > > struct reservation_object_list *fobj; > > > - unsigned seq; > > > - unsigned int i; > > > + unsigned int i, seq; > > > + size_t sz = 0; > > > shared_count = i = 0; > > > @@ -402,9 +403,14 @@ int reservation_object_get_fences_rcu(struct > > > reservation_object *obj, > > > goto unlock; > > > fobj = rcu_dereference(obj->fence); > > > - if (fobj) { > > > + if (fobj) > > > + sz += sizeof(*shared) * fobj->shared_max; > > > + > > > + if (!pfence_excl && fence_excl) > > > + sz += sizeof(*shared); > > > + > > > + if (sz) { > > > struct dma_fence **nshared; > > > - size_t sz = sizeof(*shared) * fobj->shared_max; > > > nshared = krealloc(shared, sz, > > > GFP_NOWAIT | __GFP_NOWARN); > > > @@ -420,13 +426,19 @@ int reservation_object_get_fences_rcu(struct > > > reservation_object *obj, > > > break; > > > } > > > shared = nshared; > > > - shared_count = fobj->shared_count; > > > - > > > + shared_count = fobj ? fobj->shared_count : 0; > > > for (i = 0; i < shared_count; ++i) { > > > shared[i] = > > > rcu_dereference(fobj->shared[i]); > > > if (!dma_fence_get_rcu(shared[i])) > > > break; > > > } > > > + > > > + if (!pfence_excl && fence_excl) { > > > + shared[i] = fence_excl; > > > + fence_excl = NULL; > > > + ++i; > > > + ++shared_count; > > > + } > > > } > > > if (i != shared_count || read_seqcount_retry(&obj->seq, > > > seq)) { > > > @@ -448,7 +460,8 @@ int reservation_object_get_fences_rcu(struct > > > reservation_object *obj, > > > *pshared_count = shared_count; > > > *pshared = shared; > > > - *pfence_excl = fence_excl; > > > + if (pfence_excl) > > > + *pfence_excl = fence_excl; > > > return ret; > > > } > > > -- > > > 2.14.1 > > > > > > ___ > > > Linaro-mm-sig mailing list > > > linaro-mm-...@lists.linaro.org > > > https://lists.linaro.org/mailman/listinfo/linaro-mm-sig > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 1/4 v6] drm/bridge: Add bindings for TI THS8134
This adds device tree bindings for the Texas Instruments THS8134, THS8134A and THS8134B VGA DACs by extending and renaming the existing bindings for THS8135. These DACs are used for the VGA outputs on the ARM reference designs such as Integrator, Versatile and RealView. Cc: devicet...@vger.kernel.org Cc: Bartosz Golaszewski Acked-by: Rob Herring Reviewed-by: Laurent Pinchart Signed-off-by: Linus Walleij --- ChangeLog v5->v6: - Fix the more-to-less specific compatible strings. - Fix some speling. - Collect Laurent's review tag. ChangeLog v2->v5: - Dropped the "ti,ths813x" as it turns out we need precise info about the sub-variant anyways as they all very in timings. - Refine the THS8134 variants, it turns out ths8134, ths8134a and ths8134b are three different variants of ths8134. ChangeLog v1->v2: - Introduce specific-to-general compatible string: compatible = "ti,ths8134a", "ti,ths813x"; so drivers can handle the whole family the same way. - Collected Rob's ACK. --- .../display/bridge/{ti,ths8135.txt => ti,ths813x.txt} | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) rename Documentation/devicetree/bindings/display/bridge/{ti,ths8135.txt => ti,ths813x.txt} (69%) diff --git a/Documentation/devicetree/bindings/display/bridge/ti,ths8135.txt b/Documentation/devicetree/bindings/display/bridge/ti,ths813x.txt similarity index 69% rename from Documentation/devicetree/bindings/display/bridge/ti,ths8135.txt rename to Documentation/devicetree/bindings/display/bridge/ti,ths813x.txt index 6ec1a880ac18..df3d7c1ac09e 100644 --- a/Documentation/devicetree/bindings/display/bridge/ti,ths8135.txt +++ b/Documentation/devicetree/bindings/display/bridge/ti,ths813x.txt @@ -1,11 +1,16 @@ -THS8135 Video DAC -- +THS8134 and THS8135 Video DAC +- -This is the binding for Texas Instruments THS8135 Video DAC bridge. +This is the binding for Texas Instruments THS8134, THS8134A, THS8134B and +THS8135 Video DAC bridges. Required properties: -- compatible: Must be "ti,ths8135" +- compatible: Must be one of + "ti,ths8134" + "ti,ths8134a," "ti,ths8134" + "ti,ths8134b", "ti,ths8134" + "ti,ths8135" Required nodes: -- 2.14.3 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 4/4 v6] drm/pl111: Support handling bridge timings
If the bridge has a too strict setup time for the incoming signals, we may not be fast enough and then we need to compensate by outputting the signal on the inverse clock edge so it is for sure stable when the bridge samples it. Since bridges in difference to panels does not expose their connectors, make the connector optional in the display setup code. Acked-by: Laurent Pinchart Signed-off-by: Linus Walleij --- ChangeLog v5->v6: - Collect Laurent's ACK. ChangeLog v4->v5: - Use the new bridge timings setup method. --- drivers/gpu/drm/pl111/Kconfig | 1 + drivers/gpu/drm/pl111/pl111_display.c | 35 +++ drivers/gpu/drm/pl111/pl111_drv.c | 20 +++- 3 files changed, 43 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/pl111/Kconfig b/drivers/gpu/drm/pl111/Kconfig index e5e2abd66491..82cb3e60ddc8 100644 --- a/drivers/gpu/drm/pl111/Kconfig +++ b/drivers/gpu/drm/pl111/Kconfig @@ -8,6 +8,7 @@ config DRM_PL111 select DRM_GEM_CMA_HELPER select DRM_BRIDGE select DRM_PANEL_BRIDGE + select DRM_DUMB_VGA_DAC select VT_HW_CONSOLE_BINDING if FRAMEBUFFER_CONSOLE help Choose this option for DRM support for the PL111 CLCD controller. diff --git a/drivers/gpu/drm/pl111/pl111_display.c b/drivers/gpu/drm/pl111/pl111_display.c index 06c4bf756b69..7fe4040aea46 100644 --- a/drivers/gpu/drm/pl111/pl111_display.c +++ b/drivers/gpu/drm/pl111/pl111_display.c @@ -94,6 +94,7 @@ static void pl111_display_enable(struct drm_simple_display_pipe *pipe, const struct drm_display_mode *mode = &cstate->mode; struct drm_framebuffer *fb = plane->state->fb; struct drm_connector *connector = priv->connector; + struct drm_bridge *bridge = priv->bridge; u32 cntl; u32 ppl, hsw, hfp, hbp; u32 lpp, vsw, vfp, vbp; @@ -143,11 +144,37 @@ static void pl111_display_enable(struct drm_simple_display_pipe *pipe, if (mode->flags & DRM_MODE_FLAG_NVSYNC) tim2 |= TIM2_IVS; - if (connector->display_info.bus_flags & DRM_BUS_FLAG_DE_LOW) - tim2 |= TIM2_IOE; + if (connector) { + if (connector->display_info.bus_flags & DRM_BUS_FLAG_DE_LOW) + tim2 |= TIM2_IOE; - if (connector->display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE) - tim2 |= TIM2_IPC; + if (connector->display_info.bus_flags & + DRM_BUS_FLAG_PIXDATA_NEGEDGE) + tim2 |= TIM2_IPC; + } + + if (bridge) { + const struct drm_bridge_timings *btimings = bridge->timings; + + /* +* Here is when things get really fun. Sometimes the bridge +* timings are such that the signal out from PL11x is not +* stable before the receiving bridge (such as a dumb VGA DAC +* or similar) samples it. If that happens, we compensate by +* the only method we have: output the data on the opposite +* edge of the clock so it is for sure stable when it gets +* sampled. +* +* The PL111 manual does not contain proper timining diagrams +* or data for these details, but we know from experiments +* that the setup time is more than 3000 picoseconds (3 ns). +* If we have a bridge that requires the signal to be stable +* earlier than 3000 ps before the clock pulse, we have to +* output the data on the opposite edge to avoid flicker. +*/ + if (btimings && btimings->setup_time_ps >= 3000) + tim2 ^= TIM2_IPC; + } tim2 |= cpl << 16; writel(tim2, priv->regs + CLCD_TIM2); diff --git a/drivers/gpu/drm/pl111/pl111_drv.c b/drivers/gpu/drm/pl111/pl111_drv.c index 201d57d5cb54..101a9c7db6ff 100644 --- a/drivers/gpu/drm/pl111/pl111_drv.c +++ b/drivers/gpu/drm/pl111/pl111_drv.c @@ -107,11 +107,17 @@ static int pl111_modeset_init(struct drm_device *dev) ret = PTR_ERR(bridge); goto out_config; } - /* -* TODO: when we are using a different bridge than a panel -* (such as a dumb VGA connector) we need to devise a different -* method to get the connector out of the bridge. -*/ + } else if (bridge) { + dev_info(dev->dev, "Using non-panel bridge\n"); + } else { + dev_err(dev->dev, "No bridge, exiting\n"); + return -ENODEV; + } + + priv->bridge = bridge; + if (panel) { + priv->panel = panel; + priv->connector = panel->connector; } ret = pl111_display_init(dev); @@ -125,10 +131,6 @@ static int pl111_modeset_init(struct drm_device *dev)
[PATCH 3/4 v6] drm/bridge: Add timing support to dumb VGA DAC
This extends the dumb VGA DAC bridge to handle the THS8134A and THS8134B VGA DACs in addition to those already handled. We assign the proper timing data to the pointer inside the bridge struct so display controllers that need to align their timings to the bridge can pick it up and work from there. Cc: Bartosz Golaszewski Cc: Maxime Ripard Reviewed-by: Laurent Pinchart Signed-off-by: Linus Walleij --- ChangeLog v5->v6: - Use DRM_BUS_FLAG_PIXDATA_[POS|NEG]EDGE to indicate the sampling edge of the clock signal. - Skip intermediate variable for timings. - Leave timings as NULL for really dumb VGA DACs. - Collect Laurent's Review tag. ChangeLog v4->v5: - Rewrite the support using the new concept of defining fine-granular sampling (setup+hold) timing definitions stored in the bridge timings struct. ChangeLog v3->v4: - Actually have the code syntactically correct and compiling :( (Kconfig mistake.) (...) AS usr/initramfs_data.o AR usr/built-in.o CC drivers/gpu/drm/bridge/dumb-vga-dac.o AR drivers/gpu/drm/bridge/built-in.o AR drivers/gpu/drm/built-in.o AR drivers/gpu/built-in.o AR drivers/built-in.o (...) ChangeLog v2->v3: - Move const specifier. - Cut one line of code assigning bus flags. - Preserve the "ti,ths8135" compatible for elder device trees. ChangeLog v1->v2: - Alphabetize includes - Use a u32 with the bus polarity flags and just encode the polarity using the DRM define directly. - Rename vendor_data to vendor_info. - Simplify assignment of the flag as it is just a simple u32 now. - Probe all TI variants on the "ti,ths813x" wildcard for now, we only need to know that the device is in this family to set the clock edge flag right. --- drivers/gpu/drm/bridge/dumb-vga-dac.c | 59 +-- 1 file changed, 56 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/dumb-vga-dac.c b/drivers/gpu/drm/bridge/dumb-vga-dac.c index de5e7dee7ad6..498d5948d1a8 100644 --- a/drivers/gpu/drm/bridge/dumb-vga-dac.c +++ b/drivers/gpu/drm/bridge/dumb-vga-dac.c @@ -11,6 +11,7 @@ */ #include +#include #include #include @@ -204,6 +205,7 @@ static int dumb_vga_probe(struct platform_device *pdev) vga->bridge.funcs = &dumb_vga_bridge_funcs; vga->bridge.of_node = pdev->dev.of_node; + vga->bridge.timings = of_device_get_match_data(&pdev->dev); drm_bridge_add(&vga->bridge); @@ -222,10 +224,61 @@ static int dumb_vga_remove(struct platform_device *pdev) return 0; } +/* + * We assume the ADV7123 DAC is the "default" for historical reasons + * Information taken from the ADV7123 datasheet, revision D. + * NOTE: the ADV7123EP seems to have other timings and need a new timings + * set if used. + */ +static const struct drm_bridge_timings default_dac_timings = { + /* Timing specifications, datasheet page 7 */ + .sampling_edge = DRM_BUS_FLAG_PIXDATA_POSEDGE, + .setup_time_ps = 500, + .hold_time_ps = 1500, +}; + +/* + * Information taken from the THS8134, THS8134A, THS8134B datasheet named + * "SLVS205D", dated May 1990, revised March 2000. + */ +static const struct drm_bridge_timings ti_ths8134_dac_timings = { + /* From timing diagram, datasheet page 9 */ + .sampling_edge = DRM_BUS_FLAG_PIXDATA_POSEDGE, + /* From datasheet, page 12 */ + .setup_time_ps = 3000, + /* I guess this means latched input */ + .hold_time_ps = 0, +}; + +/* + * Information taken from the THS8135 datasheet named "SLAS343B", dated + * May 2001, revised April 2013. + */ +static const struct drm_bridge_timings ti_ths8135_dac_timings = { + /* From timing diagram, datasheet page 14 */ + .sampling_edge = DRM_BUS_FLAG_PIXDATA_POSEDGE, + /* From datasheet, page 16 */ + .setup_time_ps = 2000, + .hold_time_ps = 500, +}; + static const struct of_device_id dumb_vga_match[] = { - { .compatible = "dumb-vga-dac" }, - { .compatible = "adi,adv7123" }, - { .compatible = "ti,ths8135" }, + { + .compatible = "dumb-vga-dac", + .data = NULL, + }, + { + .compatible = "adi,adv7123", + .data = &default_dac_timings, + }, + { + .compatible = "ti,ths8135", + .data = &ti_ths8135_dac_timings, + }, + { + .compatible = "ti,ths8134", + .data = &ti_ths8134_dac_timings, + }, {}, }; MODULE_DEVICE_TABLE(of, dumb_vga_match); -- 2.14.3 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH 2/4 v6] drm/bridge: Provide a way to embed timing info in bridges
After some discussion and failed patch sets trying to convey the right timing information between the display engine and a bridge using the connector, I try instead to use an optional timing information container in the bridge itself, so that display engines can retrieve it from any bridge and use it to determine how to drive outputs. Signed-off-by: Linus Walleij --- ChangeLog v5->v6: - Sort forward struct declarations alphabetically - Switch to using DRM_BUS_FLAG_PIXDATA_[POS|NEG]EDGE to indicate positive or negatice clock samling edge ChangeLog ->v5: - New patch --- include/drm/drm_bridge.h | 21 + 1 file changed, 21 insertions(+) diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index 682d01ba920c..28c9ac6d9036 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -29,6 +29,7 @@ #include struct drm_bridge; +struct drm_bridge_timings; struct drm_panel; /** @@ -222,6 +223,23 @@ struct drm_bridge_funcs { void (*enable)(struct drm_bridge *bridge); }; +/** + * struct drm_bridge_timings - timing information for the bridge + * @sampling_edge: whether the bridge samples the digital input signal from the + * display engine on the positive or negative edge of the clock, this should + * reuse the DRM_BUS_FLAG_PIXDATA_[POS|NEG]EDGE bitwise flags from the DRM + * connector (bit 2 and 3 valid) + * @setup_time_ps: the time in picoseconds the input data lines must be stable + * before the clock edge + * @hold_time_ps: the time in picoseconds taken for the bridge to sample the + * input signal after the clock edge + */ +struct drm_bridge_timings { + u32 sampling_edge; + u32 setup_time_ps; + u32 hold_time_ps; +}; + /** * struct drm_bridge - central DRM bridge control structure * @dev: DRM device this bridge belongs to @@ -229,6 +247,8 @@ struct drm_bridge_funcs { * @next: the next bridge in the encoder chain * @of_node: device node pointer to the bridge * @list: to keep track of all added bridges + * @timings: the timing specification for the bridge, if any (may + * be NULL) * @funcs: control functions * @driver_private: pointer to the bridge driver's internal context */ @@ -240,6 +260,7 @@ struct drm_bridge { struct device_node *of_node; #endif struct list_head list; + const struct drm_bridge_timings *timings; const struct drm_bridge_funcs *funcs; void *driver_private; -- 2.14.3 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/vmwgfx: Potential off by one in vmw_view_add()
Hi! On 01/10/2018 10:40 AM, Dan Carpenter wrote: The vmw_view_cmd_to_type() function returns vmw_view_max (3) on error. It's one element beyond the end of the vmw_view_cotables[] table. My read on this is that it's possible to hit this failure. header->id comes from vmw_cmd_check() and it's a user controlled number between 1040 and 1225 so we can hit that error. But I don't have the hardware to test this code. Fixes: d80efd5cb3de ("drm/vmwgfx: Initial DX support") Signed-off-by: Dan Carpenter diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c index b700667f6f0b..c9d5cc237124 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c @@ -2731,6 +2731,8 @@ static int vmw_cmd_dx_view_define(struct vmw_private *dev_priv, } view_type = vmw_view_cmd_to_type(header->id); + if (view_type == vmw_view_max) + return -EINVAL; cmd = container_of(header, typeof(*cmd), header); ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, user_surface_converter, ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel This looks correct to me. I'll queue this for a -fixes pull. Thanks. Reviewed-by: Thomas Hellstrom ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 2/2] drm/bridge/synopsys: dsi: handle endianness correctly in dw_mipi_dsi_write()
On 09.01.2018 21:32, Brian Norris wrote: > We're filling the "remainder" word with little-endian data, then writing > it out to IO registers with endian-correcting writel(). That probably > won't work on big-endian systems. > > Let's mark the "remainder" variable as LE32 (since we fill it with > memcpy()) and do the swapping explicitly. > > Some of this function could be done more easily without memcpy(), but > the unaligned "remainder" case is a little hard to do without > potentially overrunning 'tx_buf', so I just applied the same solution in > all cases (memcpy() + le32_to_cpu()). > > Tested only on a little-endian system. > > Signed-off-by: Brian Norris > --- > drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 18 +- > 1 file changed, 9 insertions(+), 9 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > index ed91e32ee43a..90f13df6f106 100644 > --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > @@ -360,18 +360,18 @@ static int dw_mipi_dsi_write(struct dw_mipi_dsi *dsi, > { > const u8 *tx_buf = packet->payload; > int len = packet->payload_length, pld_data_bytes = sizeof(u32), ret; > - u32 remainder; > + __le32 word; > u32 val; > > while (len) { > if (len < pld_data_bytes) { > - remainder = 0; > - memcpy(&remainder, tx_buf, len); > - dsi_write(dsi, DSI_GEN_PLD_DATA, remainder); > + word = 0; > + memcpy(&word, tx_buf, len); > + dsi_write(dsi, DSI_GEN_PLD_DATA, le32_to_cpu(word)); > len = 0; > } else { > - memcpy(&remainder, tx_buf, pld_data_bytes); > - dsi_write(dsi, DSI_GEN_PLD_DATA, remainder); > + memcpy(&word, tx_buf, pld_data_bytes); > + dsi_write(dsi, DSI_GEN_PLD_DATA, le32_to_cpu(word)); > tx_buf += pld_data_bytes; > len -= pld_data_bytes; > } > @@ -386,9 +386,9 @@ static int dw_mipi_dsi_write(struct dw_mipi_dsi *dsi, > } > } > > - remainder = 0; > - memcpy(&remainder, packet->header, sizeof(packet->header)); > - return dw_mipi_dsi_gen_pkt_hdr_write(dsi, remainder); > + word = 0; > + memcpy(&word, packet->header, sizeof(packet->header)); > + return dw_mipi_dsi_gen_pkt_hdr_write(dsi, le32_to_cpu(word)); You could create and use appropriate helper, lets say: u32 le_to_cpup(const u8 *p, int count) { __le32 r = 0; memcpy(&r, p, count); return le32_to_cpu(r); } With or without this change: Reviewed-by: Andrzej Hajda -- Regards Andrzej > } > > static ssize_t dw_mipi_dsi_host_transfer(struct mipi_dsi_host *host, ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
On 2017-12-20 12:54, Jarkko Nikula wrote: > On Wed, Dec 20, 2017 at 10:32:11AM +0100, Greg Kroah-Hartman wrote: >> On Wed, Dec 20, 2017 at 01:24:44AM -0800, Joe Perches wrote: >>> On Wed, 2017-12-20 at 10:34 +0200, Jarkko Nikula wrote: On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote: > Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible. >>> [] > diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c >>> [] > @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev, > return size; > } > > -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, > dma_op_mode_store); > +static DEVICE_ATTR_RW(dma_op_mode); > While I can ack this part here if it helps generic cleanup effort I don't understart would it improve code readability in general? Mode 644 is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go through all of these files in order to see what does it mean: >> >> Yeah, 644 is "clear", but _RW() is even more clear. Ideally I want to >> get rid of all of the "non-standard" users that set random modes of >> sysfs files, as we get it wrong too many times. Using the "defaults" is >> much better. >> > Fair enough. For the sound/soc/omap/ (Acked-by was missing from my > previous reply): > > Acked-by: Jarkko Nikula And from me to the same file (sound/soc/omap/mcbsp.c): Acked-by: Peter Ujfalusi - Péter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/4 v6] drm/bridge: Provide a way to embed timing info in bridges
On Wed, Jan 10, 2018 at 03:12:24PM +0100, Linus Walleij wrote: > After some discussion and failed patch sets trying to convey > the right timing information between the display engine and > a bridge using the connector, I try instead to use an optional > timing information container in the bridge itself, so that > display engines can retrieve it from any bridge and use it to > determine how to drive outputs. > > Signed-off-by: Linus Walleij > --- > ChangeLog v5->v6: > - Sort forward struct declarations alphabetically > - Switch to using DRM_BUS_FLAG_PIXDATA_[POS|NEG]EDGE to indicate > positive or negatice clock samling edge > ChangeLog ->v5: > - New patch > --- > include/drm/drm_bridge.h | 21 + > 1 file changed, 21 insertions(+) > > diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h > index 682d01ba920c..28c9ac6d9036 100644 > --- a/include/drm/drm_bridge.h > +++ b/include/drm/drm_bridge.h > @@ -29,6 +29,7 @@ > #include > > struct drm_bridge; > +struct drm_bridge_timings; > struct drm_panel; > > /** > @@ -222,6 +223,23 @@ struct drm_bridge_funcs { > void (*enable)(struct drm_bridge *bridge); > }; > > +/** > + * struct drm_bridge_timings - timing information for the bridge > + * @sampling_edge: whether the bridge samples the digital input signal from > the > + * display engine on the positive or negative edge of the clock, this should > + * reuse the DRM_BUS_FLAG_PIXDATA_[POS|NEG]EDGE bitwise flags from the DRM > + * connector (bit 2 and 3 valid) > + * @setup_time_ps: the time in picoseconds the input data lines must be > stable > + * before the clock edge > + * @hold_time_ps: the time in picoseconds taken for the bridge to sample the > + * input signal after the clock edge > + */ Just a style nit: for longer kerneldoc comments for struct members the in-line style, split up for each member, is imo better. -Daniel > +struct drm_bridge_timings { > + u32 sampling_edge; > + u32 setup_time_ps; > + u32 hold_time_ps; > +}; > + > /** > * struct drm_bridge - central DRM bridge control structure > * @dev: DRM device this bridge belongs to > @@ -229,6 +247,8 @@ struct drm_bridge_funcs { > * @next: the next bridge in the encoder chain > * @of_node: device node pointer to the bridge > * @list: to keep track of all added bridges > + * @timings: the timing specification for the bridge, if any (may > + * be NULL) > * @funcs: control functions > * @driver_private: pointer to the bridge driver's internal context > */ > @@ -240,6 +260,7 @@ struct drm_bridge { > struct device_node *of_node; > #endif > struct list_head list; > + const struct drm_bridge_timings *timings; > > const struct drm_bridge_funcs *funcs; > void *driver_private; > -- > 2.14.3 > > ___ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
RE: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse
OK. I'll do it. Samuel Li > -Original Message- > From: Daniel Vetter [mailto:daniel.vet...@ffwll.ch] On Behalf Of Daniel > Vetter > Sent: Wednesday, January 10, 2018 3:17 AM > To: Alex Deucher > Cc: Deucher, Alexander ; Li, Samuel > ; Daniel Vetter ; Koenig, Christian > ; dri-devel@lists.freedesktop.org; amd- > g...@lists.freedesktop.org > Subject: Re: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to reuse > > On Tue, Jan 09, 2018 at 01:13:08PM -0500, Alex Deucher wrote: > > On Tue, Jan 9, 2018 at 10:56 AM, Deucher, Alexander > > wrote: > > > I'll can push this and a few other misc patches today. > > > > > > > Pushed to drm-misc-next. > > One thing I just noticed: Some kerneldoc for the newly exported functions > and maybe a small update to the intro section to explain what to do with this > would be neat. > -Daniel > > > > > Thanks, > > > > Alex > > > > > > > > > > Alex > > > > > > From: amd-gfx on behalf of > > > Li, Samuel > > > Sent: Tuesday, January 9, 2018 10:20 AM > > > To: Daniel Vetter; Koenig, Christian > > > Cc: amd-...@lists.freedesktop.org; dri-devel@lists.freedesktop.org > > > Subject: RE: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to > > > reuse > > > > > > Yes, please hush this for me. > > > > > > Regards, > > > Samuel Li > > > > > > > > >> -Original Message- > > >> From: Daniel Vetter [mailto:daniel.vet...@ffwll.ch] On Behalf Of > > >> Daniel Vetter > > >> Sent: Tuesday, January 09, 2018 4:22 AM > > >> To: Koenig, Christian > > >> Cc: Li, Samuel ; > > >> dri-devel@lists.freedesktop.org; amd- g...@lists.freedesktop.org > > >> Subject: Re: [PATCH 2/3] drm: export gem dmabuf_ops for drivers to > > >> reuse > > >> > > >> On Fri, Jan 05, 2018 at 10:16:04AM +0100, Christian König wrote: > > >> > Am 04.01.2018 um 22:12 schrieb Samuel Li: > > >> > > Change-Id: I03c22a890d2305f3243d88019d1a28bddd4ddda7 > > >> > > Signed-off-by: Samuel Li > > >> > > > >> > Reviewed-by: Christian König > > >> > > >> Want to push to drm-misc or some other plan with this? > > >> -Daniel > > >> > > >> > > > >> > > --- > > >> > > drivers/gpu/drm/drm_prime.c | 53 > > >> > > ++--- > > >> > > >> > > include/drm/drm_prime.h | 22 +++ > > >> > > 2 files changed, 53 insertions(+), 22 deletions(-) > > >> > > > > >> > > diff --git a/drivers/gpu/drm/drm_prime.c > > >> > > b/drivers/gpu/drm/drm_prime.c index 8de93a2..68a69e9 100644 > > >> > > --- a/drivers/gpu/drm/drm_prime.c > > >> > > +++ b/drivers/gpu/drm/drm_prime.c > > >> > > @@ -180,9 +180,8 @@ static int > > >> > > drm_prime_lookup_buf_handle(struct > > >> drm_prime_file_private *prime_fpri > > >> > >return -ENOENT; > > >> > > } > > >> > > -static int drm_gem_map_attach(struct dma_buf *dma_buf, > > >> > > - struct device *target_dev, > > >> > > - struct dma_buf_attachment *attach) > > >> > > +int drm_gem_map_attach(struct dma_buf *dma_buf, struct > device > > >> *target_dev, > > >> > > +struct dma_buf_attachment *attach) > > >> > > { > > >> > >struct drm_prime_attachment *prime_attach; > > >> > >struct drm_gem_object *obj = dma_buf->priv; @@ -200,9 > > >> > > +199,10 > > >> @@ > > >> > > static int drm_gem_map_attach(struct dma_buf *dma_buf, > > >> > >return dev->driver->gem_prime_pin(obj); > > >> > > } > > >> > > +EXPORT_SYMBOL(drm_gem_map_attach); > > >> > > -static void drm_gem_map_detach(struct dma_buf *dma_buf, > > >> > > -struct dma_buf_attachment *attach) > > >> > > +void drm_gem_map_detach(struct dma_buf *dma_buf, > > >> > > + struct dma_buf_attachment *attach) > > >> > > { > > >> > >struct drm_prime_attachment *prime_attach = attach->priv; > > >> > >struct drm_gem_object *obj = dma_buf->priv; @@ -227,6 +227,7 > > >> @@ > > >> > > static void drm_gem_map_detach(struct dma_buf *dma_buf, > > >> > >kfree(prime_attach); > > >> > >attach->priv = NULL; > > >> > > } > > >> > > +EXPORT_SYMBOL(drm_gem_map_detach); > > >> > > void drm_prime_remove_buf_handle_locked(struct > > >> drm_prime_file_private *prime_fpriv, > > >> > >struct dma_buf *dma_buf) @@ > > >> > > -253,8 +254,8 @@ void > > >> drm_prime_remove_buf_handle_locked(struct > drm_prime_file_private > > >> *prime_fpr > > >> > >} > > >> > > } > > >> > > -static struct sg_table *drm_gem_map_dma_buf(struct > > >> dma_buf_attachment *attach, > > >> > > - enum dma_data_direction dir) > > >> > > +struct sg_table *drm_gem_map_dma_buf(struct > dma_buf_attachment > > >> *attach, > > >> > > + enum dma_data_direction dir) > > >> > > { > > >> > >struct drm_prime_attachment *prime_attach = attach->priv; > > >> > >struct drm_gem_object *obj = attach->dmabuf->priv; @@ > > >> > > -289,13 > > >> > > +290,15 @@ static struct sg_table *drm_ge
Re: AMD DC test results
On Thu, Dec 21, 2017 at 1:45 PM, Daniel Drake wrote: > Hi, Hi again, in Endless we are still actively working with DC on several laptops, so I just wanted to give you a quick update regarding the regressions indicated in Daniel's email. > 1. System hangs on S3 resume. > Bug can't be reproduced when booting with amdgpu.dc=0 > Also reproduced with DC on Linus master (4.15-rc), but appears fixed > on agd5f/amd-staging-drm-next > https://bugs.freedesktop.org/show_bug.cgi?id=104281 This keeps being an issue. Unfortunately (as stated in the bug report) this problem is still reproducible on the agd5f/amd-staging-drm-next branch (tested it today with HEAD at 95b5f44) even though the frequency is not high (maybe 1/10 suspends or less). In the bug report you can find the dmesg log if interested. > 2. Display corruption when using multiple displays > Bug can't be reproduced when booting with amdgpu.dc=0 > Also reproduced with DC on Linus master (4.15-rc), but appears fixed > on agd5f/amd-staging-drm-next > https://bugs.freedesktop.org/show_bug.cgi?id=104319 I was able to bisect this problem down to 1 specific commit (see [0]). > 3. HDMI audio device still shown as present and active even after > disconnecting HDMI cable > Bug can't be reproduced when booting with amdgpu.dc=0 > Appears fixed with DC on Linus master (4.15-rc). This was indeed fixed in on Linus master. Thank you very much for the DC work! Cheers, [0] https://www.spinics.net/lists/dri-devel/msg161258.html -- Carlo Caione | +44.7384.69.16.04 | Endless ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/vc4: Fix NULL pointer dereference in vc4_save_hang_state()
When saving BOs in the hang state we skip one entry of the kernel_state->bo[] array, thus leaving it to NULL. This leads to a NULL pointer dereference when, later in this function, we iterate over all BOs to check their ->madv state. Fixes: ca26d28bbaa3 ("drm/vc4: improve throughput by pipelining binning and rendering jobs") Cc: Signed-off-by: Boris Brezillon --- drivers/gpu/drm/vc4/vc4_gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c index 6c32c89a83a9..19ac7fe0e5db 100644 --- a/drivers/gpu/drm/vc4/vc4_gem.c +++ b/drivers/gpu/drm/vc4/vc4_gem.c @@ -208,7 +208,7 @@ vc4_save_hang_state(struct drm_device *dev) kernel_state->bo[j + prev_idx] = &bo->base.base; j++; } - prev_idx = j + 1; + prev_idx = j; } if (exec[0]) -- 2.11.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[git pull] vmwgfx-fixes-4.15
Dave, Two important fixes for vmwgfx. The off-by-one fix could cause a malicious user to potentially crash the kernel. The framebuffer map cache fix can under some circumstances enable a user to read from or write to freed pages. The following changes since commit b0bb222440a5c8273f67dd37946707e6ba6ad832: Merge branch 'linux-4.15' of git://github.com/skeggsb/linux into drm-fixes (2018-01-09 12:03:10 +1000) are available in the git repository at: git://people.freedesktop.org/~thomash/linux vmwgfx-fixes-4.15 for you to fetch changes up to 0d9cac0ca0429830c40fe1a4e50e60f6221fd7b6: drm/vmwgfx: Potential off by one in vmw_view_add() (2018-01-10 15:21:39 +0100) Dan Carpenter (1): drm/vmwgfx: Potential off by one in vmw_view_add() Thomas Hellstrom (1): drm/vmwgfx: Don't cache framebuffer maps drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 2 ++ drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 6 - drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c| 41 ++--- 4 files changed, 15 insertions(+), 36 deletions(-) ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: next/master build: 198 builds: 1 failed, 197 passed, 1 error, 148 warnings (next-20180110)
On Wed, Jan 10, 2018 at 7:59 AM, kernelci.org bot wrote: > > next/master build: 198 builds: 1 failed, 197 passed, 1 error, 148 warnings > (next-20180110) > > Errors summary: > 1 drivers/perf/arm_dsu_pmu.c:661:2: error: implicit declaration of function > 'bitmap_from_u32array' [-Werror=implicit-function-declaration] I sent a patch, waiting for it to get merged > Warnings summary: > 1 arch/x86/kvm/mmu.c:5485:2: warning: ignoring return value of > 'register_shrinker', declared with attribute warn_unused_result > [-Wunused-result] I have a patch for this, will send after some more testing. > 14 drivers/gpu/drm/ttm/ttm_page_alloc_dma.c:1186:2: warning: ignoring return > value of 'register_shrinker', declared with attribute warn_unused_result > [-Wunused-result] > 14 drivers/gpu/drm/ttm/ttm_page_alloc.c:485:2: warning: ignoring return value > of 'register_shrinker', declared with attribute warn_unused_result > [-Wunused-result] ttm and kvm are now the last user of register_shrinker that doesn't propagate the return code to its caller, all other callers got fixed in one way or another. I tried to fix this one too, but couldn't come up with a proper way of unwinding both kobject_init_and_add() and ttm_pool_mm_shrink_init(): ret = kobject_init_and_add(&_manager->kobj, &ttm_pool_kobj_type, &glob->kobj, "pool"); if (unlikely(ret != 0)) { kobject_put(&_manager->kobj); _manager = NULL; return ret; } ttm_pool_mm_shrink_init(_manager); Calling kobject_put() after a failed kobject_init_and_add() seemed wrong, and it also appears to be missing a kfree(), so I didn't want to mess it up any further. Added a few people to Cc that touched this file most, maybe one of them can have a look, or they already have a patch waiting to get merged. > 4 WARNING: modpost: missing MODULE_LICENSE() in net/9p/9pnet_xen.o > 4 WARNING: modpost: missing MODULE_LICENSE() in > drivers/auxdisplay/img-ascii-lcd.o Patches for these two got posted a while ago but never picked up. I've merged those into my tree, and plan to forward them to Andrew Morton. > 3 WARNING: modpost: missing MODULE_LICENSE() in > sound/soc/ux500/snd-soc-ux500-plat-dma.o > 3 WARNING: modpost: missing MODULE_LICENSE() in > sound/soc/ux500/snd-soc-ux500-mach-mop500.o > 3 WARNING: modpost: missing MODULE_LICENSE() in > drivers/video/fbdev/mmp/mmp_disp.o > 2 WARNING: modpost: missing MODULE_LICENSE() in > drivers/phy/qualcomm/phy-qcom-ufs.o > 2 WARNING: modpost: missing MODULE_LICENSE() in > drivers/net/ethernet/cirrus/cs89x0.o > 2 WARNING: modpost: missing MODULE_LICENSE() in arch/arm/mach-pxa/tosa-bt.o > 2 WARNING: modpost: missing MODULE_LICENSE() in > arch/arm/common/bL_switcher_dummy_if.o I made patches for these now, will send them in a bit. > 7 arch/arm/boot/dts/spear1340-evb.dtb: Warning (dmas_property): Property > 'dmas', cell 4 is not a phandle reference in /ahb/apb/serial@b410 > 7 arch/arm/boot/dts/spear1340-evb.dtb: Warning (dmas_property): Missing > property '#dma-cells' in node /interrupt-controller@ec801000 or bad phandle > (referred from /ahb/apb/serial@b410:dmas[4]) > 7 arch/arm/boot/dts/spear1310-evb.dtb: Warning (gpios_property): Property > 'cs-gpios', cell 6 is not a phandle reference in /ahb/apb/spi@e010 > 7 arch/arm/boot/dts/spear1310-evb.dtb: Warning (gpios_property): Missing > property '#gpio-cells' in node /interrupt-controller@ec801000 or bad phandle > (referred from /ahb/apb/spi@e010:cs-gpios[6]) > 2 arch/arm/boot/dts/spear600-evb.dtb: Warning (interrupts_property): Missing > interrupt-parent for /ahb/apb/rtc@fc90 Viresh, could you have a look here? > 2 arch/arm/boot/dts/ste-nomadik-s8815.dtb: Warning (interrupts_property): > Missing interrupt-parent for /amba/clcd@1012 > 2 arch/arm/boot/dts/ste-nomadik-nhk15.dtb: Warning (interrupts_property): > Missing interrupt-parent for /amba/clcd@1012 Linus, can you look at this? I don't know which interrupt-parent is the right one here, maybe you can find out from the hardware or some documentation you have. > 2 arch/arm/boot/dts/lpc3250-phy3250.dtb: Warning (gpios_property): reset-gpio > property size (12) too small for cell size 3 in > /ahb/apb/i2c@400A/uda1380@18 > 2 arch/arm/boot/dts/lpc3250-phy3250.dtb: Warning (gpios_property): power-gpio > property size (12) too small for cell size 3 in > /ahb/apb/i2c@400A/uda1380@18 > 2 arch/arm/boot/dts/lpc3250-ea3250.dtb: Warning (gpios_property): reset-gpio > property size (12) too small for cell size 3 in > /ahb/apb/i2c@400A/uda1380@18 > 2 arch/arm/boot/d
Re: next/master build: 198 builds: 1 failed, 197 passed, 1 error, 148 warnings (next-20180110)
Hi Arnd, Am 10.01.2018 um 16:45 schrieb Arnd Bergmann: 14 drivers/gpu/drm/ttm/ttm_page_alloc_dma.c:1186:2: warning: ignoring return value of 'register_shrinker', declared with attribute warn_unused_result [-Wunused-result] 14 drivers/gpu/drm/ttm/ttm_page_alloc.c:485:2: warning: ignoring return value of 'register_shrinker', declared with attribute warn_unused_result [-Wunused-result] ttm and kvm are now the last user of register_shrinker that doesn't propagate the return code to its caller, all other callers got fixed in one way or another. I tried to fix this one too, but couldn't come up with a proper way of unwinding both kobject_init_and_add() and ttm_pool_mm_shrink_init(): ret = kobject_init_and_add(&_manager->kobj, &ttm_pool_kobj_type, &glob->kobj, "pool"); if (unlikely(ret != 0)) { kobject_put(&_manager->kobj); _manager = NULL; return ret; } ttm_pool_mm_shrink_init(_manager); Calling kobject_put() after a failed kobject_init_and_add() seemed wrong, and it also appears to be missing a kfree(), so I didn't want to mess it up any further. Added a few people to Cc that touched this file most, maybe one of them can have a look, or they already have a patch waiting to get merged. That isn't urgent, isn't it? So I would say I put it on my TODO list and I'm going to take care of it no later than 4.17. Otherwise Roger or me could take a look tomorrow. Regards, Christian. ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] drm/panel: lvds: Handle the optional regulator case properly
The devm_regulator_get_optional function, unlike it was assumed in the commit a1c55bccf600 ("drm/panel: lvds: Add support for the power-supply property"), is actually returning an error pointer with -ENODEV instead of NULL when there's no regulator to find. Make sure we handle that case properly. Fixes: a1c55bccf600 ("drm/panel: lvds: Add support for the power-supply property") Signed-off-by: Maxime Ripard --- drivers/gpu/drm/panel/panel-lvds.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c index 57e38a9e7ab4..9f46e7095c0e 100644 --- a/drivers/gpu/drm/panel/panel-lvds.c +++ b/drivers/gpu/drm/panel/panel-lvds.c @@ -215,8 +215,13 @@ static int panel_lvds_probe(struct platform_device *pdev) lvds->supply = devm_regulator_get_optional(lvds->dev, "power"); if (IS_ERR(lvds->supply)) { ret = PTR_ERR(lvds->supply); - dev_err(lvds->dev, "failed to request regulator: %d\n", ret); - return ret; + + if (ret != -ENODEV) { + dev_err(lvds->dev, "failed to request regulator: %d\n", ret); + return ret; + } else { + lvds->supply = NULL; + } } /* Get GPIOs and backlight controller. */ -- 2.14.3 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: next/master build: 198 builds: 1 failed, 197 passed, 1 error, 148 warnings (next-20180110)
On Wed, Jan 10, 2018 at 4:54 PM, Christian König wrote: > Hi Arnd, > > Am 10.01.2018 um 16:45 schrieb Arnd Bergmann: >>> >>> 14 drivers/gpu/drm/ttm/ttm_page_alloc_dma.c:1186:2: warning: ignoring >>> return value of 'register_shrinker', declared with attribute >>> warn_unused_result [-Wunused-result] >>> 14 drivers/gpu/drm/ttm/ttm_page_alloc.c:485:2: warning: ignoring return >>> value of 'register_shrinker', declared with attribute warn_unused_result >>> [-Wunused-result] >> >> ttm and kvm are now the last user of register_shrinker that doesn't >> propagate the return code to its >> caller, all other callers got fixed in one way or another. >> >> I tried to fix this one too, but couldn't come up with a proper way of >> unwinding both >> kobject_init_and_add() and ttm_pool_mm_shrink_init(): >> >> ret = kobject_init_and_add(&_manager->kobj, &ttm_pool_kobj_type, >> &glob->kobj, "pool"); >> if (unlikely(ret != 0)) { >> kobject_put(&_manager->kobj); >> _manager = NULL; >> return ret; >> } >> >> ttm_pool_mm_shrink_init(_manager); >> >> Calling kobject_put() after a failed kobject_init_and_add() seemed wrong, >> and it also appears to be missing a kfree(), so I didn't want to mess it >> up any further. Added a few people to Cc that touched this file most, >> maybe one of them can have a look, or they already have a patch waiting >> to get merged. > > > That isn't urgent, isn't it? So I would say I put it on my TODO list and I'm > going to take care of it no later than 4.17. > > Otherwise Roger or me could take a look tomorrow. My understanding is that the warning will be in 4.16, so the fix should be as well, if only to get a clean build again. There were around a dozen such warnings when the warn_unused_result got added, but the others are all fixed in linux-next. This is how the flag got added: commit 64067c5cbfa24a2202b92e8fda7323610cad3043 Author: Tetsuo Handa Date: Fri Jan 5 13:25:45 2018 +1100 mm,vmscan: mark register_shrinker() as __must_check There are users not checking for register_shrinker() failure. Continuing with ignoring failure can lead to later oops at unregister_shrinker(). Link: http://lkml.kernel.org/r/1511265757-15563-1-git-send-email-penguin-ker...@i-love.sakura.ne.jp Signed-off-by: Tetsuo Handa Arnd ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v5] drm/omap: plane zpos/zorder management improvements
On 01/09/2018 04:40 PM, Daniel Vetter wrote: > On Tue, Jan 09, 2018 at 04:18:48PM +0200, Peter Ujfalusi wrote: >> Hi, >> >> On 2018-01-09 14:44, Daniel Vetter wrote: Changes since v4: - further simplify the zpos checking by using a mask and a single loop - Commit message has been extended Changes since v3: - Use drm_plane_index() instead of storing the same index wothin omap_plane struct - Optimize the zpos validation loop so we avoid extra checks. Changes since v2: - The check for duplicate zpos is moved to omap_crtc Changes since v1: - Dropped the zpos normalization related patches - New patch based on the discussion, see commit message. >>> >>> Sorry for jumping in late to the party, but except when you have a really, >>> really, really good reason for why omapdrm has to not normalize zpos like >>> the other drivers do in this case, then I think we should be consistent. >>> >>> An inconsistent kms uapi is a lot worse than an uapi with some design >>> issues: The latter just means we eventually need v2, the former guarantees >>> we need v2. >> >> Even if the v2 contains the "drm/blend: Account also the primary plane >> of the crtc for normalized_zpos"? >> It is to ensure that the crtc->primary plane is going to have zpos = 0, >> even if it's plane_id is higher. > > It's a bit a hack, but imo makes sense, given where we are with uapi.> Except > it sounds like we have more bikesheds going on about what exactly > zpos is supposed to do. As https://dri.freedesktop.org/docs/drm/gpu/drm-kms.html have this to say about zpos: "priority of the given plane on crtc (optional) Note that multiple active planes on the same crtc can have an identical zpos value. The rule to solving the conflict is to compare the plane object IDs; the plane with a higher ID must be stacked on top of a plane with a lower ID." It implies that the driver should not try to be clever about the normalization of the zpos. Even if it make sense. Considering only crtc->primary is a bit flowed anyway as for the sake of completeness the crtc->cursor plane should have been kept on top at the same time. >> As it was discussed we have use case when we have two (or more) crtcs, >> each with one plane (they are the primary planes for the given crtc) and >> user moves one of the plane from one crtc to another, where it is no >> longer the primary plane, but still holds zpos = 0. >> >> In this case we prefer to keep the actual primary plane of the crtc at >> the bottom and stack the new planes on top. > > Yeah that all sounds reasonable. Or we state that userspace in that case > better readjust zpos to make it non-ambiguous. Or something else. > > Just something that's consistent across drivers. I'm totally fine with > "organically grown uapi with lots of cruds and hacks". I'm fine with using the current normalization as it is and refer to the UAPI doc if user space is not complying with it. But then, should the normalization be forced in the core for all drivers to get consistency? > -Daniel > >> >>> Thanks, Daniel -- Péter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH] video: fbdev/mmp: add MODULE_LICENSE
Kbuild complains about the lack of a license tag in this driver: WARNING: modpost: missing MODULE_LICENSE() in drivers/video/fbdev/mmp/mmp_disp.o This adds the license, author and description tags. Signed-off-by: Arnd Bergmann --- drivers/video/fbdev/mmp/core.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/video/fbdev/mmp/core.c b/drivers/video/fbdev/mmp/core.c index a0f496049db7..3a6bb6561ba0 100644 --- a/drivers/video/fbdev/mmp/core.c +++ b/drivers/video/fbdev/mmp/core.c @@ -23,6 +23,7 @@ #include #include #include +#include #include static struct mmp_overlay *path_get_overlay(struct mmp_path *path, @@ -249,3 +250,7 @@ void mmp_unregister_path(struct mmp_path *path) mutex_unlock(&disp_lock); } EXPORT_SYMBOL_GPL(mmp_unregister_path); + +MODULE_AUTHOR("Zhou Zhu "); +MODULE_DESCRIPTION("Marvell MMP display framework"); +MODULE_LICENSE("GPL"); -- 2.9.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 104306] Mesa 17.3 breaks Firefox and other Xwayland apps on AMD HD7750
https://bugs.freedesktop.org/show_bug.cgi?id=104306 --- Comment #14 from eric vz --- Thanks, Michel. On a hanging call to glxinfo, dri2_validate_usage is being called from gbm_dri_bo_import, which gets parameters of a 100x100 FD image buffer for usage 5 (scanout | rendering). However, the image texture winds up with is_displayable = 0, so si_check_resource_capabilities returns false, gbm_dri_bo_import destroys the image, and glxinfo hangs. I confirmed that if I set variable usage = 0 the problem does not occur. I have not yet been able to trace where the texture flags are set, but I got far enough to find that they're being read from the image buffer as metadata. However, it occurs to me that as a newcomer to the domain (e.g., I had to google what a scanout is), I don't know the real problem: * Should usage include scanout? * Should the image metadata include is_displayable? * Should the null return from gbm_dri_bo_import cause the caller to hang? Either point 1 or point 2 seems like it must be wrong, and might be the easiest fix. Point 1 seems the stronger case, since glxinfo doesn't actually draw anything as far as I'm aware. Since Firefox, Chromium, and other apps also seem to fail on this, I'm expecting to find some kind of common initialization code that does it. Will report back when I get time to dig. Or, if anyone knows better than I do which avenue to pursue, I'm happy to be redirected. I don't expect to have time to look at this until the weekend. -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [RFC v2 6/8] drm: Handle fbdev emulation in core
Den 09.01.2018 11.38, skrev Daniel Vetter: On Wed, Jan 03, 2018 at 11:21:08PM +0100, Noralf Trønnes wrote: Prepare for generic fbdev emulation by letting DRM core work directly with the fbdev compatibility layer. This is done by adding new fbdev helper vtable callbacks for restore, hotplug_event, unregister and release. Signed-off-by: Noralf Trønnes No clue whether my idea is any good, but inspired by the bootsplash discussion, and the prospect that we might get other in-kernel drm/kms clients I'm wondering whether we should make this a bit more generic and tie it to drm_file? The idea would be to have a list of internal drm clients by putting all the internal drm_files onto a list (same way we do with the userspace ones). Then we'd just walk that list and call ->hotplug, ->unregister and ->release at the right places. ->restore would be a bit different, I guess for that we'd only call the ->restore callback of the very first kernel-internal client. With that we could then add/remove kernel-internal drm clients like normal userspace clients, which should make integration of emergency consoles, boot splashes and whatever else real easy. And I think it would be a lot cleaner than leaking fb_helper knowledge into the drm core, which feels a rather backwards. Otoh that feels a bit overengineered (but at least it shouldn't be a lot more code really). If the list is too much work we could start with 1 drm_file * pointer for internal stuff (but would still need locking, so list_head is probably easier). Thoughts? I prefer to have a proper in-kernel client API from the get go, instead of fixing it up later. The reason I skipped spending time on it in this RFC, was that I didn't know if I was on the right track at the right time to get the necessary attention to make this dumb_buffer idea happen. With a drm_file centric approach, are you thinking something like this: struct drm_device { + struct list_head filelist_internal; }; +struct drm_file_funcs { + int (*restore)(struct drm_file *file); + void (*hotplug)(struct drm_file *file); + void (*unregister)(struct drm_file *file); +}; struct drm_file { + struct drm_device *dev; + const struct drm_file_funcs *funcs; }; struct drm_file *drm_file_alloc(struct drm_minor *minor) { + file->dev = dev; } struct drm_file* drm_internal_open(struct drm_device *dev, const struct drm_file_funcs *funcs) struct drm_file *file; int ret; if (!try_module_get(dev->driver->fops->owner)) return ERR_PTR(-ENODEV); drm_dev_ref(dev); file = drm_file_alloc(dev); if (IS_ERR(file)) { drm_dev_unref(dev); module_put(dev->driver->fops->owner); return file; } file->funcs = funcs; mutex_lock(&dev->filelist_mutex); list_add(&file->lhead, &dev->filelist_internal); mutex_unlock(&dev->filelist_mutex); return file; } void drm_internal_release(struct drm_file *file) { struct drm_device *dev = file->dev; mutex_lock(&dev->filelist_mutex); list_del(&file->lhead); mutex_unlock(&dev->filelist_mutex); drm_file_free(file); drm_dev_unref(dev); module_put(dev->driver->fops->owner); } void drm_lastclose(struct drm_device *dev) { + mutex_lock(&dev->filelist_mutex); + list_for_each_entry(file, &dev->filelist_internal, lhead) { + if (file->funcs && file->funcs->restore && + !file->funcs->restore(file)) + break; + mutex_unlock(&dev->filelist_mutex); } void drm_kms_helper_hotplug_event(struct drm_device *dev) { + mutex_lock(&dev->filelist_mutex); + list_for_each_entry(file, &dev->filelist_internal, lhead) { + if (file->funcs && file->funcs->hotplug) + file->funcs->hotplug(file); + mutex_unlock(&dev->filelist_mutex); } How is locking done when .unregister will call into drm_internal_release()? void drm_dev_unregister(struct drm_device *dev) { + list_for_each_entry(file, &dev->filelist_internal, lhead) { + if (file->funcs && file->funcs->unregister) + file->funcs->unregister(file); } There is also the case where .unregister can't release the drm_file because userspace has mmap'ed the buffer (fbdev). The client holds a ref on drm_device so cleanup is stalled but that requires a driver that can handle that (ref the tinydrm unplug series which is awaiting a timeslot). amdgpu iterates dev->filelist in amdgpu_gem_force_release() and amdgpu_sched_process_priority_override(). I don't know if it needs to handle the internal ones as well. What's the rational for having separate lists for internal and userspace? There is one thing missing and that is notification of new drm_devices. The client iterates the available drm_devices on module init, but it needs a way to know about any later drm_device registrations. Noralf. -Daniel --- drivers/gpu/drm/drm_file.c | 12 +++- drivers/gpu/drm/drm_mode_config.c | 10 ++ d
Re: [PATCH 0/3] Meson build system
I forgot to CC you on this like you asked, Dylan Quoting Dylan Baker (2018-01-05 12:00:57) > This is a fifth iteration of the meson build system for libdrm. This > version is significantly cleaned up from the last version and uses a > style more like the build system in mesa. > > It builds all of the drivers and tests, and the tests can be run via > `ninja test`. > > It has support for being used as a wrapped dependency with ext_foo > variables (I have a branch of mesa that will build this code as a wrap, > which has also been useful for testing). This means it can be used to > build a mesa that requires a newer libdrm than the system provides > (which can be especially useful if you can't install packages on that > system), or to build libdrm support that your distro doesn't ship (like > arm only drivers on x86), cross compiling, and for testing. > > This has been build tested and mesa has been compiled against it, but > only minimal functional testing has been done, since I only have i965 > machines, and i965 only uses libdrm lightly. > > Some reviewers of the previous versions have done some additional > testing. > > Changes since v3: > - Fix freedreno kgsl check > - Fix kgls -> kgsl typo > - standardize meson options to use only `-` and not `_` > - fix typo radoen -> radeon > - add help messages to options > - fix typo in kms-universal-planes binary > - build and install modetest (this was missed in the first version for > some reason) > - install amdgpu.ids as 644 instead of 444 > > Changes since v4: > - Fix minor nits in options descriptions (Igor) > - Fix editorconfig settings > - Fix amdgpu.ids searh path > - Style nits for Eric E. > - Remove more tabs > - Ensure that 1/0 defines are always defined, instead of only when > their value is 1 > - Don't add header files into file lists. (Meson figures out header > dependencies automatically using graphs that the compiler generates > during compilation) > - Don't assign file lists to variables when possible. In a few cases > files need to be conditionally added, but if we're not in one of > those cases just put the lists directly in the exectuable or library > declaration. > > Dylan Baker (3): > Add meson build system > autotools: Include meson.build files in tarball > README: Add note about meson > > .editorconfig | 4 +- > Makefile.am | 30 ++- > README | 24 +- > amdgpu/.editorconfig| 4 +- > amdgpu/meson.build | 65 +++- > data/meson.build| 27 +++- > etnaviv/meson.build | 59 ++- > exynos/meson.build | 53 +- > freedreno/meson.build | 76 - > intel/meson.build | 105 +++- > libkms/meson.build | 74 - > man/meson.build | 67 +++- > meson.build | 364 +- > meson_options.txt | 143 +++- > nouveau/meson.build | 58 ++- > omap/meson.build| 53 +- > radeon/meson.build | 63 ++- > tegra/meson.build | 52 +- > tests/amdgpu/meson.build| 34 +++- > tests/etnaviv/meson.build | 45 +- > tests/exynos/meson.build| 54 +- > tests/kms/meson.build | 49 +- > tests/kmstest/meson.build | 30 +++- > tests/meson.build | 86 +- > tests/modeprint/meson.build | 29 +++- > tests/modetest/meson.build | 29 +++- > tests/nouveau/meson.build | 30 +++- > tests/proptest/meson.build | 28 +++- > tests/radeon/meson.build| 27 +++- > tests/tegra/meson.build | 27 +++- > tests/util/meson.build | 28 +++- > tests/vbltest/meson.build | 28 +++- > vc4/meson.build | 28 +++- > 33 files changed, 1869 insertions(+), 4 deletions(-) > create mode 100644 amdgpu/meson.build > create mode 100644 data/meson.build > create mode 100644 etnaviv/meson.build > create mode 100644 exynos/meson.build > create mode 100644 freedreno/meson.build > create mode 100644 intel/meson.build > create mode 100644 libkms/meson.build > create mode 100644 man/meson.build > create mode 100644 meson.build > create mode 100644 meson_options.txt > create mode 100644 nouveau/meson.build > create mode 100644 omap/meson.build > create mode 100644 radeon/meson.build > create mode 100644 tegra/meson.build > create mode 100644 tests/amdgpu/meson.build > create mode 100644 tests/etnaviv/meson.build > create mode 100644 tests/exynos/meson.build > create mode 100644 tests/kms/meson.build > create mode 100644 tests/kmstest/meson.build > create mode 100644 tests/meson.build > create mode 100644 tests/modeprint/meson.build > create mode 100644 tests/modetest/meson.build > create mode 100644 tests/nouveau/meson.build > create mode 100644 tests/proptest/meson.build > create mode 100644 tests/radeon/meson.build > create mode 100
[v2 PATCH] drm/msm: Add devfreq support for the GPU
Add support for devfreq to dynamically control the GPU frequency. By default try to use the 'simple_ondemand' governor which can adjust the frequency based on GPU load. v2: Fix __aeabi_uldivmod issue from the 0 day bot and use devfreq_recommended_opp() as suggested by Rob. Signed-off-by: Jordan Crouse --- drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 12 + drivers/gpu/drm/msm/adreno/adreno_gpu.c | 1 - drivers/gpu/drm/msm/msm_gpu.c | 91 + drivers/gpu/drm/msm/msm_gpu.h | 7 +++ 4 files changed, 110 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c index 56c2c44..7e09d44 100644 --- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c @@ -600,6 +600,9 @@ static int a5xx_hw_init(struct msm_gpu *gpu) /* Select CP0 to always count cycles */ gpu_write(gpu, REG_A5XX_CP_PERFCTR_CP_SEL_0, PERF_CP_ALWAYS_COUNT); + /* Select RBBM0 to countable 6 to get the busy status for devfreq */ + gpu_write(gpu, REG_A5XX_RBBM_PERFCTR_RBBM_SEL_0, 6); + /* Increase VFD cache access so LRZ and other data gets evicted less */ gpu_write(gpu, REG_A5XX_UCHE_CACHE_WAYS, 0x02); @@ -1170,6 +1173,14 @@ static struct msm_ringbuffer *a5xx_active_ring(struct msm_gpu *gpu) return a5xx_gpu->cur_ring; } +static int a5xx_gpu_busy(struct msm_gpu *gpu, uint64_t *value) +{ + *value = gpu_read64(gpu, REG_A5XX_RBBM_PERFCTR_RBBM_0_LO, + REG_A5XX_RBBM_PERFCTR_RBBM_0_HI); + + return 0; +} + static const struct adreno_gpu_funcs funcs = { .base = { .get_param = adreno_get_param, @@ -1185,6 +1196,7 @@ static struct msm_ringbuffer *a5xx_active_ring(struct msm_gpu *gpu) #ifdef CONFIG_DEBUG_FS .show = a5xx_show, #endif + .gpu_busy = a5xx_gpu_busy, }, .get_timestamp = a5xx_get_timestamp, }; diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c index b4bac84..de63ff2 100644 --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c @@ -22,7 +22,6 @@ #include "msm_gem.h" #include "msm_mmu.h" - int adreno_get_param(struct msm_gpu *gpu, uint32_t param, uint64_t *value) { struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c index 5416fe8..bd376f9 100644 --- a/drivers/gpu/drm/msm/msm_gpu.c +++ b/drivers/gpu/drm/msm/msm_gpu.c @@ -21,12 +21,91 @@ #include "msm_fence.h" #include +#include +#include /* * Power Management: */ +static int msm_devfreq_target(struct device *dev, unsigned long *freq, + u32 flags) +{ + struct msm_gpu *gpu = platform_get_drvdata(to_platform_device(dev)); + struct dev_pm_opp *opp; + + opp = devfreq_recommended_opp(dev, freq, flags); + + if (IS_ERR(opp)) + return PTR_ERR(opp); + + clk_set_rate(gpu->core_clk, *freq); + dev_pm_opp_put(opp); + + return 0; +} + +static int msm_devfreq_get_dev_status(struct device *dev, + struct devfreq_dev_status *status) +{ + struct msm_gpu *gpu = platform_get_drvdata(to_platform_device(dev)); + u64 cycles; + u32 freq = ((u32) status->current_frequency) / 100; + ktime_t time; + + status->current_frequency = (unsigned long) clk_get_rate(gpu->core_clk); + gpu->funcs->gpu_busy(gpu, &cycles); + + status->busy_time = ((u32) (cycles - gpu->devfreq.busy_cycles)) / freq; + + gpu->devfreq.busy_cycles = cycles; + + time = ktime_get(); + status->total_time = ktime_us_delta(time, gpu->devfreq.time); + gpu->devfreq.time = time; + + return 0; +} + +static int msm_devfreq_get_cur_freq(struct device *dev, unsigned long *freq) +{ + struct msm_gpu *gpu = platform_get_drvdata(to_platform_device(dev)); + + *freq = (unsigned long) clk_get_rate(gpu->core_clk); + + return 0; +} + +static struct devfreq_dev_profile msm_devfreq_profile = { + .polling_ms = 10, + .target = msm_devfreq_target, + .get_dev_status = msm_devfreq_get_dev_status, + .get_cur_freq = msm_devfreq_get_cur_freq, +}; + +static void msm_devfreq_init(struct msm_gpu *gpu) +{ + /* We need target support to do devfreq */ + if (!gpu->funcs->gpu_busy) + return; + + msm_devfreq_profile.initial_freq = gpu->fast_rate; + + /* +* Don't set the freq_table or max_state and let devfreq build the table +* from OPP +*/ + + gpu->devfreq.devfreq = devm_devfreq_add_device(&gpu->pdev->dev, + &msm_devfreq_profile, "simple_ondemand", NULL); + + if (IS_ERR(gpu->devfreq.devfreq)) { + dev_err(&gpu->pdev->dev, "Couldn't initialize GPU devfreq\n"); + gpu->devfreq.devfreq = NULL; + }
[radeon-alex:amd-17.50 2016/2100] drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/ci_smc.c:579:62: warning: 'tmp' may be used uninitialized in this function
Hi Rex, FYI, the error/warning still remains. tree: git://people.freedesktop.org/~agd5f/linux.git amd-17.50 head: 4b295aab3256d700354748dcd64017d76065d684 commit: 9c2014d08693830897cad6bbd359d905825d8a18 [2016/2100] drm/amd/powerplay: add CI asics support to smumgr config: i386-allyesconfig (attached as .config) compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025 reproduce: git checkout 9c2014d08693830897cad6bbd359d905825d8a18 # save the attached .config to linux build tree make ARCH=i386 Note: it may well be a FALSE warning. FWIW you are at least aware of it now. http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings All warnings (new ones prefixed by >>): drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/ci_smc.c: In function 'ci_init_smc_table': >> drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/ci_smc.c:579:62: warning: >> 'tmp' may be used uninitialized in this function [-Wmaybe-uninitialized] smu_data->power_tune_table.FuzzyFan_PwmSetDelta = CONVERT_FROM_HOST_TO_SMC_US(tmp); ~^~~ drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/ci_smc.c:571:11: note: 'tmp' was declared here uint16_t tmp; ^~~ vim +/tmp +579 drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/ci_smc.c 568 569 static int ci_populate_fuzzy_fan(struct pp_hwmgr *hwmgr, uint32_t fuse_table_offset) 570 { 571 uint16_t tmp; 572 struct ci_smumgr *smu_data = (struct ci_smumgr *)(hwmgr->smumgr->backend); 573 574 if ((hwmgr->thermal_controller.advanceFanControlParameters.usFanOutputSensitivity & (1 << 15)) 575 || 0 == hwmgr->thermal_controller.advanceFanControlParameters.usFanOutputSensitivity) 576 tmp = hwmgr->thermal_controller.advanceFanControlParameters.usFanOutputSensitivity 577 = hwmgr->thermal_controller.advanceFanControlParameters.usDefaultFanOutputSensitivity; 578 > 579 smu_data->power_tune_table.FuzzyFan_PwmSetDelta = > CONVERT_FROM_HOST_TO_SMC_US(tmp); 580 581 return 0; 582 } 583 --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: application/gzip ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v8 2/8] drm/bridge: analogix_dp: Fix connector and encoder cleanup
From: Jeffy Chen Since we are initing connector in the core driver and encoder in the plat driver, let's clean them up in the right places. Signed-off-by: Jeffy Chen Signed-off-by: Thierry Escande Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 2 -- drivers/gpu/drm/exynos/exynos_dp.c | 7 +-- drivers/gpu/drm/rockchip/analogix_dp-rockchip.c| 12 +--- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index 878f61b65cb2..cb5e18d6ba04 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -1411,7 +1411,6 @@ analogix_dp_bind(struct device *dev, struct drm_device *drm_dev, ret = analogix_dp_create_bridge(drm_dev, dp); if (ret) { DRM_ERROR("failed to create bridge (%d)\n", ret); - drm_encoder_cleanup(dp->encoder); goto err_disable_pm_runtime; } @@ -1434,7 +1433,6 @@ void analogix_dp_unbind(struct analogix_dp_device *dp) { analogix_dp_bridge_disable(dp->bridge); dp->connector.funcs->destroy(&dp->connector); - dp->encoder->funcs->destroy(dp->encoder); if (dp->plat_data->panel) { if (drm_panel_unprepare(dp->plat_data->panel)) diff --git a/drivers/gpu/drm/exynos/exynos_dp.c b/drivers/gpu/drm/exynos/exynos_dp.c index f7e5b2c405ed..33319a858f3a 100644 --- a/drivers/gpu/drm/exynos/exynos_dp.c +++ b/drivers/gpu/drm/exynos/exynos_dp.c @@ -185,8 +185,10 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data) dp->plat_data.encoder = encoder; dp->adp = analogix_dp_bind(dev, dp->drm_dev, &dp->plat_data); - if (IS_ERR(dp->adp)) + if (IS_ERR(dp->adp)) { + dp->encoder.funcs->destroy(&dp->encoder); return PTR_ERR(dp->adp); + } return 0; } @@ -196,7 +198,8 @@ static void exynos_dp_unbind(struct device *dev, struct device *master, { struct exynos_dp_device *dp = dev_get_drvdata(dev); - return analogix_dp_unbind(dp->adp); + analogix_dp_unbind(dp->adp); + dp->encoder.funcs->destroy(&dp->encoder); } static const struct component_ops exynos_dp_ops = { diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c index 8a58ad80f509..37250ab63bd7 100644 --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c @@ -259,13 +259,8 @@ static struct drm_encoder_helper_funcs rockchip_dp_encoder_helper_funcs = { .atomic_check = rockchip_dp_drm_encoder_atomic_check, }; -static void rockchip_dp_drm_encoder_destroy(struct drm_encoder *encoder) -{ - drm_encoder_cleanup(encoder); -} - static struct drm_encoder_funcs rockchip_dp_encoder_funcs = { - .destroy = rockchip_dp_drm_encoder_destroy, + .destroy = drm_encoder_cleanup, }; static int rockchip_dp_of_probe(struct rockchip_dp_device *dp) @@ -362,8 +357,10 @@ static int rockchip_dp_bind(struct device *dev, struct device *master, rockchip_drm_psr_register(&dp->encoder, analogix_dp_psr_set); dp->adp = analogix_dp_bind(dev, dp->drm_dev, &dp->plat_data); - if (IS_ERR(dp->adp)) + if (IS_ERR(dp->adp)) { + dp->encoder.funcs->destroy(&dp->encoder); return PTR_ERR(dp->adp); + } return 0; } @@ -375,6 +372,7 @@ static void rockchip_dp_unbind(struct device *dev, struct device *master, rockchip_drm_psr_unregister(&dp->encoder); analogix_dp_unbind(dp->adp); + dp->encoder.funcs->destroy(&dp->encoder); } static const struct component_ops rockchip_dp_component_ops = { -- 2.14.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v8 3/8] drm/rockchip: analogix_dp: Add a sanity check for rockchip_drm_psr_register()
From: Jeffy Chen The rockchip_drm_psr_register() can fail, so add a sanity check for that. Also reorder the calls in unbind() to match bind(). Signed-off-by: Jeffy Chen Signed-off-by: Thierry Escande --- drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c index 37250ab63bd7..eb88c52336a7 100644 --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c @@ -354,15 +354,22 @@ static int rockchip_dp_bind(struct device *dev, struct device *master, dp->psr_state = ~EDP_VSC_PSR_STATE_ACTIVE; INIT_WORK(&dp->psr_work, analogix_dp_psr_work); - rockchip_drm_psr_register(&dp->encoder, analogix_dp_psr_set); + ret = rockchip_drm_psr_register(&dp->encoder, analogix_dp_psr_set); + if (ret < 0) + goto err_cleanup_encoder; dp->adp = analogix_dp_bind(dev, dp->drm_dev, &dp->plat_data); if (IS_ERR(dp->adp)) { - dp->encoder.funcs->destroy(&dp->encoder); - return PTR_ERR(dp->adp); + ret = PTR_ERR(dp->adp); + goto err_unreg_psr; } return 0; +err_unreg_psr: + rockchip_drm_psr_unregister(&dp->encoder); +err_cleanup_encoder: + dp->encoder.funcs->destroy(&dp->encoder); + return ret; } static void rockchip_dp_unbind(struct device *dev, struct device *master, @@ -370,8 +377,8 @@ static void rockchip_dp_unbind(struct device *dev, struct device *master, { struct rockchip_dp_device *dp = dev_get_drvdata(dev); - rockchip_drm_psr_unregister(&dp->encoder); analogix_dp_unbind(dp->adp); + rockchip_drm_psr_unregister(&dp->encoder); dp->encoder.funcs->destroy(&dp->encoder); } -- 2.14.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v8 7/8] drm/bridge/synopsys: dw-hdmi: Do not use device's drvdata
From: Jeffy Chen Let plat drivers own the drvdata, so that they could cleanup resources in their unbind(). Signed-off-by: Jeffy Chen Signed-off-by: Thierry Escande Reviewed-by: Neil Armstrong --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 43 ++--- drivers/gpu/drm/imx/dw_hdmi-imx.c | 22 +-- drivers/gpu/drm/meson/meson_dw_hdmi.c | 20 ++ drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c | 14 -- drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 22 +-- include/drm/bridge/dw_hdmi.h| 17 ++-- 6 files changed, 77 insertions(+), 61 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 1cc63a18b7d5..f0380bcae513 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2073,7 +2073,7 @@ static irqreturn_t dw_hdmi_hardirq(int irq, void *dev_id) return ret; } -void __dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense) +void dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense) { mutex_lock(&hdmi->mutex); @@ -2099,13 +2099,6 @@ void __dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense) } mutex_unlock(&hdmi->mutex); } - -void dw_hdmi_setup_rx_sense(struct device *dev, bool hpd, bool rx_sense) -{ - struct dw_hdmi *hdmi = dev_get_drvdata(dev); - - __dw_hdmi_setup_rx_sense(hdmi, hpd, rx_sense); -} EXPORT_SYMBOL_GPL(dw_hdmi_setup_rx_sense); static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) @@ -2141,9 +2134,8 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) */ if (intr_stat & (HDMI_IH_PHY_STAT0_RX_SENSE | HDMI_IH_PHY_STAT0_HPD)) { - __dw_hdmi_setup_rx_sense(hdmi, -phy_stat & HDMI_PHY_HPD, -phy_stat & HDMI_PHY_RX_SENSE); + dw_hdmi_setup_rx_sense(hdmi, phy_stat & HDMI_PHY_HPD, + phy_stat & HDMI_PHY_RX_SENSE); if ((phy_stat & (HDMI_PHY_RX_SENSE | HDMI_PHY_HPD)) == 0) cec_notifier_set_phys_addr(hdmi->cec_notifier, @@ -2533,8 +2525,6 @@ __dw_hdmi_probe(struct platform_device *pdev, if (hdmi->i2c) dw_hdmi_i2c_init(hdmi); - platform_set_drvdata(pdev, hdmi); - return hdmi; err_iahb: @@ -2584,25 +2574,23 @@ static void __dw_hdmi_remove(struct dw_hdmi *hdmi) /* - * Probe/remove API, used from platforms based on the DRM bridge API. */ -int dw_hdmi_probe(struct platform_device *pdev, - const struct dw_hdmi_plat_data *plat_data) +struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev, + const struct dw_hdmi_plat_data *plat_data) { struct dw_hdmi *hdmi; hdmi = __dw_hdmi_probe(pdev, plat_data); if (IS_ERR(hdmi)) - return PTR_ERR(hdmi); + return hdmi; drm_bridge_add(&hdmi->bridge); - return 0; + return hdmi; } EXPORT_SYMBOL_GPL(dw_hdmi_probe); -void dw_hdmi_remove(struct platform_device *pdev) +void dw_hdmi_remove(struct dw_hdmi *hdmi) { - struct dw_hdmi *hdmi = platform_get_drvdata(pdev); - drm_bridge_remove(&hdmi->bridge); __dw_hdmi_remove(hdmi); @@ -2612,31 +2600,30 @@ EXPORT_SYMBOL_GPL(dw_hdmi_remove); /* - * Bind/unbind API, used from platforms based on the component framework. */ -int dw_hdmi_bind(struct platform_device *pdev, struct drm_encoder *encoder, -const struct dw_hdmi_plat_data *plat_data) +struct dw_hdmi *dw_hdmi_bind(struct platform_device *pdev, +struct drm_encoder *encoder, +const struct dw_hdmi_plat_data *plat_data) { struct dw_hdmi *hdmi; int ret; hdmi = __dw_hdmi_probe(pdev, plat_data); if (IS_ERR(hdmi)) - return PTR_ERR(hdmi); + return hdmi; ret = drm_bridge_attach(encoder, &hdmi->bridge, NULL); if (ret) { __dw_hdmi_remove(hdmi); DRM_ERROR("Failed to initialize bridge with drm\n"); - return ret; + return ERR_PTR(ret); } - return 0; + return hdmi; } EXPORT_SYMBOL_GPL(dw_hdmi_bind); -void dw_hdmi_unbind(struct device *dev) +void dw_hdmi_unbind(struct dw_hdmi *hdmi) { - struct dw_hdmi *hdmi = dev_get_drvdata(dev); - __dw_hdmi_remove(hdmi); } EXPORT_SYMBOL_GPL(dw_hdmi_unbind); diff --git a/drivers/gpu/drm/imx/dw_hdmi-imx.c b/drivers/gpu/drm/imx/dw_hdmi-imx.c index b62763aa8706..b01d03e02ce0 100644 --- a/drivers/gpu/drm/imx/dw_hdmi-imx.c +++ b/drivers/gpu/drm/im
[PATCH] drm/amdkfd: Fix potential NULL pointer dereferences
In case kfd_get_process_device_data returns null, there are some null pointer dereferences in functions kfd_bind_processes_to_device and kfd_unbind_processes_from_device. Fix this by null checking pdd before dereferencing it. Addresses-Coverity-ID: 1463794 ("Dereference null return value") Addresses-Coverity-ID: 1463772 ("Dereference null return value") Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm/amd/amdkfd/kfd_process.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c index a22fb071..29d51d5 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c @@ -461,6 +461,13 @@ int kfd_bind_processes_to_device(struct kfd_dev *dev) hash_for_each_rcu(kfd_processes_table, temp, p, kfd_processes) { mutex_lock(&p->mutex); pdd = kfd_get_process_device_data(dev, p); + + if (!pdd) { + pr_err("Process device data doesn't exist\n"); + mutex_unlock(&p->mutex); + return -EFAULT; + } + if (pdd->bound != PDD_BOUND_SUSPENDED) { mutex_unlock(&p->mutex); continue; @@ -501,6 +508,11 @@ void kfd_unbind_processes_from_device(struct kfd_dev *dev) mutex_lock(&p->mutex); pdd = kfd_get_process_device_data(dev, p); + if (!pdd) { + mutex_unlock(&p->mutex); + return; + } + if (pdd->bound == PDD_BOUND) pdd->bound = PDD_BOUND_SUSPENDED; mutex_unlock(&p->mutex); -- 2.7.4 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v8 0/8] rockchip: kevin: Enable edp display
Hi, This patchset makes edp display work on Chromebook kevin. This patchset has been originally posted by Jeffy Chen and the 2 first commits from a previous version (v6) are already merged in mainline. v8: Fixed compilation issue between patches #7 and #8 reported by Archit. v7: Rebased on top of next-20180108 and fixed conflicts Fixed a few warnings reported by checkpatch Jeffy Chen (8): drm/bridge: analogix: Do not use device's drvdata drm/bridge: analogix_dp: Fix connector and encoder cleanup drm/rockchip: analogix_dp: Add a sanity check for rockchip_drm_psr_register() drm/rockchip: dw-mipi-dsi: Fix error handling path drm/rockchip: inno_hdmi: Fix error handling path drm/bridge/synopsys: dw-hdmi: Add missing bridge detach drm/bridge/synopsys: dw-hdmi: Do not use device's drvdata drm/rockchip: dw_hdmi: Fix error handling path drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 52 +++-- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 53 - drivers/gpu/drm/exynos/exynos_dp.c | 29 ++ drivers/gpu/drm/imx/dw_hdmi-imx.c | 22 --- drivers/gpu/drm/meson/meson_dw_hdmi.c | 20 +-- drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c | 14 - drivers/gpu/drm/rockchip/analogix_dp-rockchip.c| 67 +- drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 21 --- drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c| 39 +++-- drivers/gpu/drm/rockchip/inno_hdmi.c | 22 +-- include/drm/bridge/analogix_dp.h | 19 +++--- include/drm/bridge/dw_hdmi.h | 17 +++--- 12 files changed, 214 insertions(+), 161 deletions(-) -- 2.14.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v8 8/8] drm/rockchip: dw_hdmi: Fix error handling path
From: Jeffy Chen Add missing clk_disable_unprepare() in bind()'s error handling path and unbind(). Also inline clk_prepare_enable() with bind(). Fixes: 12b9f204e804 ("drm: bridge/dw_hdmi: add rockchip rk3288 support") Signed-off-by: Jeffy Chen Signed-off-by: Thierry Escande --- drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c index d406d7779ed9..0b2c1a5dd1e6 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c @@ -166,7 +166,6 @@ static const struct dw_hdmi_phy_config rockchip_phy_config[] = { static int rockchip_hdmi_parse_dt(struct rockchip_hdmi *hdmi) { struct device_node *np = hdmi->dev->of_node; - int ret; hdmi->regmap = syscon_regmap_lookup_by_phandle(np, "rockchip,grf"); if (IS_ERR(hdmi->regmap)) { @@ -194,13 +193,6 @@ static int rockchip_hdmi_parse_dt(struct rockchip_hdmi *hdmi) return PTR_ERR(hdmi->grf_clk); } - ret = clk_prepare_enable(hdmi->vpll_clk); - if (ret) { - DRM_DEV_ERROR(hdmi->dev, - "Failed to enable HDMI vpll: %d\n", ret); - return ret; - } - return 0; } @@ -375,6 +367,13 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, return ret; } + ret = clk_prepare_enable(hdmi->vpll_clk); + if (ret) { + DRM_DEV_ERROR(hdmi->dev, "Failed to enable HDMI vpll: %d\n", + ret); + return ret; + } + drm_encoder_helper_add(encoder, &dw_hdmi_rockchip_encoder_helper_funcs); drm_encoder_init(drm, encoder, &dw_hdmi_rockchip_encoder_funcs, DRM_MODE_ENCODER_TMDS, NULL); @@ -382,6 +381,7 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, hdmi->hdmi = dw_hdmi_bind(pdev, encoder, plat_data); if (IS_ERR(hdmi->hdmi)) { encoder->funcs->destroy(encoder); + clk_disable_unprepare(hdmi->vpll_clk); return PTR_ERR(hdmi->hdmi); } @@ -397,6 +397,7 @@ static void dw_hdmi_rockchip_unbind(struct device *dev, struct device *master, dw_hdmi_unbind(hdmi->hdmi); hdmi->encoder.funcs->destroy(&hdmi->encoder); + clk_disable_unprepare(hdmi->vpll_clk); } static const struct component_ops dw_hdmi_rockchip_ops = { -- 2.14.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v8 4/8] drm/rockchip: dw-mipi-dsi: Fix error handling path
From: Jeffy Chen Add missing pm_runtime_disable() in bind()'s error handling path. Also cleanup encoder & connector in unbind(). Fixes: 80a9a059d4e4 ("drm/rockchip/dsi: add dw-mipi power domain support") Signed-off-by: Jeffy Chen Signed-off-by: Thierry Escande --- drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c index b1fe0639227e..78e6b7919bf7 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c @@ -1282,7 +1282,7 @@ static int dw_mipi_dsi_bind(struct device *dev, struct device *master, ret = dw_mipi_dsi_register(drm, dsi); if (ret) { DRM_DEV_ERROR(dev, "Failed to register mipi_dsi: %d\n", ret); - goto err_pllref; + goto err_disable_pllref; } dsi->dsi_host.ops = &dw_mipi_dsi_host_ops; @@ -1290,24 +1290,25 @@ static int dw_mipi_dsi_bind(struct device *dev, struct device *master, ret = mipi_dsi_host_register(&dsi->dsi_host); if (ret) { DRM_DEV_ERROR(dev, "Failed to register MIPI host: %d\n", ret); - goto err_cleanup; + goto err_disable_pm_runtime; } if (!dsi->panel) { ret = -EPROBE_DEFER; - goto err_mipi_dsi_host; + goto err_unreg_mipi_dsi_host; } dev_set_drvdata(dev, dsi); pm_runtime_enable(dev); return 0; -err_mipi_dsi_host: +err_unreg_mipi_dsi_host: mipi_dsi_host_unregister(&dsi->dsi_host); -err_cleanup: - drm_encoder_cleanup(&dsi->encoder); - drm_connector_cleanup(&dsi->connector); -err_pllref: +err_disable_pm_runtime: + pm_runtime_disable(dev); + dsi->connector.funcs->destroy(&dsi->connector); + dsi->encoder.funcs->destroy(&dsi->encoder); +err_disable_pllref: clk_disable_unprepare(dsi->pllref_clk); return ret; } @@ -1319,6 +1320,10 @@ static void dw_mipi_dsi_unbind(struct device *dev, struct device *master, mipi_dsi_host_unregister(&dsi->dsi_host); pm_runtime_disable(dev); + + dsi->connector.funcs->destroy(&dsi->connector); + dsi->encoder.funcs->destroy(&dsi->encoder); + clk_disable_unprepare(dsi->pllref_clk); } -- 2.14.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v8 5/8] drm/rockchip: inno_hdmi: Fix error handling path
From: Jeffy Chen Add missing error handling in bind(). Fixes: 412d4ae6b7a5 ("drm/rockchip: hdmi: add Innosilicon HDMI support") Signed-off-by: Jeffy Chen Signed-off-by: Thierry Escande --- drivers/gpu/drm/rockchip/inno_hdmi.c | 22 +- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index fab30927a889..b775283d7363 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -852,8 +852,10 @@ static int inno_hdmi_bind(struct device *dev, struct device *master, } irq = platform_get_irq(pdev, 0); - if (irq < 0) - return irq; + if (irq < 0) { + ret = irq; + goto err_disable_clk; + } inno_hdmi_reset(hdmi); @@ -861,7 +863,7 @@ static int inno_hdmi_bind(struct device *dev, struct device *master, if (IS_ERR(hdmi->ddc)) { ret = PTR_ERR(hdmi->ddc); hdmi->ddc = NULL; - return ret; + goto err_disable_clk; } /* @@ -875,7 +877,7 @@ static int inno_hdmi_bind(struct device *dev, struct device *master, ret = inno_hdmi_register(drm, hdmi); if (ret) - return ret; + goto err_put_adapter; dev_set_drvdata(dev, hdmi); @@ -885,7 +887,17 @@ static int inno_hdmi_bind(struct device *dev, struct device *master, ret = devm_request_threaded_irq(dev, irq, inno_hdmi_hardirq, inno_hdmi_irq, IRQF_SHARED, dev_name(dev), hdmi); + if (ret < 0) + goto err_cleanup_hdmi; + return 0; +err_cleanup_hdmi: + hdmi->connector.funcs->destroy(&hdmi->connector); + hdmi->encoder.funcs->destroy(&hdmi->encoder); +err_put_adapter: + i2c_put_adapter(hdmi->ddc); +err_disable_clk: + clk_disable_unprepare(hdmi->pclk); return ret; } @@ -897,8 +909,8 @@ static void inno_hdmi_unbind(struct device *dev, struct device *master, hdmi->connector.funcs->destroy(&hdmi->connector); hdmi->encoder.funcs->destroy(&hdmi->encoder); - clk_disable_unprepare(hdmi->pclk); i2c_put_adapter(hdmi->ddc); + clk_disable_unprepare(hdmi->pclk); } static const struct component_ops inno_hdmi_ops = { -- 2.14.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/stm: ltdc: add clut mode support
On 2018-01-09 12:28, Philippe CORNU wrote: > Hi all, > > Do you think the patch is "acceptable" or should I change it somehow? > Any opinion is welcomed : ) Maybe you should try Daniel Vetter? He was very helpful (thanks) when I worked on the clut changes... Cheers, Peter ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v8 6/8] drm/bridge/synopsys: dw-hdmi: Add missing bridge detach
From: Jeffy Chen We inited connector in attach(), so need a detach() to cleanup. Also fix wrong use of dw_hdmi_remove() in bind(). Signed-off-by: Jeffy Chen Signed-off-by: Thierry Escande --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index a38db40ce990..1cc63a18b7d5 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -1967,6 +1967,13 @@ static int dw_hdmi_bridge_attach(struct drm_bridge *bridge) return 0; } +static void dw_hdmi_bridge_detach(struct drm_bridge *bridge) +{ + struct dw_hdmi *hdmi = bridge->driver_private; + + drm_connector_cleanup(&hdmi->connector); +} + static enum drm_mode_status dw_hdmi_bridge_mode_valid(struct drm_bridge *bridge, const struct drm_display_mode *mode) @@ -2023,6 +2030,7 @@ static void dw_hdmi_bridge_enable(struct drm_bridge *bridge) static const struct drm_bridge_funcs dw_hdmi_bridge_funcs = { .attach = dw_hdmi_bridge_attach, + .detach = dw_hdmi_bridge_detach, .enable = dw_hdmi_bridge_enable, .disable = dw_hdmi_bridge_disable, .mode_set = dw_hdmi_bridge_mode_set, @@ -2616,7 +2624,7 @@ int dw_hdmi_bind(struct platform_device *pdev, struct drm_encoder *encoder, ret = drm_bridge_attach(encoder, &hdmi->bridge, NULL); if (ret) { - dw_hdmi_remove(pdev); + __dw_hdmi_remove(hdmi); DRM_ERROR("Failed to initialize bridge with drm\n"); return ret; } -- 2.14.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v8 1/8] drm/bridge: analogix: Do not use device's drvdata
From: Jeffy Chen The driver that instantiates the bridge should own the drvdata, as all driver model callbacks (probe, remove, shutdown, PM ops, etc.) are also owned by its driver struct. Moreover, storing two different pointer types in driver data depending on driver initialization status is barely a good practice and in fact has led to many bugs in this driver. Let's clean up this mess and change Analogix entry points to simply accept some opaque struct pointer, adjusting their users at the same time to avoid breaking the compilation. Signed-off-by: Tomasz Figa Signed-off-by: Jeffy Chen Signed-off-by: Thierry Escande Reviewed-by: Andrzej Hajda Reviewed-by: Sean Paul Acked-by: Jingoo Han Acked-by: Archit Taneja --- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 50 +- drivers/gpu/drm/exynos/exynos_dp.c | 26 ++- drivers/gpu/drm/rockchip/analogix_dp-rockchip.c| 48 - include/drm/bridge/analogix_dp.h | 19 4 files changed, 74 insertions(+), 69 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index a8905049b9da..878f61b65cb2 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -98,17 +98,15 @@ static int analogix_dp_detect_hpd(struct analogix_dp_device *dp) return 0; } -int analogix_dp_psr_supported(struct device *dev) +int analogix_dp_psr_supported(struct analogix_dp_device *dp) { - struct analogix_dp_device *dp = dev_get_drvdata(dev); return dp->psr_support; } EXPORT_SYMBOL_GPL(analogix_dp_psr_supported); -int analogix_dp_enable_psr(struct device *dev) +int analogix_dp_enable_psr(struct analogix_dp_device *dp) { - struct analogix_dp_device *dp = dev_get_drvdata(dev); struct edp_vsc_psr psr_vsc; if (!dp->psr_support) @@ -129,9 +127,8 @@ int analogix_dp_enable_psr(struct device *dev) } EXPORT_SYMBOL_GPL(analogix_dp_enable_psr); -int analogix_dp_disable_psr(struct device *dev) +int analogix_dp_disable_psr(struct analogix_dp_device *dp) { - struct analogix_dp_device *dp = dev_get_drvdata(dev); struct edp_vsc_psr psr_vsc; int ret; @@ -1283,8 +1280,9 @@ static ssize_t analogix_dpaux_transfer(struct drm_dp_aux *aux, return analogix_dp_transfer(dp, msg); } -int analogix_dp_bind(struct device *dev, struct drm_device *drm_dev, -struct analogix_dp_plat_data *plat_data) +struct analogix_dp_device * +analogix_dp_bind(struct device *dev, struct drm_device *drm_dev, +struct analogix_dp_plat_data *plat_data) { struct platform_device *pdev = to_platform_device(dev); struct analogix_dp_device *dp; @@ -1294,14 +1292,12 @@ int analogix_dp_bind(struct device *dev, struct drm_device *drm_dev, if (!plat_data) { dev_err(dev, "Invalided input plat_data\n"); - return -EINVAL; + return ERR_PTR(-EINVAL); } dp = devm_kzalloc(dev, sizeof(struct analogix_dp_device), GFP_KERNEL); if (!dp) - return -ENOMEM; - - dev_set_drvdata(dev, dp); + return ERR_PTR(-ENOMEM); dp->dev = &pdev->dev; dp->dpms_mode = DRM_MODE_DPMS_OFF; @@ -1318,7 +1314,7 @@ int analogix_dp_bind(struct device *dev, struct drm_device *drm_dev, ret = analogix_dp_dt_parse_pdata(dp); if (ret) - return ret; + return ERR_PTR(ret); dp->phy = devm_phy_get(dp->dev, "dp"); if (IS_ERR(dp->phy)) { @@ -1332,14 +1328,14 @@ int analogix_dp_bind(struct device *dev, struct drm_device *drm_dev, if (ret == -ENOSYS || ret == -ENODEV) dp->phy = NULL; else - return ret; + return ERR_PTR(ret); } } dp->clock = devm_clk_get(&pdev->dev, "dp"); if (IS_ERR(dp->clock)) { dev_err(&pdev->dev, "failed to get clock\n"); - return PTR_ERR(dp->clock); + return ERR_CAST(dp->clock); } clk_prepare_enable(dp->clock); @@ -1348,7 +1344,7 @@ int analogix_dp_bind(struct device *dev, struct drm_device *drm_dev, dp->reg_base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(dp->reg_base)) - return PTR_ERR(dp->reg_base); + return ERR_CAST(dp->reg_base); dp->force_hpd = of_property_read_bool(dev->of_node, "force-hpd"); @@ -1369,7 +1365,7 @@ int analogix_dp_bind(struct device *dev, struct drm_device *drm_dev, "hpd_gpio"); if (ret) { dev_err(&pdev->dev, "failed to get hpd gpio\n"); - return ret; +
Re: [PATCH] drm/amdkfd: Fix potential NULL pointer dereferences
Hi Gustavo, Thanks for catching that. When returning a fault, I think you also need to srcu_read_unlock(&kfd_processes_srcu, idx). However, instead of returning an error, I think I'd prefer to skip PDDs that can't be found with continue statements. That way others would still suspend and resume successfully. Maybe just print a WARN_ON for PDDs that aren't found, because that's an unexpected situation, currently. Maybe in the future it could be normal thing if we ever support GPU hotplug. Regards, Felix On 2018-01-10 11:50 AM, Gustavo A. R. Silva wrote: > In case kfd_get_process_device_data returns null, there are some > null pointer dereferences in functions kfd_bind_processes_to_device > and kfd_unbind_processes_from_device. > > Fix this by null checking pdd before dereferencing it. > > Addresses-Coverity-ID: 1463794 ("Dereference null return value") > Addresses-Coverity-ID: 1463772 ("Dereference null return value") > Signed-off-by: Gustavo A. R. Silva > --- > drivers/gpu/drm/amd/amdkfd/kfd_process.c | 12 > 1 file changed, 12 insertions(+) > > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c > b/drivers/gpu/drm/amd/amdkfd/kfd_process.c > index a22fb071..29d51d5 100644 > --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c > @@ -461,6 +461,13 @@ int kfd_bind_processes_to_device(struct kfd_dev *dev) > hash_for_each_rcu(kfd_processes_table, temp, p, kfd_processes) { > mutex_lock(&p->mutex); > pdd = kfd_get_process_device_data(dev, p); > + > + if (!pdd) { > + pr_err("Process device data doesn't exist\n"); > + mutex_unlock(&p->mutex); > + return -EFAULT; > + } > + > if (pdd->bound != PDD_BOUND_SUSPENDED) { > mutex_unlock(&p->mutex); > continue; > @@ -501,6 +508,11 @@ void kfd_unbind_processes_from_device(struct kfd_dev > *dev) > mutex_lock(&p->mutex); > pdd = kfd_get_process_device_data(dev, p); > > + if (!pdd) { > + mutex_unlock(&p->mutex); > + return; > + } > + > if (pdd->bound == PDD_BOUND) > pdd->bound = PDD_BOUND_SUSPENDED; > mutex_unlock(&p->mutex); ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 4/7] drm/tinydrm/mipi-dbi: Add poweron-reset functions
Split out common poweron-reset functionality. Signed-off-by: Noralf Trønnes --- drivers/gpu/drm/tinydrm/mi0283qt.c | 22 ++-- drivers/gpu/drm/tinydrm/mipi-dbi.c | 73 ++ drivers/gpu/drm/tinydrm/st7586.c | 9 ++--- drivers/gpu/drm/tinydrm/st7735r.c | 8 ++--- include/drm/tinydrm/mipi-dbi.h | 2 ++ 5 files changed, 83 insertions(+), 31 deletions(-) diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c b/drivers/gpu/drm/tinydrm/mi0283qt.c index c69a4d958f24..1617405faed4 100644 --- a/drivers/gpu/drm/tinydrm/mi0283qt.c +++ b/drivers/gpu/drm/tinydrm/mi0283qt.c @@ -49,33 +49,17 @@ static int mi0283qt_init(struct mipi_dbi *mipi) { - struct tinydrm_device *tdev = &mipi->tinydrm; - struct device *dev = tdev->drm->dev; u8 addr_mode; int ret; DRM_DEBUG_KMS("\n"); - ret = regulator_enable(mipi->regulator); - if (ret) { - DRM_DEV_ERROR(dev, "Failed to enable regulator %d\n", ret); + ret = mipi_dbi_poweron_conditional_reset(mipi); + if (ret < 0) return ret; - } - - /* Avoid flicker by skipping setup if the bootloader has done it */ - if (mipi_dbi_display_is_on(mipi)) + if (ret == 1) return 0; - mipi_dbi_hw_reset(mipi); - ret = mipi_dbi_command(mipi, MIPI_DCS_SOFT_RESET); - if (ret) { - DRM_DEV_ERROR(dev, "Error sending command %d\n", ret); - regulator_disable(mipi->regulator); - return ret; - } - - msleep(20); - mipi_dbi_command(mipi, MIPI_DCS_SET_DISPLAY_OFF); mipi_dbi_command(mipi, ILI9341_PWCTRLB, 0x00, 0x83, 0x30); diff --git a/drivers/gpu/drm/tinydrm/mipi-dbi.c b/drivers/gpu/drm/tinydrm/mipi-dbi.c index 1c8ef0c4d6d4..3e879d605ed3 100644 --- a/drivers/gpu/drm/tinydrm/mipi-dbi.c +++ b/drivers/gpu/drm/tinydrm/mipi-dbi.c @@ -463,6 +463,7 @@ bool mipi_dbi_display_is_on(struct mipi_dbi *mipi) val &= ~DCS_POWER_MODE_RESERVED_MASK; + /* The poweron/reset value is 08h DCS_POWER_MODE_DISPLAY_NORMAL_MODE */ if (val != (DCS_POWER_MODE_DISPLAY | DCS_POWER_MODE_DISPLAY_NORMAL_MODE | DCS_POWER_MODE_SLEEP_MODE)) return false; @@ -473,6 +474,78 @@ bool mipi_dbi_display_is_on(struct mipi_dbi *mipi) } EXPORT_SYMBOL(mipi_dbi_display_is_on); +static int mipi_dbi_poweron_reset_conditional(struct mipi_dbi *mipi, bool cond) +{ + struct device *dev = mipi->tinydrm.drm->dev; + int ret; + + if (mipi->regulator) { + ret = regulator_enable(mipi->regulator); + if (ret) { + DRM_DEV_ERROR(dev, "Failed to enable regulator (%d)\n", ret); + return ret; + } + } + + if (cond && mipi_dbi_display_is_on(mipi)) + return 1; + + mipi_dbi_hw_reset(mipi); + ret = mipi_dbi_command(mipi, MIPI_DCS_SOFT_RESET); + if (ret) { + DRM_DEV_ERROR(dev, "Failed to send reset command (%d)\n", ret); + if (mipi->regulator) + regulator_disable(mipi->regulator); + return ret; + } + + /* +* If we did a hw reset, we know the controller is in Sleep mode and +* per MIPI DSC spec should wait 5ms after soft reset. If we didn't, +* we assume worst case and wait 120ms. +*/ + if (mipi->reset) + usleep_range(5000, 2); + else + msleep(120); + + return 0; +} + +/** + * mipi_dbi_poweron_reset - MIPI DBI poweron and reset + * @mipi: MIPI DBI structure + * + * This function enables the regulator if used and does a hardware and software + * reset. + * + * Returns: + * Zero on success, or a negative error code. + */ +int mipi_dbi_poweron_reset(struct mipi_dbi *mipi) +{ + return mipi_dbi_poweron_reset_conditional(mipi, false); +} +EXPORT_SYMBOL(mipi_dbi_poweron_reset); + +/** + * mipi_dbi_poweron_conditional_reset - MIPI DBI poweron and conditional reset + * @mipi: MIPI DBI structure + * + * This function enables the regulator if used and if the display is off, it + * does a hardware and software reset. If mipi_dbi_display_is_on() determines + * that the display is on, no reset is performed. + * + * Returns: + * Zero if the controller was reset, 1 if the display was already on, or a + * negative error code. + */ +int mipi_dbi_poweron_conditional_reset(struct mipi_dbi *mipi) +{ + return mipi_dbi_poweron_reset_conditional(mipi, true); +} +EXPORT_SYMBOL(mipi_dbi_poweron_conditional_reset); + #if IS_ENABLED(CONFIG_SPI) /** diff --git a/drivers/gpu/drm/tinydrm/st7586.c b/drivers/gpu/drm/tinydrm/st7586.c index 9fd4423c8e70..a6396ef9cc4a 100644 --- a/drivers/gpu/drm/tinydrm/st7586.c +++ b/drivers/gpu/drm/tinydrm/st7586.c @@ -179,19 +179,16 @@ static void st7586_pipe_enable(struct drm_simple_display_pipe *pipe, { struct tinydrm_device *tdev
[PATCH v3 2/7] drm/tinydrm/mi0283qt: Remove ili9341.h
No need for a public header file for the command macros. Just include the necessary ones in the driver. Also use the MIPI_DCS_PIXEL_FMT_16BIT macro. Signed-off-by: Noralf Trønnes Reviewed-by: David Lechner --- drivers/gpu/drm/tinydrm/mi0283qt.c | 28 ++-- include/drm/tinydrm/ili9341.h | 54 -- 2 files changed, 26 insertions(+), 56 deletions(-) delete mode 100644 include/drm/tinydrm/ili9341.h diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c b/drivers/gpu/drm/tinydrm/mi0283qt.c index 45f02b6052b1..c69a4d958f24 100644 --- a/drivers/gpu/drm/tinydrm/mi0283qt.c +++ b/drivers/gpu/drm/tinydrm/mi0283qt.c @@ -18,11 +18,35 @@ #include #include -#include #include #include #include +#define ILI9341_FRMCTR10xb1 +#define ILI9341_DISCTRL0xb6 +#define ILI9341_ETMOD 0xb7 + +#define ILI9341_PWCTRL10xc0 +#define ILI9341_PWCTRL20xc1 +#define ILI9341_VMCTRL10xc5 +#define ILI9341_VMCTRL20xc7 +#define ILI9341_PWCTRLA0xcb +#define ILI9341_PWCTRLB0xcf + +#define ILI9341_PGAMCTRL 0xe0 +#define ILI9341_NGAMCTRL 0xe1 +#define ILI9341_DTCTRLA0xe8 +#define ILI9341_DTCTRLB0xea +#define ILI9341_PWRSEQ 0xed + +#define ILI9341_EN3GAM 0xf2 +#define ILI9341_PUMPCTRL 0xf7 + +#define ILI9341_MADCTL_BGR BIT(3) +#define ILI9341_MADCTL_MV BIT(5) +#define ILI9341_MADCTL_MX BIT(6) +#define ILI9341_MADCTL_MY BIT(7) + static int mi0283qt_init(struct mipi_dbi *mipi) { struct tinydrm_device *tdev = &mipi->tinydrm; @@ -69,7 +93,7 @@ static int mi0283qt_init(struct mipi_dbi *mipi) mipi_dbi_command(mipi, ILI9341_VMCTRL2, 0xbe); /* Memory Access Control */ - mipi_dbi_command(mipi, MIPI_DCS_SET_PIXEL_FORMAT, 0x55); + mipi_dbi_command(mipi, MIPI_DCS_SET_PIXEL_FORMAT, MIPI_DCS_PIXEL_FMT_16BIT); switch (mipi->rotation) { default: diff --git a/include/drm/tinydrm/ili9341.h b/include/drm/tinydrm/ili9341.h deleted file mode 100644 index 807a09f43cad.. --- a/include/drm/tinydrm/ili9341.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * ILI9341 LCD controller - * - * Copyright 2016 Noralf Trønnes - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -#ifndef __LINUX_ILI9341_H -#define __LINUX_ILI9341_H - -#define ILI9341_FRMCTR10xb1 -#define ILI9341_FRMCTR20xb2 -#define ILI9341_FRMCTR30xb3 -#define ILI9341_INVTR 0xb4 -#define ILI9341_PRCTR 0xb5 -#define ILI9341_DISCTRL0xb6 -#define ILI9341_ETMOD 0xb7 - -#define ILI9341_PWCTRL10xc0 -#define ILI9341_PWCTRL20xc1 -#define ILI9341_VMCTRL10xc5 -#define ILI9341_VMCTRL20xc7 -#define ILI9341_PWCTRLA0xcb -#define ILI9341_PWCTRLB0xcf - -#define ILI9341_RDID1 0xda -#define ILI9341_RDID2 0xdb -#define ILI9341_RDID3 0xdc -#define ILI9341_RDID4 0xd3 - -#define ILI9341_PGAMCTRL 0xe0 -#define ILI9341_NGAMCTRL 0xe1 -#define ILI9341_DGAMCTRL1 0xe2 -#define ILI9341_DGAMCTRL2 0xe3 -#define ILI9341_DTCTRLA0xe8 -#define ILI9341_DTCTRLB0xea -#define ILI9341_PWRSEQ 0xed - -#define ILI9341_EN3GAM 0xf2 -#define ILI9341_IFCTRL 0xf6 -#define ILI9341_PUMPCTRL 0xf7 - -#define ILI9341_MADCTL_MH BIT(2) -#define ILI9341_MADCTL_BGR BIT(3) -#define ILI9341_MADCTL_ML BIT(4) -#define ILI9341_MADCTL_MV BIT(5) -#define ILI9341_MADCTL_MX BIT(6) -#define ILI9341_MADCTL_MY BIT(7) - -#endif /* __LINUX_ILI9341_H */ -- 2.15.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 0/7] drm/tinydrm: Cleanup
Fix a few things that came up during the tinydrm review but wasn't addressed at the time. Noralf. Changes since version 2: - s/mipi_dbi_por_conditional/mipi_dbi_poweron_reset_conditional/ - Add sleep after soft reset to comply with spec. - Remove reset msleep from mi0283qt following the previous change. - Use (ret == 1) to test for display is ON, no reset. - Add patch to change hard reset active time. Changes since version 1: - Add mipi_dbi_enable_flush() instead of the pipe enable helper mipi_dbi_pipe_enable() that doesn't really fit anymore. - Add common poweron-reset functionality. - Use drm_mode_copy() instead of direct assignment Noralf Trønnes (7): drm/tinydrm/mi0283qt: Use common include order drm/tinydrm/mi0283qt: Remove ili9341.h drm/tinydrm/mipi-dbi: Add mipi_dbi_enable_flush() drm/tinydrm/mipi-dbi: Add poweron-reset functions drm/tinydrm/mi0283qt: Let the display pipe handle power drm/tinydrm: Embed the mode in tinydrm_connector drm/tinydrm/mipi-dbi: Change reset active time drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c | 34 - drivers/gpu/drm/tinydrm/ili9225.c | 6 +- drivers/gpu/drm/tinydrm/mi0283qt.c | 106 drivers/gpu/drm/tinydrm/mipi-dbi.c | 101 ++ drivers/gpu/drm/tinydrm/st7586.c| 15 ++-- drivers/gpu/drm/tinydrm/st7735r.c | 10 +-- include/drm/tinydrm/ili9341.h | 54 -- include/drm/tinydrm/mipi-dbi.h | 5 +- 8 files changed, 154 insertions(+), 177 deletions(-) delete mode 100644 include/drm/tinydrm/ili9341.h -- 2.15.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 7/7] drm/tinydrm/mipi-dbi: Change reset active time
The MIPI DBI spec states that reset active/low time should be more than 9us. Change from 20ms to 20us. Signed-off-by: Noralf Trønnes --- drivers/gpu/drm/tinydrm/mipi-dbi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/tinydrm/mipi-dbi.c b/drivers/gpu/drm/tinydrm/mipi-dbi.c index 6798b4837441..75dd65c57e74 100644 --- a/drivers/gpu/drm/tinydrm/mipi-dbi.c +++ b/drivers/gpu/drm/tinydrm/mipi-dbi.c @@ -414,7 +414,7 @@ void mipi_dbi_hw_reset(struct mipi_dbi *mipi) return; gpiod_set_value_cansleep(mipi->reset, 0); - msleep(20); + usleep_range(20, 1000); gpiod_set_value_cansleep(mipi->reset, 1); msleep(120); } -- 2.15.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 5/7] drm/tinydrm/mi0283qt: Let the display pipe handle power
It's better to leave power handling and controller init to the modesetting machinery using the simple pipe .enable and .disable callbacks. Remove unused mipi_dbi_pipe_enable(). Signed-off-by: Noralf Trønnes Reviewed-by: David Lechner --- drivers/gpu/drm/tinydrm/mi0283qt.c | 47 -- drivers/gpu/drm/tinydrm/mipi-dbi.c | 32 -- include/drm/tinydrm/mipi-dbi.h | 2 -- 3 files changed, 15 insertions(+), 66 deletions(-) diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c b/drivers/gpu/drm/tinydrm/mi0283qt.c index 1617405faed4..79cb5af5abac 100644 --- a/drivers/gpu/drm/tinydrm/mi0283qt.c +++ b/drivers/gpu/drm/tinydrm/mi0283qt.c @@ -47,8 +47,11 @@ #define ILI9341_MADCTL_MX BIT(6) #define ILI9341_MADCTL_MY BIT(7) -static int mi0283qt_init(struct mipi_dbi *mipi) +static void mi0283qt_enable(struct drm_simple_display_pipe *pipe, + struct drm_crtc_state *crtc_state) { + struct tinydrm_device *tdev = pipe_to_tinydrm(pipe); + struct mipi_dbi *mipi = mipi_dbi_from_tinydrm(tdev); u8 addr_mode; int ret; @@ -56,9 +59,9 @@ static int mi0283qt_init(struct mipi_dbi *mipi) ret = mipi_dbi_poweron_conditional_reset(mipi); if (ret < 0) - return ret; + return; if (ret == 1) - return 0; + goto out_enable; mipi_dbi_command(mipi, MIPI_DCS_SET_DISPLAY_OFF); @@ -121,19 +124,12 @@ static int mi0283qt_init(struct mipi_dbi *mipi) mipi_dbi_command(mipi, MIPI_DCS_SET_DISPLAY_ON); msleep(100); - return 0; -} - -static void mi0283qt_fini(void *data) -{ - struct mipi_dbi *mipi = data; - - DRM_DEBUG_KMS("\n"); - regulator_disable(mipi->regulator); +out_enable: + mipi_dbi_enable_flush(mipi); } static const struct drm_simple_display_pipe_funcs mi0283qt_pipe_funcs = { - .enable = mipi_dbi_pipe_enable, + .enable = mi0283qt_enable, .disable = mipi_dbi_pipe_disable, .update = tinydrm_display_pipe_update, .prepare_fb = tinydrm_display_pipe_prepare_fb, @@ -214,17 +210,6 @@ static int mi0283qt_probe(struct spi_device *spi) if (ret) return ret; - ret = mi0283qt_init(mipi); - if (ret) - return ret; - - /* use devres to fini after drm unregister (drv->remove is before) */ - ret = devm_add_action(dev, mi0283qt_fini, mipi); - if (ret) { - mi0283qt_fini(mipi); - return ret; - } - spi_set_drvdata(spi, mipi); return devm_tinydrm_register(&mipi->tinydrm); @@ -240,25 +225,13 @@ static void mi0283qt_shutdown(struct spi_device *spi) static int __maybe_unused mi0283qt_pm_suspend(struct device *dev) { struct mipi_dbi *mipi = dev_get_drvdata(dev); - int ret; - ret = drm_mode_config_helper_suspend(mipi->tinydrm.drm); - if (ret) - return ret; - - mi0283qt_fini(mipi); - - return 0; + return drm_mode_config_helper_suspend(mipi->tinydrm.drm); } static int __maybe_unused mi0283qt_pm_resume(struct device *dev) { struct mipi_dbi *mipi = dev_get_drvdata(dev); - int ret; - - ret = mi0283qt_init(mipi); - if (ret) - return ret; drm_mode_config_helper_resume(mipi->tinydrm.drm); diff --git a/drivers/gpu/drm/tinydrm/mipi-dbi.c b/drivers/gpu/drm/tinydrm/mipi-dbi.c index 3e879d605ed3..6798b4837441 100644 --- a/drivers/gpu/drm/tinydrm/mipi-dbi.c +++ b/drivers/gpu/drm/tinydrm/mipi-dbi.c @@ -290,31 +290,6 @@ void mipi_dbi_enable_flush(struct mipi_dbi *mipi) } EXPORT_SYMBOL(mipi_dbi_enable_flush); -/** - * mipi_dbi_pipe_enable - MIPI DBI pipe enable helper - * @pipe: Display pipe - * @crtc_state: CRTC state - * - * This function enables backlight. Drivers can use this as their - * &drm_simple_display_pipe_funcs->enable callback. - */ -void mipi_dbi_pipe_enable(struct drm_simple_display_pipe *pipe, - struct drm_crtc_state *crtc_state) -{ - struct tinydrm_device *tdev = pipe_to_tinydrm(pipe); - struct mipi_dbi *mipi = mipi_dbi_from_tinydrm(tdev); - struct drm_framebuffer *fb = pipe->plane.fb; - - DRM_DEBUG_KMS("\n"); - - mipi->enabled = true; - if (fb) - fb->funcs->dirty(fb, NULL, 0, 0, NULL, 0); - - tinydrm_enable_backlight(mipi->backlight); -} -EXPORT_SYMBOL(mipi_dbi_pipe_enable); - static void mipi_dbi_blank(struct mipi_dbi *mipi) { struct drm_device *drm = mipi->tinydrm.drm; @@ -336,8 +311,8 @@ static void mipi_dbi_blank(struct mipi_dbi *mipi) * mipi_dbi_pipe_disable - MIPI DBI pipe disable helper * @pipe: Display pipe * - * This function disables backlight if present or if not the - * display memory is blanked. Drivers can use this as their + * This function disables backlight if present, if not the display memory is + * blanked. The regul
[PATCH v3 6/7] drm/tinydrm: Embed the mode in tinydrm_connector
Embed the mode in tinydrm_connector instead of doing an devm_ allocation. Remove unnecessary use of ret variable at the end of tinydrm_display_pipe_init(). Signed-off-by: Noralf Trønnes Reviewed-by: David Lechner --- drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c | 34 +++-- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c b/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c index f41fc506ff87..11ae950b0fc9 100644 --- a/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c +++ b/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c @@ -15,7 +15,7 @@ struct tinydrm_connector { struct drm_connector base; - const struct drm_display_mode *mode; + struct drm_display_mode mode; }; static inline struct tinydrm_connector * @@ -29,7 +29,7 @@ static int tinydrm_connector_get_modes(struct drm_connector *connector) struct tinydrm_connector *tconn = to_tinydrm_connector(connector); struct drm_display_mode *mode; - mode = drm_mode_duplicate(connector->dev, tconn->mode); + mode = drm_mode_duplicate(connector->dev, &tconn->mode); if (!mode) { DRM_ERROR("Failed to duplicate mode\n"); return 0; @@ -92,7 +92,7 @@ tinydrm_connector_create(struct drm_device *drm, if (!tconn) return ERR_PTR(-ENOMEM); - tconn->mode = mode; + drm_mode_copy(&tconn->mode, mode); connector = &tconn->base; drm_connector_helper_add(connector, &tinydrm_connector_hfuncs); @@ -199,35 +199,27 @@ tinydrm_display_pipe_init(struct tinydrm_device *tdev, unsigned int rotation) { struct drm_device *drm = tdev->drm; - struct drm_display_mode *mode_copy; + struct drm_display_mode mode_copy; struct drm_connector *connector; int ret; - mode_copy = devm_kmalloc(drm->dev, sizeof(*mode_copy), GFP_KERNEL); - if (!mode_copy) - return -ENOMEM; - - *mode_copy = *mode; - ret = tinydrm_rotate_mode(mode_copy, rotation); + drm_mode_copy(&mode_copy, mode); + ret = tinydrm_rotate_mode(&mode_copy, rotation); if (ret) { DRM_ERROR("Illegal rotation value %u\n", rotation); return -EINVAL; } - drm->mode_config.min_width = mode_copy->hdisplay; - drm->mode_config.max_width = mode_copy->hdisplay; - drm->mode_config.min_height = mode_copy->vdisplay; - drm->mode_config.max_height = mode_copy->vdisplay; + drm->mode_config.min_width = mode_copy.hdisplay; + drm->mode_config.max_width = mode_copy.hdisplay; + drm->mode_config.min_height = mode_copy.vdisplay; + drm->mode_config.max_height = mode_copy.vdisplay; - connector = tinydrm_connector_create(drm, mode_copy, connector_type); + connector = tinydrm_connector_create(drm, &mode_copy, connector_type); if (IS_ERR(connector)) return PTR_ERR(connector); - ret = drm_simple_display_pipe_init(drm, &tdev->pipe, funcs, formats, - format_count, NULL, connector); - if (ret) - return ret; - - return 0; + return drm_simple_display_pipe_init(drm, &tdev->pipe, funcs, formats, + format_count, NULL, connector); } EXPORT_SYMBOL(tinydrm_display_pipe_init); -- 2.15.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 1/7] drm/tinydrm/mi0283qt: Use common include order
Include linux headers before drm headers as it's commonly done. Signed-off-by: Noralf Trønnes Reviewed-by: David Lechner --- drivers/gpu/drm/tinydrm/mi0283qt.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c b/drivers/gpu/drm/tinydrm/mi0283qt.c index 674d407640be..45f02b6052b1 100644 --- a/drivers/gpu/drm/tinydrm/mi0283qt.c +++ b/drivers/gpu/drm/tinydrm/mi0283qt.c @@ -9,17 +9,18 @@ * (at your option) any later version. */ -#include -#include -#include -#include -#include #include #include #include #include #include #include + +#include +#include +#include +#include +#include #include static int mi0283qt_init(struct mipi_dbi *mipi) -- 2.15.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[PATCH v3 3/7] drm/tinydrm/mipi-dbi: Add mipi_dbi_enable_flush()
Add and use a function for enabling, flushing and turning on backlight. Signed-off-by: Noralf Trønnes Reviewed-by: David Lechner --- drivers/gpu/drm/tinydrm/ili9225.c | 6 +- drivers/gpu/drm/tinydrm/mipi-dbi.c | 20 drivers/gpu/drm/tinydrm/st7586.c | 6 +- drivers/gpu/drm/tinydrm/st7735r.c | 2 +- include/drm/tinydrm/mipi-dbi.h | 1 + 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/tinydrm/ili9225.c b/drivers/gpu/drm/tinydrm/ili9225.c index c0cf49849302..a0759502b81a 100644 --- a/drivers/gpu/drm/tinydrm/ili9225.c +++ b/drivers/gpu/drm/tinydrm/ili9225.c @@ -180,7 +180,6 @@ static void ili9225_pipe_enable(struct drm_simple_display_pipe *pipe, { struct tinydrm_device *tdev = pipe_to_tinydrm(pipe); struct mipi_dbi *mipi = mipi_dbi_from_tinydrm(tdev); - struct drm_framebuffer *fb = pipe->plane.fb; struct device *dev = tdev->drm->dev; int ret; u8 am_id; @@ -269,10 +268,7 @@ static void ili9225_pipe_enable(struct drm_simple_display_pipe *pipe, ili9225_command(mipi, ILI9225_DISPLAY_CONTROL_1, 0x1017); - mipi->enabled = true; - - if (fb) - fb->funcs->dirty(fb, NULL, 0, 0, NULL, 0); + mipi_dbi_enable_flush(mipi); } static void ili9225_pipe_disable(struct drm_simple_display_pipe *pipe) diff --git a/drivers/gpu/drm/tinydrm/mipi-dbi.c b/drivers/gpu/drm/tinydrm/mipi-dbi.c index aa6b6ce56891..1c8ef0c4d6d4 100644 --- a/drivers/gpu/drm/tinydrm/mipi-dbi.c +++ b/drivers/gpu/drm/tinydrm/mipi-dbi.c @@ -270,6 +270,26 @@ static const struct drm_framebuffer_funcs mipi_dbi_fb_funcs = { .dirty = mipi_dbi_fb_dirty, }; +/** + * mipi_dbi_enable_flush - MIPI DBI enable helper + * @mipi: MIPI DBI structure + * + * This function sets &mipi_dbi->enabled, flushes the whole framebuffer and + * enables the backlight. Drivers can use this in their + * &drm_simple_display_pipe_funcs->enable callback. + */ +void mipi_dbi_enable_flush(struct mipi_dbi *mipi) +{ + struct drm_framebuffer *fb = mipi->tinydrm.pipe.plane.fb; + + mipi->enabled = true; + if (fb) + fb->funcs->dirty(fb, NULL, 0, 0, NULL, 0); + + tinydrm_enable_backlight(mipi->backlight); +} +EXPORT_SYMBOL(mipi_dbi_enable_flush); + /** * mipi_dbi_pipe_enable - MIPI DBI pipe enable helper * @pipe: Display pipe diff --git a/drivers/gpu/drm/tinydrm/st7586.c b/drivers/gpu/drm/tinydrm/st7586.c index 5aebfceb740e..9fd4423c8e70 100644 --- a/drivers/gpu/drm/tinydrm/st7586.c +++ b/drivers/gpu/drm/tinydrm/st7586.c @@ -179,7 +179,6 @@ static void st7586_pipe_enable(struct drm_simple_display_pipe *pipe, { struct tinydrm_device *tdev = pipe_to_tinydrm(pipe); struct mipi_dbi *mipi = mipi_dbi_from_tinydrm(tdev); - struct drm_framebuffer *fb = pipe->plane.fb; struct device *dev = tdev->drm->dev; int ret; u8 addr_mode; @@ -241,10 +240,7 @@ static void st7586_pipe_enable(struct drm_simple_display_pipe *pipe, mipi_dbi_command(mipi, MIPI_DCS_SET_DISPLAY_ON); - mipi->enabled = true; - - if (fb) - fb->funcs->dirty(fb, NULL, 0, 0, NULL, 0); + mipi_dbi_enable_flush(mipi); } static void st7586_pipe_disable(struct drm_simple_display_pipe *pipe) diff --git a/drivers/gpu/drm/tinydrm/st7735r.c b/drivers/gpu/drm/tinydrm/st7735r.c index 98ff447f40b4..1f38e15da676 100644 --- a/drivers/gpu/drm/tinydrm/st7735r.c +++ b/drivers/gpu/drm/tinydrm/st7735r.c @@ -102,7 +102,7 @@ static void jd_t18003_t01_pipe_enable(struct drm_simple_display_pipe *pipe, msleep(20); - mipi_dbi_pipe_enable(pipe, crtc_state); + mipi_dbi_enable_flush(mipi); } static const struct drm_simple_display_pipe_funcs jd_t18003_t01_pipe_funcs = { diff --git a/include/drm/tinydrm/mipi-dbi.h b/include/drm/tinydrm/mipi-dbi.h index 5d0e82b36eaf..6441d9a9161a 100644 --- a/include/drm/tinydrm/mipi-dbi.h +++ b/include/drm/tinydrm/mipi-dbi.h @@ -67,6 +67,7 @@ int mipi_dbi_init(struct device *dev, struct mipi_dbi *mipi, const struct drm_simple_display_pipe_funcs *pipe_funcs, struct drm_driver *driver, const struct drm_display_mode *mode, unsigned int rotation); +void mipi_dbi_enable_flush(struct mipi_dbi *mipi); void mipi_dbi_pipe_enable(struct drm_simple_display_pipe *pipe, struct drm_crtc_state *crtc_state); void mipi_dbi_pipe_disable(struct drm_simple_display_pipe *pipe); -- 2.15.1 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] libdrm: intel/Android.mk: Filter libdrm_intel library requirements on x86
On Wed, Jan 10, 2018 at 5:48 AM, Rob Herring wrote: > On Tue, Jan 9, 2018 at 11:25 PM, John Stultz wrote: >> When building AOSP after updating libdrm project to the >> freedesktop/master branch, I've seen the following build errors: >> >> external/libdrm/intel/Android.mk: error: libdrm_intel > > This is only needed for i915 (not i965) now BTW. I'm not sure at what > point we stop caring about i915. > >> (SHARED_LIBRARIES android-arm64) missing libpciaccess >> (SHARED_LIBRARIES android-arm64) You can set >> ALLOW_MISSING_DEPENDENCIES=true in your environment if this is >> intentional, but that may defer real problems until later in the >> build. >> >> Using ALLOW_MISSING_DEPENDENCIES=true when building allows >> things to function properly, but is not ideal. >> >> So basically, while I'm not including the libdrm_intel package >> into the build, just the fact that the Android.mk file references >> libpciaccess which isn't a repo included in AOSP causes the build >> failure. >> >> So it seems we need some sort of conditional filter in the >> Android.mk to skip over it if we're not building for intel. >> >> This is my initial attempt at solving this. >> >> Feedback would be greatly appreciated! >> >> I note that in the AOSP version of libdrm, the reference to >> libpciaccess has been removed. See: >> >> https://android.googlesource.com/platform/external/libdrm/+/f6a1130dffae8de9ddd0c379066daf1df27fc8af%5E%21/ >> So I wonder if it make sense to instead remove this upstream as >> well? > > Only if we drop i915. To be more precise, drop i915 for Android builds (I'm not suggesting dropping it elsewhere, just for the Android.mk). I'm really not sure which devices might be affected. Anyone able to point me to someone in Intel who would know? >> +ifeq ($(TARGET_ARCH), x86) > > This doesn't work for x86_64. i915 and 64-bit may not be a valid > combination, not sure, but we do at least build test that. Out of curiosity, which environment is being used for this build testing? Are you describing your generic-build/qemu work or something else done as part of freedesktop.org? thanks -john ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[radeon-alex:amd-staging-drm-next 374/952] sound/soc/amd/raven/acp3x.h:28:9: error: implicit declaration of function 'readl'; did you mean 'vread'?
Hi Maruthi, FYI, the error/warning still remains. tree: git://people.freedesktop.org/~agd5f/linux.git amd-staging-drm-next head: 95b5f448bf04b220423808df1bb36ca1bd07b270 commit: c1888183e1764d55d51ae051bd8651e634febe4d [374/952] ASoC: AMD: enable ACP3x drivers build config: arm-allmodconfig (attached as .config) compiler: arm-linux-gnueabi-gcc (Debian 7.2.0-11) 7.2.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout c1888183e1764d55d51ae051bd8651e634febe4d # save the attached .config to linux build tree make.cross ARCH=arm All errors (new ones prefixed by >>): In file included from sound/soc/amd/raven/acp3x-pcm-dma.c:26:0: sound/soc/amd/raven/acp3x.h: In function 'rv_readl': >> sound/soc/amd/raven/acp3x.h:28:9: error: implicit declaration of function >> 'readl'; did you mean 'vread'? [-Werror=implicit-function-declaration] return readl(base_addr - ACP3x_PHY_BASE_ADDRESS); ^ vread sound/soc/amd/raven/acp3x.h: In function 'rv_writel': >> sound/soc/amd/raven/acp3x.h:33:2: error: implicit declaration of function >> 'writel'; did you mean 'vwrite'? [-Werror=implicit-function-declaration] writel(val, base_addr - ACP3x_PHY_BASE_ADDRESS); ^~ vwrite sound/soc/amd/raven/acp3x-pcm-dma.c: In function 'acp3x_audio_probe': >> sound/soc/amd/raven/acp3x-pcm-dma.c:638:22: error: implicit declaration of >> function 'devm_ioremap'; did you mean 'devm_kmemdup'? >> [-Werror=implicit-function-declaration] adata->acp3x_base = devm_ioremap(&pdev->dev, res->start, ^~~~ devm_kmemdup sound/soc/amd/raven/acp3x-pcm-dma.c:638:20: warning: assignment makes pointer from integer without a cast [-Wint-conversion] adata->acp3x_base = devm_ioremap(&pdev->dev, res->start, ^ cc1: some warnings being treated as errors vim +28 sound/soc/amd/raven/acp3x.h 0360f007 Maruthi Srinivas Bayyavarapu 2017-03-27 25 0360f007 Maruthi Srinivas Bayyavarapu 2017-03-27 26 static inline u32 rv_readl(void __iomem *base_addr) 0360f007 Maruthi Srinivas Bayyavarapu 2017-03-27 27 { 0360f007 Maruthi Srinivas Bayyavarapu 2017-03-27 @28return readl(base_addr - ACP3x_PHY_BASE_ADDRESS); 0360f007 Maruthi Srinivas Bayyavarapu 2017-03-27 29 } 0360f007 Maruthi Srinivas Bayyavarapu 2017-03-27 30 0360f007 Maruthi Srinivas Bayyavarapu 2017-03-27 31 static inline void rv_writel(u32 val, void __iomem *base_addr) 0360f007 Maruthi Srinivas Bayyavarapu 2017-03-27 32 { 0360f007 Maruthi Srinivas Bayyavarapu 2017-03-27 @33writel(val, base_addr - ACP3x_PHY_BASE_ADDRESS); :: The code at line 28 was first introduced by commit :: 0360f0076fa5ee321ca46b062374c17decdcfbe2 ASoC: AMD: add ACP3.0 PCI driver :: TO: Maruthi Srinivas Bayyavarapu :: CC: Alex Deucher --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: application/gzip ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/atomic: Fix memleak on ERESTARTSYS during non-blocking commits, v2.
On Wed, Jan 10, 2018 at 6:00 AM, Maarten Lankhorst wrote: > From: "Leo (Sunpeng) Li" > > During a non-blocking commit, it is possible to return before the > commit_tail work is queued (-ERESTARTSYS, for example). > > Since a reference on the crtc commit object is obtained for the pending > vblank event when preparing the commit, the above situation will leave > us with an extra reference. > > Therefore, if the commit_tail worker has not consumed the event at the > end of a commit, release it's reference. > > Changes since v1: > - Also check for state->event->base.completion being set, to > handle the case where stall_checks() fails in setup_crtc_commit(). > > Fixes: 24835e442f28 ("drm: reference count event->completion") Thanks for fixing this up. You mentioned on IRC that this version still caused problems. What were those? Thanks, Alex > Cc: # v4.11+ > Signed-off-by: Leo (Sunpeng) Li > Acked-by: Harry Wentland #v1 > Signed-off-by: Maarten Lankhorst > --- > drivers/gpu/drm/drm_atomic_helper.c | 9 + > 1 file changed, 9 insertions(+) > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c > b/drivers/gpu/drm/drm_atomic_helper.c > index b16f1d69a0bb..1d43f3e85a7d 100644 > --- a/drivers/gpu/drm/drm_atomic_helper.c > +++ b/drivers/gpu/drm/drm_atomic_helper.c > @@ -3327,6 +3327,15 @@ EXPORT_SYMBOL(drm_atomic_helper_crtc_duplicate_state); > void __drm_atomic_helper_crtc_destroy_state(struct drm_crtc_state *state) > { > if (state->commit) { > + /* > +* In the event that a non-blocking commit returns > +* -ERESTARTSYS before the commit_tail work is queued, we will > +* have an extra reference to the commit object. Release it, > if > +* the event has not been consumed by the worker. > +*/ > + if (state->event && state->event->base.completion) > + drm_crtc_commit_put(state->commit); > + > kfree(state->commit->event); > state->commit->event = NULL; > drm_crtc_commit_put(state->commit); > -- > 2.15.1 > > ___ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] libdrm: intel/Android.mk: Filter libdrm_intel library requirements on x86
On Wed, Jan 10, 2018 at 1:09 PM, John Stultz wrote: > On Wed, Jan 10, 2018 at 5:48 AM, Rob Herring wrote: >> On Tue, Jan 9, 2018 at 11:25 PM, John Stultz wrote: >>> When building AOSP after updating libdrm project to the >>> freedesktop/master branch, I've seen the following build errors: >>> >>> external/libdrm/intel/Android.mk: error: libdrm_intel >> >> This is only needed for i915 (not i965) now BTW. I'm not sure at what >> point we stop caring about i915. >> >>> (SHARED_LIBRARIES android-arm64) missing libpciaccess >>> (SHARED_LIBRARIES android-arm64) You can set >>> ALLOW_MISSING_DEPENDENCIES=true in your environment if this is >>> intentional, but that may defer real problems until later in the >>> build. >>> >>> Using ALLOW_MISSING_DEPENDENCIES=true when building allows >>> things to function properly, but is not ideal. >>> >>> So basically, while I'm not including the libdrm_intel package >>> into the build, just the fact that the Android.mk file references >>> libpciaccess which isn't a repo included in AOSP causes the build >>> failure. >>> >>> So it seems we need some sort of conditional filter in the >>> Android.mk to skip over it if we're not building for intel. >>> >>> This is my initial attempt at solving this. >>> >>> Feedback would be greatly appreciated! >>> >>> I note that in the AOSP version of libdrm, the reference to >>> libpciaccess has been removed. See: >>> >>> https://android.googlesource.com/platform/external/libdrm/+/f6a1130dffae8de9ddd0c379066daf1df27fc8af%5E%21/ >>> So I wonder if it make sense to instead remove this upstream as >>> well? >> >> Only if we drop i915. > > To be more precise, drop i915 for Android builds (I'm not suggesting > dropping it elsewhere, just for the Android.mk). I'm really not sure > which devices might be affected. Anyone able to point me to someone in > Intel who would know? The android-x86 folks would be the ones to ask. I added Chih-Wei. >>> +ifeq ($(TARGET_ARCH), x86) >> >> This doesn't work for x86_64. i915 and 64-bit may not be a valid >> combination, not sure, but we do at least build test that. > > Out of curiosity, which environment is being used for this build > testing? Are you describing your generic-build/qemu work or something > else done as part of freedesktop.org? The CI job I setup to build mesa master (and libdrm implicitly). Rob ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [RFC][PATCH 1/5] drm_hwcomposer: provide a common gralloc handle definition
On Wed, Jan 10, 2018 at 12:05 AM, John Stultz wrote: > From: Rob Herring > > EGL, gralloc, and HWC must all have a common definition of fd's and int's > in native_handle_t to share the fd and width, height, format, etc. of a > dmabuf. > > Move the definition into HWC so we aren't dependent on a specific gralloc > implementation and so we don't have to create an importer just for > different native_handle_t layouts. This will allow supporting multiple > gralloc implementations that conform to this layout. > > For now, this is aligned with gbm_gralloc's struct. Once we change > gbm_gralloc and mesa to point to this copy, we can make modifications to > the struct. > > Change-Id: I0e0e9994c7a13e6c47f00a70d13cd2ef9b1543d3 > Cc: Marissa Wall > Cc: Sean Paul > Cc: Dmitry Shmidt > Cc: Robert Foss > Cc: Matt Szczesiak > Cc: Liviu Dudau > Cc: David Hanna > Signed-off-by: Rob Herring > [jstultz: This patch is important to be able to build AOSP > without having to include the gbm_gralloc project.] > Signed-off-by: John Stultz > --- > Android.mk | 1 - > gralloc_drm_handle.h | 87 > > 2 files changed, 87 insertions(+), 1 deletion(-) > create mode 100644 gralloc_drm_handle.h We have since decided that libdrm is a better place for this. Robert Foss is working on that. But you shouldn't need this at all with your custom importer. Rob ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[pull] drm/msm: msm-next for 4.16
Hi Dave, Updates for 4.16.. fairly small this time around, main thing is devfreq support for the gpu. The following changes since commit 9428088c90b6f7d5edd2a1b0d742c75339b36f6e: drm/qxl: reapply cursor after resetting primary (2017-12-08 13:37:02 +1000) are available in the Git repository at: git://people.freedesktop.org/~robclark/linux tags/drm-msm-next-2018-01-10 for you to fetch changes up to f91c14ab448af4d9d57350301dd9d6b6a7b6128a: drm/msm: Add devfreq support for the GPU (2018-01-10 14:30:03 -0500) Archit Taneja (1): drm/msm: Fix NULL deref in adreno_load_gpu Arnd Bergmann (2): drm/msm: fix msm_rd_dump_submit prototype drm/msm: avoid false-positive -Wmaybe-uninitialized warning Colin Ian King (1): drm/msm: fix spelling mistake: "ringubffer" -> "ringbuffer" Jordan Crouse (9): drm/msm: gpu: Only sync fences on rings that exist drm/msm/adreno: Call dev_pm_opp_put() drm/msm/adreno: Remove a useless call to dev_pm_opp_get_freq() drm/msm/gpu: Remove unused bus scaling code drm/msm/adreno: Cleanup chipid parsing drm/msm/adreno: Move clock parsing to adreno_gpu_init() drm/msm/adreno: Read the speed bins for a5xx targets drm/msm/adreno: a5xx: Explicitly program the CP0 performance counter drm/msm: Add devfreq support for the GPU Lukas Wunner (1): drm/msm/mdp4: Deduplicate bus_find_device() by name matching Nicolas Dechesne (2): drm/msm: update adreno firmware path in MODULE_FIRMWARE drm/msm: add missing MODULE_FIRMWARE declarations Prakash Kamliya (1): drm/msm: fix leak in failed get_pages Rob Clark (1): drm/msm: free kstrdup'd cmdline drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 38 drivers/gpu/drm/msm/adreno/a5xx_power.c| 8 +- drivers/gpu/drm/msm/adreno/adreno_device.c | 140 - drivers/gpu/drm/msm/adreno/adreno_gpu.c| 85 +++--- drivers/gpu/drm/msm/adreno/adreno_gpu.h| 4 - drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.h| 7 +- drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 9 +- drivers/gpu/drm/msm/msm_drv.h | 3 +- drivers/gpu/drm/msm/msm_gem.c | 14 ++- drivers/gpu/drm/msm/msm_gpu.c | 112 +-- drivers/gpu/drm/msm/msm_gpu.h | 14 +-- 11 files changed, 264 insertions(+), 170 deletions(-) ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[pull] amdgpu, radeon, ttm drm-next-4.16
Hi Dave, A few fixes for 4.16: - Cleanup the the remains of ttm io_mem_pfn - A couple dpm quirks for SI - Add Chunming as another amdgpu maintainer - A few more huge page fixes - A few other misc fixes The following changes since commit fb8baefc7b2d7b93ad96abacbe63fa99e3d213d6: drm/amdgpu: use %pap format string for phys_addr_t (2018-01-09 10:59:28 +1000) are available in the git repository at: git://people.freedesktop.org/~agd5f/linux drm-next-4.16 for you to fetch changes up to ad8cec7df5d4bf3b1109fabbb1d61663857045ae: drm/amd/pp: Implement get_max_high_clocks for CI/VI (2018-01-10 15:44:55 -0500) Alex Deucher (4): drm/radeon: Add dpm quirk for Jet PRO (v2) drm/amdgpu: Add dpm quirk for Jet PRO (v2) drm/amdgpu: add atpx quirk handling (v2) drm/amdgpu/gfx9: only init the apertures used by KGD (v2) Christian König (8): drm/ttm: specify DMA_ATTR_NO_WARN for huge page pools drm/amdgpu: loosen the criteria for huge pages a bit drm/amdgpu: minor optimize VM moved handling v2 drm/amdgpu: update VM PDs after the PTs drm/amdgpu: simplify huge page handling drm/amdgpu: optimize moved handling only when vm_debug is inactive drm/amdgpu: fix 64bit BAR detection MAINTAINERS: add David (Chunming) Zhou as additional amdgpu maintainer Evan Quan (1): drm/amd/powerplay: set pp_num_states as 0 on error situation Rex Zhu (1): drm/amd/pp: Implement get_max_high_clocks for CI/VI Tan Xiaojun (2): staging: remove the default io_mem_pfn set drm/ttm: remove ttm_bo_default_io_mem_pfn Yintian Tao (1): drm/amd/powerplay: fix memory leakage when reload (v2) MAINTAINERS| 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 57 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 8 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c| 8 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 78 +- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/si_dpm.c| 5 ++ drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 2 + drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 20 ++ drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c | 6 ++ drivers/gpu/drm/radeon/si_dpm.c| 5 ++ drivers/gpu/drm/ttm/ttm_bo_vm.c| 11 +-- drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 8 ++- drivers/staging/vboxvideo/vbox_ttm.c | 1 - include/drm/ttm/ttm_bo_api.h | 11 --- 16 files changed, 139 insertions(+), 86 deletions(-) ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/amdkfd: Fix potential NULL pointer dereferences
Yeah, this looks good to me. Regards, Felix On 2018-01-10 04:58 PM, Gustavo A. R. Silva wrote: > Hi Felix, > > Quoting Felix Kuehling : > >> Hi Gustavo, >> >> Thanks for catching that. When returning a fault, I think you also need >> to srcu_read_unlock(&kfd_processes_srcu, idx). >> >> However, instead of returning an error, I think I'd prefer to skip PDDs >> that can't be found with continue statements. That way others would >> still suspend and resume successfully. Maybe just print a WARN_ON for >> PDDs that aren't found, because that's an unexpected situation, >> currently. Maybe in the future it could be normal thing if we ever >> support GPU hotplug. >> > > I got it. In that case, what do you think about the following patch > instead? > > index a22fb071..4ff5f0f 100644 > --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c > @@ -461,7 +461,8 @@ int kfd_bind_processes_to_device(struct kfd_dev *dev) > hash_for_each_rcu(kfd_processes_table, temp, p, kfd_processes) { > mutex_lock(&p->mutex); > pdd = kfd_get_process_device_data(dev, p); > - if (pdd->bound != PDD_BOUND_SUSPENDED) { > + > + if (WARN_ON(!pdd) || pdd->bound != PDD_BOUND_SUSPENDED) { > mutex_unlock(&p->mutex); > continue; > } > @@ -501,6 +502,11 @@ void kfd_unbind_processes_from_device(struct > kfd_dev *dev) > mutex_lock(&p->mutex); > pdd = kfd_get_process_device_data(dev, p); > > + if (WARN_ON(!pdd)) { > + mutex_unlock(&p->mutex); > + continue; > + } > + > if (pdd->bound == PDD_BOUND) > pdd->bound = PDD_BOUND_SUSPENDED; > mutex_unlock(&p->mutex); > > > Thank you for the feedback. > -- > Gustavo > >> Regards, >> Felix >> >> >> On 2018-01-10 11:50 AM, Gustavo A. R. Silva wrote: >>> In case kfd_get_process_device_data returns null, there are some >>> null pointer dereferences in functions kfd_bind_processes_to_device >>> and kfd_unbind_processes_from_device. >>> >>> Fix this by null checking pdd before dereferencing it. >>> >>> Addresses-Coverity-ID: 1463794 ("Dereference null return value") >>> Addresses-Coverity-ID: 1463772 ("Dereference null return value") >>> Signed-off-by: Gustavo A. R. Silva >>> --- >>> drivers/gpu/drm/amd/amdkfd/kfd_process.c | 12 >>> 1 file changed, 12 insertions(+) >>> >>> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c >>> b/drivers/gpu/drm/amd/amdkfd/kfd_process.c >>> index a22fb071..29d51d5 100644 >>> --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c >>> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c >>> @@ -461,6 +461,13 @@ int kfd_bind_processes_to_device(struct kfd_dev >>> *dev) >>> hash_for_each_rcu(kfd_processes_table, temp, p, kfd_processes) { >>> mutex_lock(&p->mutex); >>> pdd = kfd_get_process_device_data(dev, p); >>> + >>> + if (!pdd) { >>> + pr_err("Process device data doesn't exist\n"); >>> + mutex_unlock(&p->mutex); >>> + return -EFAULT; >>> + } >>> + >>> if (pdd->bound != PDD_BOUND_SUSPENDED) { >>> mutex_unlock(&p->mutex); >>> continue; >>> @@ -501,6 +508,11 @@ void kfd_unbind_processes_from_device(struct >>> kfd_dev *dev) >>> mutex_lock(&p->mutex); >>> pdd = kfd_get_process_device_data(dev, p); >>> >>> + if (!pdd) { >>> + mutex_unlock(&p->mutex); >>> + return; >>> + } >>> + >>> if (pdd->bound == PDD_BOUND) >>> pdd->bound = PDD_BOUND_SUSPENDED; >>> mutex_unlock(&p->mutex); > > > > > > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 99353] Kaveri 7400K shows random colored noise instead of GUI in X or Wayland
https://bugs.freedesktop.org/show_bug.cgi?id=99353 --- Comment #14 from Bong Cosca --- I have the same setup and I'm experiencing the same symptoms. 7400K on Asus A68HM-K with VGA/DVI-D output on ArchLinux 4.14.12 Xorg 1.19.6, colored noise (sometimes tiled garbage). I tried every possible combination of kernel and R600_DEBUG flags along with xorg.conf options with same result. Both amdgpu and radeon drivers exhibit identical behavior. Any updates on this issue? -- You are receiving this mail because: You are the assignee for the bug.___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [RFC PATCH 01/60] hyper_dmabuf: initial working version of hyper_dmabuf drv
On Wed, Dec 20, 2017 at 10:59:57AM +0100, Daniel Vetter wrote: > On Tue, Dec 19, 2017 at 03:27:31PM -0800, Dongwon Kim wrote: > > I forgot to include this brief information about this patch series. > > > > This patch series contains the implementation of a new device driver, > > hyper_dmabuf, which provides a method for DMA-BUF sharing across > > different OSes running on the same virtual OS platform powered by > > a hypervisor. > > > > Detailed information about this driver is described in a high-level doc > > added by the second patch of the series. > > > > [RFC PATCH 02/60] hyper_dmabuf: added a doc for hyper_dmabuf sharing > > > > I am attaching 'Overview' section here as a summary. > > > > -- > > Section 1. Overview > > -- > > > > Hyper_DMABUF driver is a Linux device driver running on multiple Virtual > > achines (VMs), which expands DMA-BUF sharing capability to the VM > > environment > > where multiple different OS instances need to share same physical data > > without > > data-copy across VMs. > > > > To share a DMA_BUF across VMs, an instance of the Hyper_DMABUF drv on the > > exporting VM (so called, “exporter”) imports a local DMA_BUF from the > > original > > producer of the buffer, then re-exports it with an unique ID, > > hyper_dmabuf_id > > for the buffer to the importing VM (so called, “importer”). > > > > Another instance of the Hyper_DMABUF driver on importer registers > > a hyper_dmabuf_id together with reference information for the shared > > physical > > pages associated with the DMA_BUF to its database when the export happens. > > > > The actual mapping of the DMA_BUF on the importer’s side is done by > > the Hyper_DMABUF driver when user space issues the IOCTL command to access > > the shared DMA_BUF. The Hyper_DMABUF driver works as both an importing and > > exporting driver as is, that is, no special configuration is required. > > Consequently, only a single module per VM is needed to enable cross-VM > > DMA_BUF > > exchange. > > So I know that most dma-buf implementations (especially lots of importers > in drivers/gpu) break this, but fundamentally only the original exporter > is allowed to know about the underlying pages. There's various scenarios > where a dma-buf isn't backed by anything like a struct page. > > So your first step of noodling the underlying struct page out from the > dma-buf is kinda breaking the abstraction, and I think it's not a good > idea to have that. Especially not for sharing across VMs. > > I think a better design would be if hyper-dmabuf would be the dma-buf > exporter in both of the VMs, and you'd import it everywhere you want to in > some gpu/video/whatever driver in the VMs. That way hyper-dmabuf is always > in control of the pages, and a lot of the troubling forwarding you > currently need to do disappears. It could be another way to implement dma-buf sharing however, it would break the flexibility and transparency that this driver has now. With suggested method, there will be two different types of dma-buf exist in general usage model, one is local-dmabuf, a traditional dmabuf that can be shared only within in the same OS instance and the other is cross-vm sharable dmabuf created by hyper_dmabuf driver. The problem with this approach is that an application needs to know whether the contents will be shared or not across VMs in advance before deciding what type of dma-buf it needs to create. Otherwise, the application should always use hyper_dmabuf as the exporter for all contents that can be possibly shared in the future and I think this will require significant amount of application changes and also adds unnecessary dependency on hyper_dmabuf driver. > > 2nd thing: This seems very much related to what's happening around gvt and > allowing at least the host (in a kvm based VM environment) to be able to > access some of the dma-buf (or well, framebuffers in general) that the > client is using. Adding some mailing lists for that. I think you are talking about exposing framebuffer to another domain via GTT memory sharing. And yes, one of primary use cases for hyper_dmabuf is to share a framebuffer or other graphic object across VMs but it is designed to do it via more general way using existing dma-buf framework. Also, we wanted to make this feature available virtually for any sharable contents which can currently be shared via dma-buf locally. > -Daniel > > > > > -- > > > > There is a git repository at github.com where this series of patches are all > > integrated in Linux kernel tree based on the commit: > > > > commit ae64f9bd1d3621b5e60d7363bc20afb46aede215 > > Author: Linus Torvalds > > Date: Sun Dec 3 11:01:47 2017 -0500 > > > > Linux 4.15-rc2 > > > >