* [PATCH 1/2] drm/virtio: fix unblank [not found] <20200818072511.6745-1-kraxel@redhat.com> @ 2020-08-18 7:25 ` Gerd Hoffmann [not found] ` <88ae71c2-c3ed-e0e4-e62c-bdf9d6534f2a@kernel.org> 2020-09-01 10:20 ` Daniel Vetter 2020-08-18 7:25 ` [PATCH 2/2] drm/virtio: drop virtio_gpu_output->enabled Gerd Hoffmann 1 sibling, 2 replies; 5+ messages in thread From: Gerd Hoffmann @ 2020-08-18 7:25 UTC (permalink / raw) To: dri-devel Cc: David Airlie, open list, open list:VIRTIO GPU DRIVER, Daniel Vetter, Chia-I Wu, 1882851 When going through a disable/enable cycle without changing the framebuffer the optimization added by commit 3954ff10e06e ("drm/virtio: skip set_scanout if framebuffer didn't change") causes the screen stay blank. Add a bool to force an update to fix that. v2: use drm_atomic_crtc_needs_modeset() (Daniel). Cc: 1882851@bugs.launchpad.net Fixes: 3954ff10e06e ("drm/virtio: skip set_scanout if framebuffer didn't change") Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> --- drivers/gpu/drm/virtio/virtgpu_drv.h | 1 + drivers/gpu/drm/virtio/virtgpu_display.c | 11 +++++++++++ drivers/gpu/drm/virtio/virtgpu_plane.c | 4 +++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h index 9ff9f4ac0522..4ab1b0ba2925 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.h +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h @@ -138,6 +138,7 @@ struct virtio_gpu_output { int cur_x; int cur_y; bool enabled; + bool needs_modeset; }; #define drm_crtc_to_virtio_gpu_output(x) \ container_of(x, struct virtio_gpu_output, crtc) diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c index 2c2742b8d657..6c26b41f4e0d 100644 --- a/drivers/gpu/drm/virtio/virtgpu_display.c +++ b/drivers/gpu/drm/virtio/virtgpu_display.c @@ -123,6 +123,17 @@ static int virtio_gpu_crtc_atomic_check(struct drm_crtc *crtc, static void virtio_gpu_crtc_atomic_flush(struct drm_crtc *crtc, struct drm_crtc_state *old_state) { + struct virtio_gpu_output *output = drm_crtc_to_virtio_gpu_output(crtc); + + /* + * virtio-gpu can't do modeset and plane update operations + * independant from each other. So the actual modeset happens + * in the plane update callback, and here we just check + * whenever we must force the modeset. + */ + if (drm_atomic_crtc_needs_modeset(crtc->state)) { + output->needs_modeset = true; + } } static const struct drm_crtc_helper_funcs virtio_gpu_crtc_helper_funcs = { diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c index 52d24179bcec..65757409d9ed 100644 --- a/drivers/gpu/drm/virtio/virtgpu_plane.c +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c @@ -163,7 +163,9 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane, plane->state->src_w != old_state->src_w || plane->state->src_h != old_state->src_h || plane->state->src_x != old_state->src_x || - plane->state->src_y != old_state->src_y) { + plane->state->src_y != old_state->src_y || + output->needs_modeset) { + output->needs_modeset = false; DRM_DEBUG("handle 0x%x, crtc %dx%d+%d+%d, src %dx%d+%d+%d\n", bo->hw_res_handle, plane->state->crtc_w, plane->state->crtc_h, -- 2.18.4 _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply related [flat|nested] 5+ messages in thread
[parent not found: <88ae71c2-c3ed-e0e4-e62c-bdf9d6534f2a@kernel.org>]
* Re: [PATCH 1/2] drm/virtio: fix unblank [not found] ` <88ae71c2-c3ed-e0e4-e62c-bdf9d6534f2a@kernel.org> @ 2020-08-28 11:27 ` Gerd Hoffmann 2020-09-01 7:34 ` Daniel Vetter 0 siblings, 1 reply; 5+ messages in thread From: Gerd Hoffmann @ 2020-08-28 11:27 UTC (permalink / raw) To: Jiri Slaby Cc: David Airlie, 1882851, open list, dri-devel, open list:VIRTIO GPU DRIVER On Mon, Aug 24, 2020 at 09:24:40AM +0200, Jiri Slaby wrote: > On 18. 08. 20, 9:25, Gerd Hoffmann wrote: > > When going through a disable/enable cycle without changing the > > framebuffer the optimization added by commit 3954ff10e06e ("drm/virtio: > > skip set_scanout if framebuffer didn't change") causes the screen stay > > blank. Add a bool to force an update to fix that. > > > > v2: use drm_atomic_crtc_needs_modeset() (Daniel). > > > > Cc: 1882851@bugs.launchpad.net > > Fixes: 3954ff10e06e ("drm/virtio: skip set_scanout if framebuffer didn't change") > > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> > > Tested-by: Jiri Slaby <jirislaby@kernel.org> Ping. Need an ack or an review to merge this. thanks, Gerd _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] drm/virtio: fix unblank 2020-08-28 11:27 ` Gerd Hoffmann @ 2020-09-01 7:34 ` Daniel Vetter 0 siblings, 0 replies; 5+ messages in thread From: Daniel Vetter @ 2020-09-01 7:34 UTC (permalink / raw) To: Gerd Hoffmann Cc: David Airlie, open list, dri-devel, open list:VIRTIO GPU DRIVER, Jiri Slaby, 1882851 On Fri, Aug 28, 2020 at 01:27:59PM +0200, Gerd Hoffmann wrote: > On Mon, Aug 24, 2020 at 09:24:40AM +0200, Jiri Slaby wrote: > > On 18. 08. 20, 9:25, Gerd Hoffmann wrote: > > > When going through a disable/enable cycle without changing the > > > framebuffer the optimization added by commit 3954ff10e06e ("drm/virtio: > > > skip set_scanout if framebuffer didn't change") causes the screen stay > > > blank. Add a bool to force an update to fix that. > > > > > > v2: use drm_atomic_crtc_needs_modeset() (Daniel). > > > > > > Cc: 1882851@bugs.launchpad.net > > > Fixes: 3954ff10e06e ("drm/virtio: skip set_scanout if framebuffer didn't change") > > > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> > > > > Tested-by: Jiri Slaby <jirislaby@kernel.org> > > Ping. Need an ack or an review to merge this. In case you still need that, on both patches: Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> > > thanks, > Gerd > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] drm/virtio: fix unblank 2020-08-18 7:25 ` [PATCH 1/2] drm/virtio: fix unblank Gerd Hoffmann [not found] ` <88ae71c2-c3ed-e0e4-e62c-bdf9d6534f2a@kernel.org> @ 2020-09-01 10:20 ` Daniel Vetter 1 sibling, 0 replies; 5+ messages in thread From: Daniel Vetter @ 2020-09-01 10:20 UTC (permalink / raw) To: Gerd Hoffmann Cc: David Airlie, open list, dri-devel, open list:VIRTIO GPU DRIVER, Daniel Vetter, Chia-I Wu, 1882851 On Tue, Aug 18, 2020 at 09:25:10AM +0200, Gerd Hoffmann wrote: > When going through a disable/enable cycle without changing the > framebuffer the optimization added by commit 3954ff10e06e ("drm/virtio: > skip set_scanout if framebuffer didn't change") causes the screen stay > blank. Add a bool to force an update to fix that. > > v2: use drm_atomic_crtc_needs_modeset() (Daniel). > > Cc: 1882851@bugs.launchpad.net > Fixes: 3954ff10e06e ("drm/virtio: skip set_scanout if framebuffer didn't change") > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> > --- > drivers/gpu/drm/virtio/virtgpu_drv.h | 1 + > drivers/gpu/drm/virtio/virtgpu_display.c | 11 +++++++++++ > drivers/gpu/drm/virtio/virtgpu_plane.c | 4 +++- > 3 files changed, 15 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h > index 9ff9f4ac0522..4ab1b0ba2925 100644 > --- a/drivers/gpu/drm/virtio/virtgpu_drv.h > +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h > @@ -138,6 +138,7 @@ struct virtio_gpu_output { > int cur_x; > int cur_y; > bool enabled; > + bool needs_modeset; Maybe for a follow-up in -next: The clean atomic way of doing this is to put this into a virtio_crtc_state, compute it in atomic_check, and then fish it out (through old_state->state lookup, somewhat contrived I know) in the commit side. Putting random atomic commit state tracking stuff into non-state structures without appropriate amounts of locks is kinda iffy and means more work for reviewers pondering whether it all works correctly. Cheers, Daniel > }; > #define drm_crtc_to_virtio_gpu_output(x) \ > container_of(x, struct virtio_gpu_output, crtc) > diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c > index 2c2742b8d657..6c26b41f4e0d 100644 > --- a/drivers/gpu/drm/virtio/virtgpu_display.c > +++ b/drivers/gpu/drm/virtio/virtgpu_display.c > @@ -123,6 +123,17 @@ static int virtio_gpu_crtc_atomic_check(struct drm_crtc *crtc, > static void virtio_gpu_crtc_atomic_flush(struct drm_crtc *crtc, > struct drm_crtc_state *old_state) > { > + struct virtio_gpu_output *output = drm_crtc_to_virtio_gpu_output(crtc); > + > + /* > + * virtio-gpu can't do modeset and plane update operations > + * independant from each other. So the actual modeset happens > + * in the plane update callback, and here we just check > + * whenever we must force the modeset. > + */ > + if (drm_atomic_crtc_needs_modeset(crtc->state)) { > + output->needs_modeset = true; > + } > } > > static const struct drm_crtc_helper_funcs virtio_gpu_crtc_helper_funcs = { > diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c > index 52d24179bcec..65757409d9ed 100644 > --- a/drivers/gpu/drm/virtio/virtgpu_plane.c > +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c > @@ -163,7 +163,9 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane, > plane->state->src_w != old_state->src_w || > plane->state->src_h != old_state->src_h || > plane->state->src_x != old_state->src_x || > - plane->state->src_y != old_state->src_y) { > + plane->state->src_y != old_state->src_y || > + output->needs_modeset) { > + output->needs_modeset = false; > DRM_DEBUG("handle 0x%x, crtc %dx%d+%d+%d, src %dx%d+%d+%d\n", > bo->hw_res_handle, > plane->state->crtc_w, plane->state->crtc_h, > -- > 2.18.4 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] drm/virtio: drop virtio_gpu_output->enabled [not found] <20200818072511.6745-1-kraxel@redhat.com> 2020-08-18 7:25 ` [PATCH 1/2] drm/virtio: fix unblank Gerd Hoffmann @ 2020-08-18 7:25 ` Gerd Hoffmann 1 sibling, 0 replies; 5+ messages in thread From: Gerd Hoffmann @ 2020-08-18 7:25 UTC (permalink / raw) To: dri-devel Cc: David Airlie, open list, Daniel Vetter, open list:VIRTIO GPU DRIVER Not needed, already tracked by drm_crtc_state->active. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> --- drivers/gpu/drm/virtio/virtgpu_drv.h | 1 - drivers/gpu/drm/virtio/virtgpu_display.c | 4 ---- drivers/gpu/drm/virtio/virtgpu_plane.c | 2 +- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h index 4ab1b0ba2925..fbc04272db4f 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.h +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h @@ -137,7 +137,6 @@ struct virtio_gpu_output { struct edid *edid; int cur_x; int cur_y; - bool enabled; bool needs_modeset; }; #define drm_crtc_to_virtio_gpu_output(x) \ diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c index 6c26b41f4e0d..86a3a800d12e 100644 --- a/drivers/gpu/drm/virtio/virtgpu_display.c +++ b/drivers/gpu/drm/virtio/virtgpu_display.c @@ -97,9 +97,6 @@ static void virtio_gpu_crtc_mode_set_nofb(struct drm_crtc *crtc) static void virtio_gpu_crtc_atomic_enable(struct drm_crtc *crtc, struct drm_crtc_state *old_state) { - struct virtio_gpu_output *output = drm_crtc_to_virtio_gpu_output(crtc); - - output->enabled = true; } static void virtio_gpu_crtc_atomic_disable(struct drm_crtc *crtc, @@ -111,7 +108,6 @@ static void virtio_gpu_crtc_atomic_disable(struct drm_crtc *crtc, virtio_gpu_cmd_set_scanout(vgdev, output->index, 0, 0, 0, 0, 0); virtio_gpu_notify(vgdev); - output->enabled = false; } static int virtio_gpu_crtc_atomic_check(struct drm_crtc *crtc, diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c index 65757409d9ed..6a311cd93440 100644 --- a/drivers/gpu/drm/virtio/virtgpu_plane.c +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c @@ -142,7 +142,7 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane, if (WARN_ON(!output)) return; - if (!plane->state->fb || !output->enabled) { + if (!plane->state->fb || !output->crtc.state->active) { DRM_DEBUG("nofb\n"); virtio_gpu_cmd_set_scanout(vgdev, output->index, 0, plane->state->src_w >> 16, -- 2.18.4 _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-09-01 10:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20200818072511.6745-1-kraxel@redhat.com>
2020-08-18 7:25 ` [PATCH 1/2] drm/virtio: fix unblank Gerd Hoffmann
[not found] ` <88ae71c2-c3ed-e0e4-e62c-bdf9d6534f2a@kernel.org>
2020-08-28 11:27 ` Gerd Hoffmann
2020-09-01 7:34 ` Daniel Vetter
2020-09-01 10:20 ` Daniel Vetter
2020-08-18 7:25 ` [PATCH 2/2] drm/virtio: drop virtio_gpu_output->enabled Gerd Hoffmann
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox