Re: [Freedreno] [PATCH 2/5] arm64:dts:sdm845: Add support for GPU LLCC
On 4/4/2018 2:52 AM, Jordan Crouse wrote: On Fri, Mar 23, 2018 at 12:49:48PM +0530, Sharat Masetty wrote: Add client side bindings required for the GPU to use the last level system cache. Also add a register range in the GPU CX domain. Reviewed-by: Jordan CrouseAlso, these should go the the devicetree lists for review (but maybe wait until the other changes have gotten further through the process). Thanks Jordan for the review and the reminder, I will send this specific patch out to the devicetree mailing list for review. Signed-off-by: Sharat Masetty --- arch/arm64/boot/dts/qcom/sdm845.dtsi | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi b/arch/arm64/boot/dts/qcom/sdm845.dtsi index eb0a1b2..7e2d938 100644 --- a/arch/arm64/boot/dts/qcom/sdm845.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi @@ -887,8 +887,8 @@ compatible = "qcom,adreno-630.2", "qcom,adreno"; #stream-id-cells = <16>; - reg = <0x500 0x4>; - reg-names = "kgsl_3d0_reg_memory"; + reg = <0x500 0x4>, <0x509e000 0x10>; + reg-names = "kgsl_3d0_reg_memory", "cx_mem"; /* * Look ma, no clocks! The GPU clocks and power are controlled @@ -898,6 +898,10 @@ interrupts = <0 300 0>; interrupt-names = "kgsl_3d0_irq"; + /* GPU related llc slices */ + cache-slice-names = "gpu", "gpuhtw"; + cache-slices = < 12>, < 11>; + iommus = <_smmu 0>; operating-points-v2 = <_opp_table>; -- 1.9.1 ___ Freedreno mailing list Freedreno@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/freedreno -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, Linux Foundation Collaborative Project ___ Freedreno mailing list Freedreno@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/freedreno
Re: [Freedreno] [DPU PATCH 3/3] drm/msm: Fix dpu build warnings
On 2018-04-03 01:40, Sean Paul wrote: A bunch of warning fixes, build is clean now. Some of the changes done in this patch are unique and were not present in previous patch series to fix dpu driver warnings. Please consider refactoring this patch a bit to include the remaining valid fixes. Thanks, Rajesh Signed-off-by: Sean Paul--- drivers/gpu/drm/msm/disp/dpu1/dpu_connector.c | 7 --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_reg_dma_v1.c | 4 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 1 - drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 1 - drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c | 2 +- drivers/gpu/drm/msm/dpu_dbg.c | 2 +- 7 files changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_connector.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_connector.c index 36607e36672d..a57495f95663 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_connector.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_connector.c @@ -32,9 +32,6 @@ #define DPU_ERROR_CONN(c, fmt, ...) DPU_ERROR("conn%d " fmt,\ (c) ? (c)->base.base.id : -1, ##__VA_ARGS__) -static u32 dither_matrix[DITHER_MATRIX_SZ] = { - 15, 7, 13, 5, 3, 11, 1, 9, 12, 4, 14, 6, 0, 8, 2, 10 -}; static const struct drm_prop_enum_list e_topology_name[] = { {DPU_RM_TOPOLOGY_NONE, "dpu_none"}, @@ -226,6 +223,10 @@ void dpu_connector_unregister_event(struct drm_connector *connector, } #ifdef CONFIG_DRM_MSM_DSI_STAGING +static u32 dither_matrix[DITHER_MATRIX_SZ] = { + 15, 7, 13, 5, 3, 11, 1, 9, 12, 4, 14, 6, 0, 8, 2, 10 +}; + This change is valid. static int _dpu_connector_get_default_dither_cfg_v1( struct dpu_connector *c_conn, void *cfg) { diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index 3308929bc9d6..b0c170373632 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -2587,7 +2587,7 @@ static void dpu_crtc_disable(struct drm_crtc *crtc) struct dpu_crtc_irq_info *node = NULL; struct drm_event event; u32 power_on; - int ret, i; + int ret; if (!crtc || !crtc->dev || !crtc->dev->dev_private || !crtc->state) { DPU_ERROR("invalid crtc\n"); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_reg_dma_v1.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_reg_dma_v1.c index bb4547748ce9..e0d46c545c14 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_reg_dma_v1.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_reg_dma_v1.c @@ -374,7 +374,7 @@ static int validate_dma_cfg(struct dpu_reg_dma_setup_ops_cfg *cfg) } if (cfg->dma_buf->iova & GUARD_BYTES || !cfg->dma_buf->vaddr) { - DRM_ERROR("iova not aligned to %zx iova %x kva %pK", + DRM_ERROR("iova not aligned to %zx iova %llx kva %pK", ADDR_ALIGN, cfg->dma_buf->iova, cfg->dma_buf->vaddr); return -EINVAL; @@ -433,7 +433,7 @@ static int validate_kick_off_v1(struct dpu_reg_dma_kickoff_cfg *cfg) (WRITE_TRIGGER); if (cfg->dma_buf->iova & GUARD_BYTES) { - DRM_ERROR("Address is not aligned to %zx iova %x", ADDR_ALIGN, + DRM_ERROR("Address is not aligned to %zx iova %llx", ADDR_ALIGN, cfg->dma_buf->iova); return -EINVAL; } This was address in https://lists.freedesktop.org/archives/freedreno/2018-March/001944.html diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 36657aa97bd7..aad5a94c726a 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -426,7 +426,6 @@ static void dpu_kms_commit(struct msm_kms *kms, struct drm_atomic_state *state) { struct drm_crtc *crtc; struct drm_crtc_state *crtc_state; - struct dpu_crtc_state *cstate; int i; for_each_new_crtc_in_state(state, crtc, crtc_state, i) { diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c index 33a894e3d580..7844d6463220 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c @@ -2742,7 +2742,6 @@ dpu_plane_duplicate_state(struct drm_plane *plane) struct dpu_plane *pdpu; struct dpu_plane_state *pstate; struct dpu_plane_state *old_state; - struct drm_property *drm_prop; if (!plane) { DPU_ERROR("invalid plane\n"); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c index 801155fe0989..074223383a98 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c @@ -321,7 +321,7 @@ void
Re: [Freedreno] [DPU PATCH 1/3] drm/msm: Fix uninitialized use of prefill_lines
On 2018-04-03 01:40, Sean Paul wrote: prefill_lines initialization was removed in da61c67cdec4, but it's still being used :( Fixes: da61c67cdec4 drm/msm: remove hw rotation support Cc: Jeykumar SankaranSigned-off-by: Sean Paul Reviewed-by: Rajesh Yadav --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index 7f4182294dfd..53f5d5c52063 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -1231,7 +1231,7 @@ static int _dpu_encoder_update_rsc_client( struct drm_crtc *crtc; enum dpu_rsc_state rsc_state; struct dpu_rsc_cmd_config *rsc_config; - int ret, prefill_lines; + int ret; struct msm_display_info *disp_info; struct msm_mode_info *mode_info; int wait_vblank_crtc_id = DPU_RSC_INVALID_CRTC_ID; @@ -1273,7 +1273,7 @@ static int _dpu_encoder_update_rsc_client( (rsc_config->jitter_denom != mode_info->jitter_denom)) { rsc_config->fps = mode_info->frame_rate; rsc_config->vtotal = mode_info->vtotal; - rsc_config->prefill_lines = prefill_lines; + rsc_config->prefill_lines = mode_info->prefill_lines; rsc_config->jitter_numer = mode_info->jitter_numer; rsc_config->jitter_denom = mode_info->jitter_denom; dpu_enc->rsc_state_init = false; ___ Freedreno mailing list Freedreno@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/freedreno
Re: [Freedreno] [DPU PATCH v2 0/2] Remove DPU RSC support
On 2018-04-05 01:51, Sean Paul wrote: On Wed, Apr 04, 2018 at 02:34:40PM +0530, Rajesh Yadav wrote: MSM display controller hardware (DPU) has an inbuilt RSC block which can control power resources and bus bandwidth voting based on frame timing parameters w/o DPU driver intervention. In absence of RSC HW, DPU driver controls these resources. Downstream driver relies on RSC driver for controlling these resources (via RSC HW block) for better power benefits. Since, DPU driver can control these resources, removing RSC driver support. Corresponding devicetree binding are also removed. Details for DPU driver upstreaming: https://lists.freedesktop.org/archives/freedreno/2018-February/001678.html Changes in v2: - Remove last reference to dpu_power_rsc_update - Add DPU PATCH tag for better filtering - Rebase on tip of for-next-staging Hi Rajesh, Unrelated to this change, but I've noticed the threading seems off on the patch sets you're sending. Are you sending the emails one-by-one, or specifying --no-thread in git send-email? Sean Hi Sean, I had sent the patches one by one, I'll take care of this going forward. Thanks, Rajesh Rajesh Yadav (2): dt-bindings: msm/disp: Remove DPU RSC device bindings drm/msm: Remove RSC support from DPU driver .../devicetree/bindings/display/msm/dpu-rsc.txt| 96 -- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 130 +- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h |6 - drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 14 - drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h |9 +- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c| 242 +--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h|7 - drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h |1 - drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c | 20 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.h |3 - drivers/gpu/drm/msm/dpu_dbg.c | 27 - drivers/gpu/drm/msm/dpu_dbg.h | 10 - drivers/gpu/drm/msm/dpu_power_handle.c | 73 +- drivers/gpu/drm/msm/dpu_power_handle.h |4 - drivers/gpu/drm/msm/dpu_rsc.c | 1367 drivers/gpu/drm/msm/dpu_rsc_hw.c | 818 drivers/gpu/drm/msm/dpu_rsc_priv.h | 191 --- include/linux/dpu_rsc.h| 302 - 18 files changed, 42 insertions(+), 3278 deletions(-) delete mode 100644 Documentation/devicetree/bindings/display/msm/dpu-rsc.txt delete mode 100644 drivers/gpu/drm/msm/dpu_rsc.c delete mode 100644 drivers/gpu/drm/msm/dpu_rsc_hw.c delete mode 100644 drivers/gpu/drm/msm/dpu_rsc_priv.h delete mode 100644 include/linux/dpu_rsc.h -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project ___ Freedreno mailing list Freedreno@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/freedreno
Re: [Freedreno] [DPU PATCH v2 0/2] Remove DPU RSC support
On Wed, Apr 04, 2018 at 02:34:40PM +0530, Rajesh Yadav wrote: > MSM display controller hardware (DPU) has an inbuilt RSC block > which can control power resources and bus bandwidth voting > based on frame timing parameters w/o DPU driver intervention. > In absence of RSC HW, DPU driver controls these resources. > > Downstream driver relies on RSC driver for controlling these > resources (via RSC HW block) for better power benefits. > > Since, DPU driver can control these resources, removing RSC > driver support. Corresponding devicetree binding are also removed. > > Details for DPU driver upstreaming: > https://lists.freedesktop.org/archives/freedreno/2018-February/001678.html > > Changes in v2: > - Remove last reference to dpu_power_rsc_update > - Add DPU PATCH tag for better filtering > - Rebase on tip of for-next-staging Hi Rajesh, Unrelated to this change, but I've noticed the threading seems off on the patch sets you're sending. Are you sending the emails one-by-one, or specifying --no-thread in git send-email? Sean > > Rajesh Yadav (2): > dt-bindings: msm/disp: Remove DPU RSC device bindings > drm/msm: Remove RSC support from DPU driver > > .../devicetree/bindings/display/msm/dpu-rsc.txt| 96 -- > drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 130 +- > drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h |6 - > drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 14 - > drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h |9 +- > drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c| 242 +--- > drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h|7 - > drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h |1 - > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c | 20 +- > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.h |3 - > drivers/gpu/drm/msm/dpu_dbg.c | 27 - > drivers/gpu/drm/msm/dpu_dbg.h | 10 - > drivers/gpu/drm/msm/dpu_power_handle.c | 73 +- > drivers/gpu/drm/msm/dpu_power_handle.h |4 - > drivers/gpu/drm/msm/dpu_rsc.c | 1367 > > drivers/gpu/drm/msm/dpu_rsc_hw.c | 818 > drivers/gpu/drm/msm/dpu_rsc_priv.h | 191 --- > include/linux/dpu_rsc.h| 302 - > 18 files changed, 42 insertions(+), 3278 deletions(-) > delete mode 100644 Documentation/devicetree/bindings/display/msm/dpu-rsc.txt > delete mode 100644 drivers/gpu/drm/msm/dpu_rsc.c > delete mode 100644 drivers/gpu/drm/msm/dpu_rsc_hw.c > delete mode 100644 drivers/gpu/drm/msm/dpu_rsc_priv.h > delete mode 100644 include/linux/dpu_rsc.h > > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project > -- Sean Paul, Software Engineer, Google / Chromium OS ___ Freedreno mailing list Freedreno@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/freedreno
Re: [Freedreno] [RFC] drm/atomic+msm: add helper to implement legacy dirtyfb
On Wed, Apr 4, 2018 at 1:41 PM, Noralf Trønneswrote: > > > Den 04.04.2018 00.42, skrev Rob Clark: >> >> Add an atomic helper to implement dirtyfb support. This is needed to >> support DSI command-mode panels with x11 userspace (ie. when we can't >> rely on pageflips to trigger a flush to the panel). >> >> To signal to the driver that the async atomic update needs to >> synchronize with fences, even though the fb didn't change, the >> drm_atomic_state::dirty flag is added. >> >> Signed-off-by: Rob Clark >> --- >> Background: there are a number of different folks working on getting >> upstream kernel working on various different phones/tablets with qcom >> SoC's.. many of them have command mode panels, so we kind of need a >> way to support the legacy dirtyfb ioctl for x11 support. >> >> I know there is work on a proprer non-legacy atomic property for >> userspace to communicate dirty-rect(s) to the kernel, so this can >> be improved from triggering a full-frame flush once that is in >> place. But we kinda needa a stop-gap solution. >> >> I had considered an in-driver solution for this, but things get a >> bit tricky if userspace ands up combining dirtyfb ioctls with page- >> flips, because we need to synchronize setting various CTL.FLUSH bits >> with setting the CTL.START bit. (ie. really all we need to do for >> cmd mode panels is bang CTL.START, but is this ends up racing with >> pageflips setting FLUSH bits, then bad things.) The easiest soln >> is to wrap this up as an atomic commit and rely on the worker to >> serialize things. Hence adding an atomic dirtyfb helper. >> >> I guess at least the helper, with some small addition to translate >> and pass-thru the dirty rect(s) is useful to the final atomic dirty- >> rect property solution. Depending on how far off that is, a stop- >> gap solution could be useful. > > > I have been waiting for someone to address this since I'm not skilled > enough myself to tackle the atomic machinery. It would be be nice to do > all flushing during commit since that would mean that the tinydrm drivers > could be driven solely through drm_simple_display_pipe_funcs. I wouldn't > have to wire through the dirty callback like I do now. > > I see that you use a nonblocking commit. What happens if a new dirtyfb > comes in before the previous is done? I'm relying on the workqueue for committing the async part of non-blocking commits to serialize things. This was actually something I pretty badly need for msm (otherwise pageflip + dirtyfb causes races for settings various FLUSH/START bits which need to happen in a certain order) This was what killed my earlier lazy plan of handling dirtyfb in drm/msm ;-) > If we could save the dirty clips, then I could use this in tinydrm. > A full flush over SPI takes ~50ms so I need to shave off where I can. > > This works for me in my tinydrm world: > > diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h > index c64225274807..218cb36757fa 100644 > --- a/include/drm/drm_plane.h > +++ b/include/drm/drm_plane.h > @@ -28,6 +28,7 @@ > #include > #include > > +struct drm_clip_rect; > struct drm_crtc; > struct drm_printer; > struct drm_modeset_acquire_ctx; > @@ -85,6 +86,9 @@ struct drm_plane_state { > */ > bool dirty; > > + struct drm_clip_rect *dirty_clips; > + unsigned int num_dirty_clips; > + > /** > * @fence: > * > diff --git a/drivers/gpu/drm/drm_atomic_helper.c > b/drivers/gpu/drm/drm_atomic_helper.c > index 8066c508ab50..e00b8247b7c5 100644 > --- a/drivers/gpu/drm/drm_atomic_helper.c > +++ b/drivers/gpu/drm/drm_atomic_helper.c > @@ -3521,6 +3521,8 @@ void __drm_atomic_helper_plane_duplicate_state(struct > drm_plane *plane, > drm_framebuffer_get(state->fb); > > state->dirty = false; > + state->dirty_clips = NULL; > + state->num_dirty_clips = 0; > state->fence = NULL; > state->commit = NULL; > } > @@ -3567,6 +3569,8 @@ void __drm_atomic_helper_plane_destroy_state(struct > drm_plane_state *state) > > if (state->commit) > drm_crtc_commit_put(state->commit); > + > + kfree(state->dirty_clips); > } > EXPORT_SYMBOL(__drm_atomic_helper_plane_destroy_state); > > @@ -3877,8 +3881,20 @@ int drm_atomic_helper_dirtyfb(struct drm_framebuffer > *fb, > struct drm_modeset_acquire_ctx ctx; > struct drm_atomic_state *state; > struct drm_plane *plane; > + bool fb_found = false; > int ret = 0; > > + /* fbdev can flush even when we don't want it to */ > + drm_for_each_plane(plane, fb->dev) { > + if (plane->state->fb == fb) { > + fb_found = true; > + break; > + } > + } > + > + if (!fb_found) > + return 0; > + > /* > * When called from ioctl, we are interruptable, but not when > * called
Re: [Freedreno] [RFC] drm/atomic+msm: add helper to implement legacy dirtyfb
Den 04.04.2018 19.56, skrev Daniel Vetter: On Wed, Apr 4, 2018 at 7:41 PM, Noralf Trønneswrote: Den 04.04.2018 00.42, skrev Rob Clark: Add an atomic helper to implement dirtyfb support. This is needed to support DSI command-mode panels with x11 userspace (ie. when we can't rely on pageflips to trigger a flush to the panel). To signal to the driver that the async atomic update needs to synchronize with fences, even though the fb didn't change, the drm_atomic_state::dirty flag is added. Signed-off-by: Rob Clark --- Background: there are a number of different folks working on getting upstream kernel working on various different phones/tablets with qcom SoC's.. many of them have command mode panels, so we kind of need a way to support the legacy dirtyfb ioctl for x11 support. I know there is work on a proprer non-legacy atomic property for userspace to communicate dirty-rect(s) to the kernel, so this can be improved from triggering a full-frame flush once that is in place. But we kinda needa a stop-gap solution. I had considered an in-driver solution for this, but things get a bit tricky if userspace ands up combining dirtyfb ioctls with page- flips, because we need to synchronize setting various CTL.FLUSH bits with setting the CTL.START bit. (ie. really all we need to do for cmd mode panels is bang CTL.START, but is this ends up racing with pageflips setting FLUSH bits, then bad things.) The easiest soln is to wrap this up as an atomic commit and rely on the worker to serialize things. Hence adding an atomic dirtyfb helper. I guess at least the helper, with some small addition to translate and pass-thru the dirty rect(s) is useful to the final atomic dirty- rect property solution. Depending on how far off that is, a stop- gap solution could be useful. I have been waiting for someone to address this since I'm not skilled enough myself to tackle the atomic machinery. It would be be nice to do all flushing during commit since that would mean that the tinydrm drivers could be driven solely through drm_simple_display_pipe_funcs. I wouldn't have to wire through the dirty callback like I do now. I see that you use a nonblocking commit. What happens if a new dirtyfb comes in before the previous is done? We could reuse the same trick we're doing in the fbdev code, of pushing the commit to a worker and doing it in a blocking fashion. Or at least wait for it to finish (can be done with the crtc_state->event stuff). That way userspace can pile us up in dirtyfb calls, but we'd do at most one per frame. More isn't really useful anyway. If we could save the dirty clips, then I could use this in tinydrm. A full flush over SPI takes ~50ms so I need to shave off where I can. This works for me in my tinydrm world: One thing I thought you've had around somewhere is some additional tracking code, so we don't have to take all the plane mutexes in the ->dirtyfb callback. Does that exist, or was that just a figment of my imagination? I haven't looked at this at all since I know way too little about how atomic works and after the discussion started with damage on page flips, I knew I just had to wait for someone other than me to do this. And I hardly know anything about how the multitude of userspace operates. So I'm sorry, but I can't add much to this discussion, I fall off rather quickly when the details and corner cases are discussed. All I can do is state the needs of tinydrm :-) Noralf. ___ Freedreno mailing list Freedreno@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/freedreno
Re: [Freedreno] [RFC] drm/atomic+msm: add helper to implement legacy dirtyfb
Den 04.04.2018 00.42, skrev Rob Clark: Add an atomic helper to implement dirtyfb support. This is needed to support DSI command-mode panels with x11 userspace (ie. when we can't rely on pageflips to trigger a flush to the panel). To signal to the driver that the async atomic update needs to synchronize with fences, even though the fb didn't change, the drm_atomic_state::dirty flag is added. Signed-off-by: Rob Clark--- Background: there are a number of different folks working on getting upstream kernel working on various different phones/tablets with qcom SoC's.. many of them have command mode panels, so we kind of need a way to support the legacy dirtyfb ioctl for x11 support. I know there is work on a proprer non-legacy atomic property for userspace to communicate dirty-rect(s) to the kernel, so this can be improved from triggering a full-frame flush once that is in place. But we kinda needa a stop-gap solution. I had considered an in-driver solution for this, but things get a bit tricky if userspace ands up combining dirtyfb ioctls with page- flips, because we need to synchronize setting various CTL.FLUSH bits with setting the CTL.START bit. (ie. really all we need to do for cmd mode panels is bang CTL.START, but is this ends up racing with pageflips setting FLUSH bits, then bad things.) The easiest soln is to wrap this up as an atomic commit and rely on the worker to serialize things. Hence adding an atomic dirtyfb helper. I guess at least the helper, with some small addition to translate and pass-thru the dirty rect(s) is useful to the final atomic dirty- rect property solution. Depending on how far off that is, a stop- gap solution could be useful. I have been waiting for someone to address this since I'm not skilled enough myself to tackle the atomic machinery. It would be be nice to do all flushing during commit since that would mean that the tinydrm drivers could be driven solely through drm_simple_display_pipe_funcs. I wouldn't have to wire through the dirty callback like I do now. I see that you use a nonblocking commit. What happens if a new dirtyfb comes in before the previous is done? If we could save the dirty clips, then I could use this in tinydrm. A full flush over SPI takes ~50ms so I need to shave off where I can. This works for me in my tinydrm world: diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index c64225274807..218cb36757fa 100644 --- a/include/drm/drm_plane.h +++ b/include/drm/drm_plane.h @@ -28,6 +28,7 @@ #include #include +struct drm_clip_rect; struct drm_crtc; struct drm_printer; struct drm_modeset_acquire_ctx; @@ -85,6 +86,9 @@ struct drm_plane_state { */ bool dirty; + struct drm_clip_rect *dirty_clips; + unsigned int num_dirty_clips; + /** * @fence: * diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 8066c508ab50..e00b8247b7c5 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -3521,6 +3521,8 @@ void __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane, drm_framebuffer_get(state->fb); state->dirty = false; + state->dirty_clips = NULL; + state->num_dirty_clips = 0; state->fence = NULL; state->commit = NULL; } @@ -3567,6 +3569,8 @@ void __drm_atomic_helper_plane_destroy_state(struct drm_plane_state *state) if (state->commit) drm_crtc_commit_put(state->commit); + + kfree(state->dirty_clips); } EXPORT_SYMBOL(__drm_atomic_helper_plane_destroy_state); @@ -3877,8 +3881,20 @@ int drm_atomic_helper_dirtyfb(struct drm_framebuffer *fb, struct drm_modeset_acquire_ctx ctx; struct drm_atomic_state *state; struct drm_plane *plane; + bool fb_found = false; int ret = 0; + /* fbdev can flush even when we don't want it to */ + drm_for_each_plane(plane, fb->dev) { + if (plane->state->fb == fb) { + fb_found = true; + break; + } + } + + if (!fb_found) + return 0; + /* * When called from ioctl, we are interruptable, but not when * called internally (ie. defio worker) @@ -3907,6 +3923,25 @@ int drm_atomic_helper_dirtyfb(struct drm_framebuffer *fb, } plane_state->dirty = true; + if (clips && num_clips) + plane_state->dirty_clips = kmemdup(clips, num_clips * sizeof(*clips), + GFP_KERNEL); + else + plane_state->dirty_clips = kzalloc(sizeof(*clips), GFP_KERNEL); + + if (!plane_state->dirty_clips) { + ret = -ENOMEM; + goto out; + } + + if (clips && num_clips) { + plane_state->num_dirty_clips =
Re: [Freedreno] [DPU PATCH 3/3] drm/msm/dsi-staging: Gate bus scale code
On Wed, Mar 28, 2018 at 11:48:48AM +0530, Rajesh Yadav wrote: > DSI driver relies on downstream bus scaling > driver (msm_bus) for bus bandwidth voting. > Gate the bus bandwidth voting code under > CONFIG_QCOM_BUS_SCALING. > > Signed-off-by: Rajesh YadavThank you for your patch. Since dsi-staging isn't going upstream, let's hold off on this. Sean > --- > drivers/gpu/drm/msm/dsi-staging/dsi_clk_manager.c | 8 > drivers/gpu/drm/msm/dsi-staging/dsi_ctrl.c| 7 ++- > drivers/gpu/drm/msm/dsi-staging/dsi_phy.c | 2 ++ > 3 files changed, 16 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_clk_manager.c > b/drivers/gpu/drm/msm/dsi-staging/dsi_clk_manager.c > index 919de1e..047f759 100644 > --- a/drivers/gpu/drm/msm/dsi-staging/dsi_clk_manager.c > +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_clk_manager.c > @@ -17,7 +17,9 @@ > #include > #include "dsi_clk.h" > > +#ifdef CONFIG_QCOM_BUS_SCALING > #include > +#endif > > struct dsi_core_clks { > struct dsi_core_clk_info clks; > @@ -226,6 +228,7 @@ int dsi_core_clk_start(struct dsi_core_clks *c_clks) > } > } > > +#ifdef CONFIG_QCOM_BUS_SCALING > if (c_clks->bus_handle) { > rc = msm_bus_scale_client_update_request(c_clks->bus_handle, 1); > if (rc) { > @@ -233,11 +236,14 @@ int dsi_core_clk_start(struct dsi_core_clks *c_clks) > goto error_disable_mmss_clk; > } > } > +#endif > return rc; > > +#ifdef CONFIG_QCOM_BUS_SCALING > error_disable_mmss_clk: > if (c_clks->clks.core_mmss_clk) > clk_disable_unprepare(c_clks->clks.core_mmss_clk); > +#endif > > error_disable_bus_clk: > if (c_clks->clks.bus_clk) > @@ -259,6 +265,7 @@ int dsi_core_clk_stop(struct dsi_core_clks *c_clks) > { > int rc = 0; > > +#ifdef CONFIG_QCOM_BUS_SCALING > if (c_clks->bus_handle) { > rc = msm_bus_scale_client_update_request(c_clks->bus_handle, 0); > if (rc) { > @@ -266,6 +273,7 @@ int dsi_core_clk_stop(struct dsi_core_clks *c_clks) > return rc; > } > } > +#endif > > if (c_clks->clks.core_mmss_clk) > clk_disable_unprepare(c_clks->clks.core_mmss_clk); > diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_ctrl.c > b/drivers/gpu/drm/msm/dsi-staging/dsi_ctrl.c > index fae1b565..0ab92bb 100644 > --- a/drivers/gpu/drm/msm/dsi-staging/dsi_ctrl.c > +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_ctrl.c > @@ -17,7 +17,9 @@ > #include > #include > #include > +#ifdef CONFIG_QCOM_BUS_SCALING > #include > +#endif > #include > #include > > @@ -716,6 +718,7 @@ static int dsi_ctrl_axi_bus_client_init(struct > platform_device *pdev, > struct dsi_ctrl *ctrl) > { > int rc = 0; > +#ifdef CONFIG_QCOM_BUS_SCALING > struct dsi_ctrl_bus_scale_info *bus = >axi_bus_info; > > bus->bus_scale_table = msm_bus_cl_get_pdata(pdev); > @@ -731,12 +734,13 @@ static int dsi_ctrl_axi_bus_client_init(struct > platform_device *pdev, > rc = -EINVAL; > pr_err("failed to register axi bus client\n"); > } > - > +#endif > return rc; > } > > static int dsi_ctrl_axi_bus_client_deinit(struct dsi_ctrl *ctrl) > { > +#ifdef CONFIG_QCOM_BUS_SCALING > struct dsi_ctrl_bus_scale_info *bus = >axi_bus_info; > > if (bus->bus_handle) { > @@ -744,6 +748,7 @@ static int dsi_ctrl_axi_bus_client_deinit(struct dsi_ctrl > *ctrl) > > bus->bus_handle = 0; > } > +#endif > return 0; > } > > diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_phy.c > b/drivers/gpu/drm/msm/dsi-staging/dsi_phy.c > index c13e5bb..e712c61 100644 > --- a/drivers/gpu/drm/msm/dsi-staging/dsi_phy.c > +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_phy.c > @@ -17,7 +17,9 @@ > #include > #include > #include > +#ifdef CONFIG_QCOM_BUS_SCALING > #include > +#endif > #include > > #include "msm_drv.h" > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project > -- Sean Paul, Software Engineer, Google / Chromium OS ___ Freedreno mailing list Freedreno@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/freedreno
Re: [Freedreno] [DPU PATCH 1/3] drm/msm: Remove unused variables
On Wed, Mar 28, 2018 at 11:47:46AM +0530, Rajesh Yadav wrote: > Fix compilation errors due to unused variables. > > Signed-off-by: Rajesh YadavReviewed-by: Sean Paul > --- > drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c| 2 +- > drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c | 1 - > drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 1 - > drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 1 - > 4 files changed, 1 insertion(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c > b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c > index bf46cf1..51cffc4 100644 > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c > @@ -2587,7 +2587,7 @@ static void dpu_crtc_disable(struct drm_crtc *crtc) > struct dpu_crtc_irq_info *node = NULL; > struct drm_event event; > u32 power_on; > - int ret, i; > + int ret; > > if (!crtc || !crtc->dev || !crtc->dev->dev_private || !crtc->state) { > DPU_ERROR("invalid crtc\n"); > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c > b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c > index 2bc5894..3b1212b 100644 > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c > @@ -264,7 +264,6 @@ static void dpu_encoder_phys_wb_setup_fb(struct > dpu_encoder_phys *phys_enc, > const struct msm_format *format; > int ret; > struct msm_gem_address_space *aspace; > - u32 fb_mode; > > if (!phys_enc || !phys_enc->dpu_kms || !phys_enc->dpu_kms->catalog || > !phys_enc->connector) { > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c > b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c > index 7186c64..8ef75f5 100644 > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c > @@ -426,7 +426,6 @@ static void dpu_kms_commit(struct msm_kms *kms, struct > drm_atomic_state *state) > { > struct drm_crtc *crtc; > struct drm_crtc_state *crtc_state; > - struct dpu_crtc_state *cstate; > int i; > > for_each_new_crtc_in_state(state, crtc, crtc_state, i) { > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c > b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c > index c657e6b..b11a918 100644 > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c > @@ -2742,7 +2742,6 @@ static void dpu_plane_destroy_state(struct drm_plane > *plane, > struct dpu_plane *pdpu; > struct dpu_plane_state *pstate; > struct dpu_plane_state *old_state; > - struct drm_property *drm_prop; > > if (!plane) { > DPU_ERROR("invalid plane\n"); > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project > -- Sean Paul, Software Engineer, Google / Chromium OS ___ Freedreno mailing list Freedreno@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/freedreno
[Freedreno] [PATCH v4 5/9] drm/msm: Move implicit sync handling to prepare_fb
In preparation for moving to atomic helpers, move the implicit sync fence handling out of atomic commit and into the plane->prepare_fb() hook. While we're at it, de-duplicate the mdp*_prepare_fb functions. Changes in v4: - Added Reported-by: Rob ClarkSigned-off-by: Sean Paul --- drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c | 17 + drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c | 16 +--- drivers/gpu/drm/msm/msm_atomic.c | 22 ++ drivers/gpu/drm/msm/msm_drv.h | 2 ++ 4 files changed, 26 insertions(+), 31 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c index 7a1ad3af08e3..20e956e14c21 100644 --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c @@ -98,21 +98,6 @@ static const struct drm_plane_funcs mdp4_plane_funcs = { .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, }; -static int mdp4_plane_prepare_fb(struct drm_plane *plane, -struct drm_plane_state *new_state) -{ - struct mdp4_plane *mdp4_plane = to_mdp4_plane(plane); - struct mdp4_kms *mdp4_kms = get_kms(plane); - struct msm_kms *kms = _kms->base.base; - struct drm_framebuffer *fb = new_state->fb; - - if (!fb) - return 0; - - DBG("%s: prepare: FB[%u]", mdp4_plane->name, fb->base.id); - return msm_framebuffer_prepare(fb, kms->aspace); -} - static void mdp4_plane_cleanup_fb(struct drm_plane *plane, struct drm_plane_state *old_state) { @@ -152,7 +137,7 @@ static void mdp4_plane_atomic_update(struct drm_plane *plane, } static const struct drm_plane_helper_funcs mdp4_plane_helper_funcs = { - .prepare_fb = mdp4_plane_prepare_fb, + .prepare_fb = msm_atomic_prepare_fb, .cleanup_fb = mdp4_plane_cleanup_fb, .atomic_check = mdp4_plane_atomic_check, .atomic_update = mdp4_plane_atomic_update, diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c index 5dc42d89b588..d1006ed69aad 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c @@ -245,20 +245,6 @@ static const struct drm_plane_funcs mdp5_plane_funcs = { .atomic_print_state = mdp5_plane_atomic_print_state, }; -static int mdp5_plane_prepare_fb(struct drm_plane *plane, -struct drm_plane_state *new_state) -{ - struct mdp5_kms *mdp5_kms = get_kms(plane); - struct msm_kms *kms = _kms->base.base; - struct drm_framebuffer *fb = new_state->fb; - - if (!new_state->fb) - return 0; - - DBG("%s: prepare: FB[%u]", plane->name, fb->base.id); - return msm_framebuffer_prepare(fb, kms->aspace); -} - static void mdp5_plane_cleanup_fb(struct drm_plane *plane, struct drm_plane_state *old_state) { @@ -553,7 +539,7 @@ static void mdp5_plane_atomic_async_update(struct drm_plane *plane, } static const struct drm_plane_helper_funcs mdp5_plane_helper_funcs = { - .prepare_fb = mdp5_plane_prepare_fb, + .prepare_fb = msm_atomic_prepare_fb, .cleanup_fb = mdp5_plane_cleanup_fb, .atomic_check = mdp5_plane_atomic_check, .atomic_update = mdp5_plane_atomic_update, diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c index c18f0bee20d4..94f9c3e0e7bf 100644 --- a/drivers/gpu/drm/msm/msm_atomic.c +++ b/drivers/gpu/drm/msm/msm_atomic.c @@ -16,6 +16,7 @@ */ #include "msm_drv.h" +#include "msm_gem.h" #include "msm_kms.h" #include "msm_gem.h" #include "msm_fence.h" @@ -97,6 +98,27 @@ static void msm_atomic_wait_for_commit_done(struct drm_device *dev, } } +int msm_atomic_prepare_fb(struct drm_plane *plane, + struct drm_plane_state *new_state) +{ + struct msm_drm_private *priv = plane->dev->dev_private; + struct msm_kms *kms = priv->kms; + struct drm_gem_object *obj; + struct msm_gem_object *msm_obj; + struct dma_fence *fence; + + if (!new_state->fb) + return 0; + + obj = msm_framebuffer_bo(new_state->fb, 0); + msm_obj = to_msm_bo(obj); + fence = reservation_object_get_excl_rcu(msm_obj->resv); + + drm_atomic_set_fence_for_plane(new_state, fence); + + return msm_framebuffer_prepare(new_state->fb, kms->aspace); +} + static void msm_atomic_commit_tail(struct drm_atomic_state *state) { struct drm_device *dev = state->dev; diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index 48ed5b9a8580..98e82230b904 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -160,6 +160,8 @@ struct
[Freedreno] [PATCH v4 3/9] drm/msm: Don't subclass drm_atomic_state anymore
From: Archit TanejaWith the addition of "private_objs" in drm_atomic_state, we no longer need to subclass drm_atomic_state to store state of share resources that don't perfectly fit within planes/crtc/connector state information. We can now save this state within drm_atomic_state itself using the private objects. Remove the infrastructure that allowed subclassing of drm_atomic_state in the driver. Changes in v3: - Added to the msm atomic helper patch set Changes in v4: - None Signed-off-by: Archit Taneja Signed-off-by: Rob Clark Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 46 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h | 22 drivers/gpu/drm/msm/msm_atomic.c | 31 drivers/gpu/drm/msm/msm_drv.c| 3 -- drivers/gpu/drm/msm/msm_kms.h| 14 5 files changed, 116 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c index 6ada098dba0b..6e12e275deba 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c @@ -70,42 +70,6 @@ static int mdp5_hw_init(struct msm_kms *kms) return 0; } -struct mdp5_state *mdp5_get_state(struct drm_atomic_state *s) -{ - struct msm_drm_private *priv = s->dev->dev_private; - struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(priv->kms)); - struct msm_kms_state *state = to_kms_state(s); - struct mdp5_state *new_state; - int ret; - - if (state->state) - return state->state; - - ret = drm_modeset_lock(_kms->state_lock, s->acquire_ctx); - if (ret) - return ERR_PTR(ret); - - new_state = kmalloc(sizeof(*mdp5_kms->state), GFP_KERNEL); - if (!new_state) - return ERR_PTR(-ENOMEM); - - /* Copy state: */ - new_state->hwpipe = mdp5_kms->state->hwpipe; - new_state->hwmixer = mdp5_kms->state->hwmixer; - if (mdp5_kms->smp) - new_state->smp = mdp5_kms->state->smp; - - state->state = new_state; - - return new_state; -} - -static void mdp5_swap_state(struct msm_kms *kms, struct drm_atomic_state *state) -{ - struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(kms)); - swap(to_kms_state(state)->state, mdp5_kms->state); -} - /* Global/shared object state funcs */ /* @@ -315,7 +279,6 @@ static const struct mdp_kms_funcs kms_funcs = { .irq = mdp5_irq, .enable_vblank = mdp5_enable_vblank, .disable_vblank = mdp5_disable_vblank, - .swap_state = mdp5_swap_state, .prepare_commit = mdp5_prepare_commit, .complete_commit = mdp5_complete_commit, .wait_for_crtc_commit_done = mdp5_wait_for_crtc_commit_done, @@ -815,8 +778,6 @@ static void mdp5_destroy(struct platform_device *pdev) drm_atomic_private_obj_fini(_kms->glob_state); drm_modeset_lock_fini(_kms->glob_state_lock); - - kfree(mdp5_kms->state); } static int construct_pipes(struct mdp5_kms *mdp5_kms, int cnt, @@ -969,13 +930,6 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev) mdp5_kms->dev = dev; mdp5_kms->pdev = pdev; - drm_modeset_lock_init(_kms->state_lock); - mdp5_kms->state = kzalloc(sizeof(*mdp5_kms->state), GFP_KERNEL); - if (!mdp5_kms->state) { - ret = -ENOMEM; - goto fail; - } - ret = mdp5_global_obj_init(mdp5_kms); if (ret) goto fail; diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h index 76f0ddfca322..854dfd30e829 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h @@ -28,8 +28,6 @@ #include "mdp5_ctl.h" #include "mdp5_smp.h" -struct mdp5_state; - struct mdp5_kms { struct mdp_kms base; @@ -49,12 +47,6 @@ struct mdp5_kms { struct mdp5_cfg_handler *cfg; uint32_t caps; /* MDP capabilities (MDP_CAP_XXX bits) */ - /** -* Global atomic state. Do not access directly, use mdp5_get_state() -*/ - struct mdp5_state *state; - struct drm_modeset_lock state_lock; - /* * Global private object state, Do not access directly, use * mdp5_global_get_state() @@ -88,20 +80,6 @@ struct mdp5_kms { }; #define to_mdp5_kms(x) container_of(x, struct mdp5_kms, base) -/* Global atomic state for tracking resources that are shared across - * multiple kms objects (planes/crtcs/etc). - * - * For atomic updates which require modifying global state, - */ -struct mdp5_state { - struct mdp5_hw_pipe_state hwpipe; - struct mdp5_hw_mixer_state hwmixer; - struct mdp5_smp_state smp; -}; - -struct mdp5_state
[Freedreno] [PATCH v4 4/9] drm/msm: Refactor complete_commit() to look more the helpers
Factor out the commit_tail() portions of complete_commit() into a separate function to facilitate moving to the atomic helpers in future patches. Changes in v2: - None Changes in v3: - Rebased on Archit's private_obj set Changes in v4: - None Cc: Jeykumar SankaranReviewed-by: Archit Taneja Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/msm_atomic.c | 25 - 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c index 9d0a0ca1f0cb..c18f0bee20d4 100644 --- a/drivers/gpu/drm/msm/msm_atomic.c +++ b/drivers/gpu/drm/msm/msm_atomic.c @@ -97,18 +97,12 @@ static void msm_atomic_wait_for_commit_done(struct drm_device *dev, } } -/* The (potentially) asynchronous part of the commit. At this point - * nothing can fail short of armageddon. - */ -static void complete_commit(struct msm_commit *c, bool async) +static void msm_atomic_commit_tail(struct drm_atomic_state *state) { - struct drm_atomic_state *state = c->state; struct drm_device *dev = state->dev; struct msm_drm_private *priv = dev->dev_private; struct msm_kms *kms = priv->kms; - drm_atomic_helper_wait_for_fences(dev, state, false); - kms->funcs->prepare_commit(kms, state); drm_atomic_helper_commit_modeset_disables(dev, state); @@ -135,6 +129,19 @@ static void complete_commit(struct msm_commit *c, bool async) drm_atomic_helper_cleanup_planes(dev, state); kms->funcs->complete_commit(kms, state); +} + +/* The (potentially) asynchronous part of the commit. At this point + * nothing can fail short of armageddon. + */ +static void complete_commit(struct msm_commit *c) +{ + struct drm_atomic_state *state = c->state; + struct drm_device *dev = state->dev; + + drm_atomic_helper_wait_for_fences(dev, state, false); + + msm_atomic_commit_tail(state); drm_atomic_state_put(state); @@ -143,7 +150,7 @@ static void complete_commit(struct msm_commit *c, bool async) static void commit_worker(struct work_struct *work) { - complete_commit(container_of(work, struct msm_commit, work), true); + complete_commit(container_of(work, struct msm_commit, work)); } /** @@ -248,7 +255,7 @@ int msm_atomic_commit(struct drm_device *dev, return 0; } - complete_commit(c, false); + complete_commit(c); return 0; -- Sean Paul, Software Engineer, Google / Chromium OS ___ Freedreno mailing list Freedreno@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/freedreno
[Freedreno] [PATCH v4 8/9] drm/msm: Remove msm_commit/worker, use atomic helper commit
Moving further towards switching fully to the the atomic helpers, this patch removes the hand-rolled worker nonblock commit code and uses the atomic helpers commit_work model. Changes in v2: - Remove commit_destroy() - Shuffle order of commit_tail calls to further serialize commits - Use stall in swap_state to avoid abandoned events on disable Changes in v3: - Rebased on Archit's private_obj set Changes in v4: - None Signed-off-by: Sean Paul--- drivers/gpu/drm/msm/msm_atomic.c | 153 +-- drivers/gpu/drm/msm/msm_drv.c| 1 - drivers/gpu/drm/msm/msm_drv.h| 4 - 3 files changed, 42 insertions(+), 116 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c index 94f9c3e0e7bf..95c7868445dd 100644 --- a/drivers/gpu/drm/msm/msm_atomic.c +++ b/drivers/gpu/drm/msm/msm_atomic.c @@ -21,66 +21,6 @@ #include "msm_gem.h" #include "msm_fence.h" -struct msm_commit { - struct drm_device *dev; - struct drm_atomic_state *state; - struct work_struct work; - uint32_t crtc_mask; -}; - -static void commit_worker(struct work_struct *work); - -/* block until specified crtcs are no longer pending update, and - * atomically mark them as pending update - */ -static int start_atomic(struct msm_drm_private *priv, uint32_t crtc_mask) -{ - int ret; - - spin_lock(>pending_crtcs_event.lock); - ret = wait_event_interruptible_locked(priv->pending_crtcs_event, - !(priv->pending_crtcs & crtc_mask)); - if (ret == 0) { - DBG("start: %08x", crtc_mask); - priv->pending_crtcs |= crtc_mask; - } - spin_unlock(>pending_crtcs_event.lock); - - return ret; -} - -/* clear specified crtcs (no longer pending update) - */ -static void end_atomic(struct msm_drm_private *priv, uint32_t crtc_mask) -{ - spin_lock(>pending_crtcs_event.lock); - DBG("end: %08x", crtc_mask); - priv->pending_crtcs &= ~crtc_mask; - wake_up_all_locked(>pending_crtcs_event); - spin_unlock(>pending_crtcs_event.lock); -} - -static struct msm_commit *commit_init(struct drm_atomic_state *state) -{ - struct msm_commit *c = kzalloc(sizeof(*c), GFP_KERNEL); - - if (!c) - return NULL; - - c->dev = state->dev; - c->state = state; - - INIT_WORK(>work, commit_worker); - - return c; -} - -static void commit_destroy(struct msm_commit *c) -{ - end_atomic(c->dev->dev_private, c->crtc_mask); - kfree(c); -} - static void msm_atomic_wait_for_commit_done(struct drm_device *dev, struct drm_atomic_state *old_state) { @@ -148,31 +88,37 @@ static void msm_atomic_commit_tail(struct drm_atomic_state *state) msm_atomic_wait_for_commit_done(dev, state); - drm_atomic_helper_cleanup_planes(dev, state); - kms->funcs->complete_commit(kms, state); + + drm_atomic_helper_wait_for_vblanks(dev, state); + + drm_atomic_helper_commit_hw_done(state); + + drm_atomic_helper_cleanup_planes(dev, state); } /* The (potentially) asynchronous part of the commit. At this point * nothing can fail short of armageddon. */ -static void complete_commit(struct msm_commit *c) +static void commit_tail(struct drm_atomic_state *state) { - struct drm_atomic_state *state = c->state; - struct drm_device *dev = state->dev; + drm_atomic_helper_wait_for_fences(state->dev, state, false); - drm_atomic_helper_wait_for_fences(dev, state, false); + drm_atomic_helper_wait_for_dependencies(state); msm_atomic_commit_tail(state); - drm_atomic_state_put(state); + drm_atomic_helper_commit_cleanup_done(state); - commit_destroy(c); + drm_atomic_state_put(state); } -static void commit_worker(struct work_struct *work) +static void commit_work(struct work_struct *work) { - complete_commit(container_of(work, struct msm_commit, work)); + struct drm_atomic_state *state = container_of(work, + struct drm_atomic_state, + commit_work); + commit_tail(state); } /** @@ -191,17 +137,12 @@ int msm_atomic_commit(struct drm_device *dev, struct drm_atomic_state *state, bool nonblock) { struct msm_drm_private *priv = dev->dev_private; - struct msm_commit *c; struct drm_crtc *crtc; struct drm_crtc_state *crtc_state; struct drm_plane *plane; struct drm_plane_state *old_plane_state, *new_plane_state; int i, ret; - ret = drm_atomic_helper_prepare_planes(dev, state); - if (ret) - return ret; - /* * Note that plane->atomic_async_check() should fail if we need * to re-assign hwpipe or anything that touches global atomic @@ -209,45 +150,39 @@ int msm_atomic_commit(struct drm_device
[Freedreno] [PATCH v4 7/9] drm/msm: Issue queued events when disabling crtc
Ensure that any queued events are issued when disabling the crtc. This avoids timeouts when we come back and wait for dependencies (like the previous frame's flip_done). Changes in v2: - None Changes in v3: - Rebased on Archit's private_obj set Changes in v4: - None Reviewed-by: Archit TanejaSigned-off-by: Sean Paul --- drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c index 76b96081916f..10271359789e 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c @@ -430,6 +430,7 @@ static void mdp5_crtc_atomic_disable(struct drm_crtc *crtc, struct mdp5_crtc_state *mdp5_cstate = to_mdp5_crtc_state(crtc->state); struct mdp5_kms *mdp5_kms = get_kms(crtc); struct device *dev = _kms->pdev->dev; + unsigned long flags; DBG("%s", crtc->name); @@ -445,6 +446,14 @@ static void mdp5_crtc_atomic_disable(struct drm_crtc *crtc, mdp_irq_unregister(_kms->base, _crtc->err); pm_runtime_put_sync(dev); + if (crtc->state->event && !crtc->state->active) { + WARN_ON(mdp5_crtc->event); + spin_lock_irqsave(_kms->dev->event_lock, flags); + drm_crtc_send_vblank_event(crtc, crtc->state->event); + crtc->state->event = NULL; + spin_unlock_irqrestore(_kms->dev->event_lock, flags); + } + mdp5_crtc->enabled = false; } -- Sean Paul, Software Engineer, Google / Chromium OS ___ Freedreno mailing list Freedreno@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/freedreno
[Freedreno] [PATCH v4 1/9] drm/msm/mdp5: Add global state as a private atomic object
From: Archit TanejaGlobal shared resources (hwpipes, hwmixers and SMP) for MDP5 are implemented as a part of atomic state by subclassing drm_atomic_state. The preferred approach is to use the drm_private_obj infrastructure available in the atomic core. mdp5_global_state is introduced as a drm atomic private object. The two funcs mdp5_get_global_state() and mdp5_get_existing_global_state() are the two variants that will be used to access mdp5_global_state. This will replace the existing mdp5_state struct (which subclasses drm_atomic_state) and the funcs around it. These will be removed later once we mdp5_global_state is put to use everywhere. Changes in v3: - Added glob_state_lock instead of pushing it into the core - Added to the msm atomic helper patch set Changes in v4: - None Signed-off-by: Archit Taneja Signed-off-by: Rob Clark Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 87 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h | 25 +++ 2 files changed, 112 insertions(+) diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c index 6d8e3a9a6fc0..fcbdef385a8a 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c @@ -106,6 +106,86 @@ static void mdp5_swap_state(struct msm_kms *kms, struct drm_atomic_state *state) swap(to_kms_state(state)->state, mdp5_kms->state); } +/* Global/shared object state funcs */ + +/* + * This is a helper that returns the private state currently in operation. + * Note that this would return the "old_state" if called in the atomic check + * path, and the "new_state" after the atomic swap has been done. + */ +struct mdp5_global_state * +mdp5_get_existing_global_state(struct mdp5_kms *mdp5_kms) +{ + return to_mdp5_global_state(mdp5_kms->glob_state.state); +} + +/* + * This acquires the modeset lock set aside for global state, creates + * a new duplicated private object state. + */ +struct mdp5_global_state *mdp5_get_global_state(struct drm_atomic_state *s) +{ + struct msm_drm_private *priv = s->dev->dev_private; + struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(priv->kms)); + struct drm_private_state *priv_state; + int ret; + + ret = drm_modeset_lock(_kms->glob_state_lock, s->acquire_ctx); + if (ret) + return ERR_PTR(ret); + + priv_state = drm_atomic_get_private_obj_state(s, _kms->glob_state); + if (IS_ERR(priv_state)) + return ERR_CAST(priv_state); + + return to_mdp5_global_state(priv_state); +} + +static struct drm_private_state * +mdp5_global_duplicate_state(struct drm_private_obj *obj) +{ + struct mdp5_global_state *state; + + state = kmemdup(obj->state, sizeof(*state), GFP_KERNEL); + if (!state) + return NULL; + + __drm_atomic_helper_private_obj_duplicate_state(obj, >base); + + return >base; +} + +static void mdp5_global_destroy_state(struct drm_private_obj *obj, + struct drm_private_state *state) +{ + struct mdp5_global_state *mdp5_state = to_mdp5_global_state(state); + + kfree(mdp5_state); +} + +static const struct drm_private_state_funcs mdp5_global_state_funcs = { + .atomic_duplicate_state = mdp5_global_duplicate_state, + .atomic_destroy_state = mdp5_global_destroy_state, +}; + +static int mdp5_global_obj_init(struct mdp5_kms *mdp5_kms) +{ + struct mdp5_global_state *state; + + drm_modeset_lock_init(_kms->glob_state_lock); + + state = kzalloc(sizeof(*state), GFP_KERNEL); + if (!state) + return -ENOMEM; + + state->mdp5_kms = mdp5_kms; + + drm_atomic_private_obj_init(_kms->glob_state, + >base, + _global_state_funcs); + return 0; +} + static void mdp5_prepare_commit(struct msm_kms *kms, struct drm_atomic_state *state) { struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(kms)); @@ -727,6 +807,9 @@ static void mdp5_destroy(struct platform_device *pdev) if (mdp5_kms->rpm_enabled) pm_runtime_disable(>dev); + drm_atomic_private_obj_fini(_kms->glob_state); + drm_modeset_lock_fini(_kms->glob_state_lock); + kfree(mdp5_kms->state); } @@ -887,6 +970,10 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev) goto fail; } + ret = mdp5_global_obj_init(mdp5_kms); + if (ret) + goto fail; + mdp5_kms->mmio = msm_ioremap(pdev, "mdp_phys", "MDP5"); if (IS_ERR(mdp5_kms->mmio)) { ret = PTR_ERR(mdp5_kms->mmio); diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h index 425a03d213e5..76f0ddfca322 100644 ---
[Freedreno] [PATCH v4 9/9] drm/msm: Switch to atomic_helper_commit()
Now that all of the msm-specific goo is tucked safely away we can switch over to using the atomic helper commit directly. \o/ Changes in v2: - None Changes in v3: - Rebased on Archit's private_obj set Changes in v4: - None Cc: Abhinav KumarSigned-off-by: Sean Paul --- drivers/gpu/drm/msm/msm_atomic.c | 139 +-- drivers/gpu/drm/msm/msm_drv.c| 7 +- drivers/gpu/drm/msm/msm_drv.h| 3 +- 3 files changed, 8 insertions(+), 141 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c index 95c7868445dd..f0635c3da7f4 100644 --- a/drivers/gpu/drm/msm/msm_atomic.c +++ b/drivers/gpu/drm/msm/msm_atomic.c @@ -18,8 +18,6 @@ #include "msm_drv.h" #include "msm_gem.h" #include "msm_kms.h" -#include "msm_gem.h" -#include "msm_fence.h" static void msm_atomic_wait_for_commit_done(struct drm_device *dev, struct drm_atomic_state *old_state) @@ -59,7 +57,7 @@ int msm_atomic_prepare_fb(struct drm_plane *plane, return msm_framebuffer_prepare(new_state->fb, kms->aspace); } -static void msm_atomic_commit_tail(struct drm_atomic_state *state) +void msm_atomic_commit_tail(struct drm_atomic_state *state) { struct drm_device *dev = state->dev; struct msm_drm_private *priv = dev->dev_private; @@ -73,19 +71,6 @@ static void msm_atomic_commit_tail(struct drm_atomic_state *state) drm_atomic_helper_commit_modeset_enables(dev, state); - /* NOTE: _wait_for_vblanks() only waits for vblank on -* enabled CRTCs. So we end up faulting when disabling -* due to (potentially) unref'ing the outgoing fb's -* before the vblank when the disable has latched. -* -* But if it did wait on disabled (or newly disabled) -* CRTCs, that would be racy (ie. we could have missed -* the irq. We need some way to poll for pipe shut -* down. Or just live with occasionally hitting the -* timeout in the CRTC disable path (which really should -* not be critical path) -*/ - msm_atomic_wait_for_commit_done(dev, state); kms->funcs->complete_commit(kms, state); @@ -96,125 +81,3 @@ static void msm_atomic_commit_tail(struct drm_atomic_state *state) drm_atomic_helper_cleanup_planes(dev, state); } - -/* The (potentially) asynchronous part of the commit. At this point - * nothing can fail short of armageddon. - */ -static void commit_tail(struct drm_atomic_state *state) -{ - drm_atomic_helper_wait_for_fences(state->dev, state, false); - - drm_atomic_helper_wait_for_dependencies(state); - - msm_atomic_commit_tail(state); - - drm_atomic_helper_commit_cleanup_done(state); - - drm_atomic_state_put(state); -} - -static void commit_work(struct work_struct *work) -{ - struct drm_atomic_state *state = container_of(work, - struct drm_atomic_state, - commit_work); - commit_tail(state); -} - -/** - * drm_atomic_helper_commit - commit validated state object - * @dev: DRM device - * @state: the driver state object - * @nonblock: nonblocking commit - * - * This function commits a with drm_atomic_helper_check() pre-validated state - * object. This can still fail when e.g. the framebuffer reservation fails. - * - * RETURNS - * Zero for success or -errno. - */ -int msm_atomic_commit(struct drm_device *dev, - struct drm_atomic_state *state, bool nonblock) -{ - struct msm_drm_private *priv = dev->dev_private; - struct drm_crtc *crtc; - struct drm_crtc_state *crtc_state; - struct drm_plane *plane; - struct drm_plane_state *old_plane_state, *new_plane_state; - int i, ret; - - /* -* Note that plane->atomic_async_check() should fail if we need -* to re-assign hwpipe or anything that touches global atomic -* state, so we'll never go down the async update path in those -* cases. -*/ - if (state->async_update) { - ret = drm_atomic_helper_prepare_planes(dev, state); - if (ret) - return ret; - - drm_atomic_helper_async_commit(dev, state); - drm_atomic_helper_cleanup_planes(dev, state); - return 0; - } - - ret = drm_atomic_helper_setup_commit(state, nonblock); - if (ret) - return ret; - - INIT_WORK(>commit_work, commit_work); - - ret = drm_atomic_helper_prepare_planes(dev, state); - if (ret) - return ret; - - if (!nonblock) { - ret = drm_atomic_helper_wait_for_fences(dev, state, true); - if (ret) - goto error; - } - - /* -* This is the point of no return - everything below never fails except -* when the hw goes
[Freedreno] [PATCH v4 2/9] drm/msm/mdp5: Use the new private_obj state
From: Archit TanejaThis replaces the usage of the subclassed atomic state (mdp5_state) with a private_obj state embedded within drm_atomic_state. The latter method is the preferred approach, since it's simpler to implement and less prone to errors. The new API replaces the older and equivalent mdp5_state usage in the following pattern: - References to "mdp5_kms->state" (i.e, the old/existing state) is replaced with mdp5_get_existing_global_state(). In the atomic_check path, this should be called with the glob_state_lock drm_modeset_lock alredy taken. - References to "mdp5_get_state()" are replaced with mdp5_get_global_state(). This acquires glob_state_lock and uses drm_atomic_get_private_obj_state() to create a new duplicated state. Changes in v3: - Acquire glob_state_lock in mdp5_smp.c - Added to the msm atomic helper patch set Changes in v4: - None Signed-off-by: Archit Taneja Signed-off-by: Rob Clark Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 10 -- drivers/gpu/drm/msm/disp/mdp5/mdp5_mixer.c | 12 ++-- drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.c | 20 +++- drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c | 17 - 4 files changed, 37 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c index fcbdef385a8a..6ada098dba0b 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c @@ -190,20 +190,26 @@ static void mdp5_prepare_commit(struct msm_kms *kms, struct drm_atomic_state *st { struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(kms)); struct device *dev = _kms->pdev->dev; + struct mdp5_global_state *global_state; + + global_state = mdp5_get_existing_global_state(mdp5_kms); pm_runtime_get_sync(dev); if (mdp5_kms->smp) - mdp5_smp_prepare_commit(mdp5_kms->smp, _kms->state->smp); + mdp5_smp_prepare_commit(mdp5_kms->smp, _state->smp); } static void mdp5_complete_commit(struct msm_kms *kms, struct drm_atomic_state *state) { struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(kms)); struct device *dev = _kms->pdev->dev; + struct mdp5_global_state *global_state; + + global_state = mdp5_get_existing_global_state(mdp5_kms); if (mdp5_kms->smp) - mdp5_smp_complete_commit(mdp5_kms->smp, _kms->state->smp); + mdp5_smp_complete_commit(mdp5_kms->smp, _state->smp); pm_runtime_put_sync(dev); } diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_mixer.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_mixer.c index 8a00991f03c7..113e6b569562 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_mixer.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_mixer.c @@ -52,14 +52,14 @@ int mdp5_mixer_assign(struct drm_atomic_state *s, struct drm_crtc *crtc, { struct msm_drm_private *priv = s->dev->dev_private; struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(priv->kms)); - struct mdp5_state *state = mdp5_get_state(s); + struct mdp5_global_state *global_state = mdp5_get_global_state(s); struct mdp5_hw_mixer_state *new_state; int i; - if (IS_ERR(state)) - return PTR_ERR(state); + if (IS_ERR(global_state)) + return PTR_ERR(global_state); - new_state = >hwmixer; + new_state = _state->hwmixer; for (i = 0; i < mdp5_kms->num_hwmixers; i++) { struct mdp5_hw_mixer *cur = mdp5_kms->hwmixers[i]; @@ -129,8 +129,8 @@ int mdp5_mixer_assign(struct drm_atomic_state *s, struct drm_crtc *crtc, void mdp5_mixer_release(struct drm_atomic_state *s, struct mdp5_hw_mixer *mixer) { - struct mdp5_state *state = mdp5_get_state(s); - struct mdp5_hw_mixer_state *new_state = >hwmixer; + struct mdp5_global_state *global_state = mdp5_get_global_state(s); + struct mdp5_hw_mixer_state *new_state = _state->hwmixer; if (!mixer) return; diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.c index ff52c49095f9..1ef26bc63163 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.c @@ -24,17 +24,19 @@ int mdp5_pipe_assign(struct drm_atomic_state *s, struct drm_plane *plane, { struct msm_drm_private *priv = s->dev->dev_private; struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(priv->kms)); - struct mdp5_state *state; + struct mdp5_global_state *new_global_state, *old_global_state; struct mdp5_hw_pipe_state *old_state, *new_state; int i, j; - state = mdp5_get_state(s); - if (IS_ERR(state)) - return PTR_ERR(state); + new_global_state = mdp5_get_global_state(s); + if
[Freedreno] [PATCH v4 6/9] drm/msm: Mark the crtc->state->event consumed
Don't leave the event != NULL once it's consumed, this is used a signal to the atomic helpers that the event will be handled by the driver. Changes in v2: - None Changes in v3: - Rebased on Archit's private_obj set Changes in v4: - None Cc: Jeykumar SankaranReviewed-by: Archit Taneja Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c | 1 + drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c index 6e5e1aa54ce1..b001699297c4 100644 --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c @@ -351,6 +351,7 @@ static void mdp4_crtc_atomic_flush(struct drm_crtc *crtc, spin_lock_irqsave(>event_lock, flags); mdp4_crtc->event = crtc->state->event; + crtc->state->event = NULL; spin_unlock_irqrestore(>event_lock, flags); blend_setup(crtc); diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c index 9893e43ba6c5..76b96081916f 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c @@ -708,6 +708,7 @@ static void mdp5_crtc_atomic_flush(struct drm_crtc *crtc, spin_lock_irqsave(>event_lock, flags); mdp5_crtc->event = crtc->state->event; + crtc->state->event = NULL; spin_unlock_irqrestore(>event_lock, flags); /* -- Sean Paul, Software Engineer, Google / Chromium OS ___ Freedreno mailing list Freedreno@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/freedreno
Re: [Freedreno] [RFC] drm/atomic+msm: add helper to implement legacy dirtyfb
On Wed, Apr 4, 2018 at 3:24 PM, Rob Clarkwrote: > On Wed, Apr 4, 2018 at 8:16 AM, Daniel Vetter wrote: >> On Wed, Apr 04, 2018 at 07:40:32AM -0400, Rob Clark wrote: >>> On Wed, Apr 4, 2018 at 5:56 AM, Daniel Vetter wrote: >>> > On Wed, Apr 04, 2018 at 11:10:08AM +0200, Thomas Hellstrom wrote: >>> >> On 04/04/2018 10:43 AM, Daniel Vetter wrote: >>> >> > On Wed, Apr 04, 2018 at 10:22:21AM +0200, Thomas Hellstrom wrote: >>> >> > > Hi, >>> >> > > >>> >> > > On 04/04/2018 08:58 AM, Daniel Vetter wrote: >>> >> > > > On Wed, Apr 4, 2018 at 12:42 AM, Rob Clark >>> >> > > > wrote: >>> >> > > > > Add an atomic helper to implement dirtyfb support. This is >>> >> > > > > needed to >>> >> > > > > support DSI command-mode panels with x11 userspace (ie. when we >>> >> > > > > can't >>> >> > > > > rely on pageflips to trigger a flush to the panel). >>> >> > > > > >>> >> > > > > To signal to the driver that the async atomic update needs to >>> >> > > > > synchronize with fences, even though the fb didn't change, the >>> >> > > > > drm_atomic_state::dirty flag is added. >>> >> > > > > >>> >> > > > > Signed-off-by: Rob Clark >>> >> > > > > --- >>> >> > > > > Background: there are a number of different folks working on >>> >> > > > > getting >>> >> > > > > upstream kernel working on various different phones/tablets with >>> >> > > > > qcom >>> >> > > > > SoC's.. many of them have command mode panels, so we kind of >>> >> > > > > need a >>> >> > > > > way to support the legacy dirtyfb ioctl for x11 support. >>> >> > > > > >>> >> > > > > I know there is work on a proprer non-legacy atomic property for >>> >> > > > > userspace to communicate dirty-rect(s) to the kernel, so this can >>> >> > > > > be improved from triggering a full-frame flush once that is in >>> >> > > > > place. But we kinda needa a stop-gap solution. >>> >> > > > > >>> >> > > > > I had considered an in-driver solution for this, but things get a >>> >> > > > > bit tricky if userspace ands up combining dirtyfb ioctls with >>> >> > > > > page- >>> >> > > > > flips, because we need to synchronize setting various CTL.FLUSH >>> >> > > > > bits >>> >> > > > > with setting the CTL.START bit. (ie. really all we need to do >>> >> > > > > for >>> >> > > > > cmd mode panels is bang CTL.START, but is this ends up racing >>> >> > > > > with >>> >> > > > > pageflips setting FLUSH bits, then bad things.) The easiest soln >>> >> > > > > is to wrap this up as an atomic commit and rely on the worker to >>> >> > > > > serialize things. Hence adding an atomic dirtyfb helper. >>> >> > > > > >>> >> > > > > I guess at least the helper, with some small addition to >>> >> > > > > translate >>> >> > > > > and pass-thru the dirty rect(s) is useful to the final atomic >>> >> > > > > dirty- >>> >> > > > > rect property solution. Depending on how far off that is, a >>> >> > > > > stop- >>> >> > > > > gap solution could be useful. >>> >> > > > Adding Noralf, who iirc already posted the full dirty helpers >>> >> > > > already somewhere. >>> >> > > > -Daniel >>> >> > > I've asked Deepak to RFC the core changes suggested for the full >>> >> > > dirty blob >>> >> > > on dri-devel. It builds on DisplayLink's suggestion, with a simple >>> >> > > helper to >>> >> > > get to the desired coordinates. >>> >> > > >>> >> > > One thing to perhaps discuss is how we would like to fit this with >>> >> > > front-buffer rendering and the dirty ioctl. In the page-flip >>> >> > > context, the >>> >> > > dirty rects, like egl's swapbuffer_with_damage is a hint to restrict >>> >> > > the >>> >> > > damage region that can be fully ignored by the driver, new content is >>> >> > > indicated by a new framebuffer. >>> >> > > >>> >> > > We could do the same for frontbuffer rendering: Either set a dirty >>> >> > > flag like >>> >> > > you do here, or provide a content_age state member. Since we clear >>> >> > > the dirty >>> >> > > flag on state copies, I guess that would be sufficient. The blob >>> >> > > rectangles >>> >> > > would then become a hint to restrict the damage region. >>> >> > I'm not entirely following here - I thought for frontbuffer rendering >>> >> > the >>> >> > dirty rects have always just been a hint, and that the driver was >>> >> > always >>> >> > free to re-upload the entire buffer to the screen. >>> >> > >>> >> > And through a helper like Rob's proposing here (and have floated >>> >> > around in >>> >> > different versions already) we'd essentially map a frontbuffer dirtyfb >>> >> > call to a fake flip with dirty rect. Manual upload drivers already >>> >> > need to >>> >> > upload the entire screen if they get a flip, since some userspace uses >>> >> > that to flush out frontbuffer rendering (instead of calling dirtyfb). >>> >> > >>> >> > So from that pov the new dirty flag is kinda not necessary imo. >>> >> > >>> >> > > Another approach would be to have the
Re: [Freedreno] [RFC] drm/atomic+msm: add helper to implement legacy dirtyfb
On Wed, Apr 4, 2018 at 8:16 AM, Daniel Vetterwrote: > On Wed, Apr 04, 2018 at 07:40:32AM -0400, Rob Clark wrote: >> On Wed, Apr 4, 2018 at 5:56 AM, Daniel Vetter wrote: >> > On Wed, Apr 04, 2018 at 11:10:08AM +0200, Thomas Hellstrom wrote: >> >> On 04/04/2018 10:43 AM, Daniel Vetter wrote: >> >> > On Wed, Apr 04, 2018 at 10:22:21AM +0200, Thomas Hellstrom wrote: >> >> > > Hi, >> >> > > >> >> > > On 04/04/2018 08:58 AM, Daniel Vetter wrote: >> >> > > > On Wed, Apr 4, 2018 at 12:42 AM, Rob Clark >> >> > > > wrote: >> >> > > > > Add an atomic helper to implement dirtyfb support. This is >> >> > > > > needed to >> >> > > > > support DSI command-mode panels with x11 userspace (ie. when we >> >> > > > > can't >> >> > > > > rely on pageflips to trigger a flush to the panel). >> >> > > > > >> >> > > > > To signal to the driver that the async atomic update needs to >> >> > > > > synchronize with fences, even though the fb didn't change, the >> >> > > > > drm_atomic_state::dirty flag is added. >> >> > > > > >> >> > > > > Signed-off-by: Rob Clark >> >> > > > > --- >> >> > > > > Background: there are a number of different folks working on >> >> > > > > getting >> >> > > > > upstream kernel working on various different phones/tablets with >> >> > > > > qcom >> >> > > > > SoC's.. many of them have command mode panels, so we kind of need >> >> > > > > a >> >> > > > > way to support the legacy dirtyfb ioctl for x11 support. >> >> > > > > >> >> > > > > I know there is work on a proprer non-legacy atomic property for >> >> > > > > userspace to communicate dirty-rect(s) to the kernel, so this can >> >> > > > > be improved from triggering a full-frame flush once that is in >> >> > > > > place. But we kinda needa a stop-gap solution. >> >> > > > > >> >> > > > > I had considered an in-driver solution for this, but things get a >> >> > > > > bit tricky if userspace ands up combining dirtyfb ioctls with >> >> > > > > page- >> >> > > > > flips, because we need to synchronize setting various CTL.FLUSH >> >> > > > > bits >> >> > > > > with setting the CTL.START bit. (ie. really all we need to do for >> >> > > > > cmd mode panels is bang CTL.START, but is this ends up racing with >> >> > > > > pageflips setting FLUSH bits, then bad things.) The easiest soln >> >> > > > > is to wrap this up as an atomic commit and rely on the worker to >> >> > > > > serialize things. Hence adding an atomic dirtyfb helper. >> >> > > > > >> >> > > > > I guess at least the helper, with some small addition to translate >> >> > > > > and pass-thru the dirty rect(s) is useful to the final atomic >> >> > > > > dirty- >> >> > > > > rect property solution. Depending on how far off that is, a stop- >> >> > > > > gap solution could be useful. >> >> > > > Adding Noralf, who iirc already posted the full dirty helpers >> >> > > > already somewhere. >> >> > > > -Daniel >> >> > > I've asked Deepak to RFC the core changes suggested for the full >> >> > > dirty blob >> >> > > on dri-devel. It builds on DisplayLink's suggestion, with a simple >> >> > > helper to >> >> > > get to the desired coordinates. >> >> > > >> >> > > One thing to perhaps discuss is how we would like to fit this with >> >> > > front-buffer rendering and the dirty ioctl. In the page-flip context, >> >> > > the >> >> > > dirty rects, like egl's swapbuffer_with_damage is a hint to restrict >> >> > > the >> >> > > damage region that can be fully ignored by the driver, new content is >> >> > > indicated by a new framebuffer. >> >> > > >> >> > > We could do the same for frontbuffer rendering: Either set a dirty >> >> > > flag like >> >> > > you do here, or provide a content_age state member. Since we clear >> >> > > the dirty >> >> > > flag on state copies, I guess that would be sufficient. The blob >> >> > > rectangles >> >> > > would then become a hint to restrict the damage region. >> >> > I'm not entirely following here - I thought for frontbuffer rendering >> >> > the >> >> > dirty rects have always just been a hint, and that the driver was always >> >> > free to re-upload the entire buffer to the screen. >> >> > >> >> > And through a helper like Rob's proposing here (and have floated around >> >> > in >> >> > different versions already) we'd essentially map a frontbuffer dirtyfb >> >> > call to a fake flip with dirty rect. Manual upload drivers already need >> >> > to >> >> > upload the entire screen if they get a flip, since some userspace uses >> >> > that to flush out frontbuffer rendering (instead of calling dirtyfb). >> >> > >> >> > So from that pov the new dirty flag is kinda not necessary imo. >> >> > >> >> > > Another approach would be to have the presence of dirty rects without >> >> > > framebuffer change to indicate frontbuffer rendering. >> >> > > >> >> > > I think I like the first approach best, although it may be tempting >> >> > > for >> >> > > user-space apps to just set the
Re: [Freedreno] [RFC] drm/atomic+msm: add helper to implement legacy dirtyfb
Op 04-04-18 om 14:26 schreef Daniel Vetter: > On Wed, Apr 4, 2018 at 2:05 PM, Rob Clarkwrote: >> On Wed, Apr 4, 2018 at 7:49 AM, Maarten Lankhorst >> wrote: >>> Op 04-04-18 om 13:37 schreef Rob Clark: On Wed, Apr 4, 2018 at 6:36 AM, Maarten Lankhorst wrote: > Op 04-04-18 om 12:21 schreef Daniel Vetter: >> On Wed, Apr 04, 2018 at 12:03:00PM +0200, Daniel Vetter wrote: >>> On Tue, Apr 03, 2018 at 06:42:23PM -0400, Rob Clark wrote: Add an atomic helper to implement dirtyfb support. This is needed to support DSI command-mode panels with x11 userspace (ie. when we can't rely on pageflips to trigger a flush to the panel). To signal to the driver that the async atomic update needs to synchronize with fences, even though the fb didn't change, the drm_atomic_state::dirty flag is added. Signed-off-by: Rob Clark --- Background: there are a number of different folks working on getting upstream kernel working on various different phones/tablets with qcom SoC's.. many of them have command mode panels, so we kind of need a way to support the legacy dirtyfb ioctl for x11 support. I know there is work on a proprer non-legacy atomic property for userspace to communicate dirty-rect(s) to the kernel, so this can be improved from triggering a full-frame flush once that is in place. But we kinda needa a stop-gap solution. I had considered an in-driver solution for this, but things get a bit tricky if userspace ands up combining dirtyfb ioctls with page- flips, because we need to synchronize setting various CTL.FLUSH bits with setting the CTL.START bit. (ie. really all we need to do for cmd mode panels is bang CTL.START, but is this ends up racing with pageflips setting FLUSH bits, then bad things.) The easiest soln is to wrap this up as an atomic commit and rely on the worker to serialize things. Hence adding an atomic dirtyfb helper. I guess at least the helper, with some small addition to translate and pass-thru the dirty rect(s) is useful to the final atomic dirty- rect property solution. Depending on how far off that is, a stop- gap solution could be useful. drivers/gpu/drm/drm_atomic_helper.c | 66 + drivers/gpu/drm/msm/msm_atomic.c| 5 ++- drivers/gpu/drm/msm/msm_fb.c| 1 + include/drm/drm_atomic_helper.h | 4 +++ include/drm/drm_plane.h | 9 + 5 files changed, 84 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index c35654591c12..a578dc681b27 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -3504,6 +3504,7 @@ void __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane, if (state->fb) drm_framebuffer_get(state->fb); + state->dirty = false; state->fence = NULL; state->commit = NULL; } @@ -3847,6 +3848,71 @@ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc, } EXPORT_SYMBOL(drm_atomic_helper_legacy_gamma_set); +/** + * drm_atomic_helper_dirtyfb - helper for dirtyfb + * + * A helper to implement drm_framebuffer_funcs::dirty + */ +int drm_atomic_helper_dirtyfb(struct drm_framebuffer *fb, + struct drm_file *file_priv, unsigned flags, + unsigned color, struct drm_clip_rect *clips, + unsigned num_clips) +{ + struct drm_modeset_acquire_ctx ctx; + struct drm_atomic_state *state; + struct drm_plane *plane; + int ret = 0; + + /* +* When called from ioctl, we are interruptable, but not when +* called internally (ie. defio worker) +*/ + drm_modeset_acquire_init(, + file_priv ? DRM_MODESET_ACQUIRE_INTERRUPTIBLE : 0); + + state = drm_atomic_state_alloc(fb->dev); + if (!state) { + ret = -ENOMEM; + goto out; + } + state->acquire_ctx = + +retry: + drm_for_each_plane(plane, fb->dev) { + struct drm_plane_state *plane_state; + + if (plane->state->fb != fb) +
Re: [Freedreno] [RFC] drm/atomic+msm: add helper to implement legacy dirtyfb
On Wed, Apr 4, 2018 at 2:05 PM, Rob Clarkwrote: > On Wed, Apr 4, 2018 at 7:49 AM, Maarten Lankhorst > wrote: >> Op 04-04-18 om 13:37 schreef Rob Clark: >>> On Wed, Apr 4, 2018 at 6:36 AM, Maarten Lankhorst >>> wrote: Op 04-04-18 om 12:21 schreef Daniel Vetter: > On Wed, Apr 04, 2018 at 12:03:00PM +0200, Daniel Vetter wrote: >> On Tue, Apr 03, 2018 at 06:42:23PM -0400, Rob Clark wrote: >>> Add an atomic helper to implement dirtyfb support. This is needed to >>> support DSI command-mode panels with x11 userspace (ie. when we can't >>> rely on pageflips to trigger a flush to the panel). >>> >>> To signal to the driver that the async atomic update needs to >>> synchronize with fences, even though the fb didn't change, the >>> drm_atomic_state::dirty flag is added. >>> >>> Signed-off-by: Rob Clark >>> --- >>> Background: there are a number of different folks working on getting >>> upstream kernel working on various different phones/tablets with qcom >>> SoC's.. many of them have command mode panels, so we kind of need a >>> way to support the legacy dirtyfb ioctl for x11 support. >>> >>> I know there is work on a proprer non-legacy atomic property for >>> userspace to communicate dirty-rect(s) to the kernel, so this can >>> be improved from triggering a full-frame flush once that is in >>> place. But we kinda needa a stop-gap solution. >>> >>> I had considered an in-driver solution for this, but things get a >>> bit tricky if userspace ands up combining dirtyfb ioctls with page- >>> flips, because we need to synchronize setting various CTL.FLUSH bits >>> with setting the CTL.START bit. (ie. really all we need to do for >>> cmd mode panels is bang CTL.START, but is this ends up racing with >>> pageflips setting FLUSH bits, then bad things.) The easiest soln >>> is to wrap this up as an atomic commit and rely on the worker to >>> serialize things. Hence adding an atomic dirtyfb helper. >>> >>> I guess at least the helper, with some small addition to translate >>> and pass-thru the dirty rect(s) is useful to the final atomic dirty- >>> rect property solution. Depending on how far off that is, a stop- >>> gap solution could be useful. >>> >>> drivers/gpu/drm/drm_atomic_helper.c | 66 >>> + >>> drivers/gpu/drm/msm/msm_atomic.c| 5 ++- >>> drivers/gpu/drm/msm/msm_fb.c| 1 + >>> include/drm/drm_atomic_helper.h | 4 +++ >>> include/drm/drm_plane.h | 9 + >>> 5 files changed, 84 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/gpu/drm/drm_atomic_helper.c >>> b/drivers/gpu/drm/drm_atomic_helper.c >>> index c35654591c12..a578dc681b27 100644 >>> --- a/drivers/gpu/drm/drm_atomic_helper.c >>> +++ b/drivers/gpu/drm/drm_atomic_helper.c >>> @@ -3504,6 +3504,7 @@ void >>> __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane, >>> if (state->fb) >>> drm_framebuffer_get(state->fb); >>> >>> + state->dirty = false; >>> state->fence = NULL; >>> state->commit = NULL; >>> } >>> @@ -3847,6 +3848,71 @@ int drm_atomic_helper_legacy_gamma_set(struct >>> drm_crtc *crtc, >>> } >>> EXPORT_SYMBOL(drm_atomic_helper_legacy_gamma_set); >>> >>> +/** >>> + * drm_atomic_helper_dirtyfb - helper for dirtyfb >>> + * >>> + * A helper to implement drm_framebuffer_funcs::dirty >>> + */ >>> +int drm_atomic_helper_dirtyfb(struct drm_framebuffer *fb, >>> + struct drm_file *file_priv, unsigned flags, >>> + unsigned color, struct drm_clip_rect *clips, >>> + unsigned num_clips) >>> +{ >>> + struct drm_modeset_acquire_ctx ctx; >>> + struct drm_atomic_state *state; >>> + struct drm_plane *plane; >>> + int ret = 0; >>> + >>> + /* >>> +* When called from ioctl, we are interruptable, but not when >>> +* called internally (ie. defio worker) >>> +*/ >>> + drm_modeset_acquire_init(, >>> + file_priv ? DRM_MODESET_ACQUIRE_INTERRUPTIBLE : 0); >>> + >>> + state = drm_atomic_state_alloc(fb->dev); >>> + if (!state) { >>> + ret = -ENOMEM; >>> + goto out; >>> + } >>> + state->acquire_ctx = >>> + >>> +retry: >>> + drm_for_each_plane(plane, fb->dev) { >>> + struct drm_plane_state *plane_state; >>> + >>> + if (plane->state->fb != fb) >>> + continue; >>> + >>> + plane_state = drm_atomic_get_plane_state(state, plane); >>> + if
Re: [Freedreno] [RFC] drm/atomic+msm: add helper to implement legacy dirtyfb
Op 04-04-18 om 14:05 schreef Rob Clark: > On Wed, Apr 4, 2018 at 7:49 AM, Maarten Lankhorst >wrote: >> Op 04-04-18 om 13:37 schreef Rob Clark: >>> On Wed, Apr 4, 2018 at 6:36 AM, Maarten Lankhorst >>> wrote: Op 04-04-18 om 12:21 schreef Daniel Vetter: > On Wed, Apr 04, 2018 at 12:03:00PM +0200, Daniel Vetter wrote: >> On Tue, Apr 03, 2018 at 06:42:23PM -0400, Rob Clark wrote: >>> Add an atomic helper to implement dirtyfb support. This is needed to >>> support DSI command-mode panels with x11 userspace (ie. when we can't >>> rely on pageflips to trigger a flush to the panel). >>> >>> To signal to the driver that the async atomic update needs to >>> synchronize with fences, even though the fb didn't change, the >>> drm_atomic_state::dirty flag is added. >>> >>> Signed-off-by: Rob Clark >>> --- >>> Background: there are a number of different folks working on getting >>> upstream kernel working on various different phones/tablets with qcom >>> SoC's.. many of them have command mode panels, so we kind of need a >>> way to support the legacy dirtyfb ioctl for x11 support. >>> >>> I know there is work on a proprer non-legacy atomic property for >>> userspace to communicate dirty-rect(s) to the kernel, so this can >>> be improved from triggering a full-frame flush once that is in >>> place. But we kinda needa a stop-gap solution. >>> >>> I had considered an in-driver solution for this, but things get a >>> bit tricky if userspace ands up combining dirtyfb ioctls with page- >>> flips, because we need to synchronize setting various CTL.FLUSH bits >>> with setting the CTL.START bit. (ie. really all we need to do for >>> cmd mode panels is bang CTL.START, but is this ends up racing with >>> pageflips setting FLUSH bits, then bad things.) The easiest soln >>> is to wrap this up as an atomic commit and rely on the worker to >>> serialize things. Hence adding an atomic dirtyfb helper. >>> >>> I guess at least the helper, with some small addition to translate >>> and pass-thru the dirty rect(s) is useful to the final atomic dirty- >>> rect property solution. Depending on how far off that is, a stop- >>> gap solution could be useful. >>> >>> drivers/gpu/drm/drm_atomic_helper.c | 66 >>> + >>> drivers/gpu/drm/msm/msm_atomic.c| 5 ++- >>> drivers/gpu/drm/msm/msm_fb.c| 1 + >>> include/drm/drm_atomic_helper.h | 4 +++ >>> include/drm/drm_plane.h | 9 + >>> 5 files changed, 84 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/gpu/drm/drm_atomic_helper.c >>> b/drivers/gpu/drm/drm_atomic_helper.c >>> index c35654591c12..a578dc681b27 100644 >>> --- a/drivers/gpu/drm/drm_atomic_helper.c >>> +++ b/drivers/gpu/drm/drm_atomic_helper.c >>> @@ -3504,6 +3504,7 @@ void >>> __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane, >>> if (state->fb) >>> drm_framebuffer_get(state->fb); >>> >>> + state->dirty = false; >>> state->fence = NULL; >>> state->commit = NULL; >>> } >>> @@ -3847,6 +3848,71 @@ int drm_atomic_helper_legacy_gamma_set(struct >>> drm_crtc *crtc, >>> } >>> EXPORT_SYMBOL(drm_atomic_helper_legacy_gamma_set); >>> >>> +/** >>> + * drm_atomic_helper_dirtyfb - helper for dirtyfb >>> + * >>> + * A helper to implement drm_framebuffer_funcs::dirty >>> + */ >>> +int drm_atomic_helper_dirtyfb(struct drm_framebuffer *fb, >>> + struct drm_file *file_priv, unsigned flags, >>> + unsigned color, struct drm_clip_rect *clips, >>> + unsigned num_clips) >>> +{ >>> + struct drm_modeset_acquire_ctx ctx; >>> + struct drm_atomic_state *state; >>> + struct drm_plane *plane; >>> + int ret = 0; >>> + >>> + /* >>> +* When called from ioctl, we are interruptable, but not when >>> +* called internally (ie. defio worker) >>> +*/ >>> + drm_modeset_acquire_init(, >>> + file_priv ? DRM_MODESET_ACQUIRE_INTERRUPTIBLE : 0); >>> + >>> + state = drm_atomic_state_alloc(fb->dev); >>> + if (!state) { >>> + ret = -ENOMEM; >>> + goto out; >>> + } >>> + state->acquire_ctx = >>> + >>> +retry: >>> + drm_for_each_plane(plane, fb->dev) { >>> + struct drm_plane_state *plane_state; >>> + >>> + if (plane->state->fb != fb) >>> + continue; >>> + >>> + plane_state = drm_atomic_get_plane_state(state, plane); >>> + if (IS_ERR(plane_state)) { >>> +
Re: [Freedreno] [DPU PATCH v2 0/2] Remove DPU RSC support
On Wed, Apr 04, 2018 at 04:53:51PM +0530, rya...@codeaurora.org wrote: > On 2018-04-04 15:56, Daniel Vetter wrote: > > On Wed, Apr 04, 2018 at 02:34:40PM +0530, Rajesh Yadav wrote: > > > MSM display controller hardware (DPU) has an inbuilt RSC block > > > which can control power resources and bus bandwidth voting > > > based on frame timing parameters w/o DPU driver intervention. > > > In absence of RSC HW, DPU driver controls these resources. > > > > > > Downstream driver relies on RSC driver for controlling these > > > resources (via RSC HW block) for better power benefits. > > > > > > Since, DPU driver can control these resources, removing RSC > > > driver support. Corresponding devicetree binding are also removed. > > > > If it has benefits, why remove the support for this? > > -Daniel > Currently, the dpu driver has custom implementation for power management. > We are planning to move to runtime_pm and this change is 1st step toward > that goal. > We will re-introduce the RSC support at a later stage when all the > dependencies > are sent upstream. That kind of context would be really good to explain in the commit message and cover letter. -Daniel > > Thanks, > Rajesh > > > > > > > > Details for DPU driver upstreaming: > > > https://lists.freedesktop.org/archives/freedreno/2018-February/001678.html > > > > > > Changes in v2: > > > - Remove last reference to dpu_power_rsc_update > > > - Add DPU PATCH tag for better filtering > > > - Rebase on tip of for-next-staging > > > > > > Rajesh Yadav (2): > > > dt-bindings: msm/disp: Remove DPU RSC device bindings > > > drm/msm: Remove RSC support from DPU driver > > > > > > .../devicetree/bindings/display/msm/dpu-rsc.txt| 96 -- > > > drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 130 +- > > > drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h |6 - > > > drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 14 - > > > drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h |9 +- > > > drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c| 242 +--- > > > drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h|7 - > > > drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h |1 - > > > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c | 20 +- > > > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.h |3 - > > > drivers/gpu/drm/msm/dpu_dbg.c | 27 - > > > drivers/gpu/drm/msm/dpu_dbg.h | 10 - > > > drivers/gpu/drm/msm/dpu_power_handle.c | 73 +- > > > drivers/gpu/drm/msm/dpu_power_handle.h |4 - > > > drivers/gpu/drm/msm/dpu_rsc.c | 1367 > > > > > > drivers/gpu/drm/msm/dpu_rsc_hw.c | 818 > > > > > > drivers/gpu/drm/msm/dpu_rsc_priv.h | 191 --- > > > include/linux/dpu_rsc.h| 302 - > > > 18 files changed, 42 insertions(+), 3278 deletions(-) > > > delete mode 100644 > > > Documentation/devicetree/bindings/display/msm/dpu-rsc.txt > > > delete mode 100644 drivers/gpu/drm/msm/dpu_rsc.c > > > delete mode 100644 drivers/gpu/drm/msm/dpu_rsc_hw.c > > > delete mode 100644 drivers/gpu/drm/msm/dpu_rsc_priv.h > > > delete mode 100644 include/linux/dpu_rsc.h > > > > > > -- > > > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora > > > Forum, > > > a Linux Foundation Collaborative Project > > > > > > ___ > > > dri-devel mailing list > > > dri-de...@lists.freedesktop.org > > > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ___ Freedreno mailing list Freedreno@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/freedreno
Re: [Freedreno] [RFC] drm/atomic+msm: add helper to implement legacy dirtyfb
On Wed, Apr 04, 2018 at 07:35:58AM -0400, Rob Clark wrote: > On Wed, Apr 4, 2018 at 6:21 AM, Daniel Vetterwrote: > > On Wed, Apr 04, 2018 at 12:03:00PM +0200, Daniel Vetter wrote: > >> On Tue, Apr 03, 2018 at 06:42:23PM -0400, Rob Clark wrote: > >> > Add an atomic helper to implement dirtyfb support. This is needed to > >> > support DSI command-mode panels with x11 userspace (ie. when we can't > >> > rely on pageflips to trigger a flush to the panel). > >> > > >> > To signal to the driver that the async atomic update needs to > >> > synchronize with fences, even though the fb didn't change, the > >> > drm_atomic_state::dirty flag is added. > >> > > >> > Signed-off-by: Rob Clark > >> > --- > >> > Background: there are a number of different folks working on getting > >> > upstream kernel working on various different phones/tablets with qcom > >> > SoC's.. many of them have command mode panels, so we kind of need a > >> > way to support the legacy dirtyfb ioctl for x11 support. > >> > > >> > I know there is work on a proprer non-legacy atomic property for > >> > userspace to communicate dirty-rect(s) to the kernel, so this can > >> > be improved from triggering a full-frame flush once that is in > >> > place. But we kinda needa a stop-gap solution. > >> > > >> > I had considered an in-driver solution for this, but things get a > >> > bit tricky if userspace ands up combining dirtyfb ioctls with page- > >> > flips, because we need to synchronize setting various CTL.FLUSH bits > >> > with setting the CTL.START bit. (ie. really all we need to do for > >> > cmd mode panels is bang CTL.START, but is this ends up racing with > >> > pageflips setting FLUSH bits, then bad things.) The easiest soln > >> > is to wrap this up as an atomic commit and rely on the worker to > >> > serialize things. Hence adding an atomic dirtyfb helper. > >> > > >> > I guess at least the helper, with some small addition to translate > >> > and pass-thru the dirty rect(s) is useful to the final atomic dirty- > >> > rect property solution. Depending on how far off that is, a stop- > >> > gap solution could be useful. > >> > > >> > drivers/gpu/drm/drm_atomic_helper.c | 66 > >> > + > >> > drivers/gpu/drm/msm/msm_atomic.c| 5 ++- > >> > drivers/gpu/drm/msm/msm_fb.c| 1 + > >> > include/drm/drm_atomic_helper.h | 4 +++ > >> > include/drm/drm_plane.h | 9 + > >> > 5 files changed, 84 insertions(+), 1 deletion(-) > >> > > >> > diff --git a/drivers/gpu/drm/drm_atomic_helper.c > >> > b/drivers/gpu/drm/drm_atomic_helper.c > >> > index c35654591c12..a578dc681b27 100644 > >> > --- a/drivers/gpu/drm/drm_atomic_helper.c > >> > +++ b/drivers/gpu/drm/drm_atomic_helper.c > >> > @@ -3504,6 +3504,7 @@ void > >> > __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane, > >> > if (state->fb) > >> > drm_framebuffer_get(state->fb); > >> > > >> > + state->dirty = false; > >> > state->fence = NULL; > >> > state->commit = NULL; > >> > } > >> > @@ -3847,6 +3848,71 @@ int drm_atomic_helper_legacy_gamma_set(struct > >> > drm_crtc *crtc, > >> > } > >> > EXPORT_SYMBOL(drm_atomic_helper_legacy_gamma_set); > >> > > >> > +/** > >> > + * drm_atomic_helper_dirtyfb - helper for dirtyfb > >> > + * > >> > + * A helper to implement drm_framebuffer_funcs::dirty > >> > + */ > >> > +int drm_atomic_helper_dirtyfb(struct drm_framebuffer *fb, > >> > + struct drm_file *file_priv, unsigned flags, > >> > + unsigned color, struct drm_clip_rect *clips, > >> > + unsigned num_clips) > >> > +{ > >> > + struct drm_modeset_acquire_ctx ctx; > >> > + struct drm_atomic_state *state; > >> > + struct drm_plane *plane; > >> > + int ret = 0; > >> > + > >> > + /* > >> > +* When called from ioctl, we are interruptable, but not when > >> > +* called internally (ie. defio worker) > >> > +*/ > >> > + drm_modeset_acquire_init(, > >> > + file_priv ? DRM_MODESET_ACQUIRE_INTERRUPTIBLE : 0); > >> > + > >> > + state = drm_atomic_state_alloc(fb->dev); > >> > + if (!state) { > >> > + ret = -ENOMEM; > >> > + goto out; > >> > + } > >> > + state->acquire_ctx = > >> > + > >> > +retry: > >> > + drm_for_each_plane(plane, fb->dev) { > >> > + struct drm_plane_state *plane_state; > >> > + > >> > + if (plane->state->fb != fb) > >> > + continue; > >> > + > >> > + plane_state = drm_atomic_get_plane_state(state, plane); > >> > + if (IS_ERR(plane_state)) { > >> > + ret = PTR_ERR(plane_state); > >> > + goto out; > >> > + } > >> > + > >> > + plane_state->dirty = true; > >> > + } > >> > + > >> > + ret = drm_atomic_nonblocking_commit(state); > >> > + > >> > +out: > >> > + if (ret == -EDEADLK) { > >> > +
Re: [Freedreno] [RFC] drm/atomic+msm: add helper to implement legacy dirtyfb
On Wed, Apr 04, 2018 at 07:40:32AM -0400, Rob Clark wrote: > On Wed, Apr 4, 2018 at 5:56 AM, Daniel Vetterwrote: > > On Wed, Apr 04, 2018 at 11:10:08AM +0200, Thomas Hellstrom wrote: > >> On 04/04/2018 10:43 AM, Daniel Vetter wrote: > >> > On Wed, Apr 04, 2018 at 10:22:21AM +0200, Thomas Hellstrom wrote: > >> > > Hi, > >> > > > >> > > On 04/04/2018 08:58 AM, Daniel Vetter wrote: > >> > > > On Wed, Apr 4, 2018 at 12:42 AM, Rob Clark > >> > > > wrote: > >> > > > > Add an atomic helper to implement dirtyfb support. This is needed > >> > > > > to > >> > > > > support DSI command-mode panels with x11 userspace (ie. when we > >> > > > > can't > >> > > > > rely on pageflips to trigger a flush to the panel). > >> > > > > > >> > > > > To signal to the driver that the async atomic update needs to > >> > > > > synchronize with fences, even though the fb didn't change, the > >> > > > > drm_atomic_state::dirty flag is added. > >> > > > > > >> > > > > Signed-off-by: Rob Clark > >> > > > > --- > >> > > > > Background: there are a number of different folks working on > >> > > > > getting > >> > > > > upstream kernel working on various different phones/tablets with > >> > > > > qcom > >> > > > > SoC's.. many of them have command mode panels, so we kind of need a > >> > > > > way to support the legacy dirtyfb ioctl for x11 support. > >> > > > > > >> > > > > I know there is work on a proprer non-legacy atomic property for > >> > > > > userspace to communicate dirty-rect(s) to the kernel, so this can > >> > > > > be improved from triggering a full-frame flush once that is in > >> > > > > place. But we kinda needa a stop-gap solution. > >> > > > > > >> > > > > I had considered an in-driver solution for this, but things get a > >> > > > > bit tricky if userspace ands up combining dirtyfb ioctls with page- > >> > > > > flips, because we need to synchronize setting various CTL.FLUSH > >> > > > > bits > >> > > > > with setting the CTL.START bit. (ie. really all we need to do for > >> > > > > cmd mode panels is bang CTL.START, but is this ends up racing with > >> > > > > pageflips setting FLUSH bits, then bad things.) The easiest soln > >> > > > > is to wrap this up as an atomic commit and rely on the worker to > >> > > > > serialize things. Hence adding an atomic dirtyfb helper. > >> > > > > > >> > > > > I guess at least the helper, with some small addition to translate > >> > > > > and pass-thru the dirty rect(s) is useful to the final atomic > >> > > > > dirty- > >> > > > > rect property solution. Depending on how far off that is, a stop- > >> > > > > gap solution could be useful. > >> > > > Adding Noralf, who iirc already posted the full dirty helpers > >> > > > already somewhere. > >> > > > -Daniel > >> > > I've asked Deepak to RFC the core changes suggested for the full dirty > >> > > blob > >> > > on dri-devel. It builds on DisplayLink's suggestion, with a simple > >> > > helper to > >> > > get to the desired coordinates. > >> > > > >> > > One thing to perhaps discuss is how we would like to fit this with > >> > > front-buffer rendering and the dirty ioctl. In the page-flip context, > >> > > the > >> > > dirty rects, like egl's swapbuffer_with_damage is a hint to restrict > >> > > the > >> > > damage region that can be fully ignored by the driver, new content is > >> > > indicated by a new framebuffer. > >> > > > >> > > We could do the same for frontbuffer rendering: Either set a dirty > >> > > flag like > >> > > you do here, or provide a content_age state member. Since we clear the > >> > > dirty > >> > > flag on state copies, I guess that would be sufficient. The blob > >> > > rectangles > >> > > would then become a hint to restrict the damage region. > >> > I'm not entirely following here - I thought for frontbuffer rendering the > >> > dirty rects have always just been a hint, and that the driver was always > >> > free to re-upload the entire buffer to the screen. > >> > > >> > And through a helper like Rob's proposing here (and have floated around > >> > in > >> > different versions already) we'd essentially map a frontbuffer dirtyfb > >> > call to a fake flip with dirty rect. Manual upload drivers already need > >> > to > >> > upload the entire screen if they get a flip, since some userspace uses > >> > that to flush out frontbuffer rendering (instead of calling dirtyfb). > >> > > >> > So from that pov the new dirty flag is kinda not necessary imo. > >> > > >> > > Another approach would be to have the presence of dirty rects without > >> > > framebuffer change to indicate frontbuffer rendering. > >> > > > >> > > I think I like the first approach best, although it may be tempting for > >> > > user-space apps to just set the dirty bit instead of providing the full > >> > > damage region. > >> > Or I'm not following you here, because I don't quite see the difference > >> > between dirtyfb and a flip. > >> > -Daniel > >> > >> OK, let me
Re: [Freedreno] [RFC] drm/atomic+msm: add helper to implement legacy dirtyfb
On Wed, Apr 04, 2018 at 01:46:37PM +0200, Thomas Hellstrom wrote: > On 04/04/2018 12:28 PM, Thomas Hellstrom wrote: > > On 04/04/2018 11:56 AM, Daniel Vetter wrote: > > > On Wed, Apr 04, 2018 at 11:10:08AM +0200, Thomas Hellstrom wrote: > > > > On 04/04/2018 10:43 AM, Daniel Vetter wrote: > > > > > On Wed, Apr 04, 2018 at 10:22:21AM +0200, Thomas Hellstrom wrote: > > > > > > Hi, > > > > > > > > > > > > On 04/04/2018 08:58 AM, Daniel Vetter wrote: > > > > > > > On Wed, Apr 4, 2018 at 12:42 AM, Rob Clark > > > > > > >wrote: > > > > > > > > Add an atomic helper to implement dirtyfb > > > > > > > > support. This is needed to > > > > > > > > support DSI command-mode panels with x11 > > > > > > > > userspace (ie. when we can't > > > > > > > > rely on pageflips to trigger a flush to the panel). > > > > > > > > > > > > > > > > To signal to the driver that the async atomic update needs to > > > > > > > > synchronize with fences, even though the fb didn't change, the > > > > > > > > drm_atomic_state::dirty flag is added. > > > > > > > > > > > > > > > > Signed-off-by: Rob Clark > > > > > > > > --- > > > > > > > > Background: there are a number of different > > > > > > > > folks working on getting > > > > > > > > upstream kernel working on various different > > > > > > > > phones/tablets with qcom > > > > > > > > SoC's.. many of them have command mode panels, so we kind of > > > > > > > > need a > > > > > > > > way to support the legacy dirtyfb ioctl for x11 support. > > > > > > > > > > > > > > > > I know there is work on a proprer non-legacy atomic property for > > > > > > > > userspace to communicate dirty-rect(s) to the kernel, so this > > > > > > > > can > > > > > > > > be improved from triggering a full-frame flush once that is in > > > > > > > > place. But we kinda needa a stop-gap solution. > > > > > > > > > > > > > > > > I had considered an in-driver solution for this, but things get > > > > > > > > a > > > > > > > > bit tricky if userspace ands up combining dirtyfb ioctls with > > > > > > > > page- > > > > > > > > flips, because we need to synchronize setting > > > > > > > > various CTL.FLUSH bits > > > > > > > > with setting the CTL.START bit. (ie. really all we need to do > > > > > > > > for > > > > > > > > cmd mode panels is bang CTL.START, but is this ends up racing > > > > > > > > with > > > > > > > > pageflips setting FLUSH bits, then bad things.) The easiest > > > > > > > > soln > > > > > > > > is to wrap this up as an atomic commit and rely on the worker to > > > > > > > > serialize things. Hence adding an atomic dirtyfb helper. > > > > > > > > > > > > > > > > I guess at least the helper, with some small addition to > > > > > > > > translate > > > > > > > > and pass-thru the dirty rect(s) is useful to the > > > > > > > > final atomic dirty- > > > > > > > > rect property solution. Depending on how far off that is, a > > > > > > > > stop- > > > > > > > > gap solution could be useful. > > > > > > > Adding Noralf, who iirc already posted the full > > > > > > > dirty helpers already somewhere. > > > > > > > -Daniel > > > > > > I've asked Deepak to RFC the core changes suggested for > > > > > > the full dirty blob > > > > > > on dri-devel. It builds on DisplayLink's suggestion, > > > > > > with a simple helper to > > > > > > get to the desired coordinates. > > > > > > > > > > > > One thing to perhaps discuss is how we would like to fit this with > > > > > > front-buffer rendering and the dirty ioctl. In the > > > > > > page-flip context, the > > > > > > dirty rects, like egl's swapbuffer_with_damage is a hint > > > > > > to restrict the > > > > > > damage region that can be fully ignored by the driver, new content > > > > > > is > > > > > > indicated by a new framebuffer. > > > > > > > > > > > > We could do the same for frontbuffer rendering: Either > > > > > > set a dirty flag like > > > > > > you do here, or provide a content_age state member. > > > > > > Since we clear the dirty > > > > > > flag on state copies, I guess that would be sufficient. > > > > > > The blob rectangles > > > > > > would then become a hint to restrict the damage region. > > > > > I'm not entirely following here - I thought for frontbuffer > > > > > rendering the > > > > > dirty rects have always just been a hint, and that the > > > > > driver was always > > > > > free to re-upload the entire buffer to the screen. > > > > > > > > > > And through a helper like Rob's proposing here (and have > > > > > floated around in > > > > > different versions already) we'd essentially map a frontbuffer dirtyfb > > > > > call to a fake flip with dirty rect. Manual upload drivers > > > > > already need to > > > > > upload the entire screen if they get a flip, since some userspace uses > > > > > that to flush out frontbuffer rendering (instead of calling dirtyfb). > > > > > > > > > > So from that pov the new dirty flag is kinda not necessary imo. > > > > > > > > > > > Another
Re: [Freedreno] [RFC] drm/atomic+msm: add helper to implement legacy dirtyfb
On Wed, Apr 4, 2018 at 7:49 AM, Maarten Lankhorstwrote: > Op 04-04-18 om 13:37 schreef Rob Clark: >> On Wed, Apr 4, 2018 at 6:36 AM, Maarten Lankhorst >> wrote: >>> Op 04-04-18 om 12:21 schreef Daniel Vetter: On Wed, Apr 04, 2018 at 12:03:00PM +0200, Daniel Vetter wrote: > On Tue, Apr 03, 2018 at 06:42:23PM -0400, Rob Clark wrote: >> Add an atomic helper to implement dirtyfb support. This is needed to >> support DSI command-mode panels with x11 userspace (ie. when we can't >> rely on pageflips to trigger a flush to the panel). >> >> To signal to the driver that the async atomic update needs to >> synchronize with fences, even though the fb didn't change, the >> drm_atomic_state::dirty flag is added. >> >> Signed-off-by: Rob Clark >> --- >> Background: there are a number of different folks working on getting >> upstream kernel working on various different phones/tablets with qcom >> SoC's.. many of them have command mode panels, so we kind of need a >> way to support the legacy dirtyfb ioctl for x11 support. >> >> I know there is work on a proprer non-legacy atomic property for >> userspace to communicate dirty-rect(s) to the kernel, so this can >> be improved from triggering a full-frame flush once that is in >> place. But we kinda needa a stop-gap solution. >> >> I had considered an in-driver solution for this, but things get a >> bit tricky if userspace ands up combining dirtyfb ioctls with page- >> flips, because we need to synchronize setting various CTL.FLUSH bits >> with setting the CTL.START bit. (ie. really all we need to do for >> cmd mode panels is bang CTL.START, but is this ends up racing with >> pageflips setting FLUSH bits, then bad things.) The easiest soln >> is to wrap this up as an atomic commit and rely on the worker to >> serialize things. Hence adding an atomic dirtyfb helper. >> >> I guess at least the helper, with some small addition to translate >> and pass-thru the dirty rect(s) is useful to the final atomic dirty- >> rect property solution. Depending on how far off that is, a stop- >> gap solution could be useful. >> >> drivers/gpu/drm/drm_atomic_helper.c | 66 >> + >> drivers/gpu/drm/msm/msm_atomic.c| 5 ++- >> drivers/gpu/drm/msm/msm_fb.c| 1 + >> include/drm/drm_atomic_helper.h | 4 +++ >> include/drm/drm_plane.h | 9 + >> 5 files changed, 84 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/gpu/drm/drm_atomic_helper.c >> b/drivers/gpu/drm/drm_atomic_helper.c >> index c35654591c12..a578dc681b27 100644 >> --- a/drivers/gpu/drm/drm_atomic_helper.c >> +++ b/drivers/gpu/drm/drm_atomic_helper.c >> @@ -3504,6 +3504,7 @@ void >> __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane, >> if (state->fb) >> drm_framebuffer_get(state->fb); >> >> + state->dirty = false; >> state->fence = NULL; >> state->commit = NULL; >> } >> @@ -3847,6 +3848,71 @@ int drm_atomic_helper_legacy_gamma_set(struct >> drm_crtc *crtc, >> } >> EXPORT_SYMBOL(drm_atomic_helper_legacy_gamma_set); >> >> +/** >> + * drm_atomic_helper_dirtyfb - helper for dirtyfb >> + * >> + * A helper to implement drm_framebuffer_funcs::dirty >> + */ >> +int drm_atomic_helper_dirtyfb(struct drm_framebuffer *fb, >> + struct drm_file *file_priv, unsigned flags, >> + unsigned color, struct drm_clip_rect *clips, >> + unsigned num_clips) >> +{ >> + struct drm_modeset_acquire_ctx ctx; >> + struct drm_atomic_state *state; >> + struct drm_plane *plane; >> + int ret = 0; >> + >> + /* >> +* When called from ioctl, we are interruptable, but not when >> +* called internally (ie. defio worker) >> +*/ >> + drm_modeset_acquire_init(, >> + file_priv ? DRM_MODESET_ACQUIRE_INTERRUPTIBLE : 0); >> + >> + state = drm_atomic_state_alloc(fb->dev); >> + if (!state) { >> + ret = -ENOMEM; >> + goto out; >> + } >> + state->acquire_ctx = >> + >> +retry: >> + drm_for_each_plane(plane, fb->dev) { >> + struct drm_plane_state *plane_state; >> + >> + if (plane->state->fb != fb) >> + continue; >> + >> + plane_state = drm_atomic_get_plane_state(state, plane); >> + if (IS_ERR(plane_state)) { >> + ret = PTR_ERR(plane_state); >> + goto out; >> + } >> + >> + plane_state->dirty = true;
Re: [Freedreno] [RFC] drm/atomic+msm: add helper to implement legacy dirtyfb
Op 04-04-18 om 13:37 schreef Rob Clark: > On Wed, Apr 4, 2018 at 6:36 AM, Maarten Lankhorst >wrote: >> Op 04-04-18 om 12:21 schreef Daniel Vetter: >>> On Wed, Apr 04, 2018 at 12:03:00PM +0200, Daniel Vetter wrote: On Tue, Apr 03, 2018 at 06:42:23PM -0400, Rob Clark wrote: > Add an atomic helper to implement dirtyfb support. This is needed to > support DSI command-mode panels with x11 userspace (ie. when we can't > rely on pageflips to trigger a flush to the panel). > > To signal to the driver that the async atomic update needs to > synchronize with fences, even though the fb didn't change, the > drm_atomic_state::dirty flag is added. > > Signed-off-by: Rob Clark > --- > Background: there are a number of different folks working on getting > upstream kernel working on various different phones/tablets with qcom > SoC's.. many of them have command mode panels, so we kind of need a > way to support the legacy dirtyfb ioctl for x11 support. > > I know there is work on a proprer non-legacy atomic property for > userspace to communicate dirty-rect(s) to the kernel, so this can > be improved from triggering a full-frame flush once that is in > place. But we kinda needa a stop-gap solution. > > I had considered an in-driver solution for this, but things get a > bit tricky if userspace ands up combining dirtyfb ioctls with page- > flips, because we need to synchronize setting various CTL.FLUSH bits > with setting the CTL.START bit. (ie. really all we need to do for > cmd mode panels is bang CTL.START, but is this ends up racing with > pageflips setting FLUSH bits, then bad things.) The easiest soln > is to wrap this up as an atomic commit and rely on the worker to > serialize things. Hence adding an atomic dirtyfb helper. > > I guess at least the helper, with some small addition to translate > and pass-thru the dirty rect(s) is useful to the final atomic dirty- > rect property solution. Depending on how far off that is, a stop- > gap solution could be useful. > > drivers/gpu/drm/drm_atomic_helper.c | 66 > + > drivers/gpu/drm/msm/msm_atomic.c| 5 ++- > drivers/gpu/drm/msm/msm_fb.c| 1 + > include/drm/drm_atomic_helper.h | 4 +++ > include/drm/drm_plane.h | 9 + > 5 files changed, 84 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c > b/drivers/gpu/drm/drm_atomic_helper.c > index c35654591c12..a578dc681b27 100644 > --- a/drivers/gpu/drm/drm_atomic_helper.c > +++ b/drivers/gpu/drm/drm_atomic_helper.c > @@ -3504,6 +3504,7 @@ void > __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane, > if (state->fb) > drm_framebuffer_get(state->fb); > > + state->dirty = false; > state->fence = NULL; > state->commit = NULL; > } > @@ -3847,6 +3848,71 @@ int drm_atomic_helper_legacy_gamma_set(struct > drm_crtc *crtc, > } > EXPORT_SYMBOL(drm_atomic_helper_legacy_gamma_set); > > +/** > + * drm_atomic_helper_dirtyfb - helper for dirtyfb > + * > + * A helper to implement drm_framebuffer_funcs::dirty > + */ > +int drm_atomic_helper_dirtyfb(struct drm_framebuffer *fb, > + struct drm_file *file_priv, unsigned flags, > + unsigned color, struct drm_clip_rect *clips, > + unsigned num_clips) > +{ > + struct drm_modeset_acquire_ctx ctx; > + struct drm_atomic_state *state; > + struct drm_plane *plane; > + int ret = 0; > + > + /* > +* When called from ioctl, we are interruptable, but not when > +* called internally (ie. defio worker) > +*/ > + drm_modeset_acquire_init(, > + file_priv ? DRM_MODESET_ACQUIRE_INTERRUPTIBLE : 0); > + > + state = drm_atomic_state_alloc(fb->dev); > + if (!state) { > + ret = -ENOMEM; > + goto out; > + } > + state->acquire_ctx = > + > +retry: > + drm_for_each_plane(plane, fb->dev) { > + struct drm_plane_state *plane_state; > + > + if (plane->state->fb != fb) > + continue; > + > + plane_state = drm_atomic_get_plane_state(state, plane); > + if (IS_ERR(plane_state)) { > + ret = PTR_ERR(plane_state); > + goto out; > + } > + > + plane_state->dirty = true; > + } > + > + ret = drm_atomic_nonblocking_commit(state); > + > +out: > + if (ret == -EDEADLK) { > + drm_atomic_state_clear(state); > + ret =
Re: [Freedreno] [RFC] drm/atomic+msm: add helper to implement legacy dirtyfb
On Wed, Apr 4, 2018 at 5:56 AM, Daniel Vetterwrote: > On Wed, Apr 04, 2018 at 11:10:08AM +0200, Thomas Hellstrom wrote: >> On 04/04/2018 10:43 AM, Daniel Vetter wrote: >> > On Wed, Apr 04, 2018 at 10:22:21AM +0200, Thomas Hellstrom wrote: >> > > Hi, >> > > >> > > On 04/04/2018 08:58 AM, Daniel Vetter wrote: >> > > > On Wed, Apr 4, 2018 at 12:42 AM, Rob Clark wrote: >> > > > > Add an atomic helper to implement dirtyfb support. This is needed to >> > > > > support DSI command-mode panels with x11 userspace (ie. when we can't >> > > > > rely on pageflips to trigger a flush to the panel). >> > > > > >> > > > > To signal to the driver that the async atomic update needs to >> > > > > synchronize with fences, even though the fb didn't change, the >> > > > > drm_atomic_state::dirty flag is added. >> > > > > >> > > > > Signed-off-by: Rob Clark >> > > > > --- >> > > > > Background: there are a number of different folks working on getting >> > > > > upstream kernel working on various different phones/tablets with qcom >> > > > > SoC's.. many of them have command mode panels, so we kind of need a >> > > > > way to support the legacy dirtyfb ioctl for x11 support. >> > > > > >> > > > > I know there is work on a proprer non-legacy atomic property for >> > > > > userspace to communicate dirty-rect(s) to the kernel, so this can >> > > > > be improved from triggering a full-frame flush once that is in >> > > > > place. But we kinda needa a stop-gap solution. >> > > > > >> > > > > I had considered an in-driver solution for this, but things get a >> > > > > bit tricky if userspace ands up combining dirtyfb ioctls with page- >> > > > > flips, because we need to synchronize setting various CTL.FLUSH bits >> > > > > with setting the CTL.START bit. (ie. really all we need to do for >> > > > > cmd mode panels is bang CTL.START, but is this ends up racing with >> > > > > pageflips setting FLUSH bits, then bad things.) The easiest soln >> > > > > is to wrap this up as an atomic commit and rely on the worker to >> > > > > serialize things. Hence adding an atomic dirtyfb helper. >> > > > > >> > > > > I guess at least the helper, with some small addition to translate >> > > > > and pass-thru the dirty rect(s) is useful to the final atomic dirty- >> > > > > rect property solution. Depending on how far off that is, a stop- >> > > > > gap solution could be useful. >> > > > Adding Noralf, who iirc already posted the full dirty helpers already >> > > > somewhere. >> > > > -Daniel >> > > I've asked Deepak to RFC the core changes suggested for the full dirty >> > > blob >> > > on dri-devel. It builds on DisplayLink's suggestion, with a simple >> > > helper to >> > > get to the desired coordinates. >> > > >> > > One thing to perhaps discuss is how we would like to fit this with >> > > front-buffer rendering and the dirty ioctl. In the page-flip context, the >> > > dirty rects, like egl's swapbuffer_with_damage is a hint to restrict the >> > > damage region that can be fully ignored by the driver, new content is >> > > indicated by a new framebuffer. >> > > >> > > We could do the same for frontbuffer rendering: Either set a dirty flag >> > > like >> > > you do here, or provide a content_age state member. Since we clear the >> > > dirty >> > > flag on state copies, I guess that would be sufficient. The blob >> > > rectangles >> > > would then become a hint to restrict the damage region. >> > I'm not entirely following here - I thought for frontbuffer rendering the >> > dirty rects have always just been a hint, and that the driver was always >> > free to re-upload the entire buffer to the screen. >> > >> > And through a helper like Rob's proposing here (and have floated around in >> > different versions already) we'd essentially map a frontbuffer dirtyfb >> > call to a fake flip with dirty rect. Manual upload drivers already need to >> > upload the entire screen if they get a flip, since some userspace uses >> > that to flush out frontbuffer rendering (instead of calling dirtyfb). >> > >> > So from that pov the new dirty flag is kinda not necessary imo. >> > >> > > Another approach would be to have the presence of dirty rects without >> > > framebuffer change to indicate frontbuffer rendering. >> > > >> > > I think I like the first approach best, although it may be tempting for >> > > user-space apps to just set the dirty bit instead of providing the full >> > > damage region. >> > Or I'm not following you here, because I don't quite see the difference >> > between dirtyfb and a flip. >> > -Daniel >> >> OK, let me rephrase: >> >> From the driver's point-of-view, in the atomic world, new content and the >> need for manual upload is indicated by a change in fb attached to the plane. >> >> With Rob's patch here, (correct me if I'm wrong) in addition new content and >> the need for manual upload is identified by the dirty flag, (since the fb >> stays the same and the driver
Re: [Freedreno] [RFC] drm/atomic+msm: add helper to implement legacy dirtyfb
On Wed, Apr 4, 2018 at 6:36 AM, Maarten Lankhorstwrote: > Op 04-04-18 om 12:21 schreef Daniel Vetter: >> On Wed, Apr 04, 2018 at 12:03:00PM +0200, Daniel Vetter wrote: >>> On Tue, Apr 03, 2018 at 06:42:23PM -0400, Rob Clark wrote: Add an atomic helper to implement dirtyfb support. This is needed to support DSI command-mode panels with x11 userspace (ie. when we can't rely on pageflips to trigger a flush to the panel). To signal to the driver that the async atomic update needs to synchronize with fences, even though the fb didn't change, the drm_atomic_state::dirty flag is added. Signed-off-by: Rob Clark --- Background: there are a number of different folks working on getting upstream kernel working on various different phones/tablets with qcom SoC's.. many of them have command mode panels, so we kind of need a way to support the legacy dirtyfb ioctl for x11 support. I know there is work on a proprer non-legacy atomic property for userspace to communicate dirty-rect(s) to the kernel, so this can be improved from triggering a full-frame flush once that is in place. But we kinda needa a stop-gap solution. I had considered an in-driver solution for this, but things get a bit tricky if userspace ands up combining dirtyfb ioctls with page- flips, because we need to synchronize setting various CTL.FLUSH bits with setting the CTL.START bit. (ie. really all we need to do for cmd mode panels is bang CTL.START, but is this ends up racing with pageflips setting FLUSH bits, then bad things.) The easiest soln is to wrap this up as an atomic commit and rely on the worker to serialize things. Hence adding an atomic dirtyfb helper. I guess at least the helper, with some small addition to translate and pass-thru the dirty rect(s) is useful to the final atomic dirty- rect property solution. Depending on how far off that is, a stop- gap solution could be useful. drivers/gpu/drm/drm_atomic_helper.c | 66 + drivers/gpu/drm/msm/msm_atomic.c| 5 ++- drivers/gpu/drm/msm/msm_fb.c| 1 + include/drm/drm_atomic_helper.h | 4 +++ include/drm/drm_plane.h | 9 + 5 files changed, 84 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index c35654591c12..a578dc681b27 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -3504,6 +3504,7 @@ void __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane, if (state->fb) drm_framebuffer_get(state->fb); + state->dirty = false; state->fence = NULL; state->commit = NULL; } @@ -3847,6 +3848,71 @@ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc, } EXPORT_SYMBOL(drm_atomic_helper_legacy_gamma_set); +/** + * drm_atomic_helper_dirtyfb - helper for dirtyfb + * + * A helper to implement drm_framebuffer_funcs::dirty + */ +int drm_atomic_helper_dirtyfb(struct drm_framebuffer *fb, + struct drm_file *file_priv, unsigned flags, + unsigned color, struct drm_clip_rect *clips, + unsigned num_clips) +{ + struct drm_modeset_acquire_ctx ctx; + struct drm_atomic_state *state; + struct drm_plane *plane; + int ret = 0; + + /* +* When called from ioctl, we are interruptable, but not when +* called internally (ie. defio worker) +*/ + drm_modeset_acquire_init(, + file_priv ? DRM_MODESET_ACQUIRE_INTERRUPTIBLE : 0); + + state = drm_atomic_state_alloc(fb->dev); + if (!state) { + ret = -ENOMEM; + goto out; + } + state->acquire_ctx = + +retry: + drm_for_each_plane(plane, fb->dev) { + struct drm_plane_state *plane_state; + + if (plane->state->fb != fb) + continue; + + plane_state = drm_atomic_get_plane_state(state, plane); + if (IS_ERR(plane_state)) { + ret = PTR_ERR(plane_state); + goto out; + } + + plane_state->dirty = true; + } + + ret = drm_atomic_nonblocking_commit(state); + +out: + if (ret == -EDEADLK) { + drm_atomic_state_clear(state); + ret = drm_modeset_backoff(); + if (!ret) + goto retry; + } + + drm_atomic_state_put(state); + +
Re: [Freedreno] [RFC] drm/atomic+msm: add helper to implement legacy dirtyfb
On Wed, Apr 4, 2018 at 6:21 AM, Daniel Vetterwrote: > On Wed, Apr 04, 2018 at 12:03:00PM +0200, Daniel Vetter wrote: >> On Tue, Apr 03, 2018 at 06:42:23PM -0400, Rob Clark wrote: >> > Add an atomic helper to implement dirtyfb support. This is needed to >> > support DSI command-mode panels with x11 userspace (ie. when we can't >> > rely on pageflips to trigger a flush to the panel). >> > >> > To signal to the driver that the async atomic update needs to >> > synchronize with fences, even though the fb didn't change, the >> > drm_atomic_state::dirty flag is added. >> > >> > Signed-off-by: Rob Clark >> > --- >> > Background: there are a number of different folks working on getting >> > upstream kernel working on various different phones/tablets with qcom >> > SoC's.. many of them have command mode panels, so we kind of need a >> > way to support the legacy dirtyfb ioctl for x11 support. >> > >> > I know there is work on a proprer non-legacy atomic property for >> > userspace to communicate dirty-rect(s) to the kernel, so this can >> > be improved from triggering a full-frame flush once that is in >> > place. But we kinda needa a stop-gap solution. >> > >> > I had considered an in-driver solution for this, but things get a >> > bit tricky if userspace ands up combining dirtyfb ioctls with page- >> > flips, because we need to synchronize setting various CTL.FLUSH bits >> > with setting the CTL.START bit. (ie. really all we need to do for >> > cmd mode panels is bang CTL.START, but is this ends up racing with >> > pageflips setting FLUSH bits, then bad things.) The easiest soln >> > is to wrap this up as an atomic commit and rely on the worker to >> > serialize things. Hence adding an atomic dirtyfb helper. >> > >> > I guess at least the helper, with some small addition to translate >> > and pass-thru the dirty rect(s) is useful to the final atomic dirty- >> > rect property solution. Depending on how far off that is, a stop- >> > gap solution could be useful. >> > >> > drivers/gpu/drm/drm_atomic_helper.c | 66 >> > + >> > drivers/gpu/drm/msm/msm_atomic.c| 5 ++- >> > drivers/gpu/drm/msm/msm_fb.c| 1 + >> > include/drm/drm_atomic_helper.h | 4 +++ >> > include/drm/drm_plane.h | 9 + >> > 5 files changed, 84 insertions(+), 1 deletion(-) >> > >> > diff --git a/drivers/gpu/drm/drm_atomic_helper.c >> > b/drivers/gpu/drm/drm_atomic_helper.c >> > index c35654591c12..a578dc681b27 100644 >> > --- a/drivers/gpu/drm/drm_atomic_helper.c >> > +++ b/drivers/gpu/drm/drm_atomic_helper.c >> > @@ -3504,6 +3504,7 @@ void >> > __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane, >> > if (state->fb) >> > drm_framebuffer_get(state->fb); >> > >> > + state->dirty = false; >> > state->fence = NULL; >> > state->commit = NULL; >> > } >> > @@ -3847,6 +3848,71 @@ int drm_atomic_helper_legacy_gamma_set(struct >> > drm_crtc *crtc, >> > } >> > EXPORT_SYMBOL(drm_atomic_helper_legacy_gamma_set); >> > >> > +/** >> > + * drm_atomic_helper_dirtyfb - helper for dirtyfb >> > + * >> > + * A helper to implement drm_framebuffer_funcs::dirty >> > + */ >> > +int drm_atomic_helper_dirtyfb(struct drm_framebuffer *fb, >> > + struct drm_file *file_priv, unsigned flags, >> > + unsigned color, struct drm_clip_rect *clips, >> > + unsigned num_clips) >> > +{ >> > + struct drm_modeset_acquire_ctx ctx; >> > + struct drm_atomic_state *state; >> > + struct drm_plane *plane; >> > + int ret = 0; >> > + >> > + /* >> > +* When called from ioctl, we are interruptable, but not when >> > +* called internally (ie. defio worker) >> > +*/ >> > + drm_modeset_acquire_init(, >> > + file_priv ? DRM_MODESET_ACQUIRE_INTERRUPTIBLE : 0); >> > + >> > + state = drm_atomic_state_alloc(fb->dev); >> > + if (!state) { >> > + ret = -ENOMEM; >> > + goto out; >> > + } >> > + state->acquire_ctx = >> > + >> > +retry: >> > + drm_for_each_plane(plane, fb->dev) { >> > + struct drm_plane_state *plane_state; >> > + >> > + if (plane->state->fb != fb) >> > + continue; >> > + >> > + plane_state = drm_atomic_get_plane_state(state, plane); >> > + if (IS_ERR(plane_state)) { >> > + ret = PTR_ERR(plane_state); >> > + goto out; >> > + } >> > + >> > + plane_state->dirty = true; >> > + } >> > + >> > + ret = drm_atomic_nonblocking_commit(state); >> > + >> > +out: >> > + if (ret == -EDEADLK) { >> > + drm_atomic_state_clear(state); >> > + ret = drm_modeset_backoff(); >> > + if (!ret) >> > + goto retry; >> > + } >> > + >> > + drm_atomic_state_put(state); >> > + >> > + drm_modeset_drop_locks(); >> > + drm_modeset_acquire_fini(); >> > + >> > +
Re: [Freedreno] [RFC] drm/atomic+msm: add helper to implement legacy dirtyfb
On 04/04/2018 10:43 AM, Daniel Vetter wrote: On Wed, Apr 04, 2018 at 10:22:21AM +0200, Thomas Hellstrom wrote: Hi, On 04/04/2018 08:58 AM, Daniel Vetter wrote: On Wed, Apr 4, 2018 at 12:42 AM, Rob Clarkwrote: Add an atomic helper to implement dirtyfb support. This is needed to support DSI command-mode panels with x11 userspace (ie. when we can't rely on pageflips to trigger a flush to the panel). To signal to the driver that the async atomic update needs to synchronize with fences, even though the fb didn't change, the drm_atomic_state::dirty flag is added. Signed-off-by: Rob Clark --- Background: there are a number of different folks working on getting upstream kernel working on various different phones/tablets with qcom SoC's.. many of them have command mode panels, so we kind of need a way to support the legacy dirtyfb ioctl for x11 support. I know there is work on a proprer non-legacy atomic property for userspace to communicate dirty-rect(s) to the kernel, so this can be improved from triggering a full-frame flush once that is in place. But we kinda needa a stop-gap solution. I had considered an in-driver solution for this, but things get a bit tricky if userspace ands up combining dirtyfb ioctls with page- flips, because we need to synchronize setting various CTL.FLUSH bits with setting the CTL.START bit. (ie. really all we need to do for cmd mode panels is bang CTL.START, but is this ends up racing with pageflips setting FLUSH bits, then bad things.) The easiest soln is to wrap this up as an atomic commit and rely on the worker to serialize things. Hence adding an atomic dirtyfb helper. I guess at least the helper, with some small addition to translate and pass-thru the dirty rect(s) is useful to the final atomic dirty- rect property solution. Depending on how far off that is, a stop- gap solution could be useful. Adding Noralf, who iirc already posted the full dirty helpers already somewhere. -Daniel I've asked Deepak to RFC the core changes suggested for the full dirty blob on dri-devel. It builds on DisplayLink's suggestion, with a simple helper to get to the desired coordinates. One thing to perhaps discuss is how we would like to fit this with front-buffer rendering and the dirty ioctl. In the page-flip context, the dirty rects, like egl's swapbuffer_with_damage is a hint to restrict the damage region that can be fully ignored by the driver, new content is indicated by a new framebuffer. We could do the same for frontbuffer rendering: Either set a dirty flag like you do here, or provide a content_age state member. Since we clear the dirty flag on state copies, I guess that would be sufficient. The blob rectangles would then become a hint to restrict the damage region. I'm not entirely following here - I thought for frontbuffer rendering the dirty rects have always just been a hint, and that the driver was always free to re-upload the entire buffer to the screen. And through a helper like Rob's proposing here (and have floated around in different versions already) we'd essentially map a frontbuffer dirtyfb call to a fake flip with dirty rect. Manual upload drivers already need to upload the entire screen if they get a flip, since some userspace uses that to flush out frontbuffer rendering (instead of calling dirtyfb). So from that pov the new dirty flag is kinda not necessary imo. Another approach would be to have the presence of dirty rects without framebuffer change to indicate frontbuffer rendering. I think I like the first approach best, although it may be tempting for user-space apps to just set the dirty bit instead of providing the full damage region. Or I'm not following you here, because I don't quite see the difference between dirtyfb and a flip. -Daniel OK, let me rephrase: From the driver's point-of-view, in the atomic world, new content and the need for manual upload is indicated by a change in fb attached to the plane. With Rob's patch here, (correct me if I'm wrong) in addition new content and the need for manual upload is identified by the dirty flag, (since the fb stays the same and the driver thus never identifies a page-flip). In both these situations, clip rects can provide a hint to restrict the dirty region. Now I was thinking about the preferred way for user-space to communicate front buffer rendering through the atomic ioctl: 1) Expose a dirty (or content_age property) 2) Attach a clip-rect blob property. 3) Fake a page-flip by ping-ponging two frame-buffers pointing to the same underlying buffer object. Are you saying that people are already using 3) and we should keep using that? /Thomas ___ Freedreno mailing list Freedreno@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/freedreno
Re: [Freedreno] [RFC] drm/atomic+msm: add helper to implement legacy dirtyfb
On 04/04/2018 11:56 AM, Daniel Vetter wrote: On Wed, Apr 04, 2018 at 11:10:08AM +0200, Thomas Hellstrom wrote: On 04/04/2018 10:43 AM, Daniel Vetter wrote: On Wed, Apr 04, 2018 at 10:22:21AM +0200, Thomas Hellstrom wrote: Hi, On 04/04/2018 08:58 AM, Daniel Vetter wrote: On Wed, Apr 4, 2018 at 12:42 AM, Rob Clarkwrote: Add an atomic helper to implement dirtyfb support. This is needed to support DSI command-mode panels with x11 userspace (ie. when we can't rely on pageflips to trigger a flush to the panel). To signal to the driver that the async atomic update needs to synchronize with fences, even though the fb didn't change, the drm_atomic_state::dirty flag is added. Signed-off-by: Rob Clark --- Background: there are a number of different folks working on getting upstream kernel working on various different phones/tablets with qcom SoC's.. many of them have command mode panels, so we kind of need a way to support the legacy dirtyfb ioctl for x11 support. I know there is work on a proprer non-legacy atomic property for userspace to communicate dirty-rect(s) to the kernel, so this can be improved from triggering a full-frame flush once that is in place. But we kinda needa a stop-gap solution. I had considered an in-driver solution for this, but things get a bit tricky if userspace ands up combining dirtyfb ioctls with page- flips, because we need to synchronize setting various CTL.FLUSH bits with setting the CTL.START bit. (ie. really all we need to do for cmd mode panels is bang CTL.START, but is this ends up racing with pageflips setting FLUSH bits, then bad things.) The easiest soln is to wrap this up as an atomic commit and rely on the worker to serialize things. Hence adding an atomic dirtyfb helper. I guess at least the helper, with some small addition to translate and pass-thru the dirty rect(s) is useful to the final atomic dirty- rect property solution. Depending on how far off that is, a stop- gap solution could be useful. Adding Noralf, who iirc already posted the full dirty helpers already somewhere. -Daniel I've asked Deepak to RFC the core changes suggested for the full dirty blob on dri-devel. It builds on DisplayLink's suggestion, with a simple helper to get to the desired coordinates. One thing to perhaps discuss is how we would like to fit this with front-buffer rendering and the dirty ioctl. In the page-flip context, the dirty rects, like egl's swapbuffer_with_damage is a hint to restrict the damage region that can be fully ignored by the driver, new content is indicated by a new framebuffer. We could do the same for frontbuffer rendering: Either set a dirty flag like you do here, or provide a content_age state member. Since we clear the dirty flag on state copies, I guess that would be sufficient. The blob rectangles would then become a hint to restrict the damage region. I'm not entirely following here - I thought for frontbuffer rendering the dirty rects have always just been a hint, and that the driver was always free to re-upload the entire buffer to the screen. And through a helper like Rob's proposing here (and have floated around in different versions already) we'd essentially map a frontbuffer dirtyfb call to a fake flip with dirty rect. Manual upload drivers already need to upload the entire screen if they get a flip, since some userspace uses that to flush out frontbuffer rendering (instead of calling dirtyfb). So from that pov the new dirty flag is kinda not necessary imo. Another approach would be to have the presence of dirty rects without framebuffer change to indicate frontbuffer rendering. I think I like the first approach best, although it may be tempting for user-space apps to just set the dirty bit instead of providing the full damage region. Or I'm not following you here, because I don't quite see the difference between dirtyfb and a flip. -Daniel OK, let me rephrase: From the driver's point-of-view, in the atomic world, new content and the need for manual upload is indicated by a change in fb attached to the plane. With Rob's patch here, (correct me if I'm wrong) in addition new content and the need for manual upload is identified by the dirty flag, (since the fb stays the same and the driver thus never identifies a page-flip). Hm, I'm not entirely sure Rob's approach is correct. Imo a pageflip (atomic or not) should result in the entire buffer getting uploaded. The dirty flag is kinda redundant, a flip with the same buffer works the same way as a dirtyfb with the entire buffer as the dirty rectangle. In both these situations, clip rects can provide a hint to restrict the dirty region. Now I was thinking about the preferred way for user-space to communicate front buffer rendering through the atomic ioctl: 1) Expose a dirty (or content_age property) 2) Attach a clip-rect blob property. 3) Fake a page-flip by ping-ponging two frame-buffers pointing to the same underlying buffer object.
Re: [Freedreno] [DPU PATCH v2 0/2] Remove DPU RSC support
On 2018-04-04 15:56, Daniel Vetter wrote: On Wed, Apr 04, 2018 at 02:34:40PM +0530, Rajesh Yadav wrote: MSM display controller hardware (DPU) has an inbuilt RSC block which can control power resources and bus bandwidth voting based on frame timing parameters w/o DPU driver intervention. In absence of RSC HW, DPU driver controls these resources. Downstream driver relies on RSC driver for controlling these resources (via RSC HW block) for better power benefits. Since, DPU driver can control these resources, removing RSC driver support. Corresponding devicetree binding are also removed. If it has benefits, why remove the support for this? -Daniel Currently, the dpu driver has custom implementation for power management. We are planning to move to runtime_pm and this change is 1st step toward that goal. We will re-introduce the RSC support at a later stage when all the dependencies are sent upstream. Thanks, Rajesh Details for DPU driver upstreaming: https://lists.freedesktop.org/archives/freedreno/2018-February/001678.html Changes in v2: - Remove last reference to dpu_power_rsc_update - Add DPU PATCH tag for better filtering - Rebase on tip of for-next-staging Rajesh Yadav (2): dt-bindings: msm/disp: Remove DPU RSC device bindings drm/msm: Remove RSC support from DPU driver .../devicetree/bindings/display/msm/dpu-rsc.txt| 96 -- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 130 +- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h |6 - drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 14 - drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h |9 +- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c| 242 +--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h|7 - drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h |1 - drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c | 20 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.h |3 - drivers/gpu/drm/msm/dpu_dbg.c | 27 - drivers/gpu/drm/msm/dpu_dbg.h | 10 - drivers/gpu/drm/msm/dpu_power_handle.c | 73 +- drivers/gpu/drm/msm/dpu_power_handle.h |4 - drivers/gpu/drm/msm/dpu_rsc.c | 1367 drivers/gpu/drm/msm/dpu_rsc_hw.c | 818 drivers/gpu/drm/msm/dpu_rsc_priv.h | 191 --- include/linux/dpu_rsc.h| 302 - 18 files changed, 42 insertions(+), 3278 deletions(-) delete mode 100644 Documentation/devicetree/bindings/display/msm/dpu-rsc.txt delete mode 100644 drivers/gpu/drm/msm/dpu_rsc.c delete mode 100644 drivers/gpu/drm/msm/dpu_rsc_hw.c delete mode 100644 drivers/gpu/drm/msm/dpu_rsc_priv.h delete mode 100644 include/linux/dpu_rsc.h -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project ___ dri-devel mailing list dri-de...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ___ Freedreno mailing list Freedreno@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/freedreno
Re: [Freedreno] [RFC] drm/atomic+msm: add helper to implement legacy dirtyfb
Op 04-04-18 om 12:21 schreef Daniel Vetter: > On Wed, Apr 04, 2018 at 12:03:00PM +0200, Daniel Vetter wrote: >> On Tue, Apr 03, 2018 at 06:42:23PM -0400, Rob Clark wrote: >>> Add an atomic helper to implement dirtyfb support. This is needed to >>> support DSI command-mode panels with x11 userspace (ie. when we can't >>> rely on pageflips to trigger a flush to the panel). >>> >>> To signal to the driver that the async atomic update needs to >>> synchronize with fences, even though the fb didn't change, the >>> drm_atomic_state::dirty flag is added. >>> >>> Signed-off-by: Rob Clark>>> --- >>> Background: there are a number of different folks working on getting >>> upstream kernel working on various different phones/tablets with qcom >>> SoC's.. many of them have command mode panels, so we kind of need a >>> way to support the legacy dirtyfb ioctl for x11 support. >>> >>> I know there is work on a proprer non-legacy atomic property for >>> userspace to communicate dirty-rect(s) to the kernel, so this can >>> be improved from triggering a full-frame flush once that is in >>> place. But we kinda needa a stop-gap solution. >>> >>> I had considered an in-driver solution for this, but things get a >>> bit tricky if userspace ands up combining dirtyfb ioctls with page- >>> flips, because we need to synchronize setting various CTL.FLUSH bits >>> with setting the CTL.START bit. (ie. really all we need to do for >>> cmd mode panels is bang CTL.START, but is this ends up racing with >>> pageflips setting FLUSH bits, then bad things.) The easiest soln >>> is to wrap this up as an atomic commit and rely on the worker to >>> serialize things. Hence adding an atomic dirtyfb helper. >>> >>> I guess at least the helper, with some small addition to translate >>> and pass-thru the dirty rect(s) is useful to the final atomic dirty- >>> rect property solution. Depending on how far off that is, a stop- >>> gap solution could be useful. >>> >>> drivers/gpu/drm/drm_atomic_helper.c | 66 >>> + >>> drivers/gpu/drm/msm/msm_atomic.c| 5 ++- >>> drivers/gpu/drm/msm/msm_fb.c| 1 + >>> include/drm/drm_atomic_helper.h | 4 +++ >>> include/drm/drm_plane.h | 9 + >>> 5 files changed, 84 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/gpu/drm/drm_atomic_helper.c >>> b/drivers/gpu/drm/drm_atomic_helper.c >>> index c35654591c12..a578dc681b27 100644 >>> --- a/drivers/gpu/drm/drm_atomic_helper.c >>> +++ b/drivers/gpu/drm/drm_atomic_helper.c >>> @@ -3504,6 +3504,7 @@ void __drm_atomic_helper_plane_duplicate_state(struct >>> drm_plane *plane, >>> if (state->fb) >>> drm_framebuffer_get(state->fb); >>> >>> + state->dirty = false; >>> state->fence = NULL; >>> state->commit = NULL; >>> } >>> @@ -3847,6 +3848,71 @@ int drm_atomic_helper_legacy_gamma_set(struct >>> drm_crtc *crtc, >>> } >>> EXPORT_SYMBOL(drm_atomic_helper_legacy_gamma_set); >>> >>> +/** >>> + * drm_atomic_helper_dirtyfb - helper for dirtyfb >>> + * >>> + * A helper to implement drm_framebuffer_funcs::dirty >>> + */ >>> +int drm_atomic_helper_dirtyfb(struct drm_framebuffer *fb, >>> + struct drm_file *file_priv, unsigned flags, >>> + unsigned color, struct drm_clip_rect *clips, >>> + unsigned num_clips) >>> +{ >>> + struct drm_modeset_acquire_ctx ctx; >>> + struct drm_atomic_state *state; >>> + struct drm_plane *plane; >>> + int ret = 0; >>> + >>> + /* >>> +* When called from ioctl, we are interruptable, but not when >>> +* called internally (ie. defio worker) >>> +*/ >>> + drm_modeset_acquire_init(, >>> + file_priv ? DRM_MODESET_ACQUIRE_INTERRUPTIBLE : 0); >>> + >>> + state = drm_atomic_state_alloc(fb->dev); >>> + if (!state) { >>> + ret = -ENOMEM; >>> + goto out; >>> + } >>> + state->acquire_ctx = >>> + >>> +retry: >>> + drm_for_each_plane(plane, fb->dev) { >>> + struct drm_plane_state *plane_state; >>> + >>> + if (plane->state->fb != fb) >>> + continue; >>> + >>> + plane_state = drm_atomic_get_plane_state(state, plane); >>> + if (IS_ERR(plane_state)) { >>> + ret = PTR_ERR(plane_state); >>> + goto out; >>> + } >>> + >>> + plane_state->dirty = true; >>> + } >>> + >>> + ret = drm_atomic_nonblocking_commit(state); >>> + >>> +out: >>> + if (ret == -EDEADLK) { >>> + drm_atomic_state_clear(state); >>> + ret = drm_modeset_backoff(); >>> + if (!ret) >>> + goto retry; >>> + } >>> + >>> + drm_atomic_state_put(state); >>> + >>> + drm_modeset_drop_locks(); >>> + drm_modeset_acquire_fini(); >>> + >>> + return ret; >>> + >>> +} >>> +EXPORT_SYMBOL(drm_atomic_helper_dirtyfb); >>> + >>> /** >>> * __drm_atomic_helper_private_duplicate_state -
Re: [Freedreno] [DPU PATCH v2 0/2] Remove DPU RSC support
On Wed, Apr 04, 2018 at 02:34:40PM +0530, Rajesh Yadav wrote: > MSM display controller hardware (DPU) has an inbuilt RSC block > which can control power resources and bus bandwidth voting > based on frame timing parameters w/o DPU driver intervention. > In absence of RSC HW, DPU driver controls these resources. > > Downstream driver relies on RSC driver for controlling these > resources (via RSC HW block) for better power benefits. > > Since, DPU driver can control these resources, removing RSC > driver support. Corresponding devicetree binding are also removed. If it has benefits, why remove the support for this? -Daniel > > Details for DPU driver upstreaming: > https://lists.freedesktop.org/archives/freedreno/2018-February/001678.html > > Changes in v2: > - Remove last reference to dpu_power_rsc_update > - Add DPU PATCH tag for better filtering > - Rebase on tip of for-next-staging > > Rajesh Yadav (2): > dt-bindings: msm/disp: Remove DPU RSC device bindings > drm/msm: Remove RSC support from DPU driver > > .../devicetree/bindings/display/msm/dpu-rsc.txt| 96 -- > drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 130 +- > drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h |6 - > drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 14 - > drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h |9 +- > drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c| 242 +--- > drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h|7 - > drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h |1 - > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c | 20 +- > drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.h |3 - > drivers/gpu/drm/msm/dpu_dbg.c | 27 - > drivers/gpu/drm/msm/dpu_dbg.h | 10 - > drivers/gpu/drm/msm/dpu_power_handle.c | 73 +- > drivers/gpu/drm/msm/dpu_power_handle.h |4 - > drivers/gpu/drm/msm/dpu_rsc.c | 1367 > > drivers/gpu/drm/msm/dpu_rsc_hw.c | 818 > drivers/gpu/drm/msm/dpu_rsc_priv.h | 191 --- > include/linux/dpu_rsc.h| 302 - > 18 files changed, 42 insertions(+), 3278 deletions(-) > delete mode 100644 Documentation/devicetree/bindings/display/msm/dpu-rsc.txt > delete mode 100644 drivers/gpu/drm/msm/dpu_rsc.c > delete mode 100644 drivers/gpu/drm/msm/dpu_rsc_hw.c > delete mode 100644 drivers/gpu/drm/msm/dpu_rsc_priv.h > delete mode 100644 include/linux/dpu_rsc.h > > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project > > ___ > dri-devel mailing list > dri-de...@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ___ Freedreno mailing list Freedreno@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/freedreno
Re: [Freedreno] [RFC] drm/atomic+msm: add helper to implement legacy dirtyfb
On Tue, Apr 03, 2018 at 06:42:23PM -0400, Rob Clark wrote: > Add an atomic helper to implement dirtyfb support. This is needed to > support DSI command-mode panels with x11 userspace (ie. when we can't > rely on pageflips to trigger a flush to the panel). > > To signal to the driver that the async atomic update needs to > synchronize with fences, even though the fb didn't change, the > drm_atomic_state::dirty flag is added. > > Signed-off-by: Rob Clark> --- > Background: there are a number of different folks working on getting > upstream kernel working on various different phones/tablets with qcom > SoC's.. many of them have command mode panels, so we kind of need a > way to support the legacy dirtyfb ioctl for x11 support. > > I know there is work on a proprer non-legacy atomic property for > userspace to communicate dirty-rect(s) to the kernel, so this can > be improved from triggering a full-frame flush once that is in > place. But we kinda needa a stop-gap solution. > > I had considered an in-driver solution for this, but things get a > bit tricky if userspace ands up combining dirtyfb ioctls with page- > flips, because we need to synchronize setting various CTL.FLUSH bits > with setting the CTL.START bit. (ie. really all we need to do for > cmd mode panels is bang CTL.START, but is this ends up racing with > pageflips setting FLUSH bits, then bad things.) The easiest soln > is to wrap this up as an atomic commit and rely on the worker to > serialize things. Hence adding an atomic dirtyfb helper. > > I guess at least the helper, with some small addition to translate > and pass-thru the dirty rect(s) is useful to the final atomic dirty- > rect property solution. Depending on how far off that is, a stop- > gap solution could be useful. > > drivers/gpu/drm/drm_atomic_helper.c | 66 > + > drivers/gpu/drm/msm/msm_atomic.c| 5 ++- > drivers/gpu/drm/msm/msm_fb.c| 1 + > include/drm/drm_atomic_helper.h | 4 +++ > include/drm/drm_plane.h | 9 + > 5 files changed, 84 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c > b/drivers/gpu/drm/drm_atomic_helper.c > index c35654591c12..a578dc681b27 100644 > --- a/drivers/gpu/drm/drm_atomic_helper.c > +++ b/drivers/gpu/drm/drm_atomic_helper.c > @@ -3504,6 +3504,7 @@ void __drm_atomic_helper_plane_duplicate_state(struct > drm_plane *plane, > if (state->fb) > drm_framebuffer_get(state->fb); > > + state->dirty = false; > state->fence = NULL; > state->commit = NULL; > } > @@ -3847,6 +3848,71 @@ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc > *crtc, > } > EXPORT_SYMBOL(drm_atomic_helper_legacy_gamma_set); > > +/** > + * drm_atomic_helper_dirtyfb - helper for dirtyfb > + * > + * A helper to implement drm_framebuffer_funcs::dirty > + */ > +int drm_atomic_helper_dirtyfb(struct drm_framebuffer *fb, > + struct drm_file *file_priv, unsigned flags, > + unsigned color, struct drm_clip_rect *clips, > + unsigned num_clips) > +{ > + struct drm_modeset_acquire_ctx ctx; > + struct drm_atomic_state *state; > + struct drm_plane *plane; > + int ret = 0; > + > + /* > + * When called from ioctl, we are interruptable, but not when > + * called internally (ie. defio worker) > + */ > + drm_modeset_acquire_init(, > + file_priv ? DRM_MODESET_ACQUIRE_INTERRUPTIBLE : 0); > + > + state = drm_atomic_state_alloc(fb->dev); > + if (!state) { > + ret = -ENOMEM; > + goto out; > + } > + state->acquire_ctx = > + > +retry: > + drm_for_each_plane(plane, fb->dev) { > + struct drm_plane_state *plane_state; > + > + if (plane->state->fb != fb) > + continue; > + > + plane_state = drm_atomic_get_plane_state(state, plane); > + if (IS_ERR(plane_state)) { > + ret = PTR_ERR(plane_state); > + goto out; > + } > + > + plane_state->dirty = true; > + } > + > + ret = drm_atomic_nonblocking_commit(state); > + > +out: > + if (ret == -EDEADLK) { > + drm_atomic_state_clear(state); > + ret = drm_modeset_backoff(); > + if (!ret) > + goto retry; > + } > + > + drm_atomic_state_put(state); > + > + drm_modeset_drop_locks(); > + drm_modeset_acquire_fini(); > + > + return ret; > + > +} > +EXPORT_SYMBOL(drm_atomic_helper_dirtyfb); > + > /** > * __drm_atomic_helper_private_duplicate_state - copy atomic private state > * @obj: CRTC object > diff --git a/drivers/gpu/drm/msm/msm_atomic.c > b/drivers/gpu/drm/msm/msm_atomic.c > index bf5f8c39f34d..bb55a048e98b 100644 > --- a/drivers/gpu/drm/msm/msm_atomic.c > +++ b/drivers/gpu/drm/msm/msm_atomic.c > @@ -201,7
Re: [Freedreno] [RFC] drm/atomic+msm: add helper to implement legacy dirtyfb
On Wed, Apr 04, 2018 at 11:10:08AM +0200, Thomas Hellstrom wrote: > On 04/04/2018 10:43 AM, Daniel Vetter wrote: > > On Wed, Apr 04, 2018 at 10:22:21AM +0200, Thomas Hellstrom wrote: > > > Hi, > > > > > > On 04/04/2018 08:58 AM, Daniel Vetter wrote: > > > > On Wed, Apr 4, 2018 at 12:42 AM, Rob Clarkwrote: > > > > > Add an atomic helper to implement dirtyfb support. This is needed to > > > > > support DSI command-mode panels with x11 userspace (ie. when we can't > > > > > rely on pageflips to trigger a flush to the panel). > > > > > > > > > > To signal to the driver that the async atomic update needs to > > > > > synchronize with fences, even though the fb didn't change, the > > > > > drm_atomic_state::dirty flag is added. > > > > > > > > > > Signed-off-by: Rob Clark > > > > > --- > > > > > Background: there are a number of different folks working on getting > > > > > upstream kernel working on various different phones/tablets with qcom > > > > > SoC's.. many of them have command mode panels, so we kind of need a > > > > > way to support the legacy dirtyfb ioctl for x11 support. > > > > > > > > > > I know there is work on a proprer non-legacy atomic property for > > > > > userspace to communicate dirty-rect(s) to the kernel, so this can > > > > > be improved from triggering a full-frame flush once that is in > > > > > place. But we kinda needa a stop-gap solution. > > > > > > > > > > I had considered an in-driver solution for this, but things get a > > > > > bit tricky if userspace ands up combining dirtyfb ioctls with page- > > > > > flips, because we need to synchronize setting various CTL.FLUSH bits > > > > > with setting the CTL.START bit. (ie. really all we need to do for > > > > > cmd mode panels is bang CTL.START, but is this ends up racing with > > > > > pageflips setting FLUSH bits, then bad things.) The easiest soln > > > > > is to wrap this up as an atomic commit and rely on the worker to > > > > > serialize things. Hence adding an atomic dirtyfb helper. > > > > > > > > > > I guess at least the helper, with some small addition to translate > > > > > and pass-thru the dirty rect(s) is useful to the final atomic dirty- > > > > > rect property solution. Depending on how far off that is, a stop- > > > > > gap solution could be useful. > > > > Adding Noralf, who iirc already posted the full dirty helpers already > > > > somewhere. > > > > -Daniel > > > I've asked Deepak to RFC the core changes suggested for the full dirty > > > blob > > > on dri-devel. It builds on DisplayLink's suggestion, with a simple helper > > > to > > > get to the desired coordinates. > > > > > > One thing to perhaps discuss is how we would like to fit this with > > > front-buffer rendering and the dirty ioctl. In the page-flip context, the > > > dirty rects, like egl's swapbuffer_with_damage is a hint to restrict the > > > damage region that can be fully ignored by the driver, new content is > > > indicated by a new framebuffer. > > > > > > We could do the same for frontbuffer rendering: Either set a dirty flag > > > like > > > you do here, or provide a content_age state member. Since we clear the > > > dirty > > > flag on state copies, I guess that would be sufficient. The blob > > > rectangles > > > would then become a hint to restrict the damage region. > > I'm not entirely following here - I thought for frontbuffer rendering the > > dirty rects have always just been a hint, and that the driver was always > > free to re-upload the entire buffer to the screen. > > > > And through a helper like Rob's proposing here (and have floated around in > > different versions already) we'd essentially map a frontbuffer dirtyfb > > call to a fake flip with dirty rect. Manual upload drivers already need to > > upload the entire screen if they get a flip, since some userspace uses > > that to flush out frontbuffer rendering (instead of calling dirtyfb). > > > > So from that pov the new dirty flag is kinda not necessary imo. > > > > > Another approach would be to have the presence of dirty rects without > > > framebuffer change to indicate frontbuffer rendering. > > > > > > I think I like the first approach best, although it may be tempting for > > > user-space apps to just set the dirty bit instead of providing the full > > > damage region. > > Or I'm not following you here, because I don't quite see the difference > > between dirtyfb and a flip. > > -Daniel > > OK, let me rephrase: > > From the driver's point-of-view, in the atomic world, new content and the > need for manual upload is indicated by a change in fb attached to the plane. > > With Rob's patch here, (correct me if I'm wrong) in addition new content and > the need for manual upload is identified by the dirty flag, (since the fb > stays the same and the driver thus never identifies a page-flip). Hm, I'm not entirely sure Rob's approach is correct. Imo a pageflip (atomic or not) should result in the entire
[Freedreno] [DPU PATCH v2 1/2] dt-bindings: msm/disp: Remove DPU RSC device bindings
Display controller's power resources and bus bandwidth voting is controlled by DPU device. Remove DPU RSC (hardware block for DPU power resource control) device support. Signed-off-by: Rajesh Yadav--- .../devicetree/bindings/display/msm/dpu-rsc.txt| 96 -- 1 file changed, 96 deletions(-) delete mode 100644 Documentation/devicetree/bindings/display/msm/dpu-rsc.txt diff --git a/Documentation/devicetree/bindings/display/msm/dpu-rsc.txt b/Documentation/devicetree/bindings/display/msm/dpu-rsc.txt deleted file mode 100644 index f5fbcda..000 --- a/Documentation/devicetree/bindings/display/msm/dpu-rsc.txt +++ /dev/null @@ -1,96 +0,0 @@ -Qualcomm Technologies, Inc. DPU RSC - -Snapdragon Display Engine implements display rsc to driver -display core to different modes for power saving - -Required properties -- compatible: Must be "qcom,dpu-rsc" -- reg: Offset and length of the register set for - the device. -- reg-names: Names to refer to register sets related - to this device - -Optional properties: -- clocks: List of phandles for clock device nodes - needed by the device. -- clock-names: List of clock names needed by the device. -- vdd-supply: phandle for vdd regulator device node. -- qcom,dpu-rsc-version:U32 property represents the rsc version. It helps to - select correct sequence for dpu rsc based on version. -- qcom,dpu-dram-channels: U32 property represents the number of channels in the - Bus memory controller. -- qcom,dpu-num-nrt-paths: U32 property represents the number of non-realtime - paths in each Bus Scaling Usecase. This value depends on - number of AXI ports that are dedicated to non-realtime VBIF - for particular chipset. - These paths must be defined after rt-paths in - "qcom,msm-bus,vectors-KBps" vector request. - -Bus Scaling Subnodes: -- qcom,dpu-data-bus: Property to provide Bus scaling for data bus access for - dpu blocks. -- qcom,dpu-llcc-bus: Property to provide Bus scaling for data bus access for - mnoc to llcc. -- qcom,dpu-ebi-bus:Property to provide Bus scaling for data bus access for - llcc to ebi. - -Bus Scaling Data: -- qcom,msm-bus,name: String property describing client name. -- qcom,msm-bus,active-only:Boolean context flag for requests in active or - dual (active & sleep) contex -- qcom,msm-bus,num-cases: This is the number of Bus Scaling use cases - defined in the vectors property. -- qcom,msm-bus,num-paths: This represents the number of paths in each - Bus Scaling Usecase. -- qcom,msm-bus,vectors-KBps: * A series of 4 cell properties, with a format - of (src, dst, ab, ib) which is defined at - Documentation/devicetree/bindings/arm/msm/msm_bus.txt - * Current values of src & dst are defined at - include/linux/msm-bus-board.h -Example: - dpu_rscc { - cell-index = <0>; - compatible = "qcom,dpu-rsc"; - reg = <0xaf2 0x1c44>, - <0xaf3 0x3fd4>; - reg-names = "drv", "wrapper"; - clocks = <_mmss clk_mdss_ahb_clk>, - <_mmss clk_mdss_axi_clk>; - clock-names = "iface_clk", "bus_clk"; - vdd-supply = <_mdss>; - - qcom,dpu-rsc-version = <1>; - qcom,dpu-dram-channels = <2>; - qcom,dpu-num-nrt-paths = <1>; - - qcom,dpu-data-bus { - qcom,msm-bus,name = "dpu_rsc"; - qcom,msm-bus,active-only; - qcom,msm-bus,num-cases = <3>; - qcom,msm-bus,num-paths = <2>; - qcom,msm-bus,vectors-KBps = - <22 512 0 0>, <23 512 0 0>, - <22 512 0 640>, <23 512 0 640>, - <22 512 0 640>, <23 512 0 640>; - }; - qcom,dpu-llcc-bus { - qcom,msm-bus,name = "dpu_rsc_llcc"; - qcom,msm-bus,active-only; - qcom,msm-bus,num-cases = <3>; - qcom,msm-bus,num-paths = <1>; - qcom,msm-bus,vectors-KBps = - <20001 20513 0 0>, -
[Freedreno] [DPU PATCH v2 0/2] Remove DPU RSC support
MSM display controller hardware (DPU) has an inbuilt RSC block which can control power resources and bus bandwidth voting based on frame timing parameters w/o DPU driver intervention. In absence of RSC HW, DPU driver controls these resources. Downstream driver relies on RSC driver for controlling these resources (via RSC HW block) for better power benefits. Since, DPU driver can control these resources, removing RSC driver support. Corresponding devicetree binding are also removed. Details for DPU driver upstreaming: https://lists.freedesktop.org/archives/freedreno/2018-February/001678.html Changes in v2: - Remove last reference to dpu_power_rsc_update - Add DPU PATCH tag for better filtering - Rebase on tip of for-next-staging Rajesh Yadav (2): dt-bindings: msm/disp: Remove DPU RSC device bindings drm/msm: Remove RSC support from DPU driver .../devicetree/bindings/display/msm/dpu-rsc.txt| 96 -- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 130 +- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.h |6 - drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 14 - drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h |9 +- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c| 242 +--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h|7 - drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h |1 - drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c | 20 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.h |3 - drivers/gpu/drm/msm/dpu_dbg.c | 27 - drivers/gpu/drm/msm/dpu_dbg.h | 10 - drivers/gpu/drm/msm/dpu_power_handle.c | 73 +- drivers/gpu/drm/msm/dpu_power_handle.h |4 - drivers/gpu/drm/msm/dpu_rsc.c | 1367 drivers/gpu/drm/msm/dpu_rsc_hw.c | 818 drivers/gpu/drm/msm/dpu_rsc_priv.h | 191 --- include/linux/dpu_rsc.h| 302 - 18 files changed, 42 insertions(+), 3278 deletions(-) delete mode 100644 Documentation/devicetree/bindings/display/msm/dpu-rsc.txt delete mode 100644 drivers/gpu/drm/msm/dpu_rsc.c delete mode 100644 drivers/gpu/drm/msm/dpu_rsc_hw.c delete mode 100644 drivers/gpu/drm/msm/dpu_rsc_priv.h delete mode 100644 include/linux/dpu_rsc.h -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project ___ Freedreno mailing list Freedreno@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/freedreno