Re: [PATCH] virtio-gpu: use src not crtc

2016-06-20 Thread Marc-André Lureau
Hi

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

Reviewed-by: Marc-André Lureau 

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
___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Re: [PATCH v2 3/4] Add virtio gpu driver.

2015-04-02 Thread Marc-André Lureau
Hi Gerd

While doing some testing with your brance, I reached that:

On Wed, Apr 1, 2015 at 3:15 PM, Gerd Hoffmann  wrote:

> +#define MAX_INLINE_CMD_SIZE   96
>

[  750.446449] kernel BUG at drivers/gpu/drm/virtio/virtgpu_vq.c:132!
[  750.447005] Call Trace:
[  750.447005]  [] virtio_gpu_alloc_cmd+0x22/0x50
[virtio_gpu]
[  750.447005]  []
virtio_gpu_cmd_context_create+0x30/0xa0 [virtio_gpu]


struct virtio_gpu_ctx_create {
struct virtio_gpu_ctrl_hdr hdr;
__le32 nlen;
__le32 padding;
char debug_name[64];
};

Is actually 96 bytes.

Perhaps that condition should be changed:
+   BUG_ON(size >= MAX_INLINE_CMD_SIZE);

-- 
Marc-André Lureau
___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization