Re: [RFC][PATCH] HACK: drm_atomic: Don't try to set vblank if crtc isn't active

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 23, 2018 at 12:30:58AM -0800, John Stultz wrote:
> In trying to use the drm_hwcomposer on HiKey, I found things
> wouldn't initialize due to the following check in
> drm_atomic_crtc_check() failing:
> 
>  if (state->event && !state->active && !crtc->state->active) {
>      DRM_DEBUG_ATOMIC("[CRTC:%d:%s] requesting event but off\n",
>                       crtc->base.id, crtc->name);
>      return -EINVAL;
>  }

I think the answer is in the comment directly above this code. Having an event
present while the crtc _stays_ off is the problem. So drm_hwc is requesting an
event (or providing a fence) for a crtc which it does not turn on. So I think
you should go back into hwc and find out how this situation arises.

AFAIK, requesting an event in a commit with both a modeset and plane update
should work.

Sean

> 
> This case fails because the crtc_state hasn't been set to active
> yet.
> 
> However, this trips on the first call to drm_atomic_commit(),
> where the drm_hwcomposer is trying to setup the initial mode.
> 
> Digging further its seems the state->event value is set because
> before we get into handling the atomic mode, we call
> prepare_crtc_signaling(), which sees a fence ptr, and calls
> create_vblank_event().
> 
> So to hack around this, I've added a check in
> prepare_crtc_signaling() to see if the crtc_state is active and
> if not, skip trying to create the vblank event.
> 
> I suspect this isn't correct, but I'm a bit confused on what the
> right solution is. I was thinking the drm_hwcomposer was missing
> something to enable the display before calling
> drmModeAtomicCommit(), but as I look at the logic it seems that
> should be ok. I'm starting to suspect I only see this issue
> because I don't have the framebuffer console enabled, so the
> kernel has yet to initialize the crtc, and that's probably not
> commonly used.
> 
> Any thoughts or feedback on a better approach to solving this
> issue would be greatly appreciated!
> 
> Cc: Marissa Wall <marissaw@xxxxxxxxxx>
> Cc: Sean Paul <seanpaul@xxxxxxxxxx>
> Cc: Dmitry Shmidt <dimitrysh@xxxxxxxxxx>
> Cc: Matt Szczesiak <matt.szczesiak@xxxxxxx>
> Cc: Liviu Dudau <Liviu.Dudau@xxxxxxx>
> Cc: David Hanna <david.hanna11@xxxxxxxxx>
> Cc: Rob Herring <rob.herring@xxxxxxxxxx>
> Cc: Sumit Semwal <sumit.semwal@xxxxxxxxxx>
> Cc: Robert Foss <robert.foss@xxxxxxxxxxxxx>
> Cc: Gustavo Padovan <gustavo.padovan@xxxxxxxxxxxxx>
> Cc: Rob Clark <robdclark@xxxxxxxxx>
> Cc: dri-devel@xxxxxxxxxxxxxxxxxxxxx
> Signed-off-by: John Stultz <john.stultz@xxxxxxxxxx>
> ---
>  drivers/gpu/drm/drm_atomic.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index c2da558..e6404b2 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -2072,6 +2072,9 @@ static int prepare_crtc_signaling(struct drm_device *dev,
>  	for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
>  		s32 __user *fence_ptr;
>  
> +		if (!crtc_state->active)
> +			continue;
> +
>  		fence_ptr = get_out_fence_for_crtc(crtc_state->state, crtc);
>  
>  		if (arg->flags & DRM_MODE_PAGE_FLIP_EVENT || fence_ptr) {
> -- 
> 2.7.4
> 

-- 
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux