Dave,
This series is the minimal changes to get virtio-gpu working with Android DRM based hwcomposer. The first 3 patches are fixes, but I assume they are only hit if using the atomic APIs which is dependent on the 4th patch. I suspect async commit support is also missing, but Android doesn't seem to need it.
I also have a few more patches for fb emulation to support panning and mmapping the framebuffer. I'm not too sure that is really worth supporting though.
Rob
Rob Herring (4): drm: virtio-gpu: get the fb from the plane state for atomic updates drm: virtio-gpu: ensure plane is flushed to host on atomic update drm: virtio-gpu: transfer dumb buffers to host on plane update drm: virtio-gpu: set atomic flag
drivers/gpu/drm/virtio/virtgpu_drv.c | 2 +- drivers/gpu/drm/virtio/virtgpu_plane.c | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-)
When using the atomic API, plane->fb is not set when calling virtio_gpu_plane_atomic_update. Use plane->state->fb instead.
Signed-off-by: Rob Herring robh@kernel.org --- drivers/gpu/drm/virtio/virtgpu_plane.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c index 4a74129..6b9ad59 100644 --- a/drivers/gpu/drm/virtio/virtgpu_plane.c +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c @@ -68,8 +68,8 @@ static void virtio_gpu_plane_atomic_update(struct drm_plane *plane, struct virtio_gpu_object *bo; uint32_t handle;
- if (plane->fb) { - vgfb = to_virtio_gpu_framebuffer(plane->fb); + if (plane->state->fb) { + vgfb = to_virtio_gpu_framebuffer(plane->state->fb); bo = gem_to_virtio_gpu_obj(vgfb->obj); handle = bo->hw_res_handle; } else {
This fixes drawing updates when updating planes with atomic API.
Signed-off-by: Rob Herring robh@kernel.org --- drivers/gpu/drm/virtio/virtgpu_plane.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c index 6b9ad59..af121cf 100644 --- a/drivers/gpu/drm/virtio/virtgpu_plane.c +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c @@ -84,6 +84,11 @@ static void virtio_gpu_plane_atomic_update(struct drm_plane *plane, plane->state->crtc_h, plane->state->crtc_x, plane->state->crtc_y); + virtio_gpu_cmd_resource_flush(vgdev, handle, + plane->state->crtc_x, + plane->state->crtc_y, + plane->state->crtc_w, + plane->state->crtc_h); }
For dumb buffers, we need to transfer them to the host when updating a plane.
Signed-off-by: Rob Herring robh@kernel.org --- drivers/gpu/drm/virtio/virtgpu_plane.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c index af121cf..7b6e5c5 100644 --- a/drivers/gpu/drm/virtio/virtgpu_plane.c +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c @@ -72,6 +72,13 @@ static void virtio_gpu_plane_atomic_update(struct drm_plane *plane, vgfb = to_virtio_gpu_framebuffer(plane->state->fb); bo = gem_to_virtio_gpu_obj(vgfb->obj); handle = bo->hw_res_handle; + 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); + } } else { handle = 0; }
Advertise atomic mode setting capability to user space.
Signed-off-by: Rob Herring robh@kernel.org --- drivers/gpu/drm/virtio/virtgpu_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c b/drivers/gpu/drm/virtio/virtgpu_drv.c index b40ed60..7f898cf 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.c +++ b/drivers/gpu/drm/virtio/virtgpu_drv.c @@ -118,7 +118,7 @@ static const struct file_operations virtio_gpu_driver_fops = {
static struct drm_driver driver = { - .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME | DRIVER_RENDER, + .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME | DRIVER_RENDER | DRIVER_ATOMIC, .set_busid = drm_virtio_set_busid, .load = virtio_gpu_driver_load, .unload = virtio_gpu_driver_unload,
On Wed, Jan 13, 2016 at 3:52 PM, Rob Herring robh@kernel.org wrote:
Dave,
This series is the minimal changes to get virtio-gpu working with Android DRM based hwcomposer. The first 3 patches are fixes, but I assume they are only hit if using the atomic APIs which is dependent on the 4th patch. I suspect async commit support is also missing, but Android doesn't seem to need it.
I also have a few more patches for fb emulation to support panning and mmapping the framebuffer. I'm not too sure that is really worth supporting though.
Rob
Rob Herring (4): drm: virtio-gpu: get the fb from the plane state for atomic updates drm: virtio-gpu: ensure plane is flushed to host on atomic update drm: virtio-gpu: transfer dumb buffers to host on plane update drm: virtio-gpu: set atomic flag
drivers/gpu/drm/virtio/virtgpu_drv.c | 2 +- drivers/gpu/drm/virtio/virtgpu_plane.c | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-)
Ping on this series.
Rob
On 2 February 2016 at 05:58, Rob Herring robh@kernel.org wrote:
On Wed, Jan 13, 2016 at 3:52 PM, Rob Herring robh@kernel.org wrote:
Dave,
This series is the minimal changes to get virtio-gpu working with Android DRM based hwcomposer. The first 3 patches are fixes, but I assume they are only hit if using the atomic APIs which is dependent on the 4th patch. I suspect async commit support is also missing, but Android doesn't seem to need it.
I also have a few more patches for fb emulation to support panning and mmapping the framebuffer. I'm not too sure that is really worth supporting though.
Rob
Rob Herring (4): drm: virtio-gpu: get the fb from the plane state for atomic updates drm: virtio-gpu: ensure plane is flushed to host on atomic update drm: virtio-gpu: transfer dumb buffers to host on plane update drm: virtio-gpu: set atomic flag
drivers/gpu/drm/virtio/virtgpu_drv.c | 2 +- drivers/gpu/drm/virtio/virtgpu_plane.c | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-)
Ping on this series.
Hey,
I was going to put them in drm-next when I start doing drm-next.
I didn't think they were urgent enough for -fixes at this point.
Dave.
dri-devel@lists.freedesktop.org