From: Gerd Hoffmann Subject: [PATCH v2 3/3] drm/virtio: factor out virtio_gpu_update_dumb_bo Date: Wed, 23 Oct 2019 08:25:39 +0200 Message-ID: <20191023062539.11728-4-kraxel@redhat.com> References: <20191023062539.11728-1-kraxel@redhat.com> Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <20191023062539.11728-1-kraxel@redhat.com> Sender: linux-kernel-owner@vger.kernel.org To: dri-devel@lists.freedesktop.org Cc: Gurchetan Singh , Gerd Hoffmann , David Airlie , Daniel Vetter , "open list:VIRTIO GPU DRIVER" , open list List-Id: dri-devel@lists.freedesktop.org No functional change. Signed-off-by: Gerd Hoffmann --- drivers/gpu/drm/virtio/virtgpu_plane.c | 36 +++++++++++++++----------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virti= o/virtgpu_plane.c index 0b5a760bc293..bc4bc4475a8c 100644 --- a/drivers/gpu/drm/virtio/virtgpu_plane.c +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c @@ -102,6 +102,25 @@ static int virtio_gpu_plane_atomic_check(struct drm_pl= ane *plane, =09return ret; } =20 +static void virtio_gpu_update_dumb_bo(struct virtio_gpu_device *vgdev, +=09=09=09=09 struct virtio_gpu_object *bo, +=09=09=09=09 struct drm_plane_state *state) +{ +=09struct virtio_gpu_object_array *objs; + +=09objs =3D virtio_gpu_array_alloc(1); +=09if (!objs) +=09=09return; +=09virtio_gpu_array_add_obj(objs, &bo->base.base); +=09virtio_gpu_cmd_transfer_to_host_2d +=09=09(vgdev, 0, +=09=09 state->src_w >> 16, +=09=09 state->src_h >> 16, +=09=09 state->src_x >> 16, +=09=09 state->src_y >> 16, +=09=09 objs, NULL); +} + static void virtio_gpu_primary_plane_update(struct drm_plane *plane, =09=09=09=09=09 struct drm_plane_state *old_state) { @@ -129,21 +148,8 @@ static void virtio_gpu_primary_plane_update(struct drm= _plane *plane, =20 =09vgfb =3D to_virtio_gpu_framebuffer(plane->state->fb); =09bo =3D gem_to_virtio_gpu_obj(vgfb->base.obj[0]); -=09if (bo->dumb) { -=09=09struct virtio_gpu_object_array *objs; - -=09=09objs =3D virtio_gpu_array_alloc(1); -=09=09if (!objs) -=09=09=09return; -=09=09virtio_gpu_array_add_obj(objs, vgfb->base.obj[0]); -=09=09virtio_gpu_cmd_transfer_to_host_2d -=09=09=09(vgdev, 0, -=09=09=09 plane->state->src_w >> 16, -=09=09=09 plane->state->src_h >> 16, -=09=09=09 plane->state->src_x >> 16, -=09=09=09 plane->state->src_y >> 16, -=09=09=09 objs, NULL); -=09} +=09if (bo->dumb) +=09=09virtio_gpu_update_dumb_bo(vgdev, bo, plane->state); =20 =09DRM_DEBUG("handle 0x%x, crtc %dx%d+%d+%d, src %dx%d+%d+%d\n", =09=09 bo->hw_res_handle, --=20 2.18.1