linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] virtio-gpu: use src not crtc
@ 2016-05-31 12:52 Gerd Hoffmann
  2016-06-14 10:13 ` Marc-André Lureau
  0 siblings, 1 reply; 3+ messages in thread
From: Gerd Hoffmann @ 2016-05-31 12:52 UTC (permalink / raw)
  To: dri-devel
  Cc: Marc-André Lureau, Gerd Hoffmann, David Airlie,
	open list:VIRTIO GPU DRIVER, open list

Pick up the correct source rectangle from framebuffer.
Without this multihead setups are not working correctly.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 drivers/gpu/drm/virtio/virtgpu_plane.c | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c
index b7778a7..925ca25 100644
--- a/drivers/gpu/drm/virtio/virtgpu_plane.c
+++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
@@ -85,27 +85,32 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane,
 		if (bo->dumb) {
 			virtio_gpu_cmd_transfer_to_host_2d
 				(vgdev, handle, 0,
-				 cpu_to_le32(plane->state->crtc_w),
-				 cpu_to_le32(plane->state->crtc_h),
-				 plane->state->crtc_x, plane->state->crtc_y, NULL);
+				 cpu_to_le32(plane->state->src_w >> 16),
+				 cpu_to_le32(plane->state->src_h >> 16),
+				 plane->state->src_x >> 16,
+				 plane->state->src_y >> 16, NULL);
 		}
 	} else {
 		handle = 0;
 	}
 
-	DRM_DEBUG("handle 0x%x, crtc %dx%d+%d+%d\n", handle,
+	DRM_DEBUG("handle 0x%x, crtc %dx%d+%d+%d, src %dx%d+%d+%d\n", handle,
 		  plane->state->crtc_w, plane->state->crtc_h,
-		  plane->state->crtc_x, plane->state->crtc_y);
+		  plane->state->crtc_x, plane->state->crtc_y,
+		  plane->state->src_w >> 16,
+		  plane->state->src_h >> 16,
+		  plane->state->src_x >> 16,
+		  plane->state->src_y >> 16);
 	virtio_gpu_cmd_set_scanout(vgdev, output->index, handle,
-				   plane->state->crtc_w,
-				   plane->state->crtc_h,
-				   plane->state->crtc_x,
-				   plane->state->crtc_y);
+				   plane->state->src_w >> 16,
+				   plane->state->src_h >> 16,
+				   plane->state->src_x >> 16,
+				   plane->state->src_y >> 16);
 	virtio_gpu_cmd_resource_flush(vgdev, handle,
-				      plane->state->crtc_x,
-				      plane->state->crtc_y,
-				      plane->state->crtc_w,
-				      plane->state->crtc_h);
+				      plane->state->src_x >> 16,
+				      plane->state->src_y >> 16,
+				      plane->state->src_w >> 16,
+				      plane->state->src_h >> 16);
 }
 
 static void virtio_gpu_cursor_plane_update(struct drm_plane *plane,
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] virtio-gpu: use src not crtc
  2016-05-31 12:52 [PATCH] virtio-gpu: use src not crtc Gerd Hoffmann
@ 2016-06-14 10:13 ` Marc-André Lureau
  2016-06-14 12:57   ` Gerd Hoffmann
  0 siblings, 1 reply; 3+ messages in thread
From: Marc-André Lureau @ 2016-06-14 10:13 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: dri-devel, David Airlie, open list:VIRTIO GPU DRIVER, open list

Hi

On Tue, May 31, 2016 at 2:52 PM, Gerd Hoffmann <kraxel@redhat.com> wrote:
> Pick up the correct source rectangle from framebuffer.
> Without this multihead setups are not working correctly.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Additionally, I had to modify the page_flip() function to take the
plane source coordinates for virgl/3d multihead to work. Feel free to
squash.

--- a/drivers/gpu/drm/virtio/virtgpu_display.c
+++ b/drivers/gpu/drm/virtio/virtgpu_display.c
@@ -68,11 +68,16 @@ static int virtio_gpu_page_flip(struct drm_crtc *crtc,
                         0, 0, NULL);
        }
        virtio_gpu_cmd_set_scanout(vgdev, output->index, handle,
-                                  crtc->mode.hdisplay,
-                                  crtc->mode.vdisplay, 0, 0);
-       virtio_gpu_cmd_resource_flush(vgdev, handle, 0, 0,
-                                     crtc->mode.hdisplay,
-                                     crtc->mode.vdisplay);
+                       plane->state->src_w >> 16,
+                       plane->state->src_h >> 16,
+                       plane->state->src_x >> 16,
+                       plane->state->src_y >> 16);
+
+       virtio_gpu_cmd_resource_flush(vgdev, handle,
+                       plane->state->src_x >> 16,
+                       plane->state->src_y >> 16,
+                       plane->state->src_w >> 16,
+                       plane->state->src_h);

> ---
>  drivers/gpu/drm/virtio/virtgpu_plane.c | 31 ++++++++++++++++++-------------
>  1 file changed, 18 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c
> index b7778a7..925ca25 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_plane.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c
> @@ -85,27 +85,32 @@ static void virtio_gpu_primary_plane_update(struct drm_plane *plane,
>                 if (bo->dumb) {
>                         virtio_gpu_cmd_transfer_to_host_2d
>                                 (vgdev, handle, 0,
> -                                cpu_to_le32(plane->state->crtc_w),
> -                                cpu_to_le32(plane->state->crtc_h),
> -                                plane->state->crtc_x, plane->state->crtc_y, NULL);
> +                                cpu_to_le32(plane->state->src_w >> 16),
> +                                cpu_to_le32(plane->state->src_h >> 16),
> +                                plane->state->src_x >> 16,
> +                                plane->state->src_y >> 16, NULL);
>                 }
>         } else {
>                 handle = 0;
>         }
>
> -       DRM_DEBUG("handle 0x%x, crtc %dx%d+%d+%d\n", handle,
> +       DRM_DEBUG("handle 0x%x, crtc %dx%d+%d+%d, src %dx%d+%d+%d\n", handle,
>                   plane->state->crtc_w, plane->state->crtc_h,
> -                 plane->state->crtc_x, plane->state->crtc_y);
> +                 plane->state->crtc_x, plane->state->crtc_y,
> +                 plane->state->src_w >> 16,
> +                 plane->state->src_h >> 16,
> +                 plane->state->src_x >> 16,
> +                 plane->state->src_y >> 16);
>         virtio_gpu_cmd_set_scanout(vgdev, output->index, handle,
> -                                  plane->state->crtc_w,
> -                                  plane->state->crtc_h,
> -                                  plane->state->crtc_x,
> -                                  plane->state->crtc_y);
> +                                  plane->state->src_w >> 16,
> +                                  plane->state->src_h >> 16,
> +                                  plane->state->src_x >> 16,
> +                                  plane->state->src_y >> 16);
>         virtio_gpu_cmd_resource_flush(vgdev, handle,
> -                                     plane->state->crtc_x,
> -                                     plane->state->crtc_y,
> -                                     plane->state->crtc_w,
> -                                     plane->state->crtc_h);
> +                                     plane->state->src_x >> 16,
> +                                     plane->state->src_y >> 16,
> +                                     plane->state->src_w >> 16,
> +                                     plane->state->src_h >> 16);
>  }
>
>  static void virtio_gpu_cursor_plane_update(struct drm_plane *plane,
> --
> 1.8.3.1
>



-- 
Marc-André Lureau

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] virtio-gpu: use src not crtc
  2016-06-14 10:13 ` Marc-André Lureau
@ 2016-06-14 12:57   ` Gerd Hoffmann
  0 siblings, 0 replies; 3+ messages in thread
From: Gerd Hoffmann @ 2016-06-14 12:57 UTC (permalink / raw)
  To: Marc-André Lureau
  Cc: dri-devel, David Airlie, open list:VIRTIO GPU DRIVER, open list

On Di, 2016-06-14 at 12:13 +0200, Marc-André Lureau wrote:
> Hi
> 
> On Tue, May 31, 2016 at 2:52 PM, Gerd Hoffmann <kraxel@redhat.com> wrote:
> > Pick up the correct source rectangle from framebuffer.
> > Without this multihead setups are not working correctly.
> >
> > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> 
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Additionally, I had to modify the page_flip() function to take the
> plane source coordinates for virgl/3d multihead to work. Feel free to
> squash.

This is in progress of being sorted, by dropping the
virtio_gpu_page_flip function altogether in favor of atomic helpers,
which will use the (already fixed) plane callbacks instead.

See nonblocking commit support patches by Daniel Vetter on this list.

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-06-14 12:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-31 12:52 [PATCH] virtio-gpu: use src not crtc Gerd Hoffmann
2016-06-14 10:13 ` Marc-André Lureau
2016-06-14 12:57   ` Gerd Hoffmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).