Re: [PATCH 2/4] drm/virtio: resource teardown tweaks

From: Chia-I Wu
Date: Thu Feb 06 2020 - 13:32:51 EST


On Wed, Feb 5, 2020 at 10:43 PM Gerd Hoffmann <kraxel@xxxxxxxxxx> wrote:
>
> > > -
> > > - drm_gem_shmem_free_object(obj);
> > > + if (bo->created) {
> > > + virtio_gpu_cmd_unref_resource(vgdev, bo);
> > > + /* completion handler calls virtio_gpu_cleanup_object() */
> > nitpick: we don't need this comment when virtio_gpu_cmd_unref_cb is
> > defined by this file and passed to virtio_gpu_cmd_unref_resource.
>
> I want virtio_gpu_cmd_unref_cb + virtio_gpu_cmd_unref_resource being
> placed next to each other so it is easier to see how they work hand in
> hand.
>
> > I happen to be looking at our error handling paths. I think we want
> > virtio_gpu_queue_fenced_ctrl_buffer to call vbuf->resp_cb on errors.
>
> /me was thinking about that too. Yes, we will need either that,
> or a separate vbuf->error_cb callback. That'll be another patch
> though.
Or the new virtio_gpu_queue_ctrl_sgs can return errors rather than
eating errors.

Yeah, that should be another patch.
>
> > > + /*
> > > + * We are in the release callback and do NOT want refcount
> > > + * bo, so do NOT use virtio_gpu_array_add_obj().
> > > + */
> > > + vbuf->objs = virtio_gpu_array_alloc(1);
> > > + vbuf->objs->objs[0] = &bo->base.base
> > This is an abuse of obj array. Add "void *private_data;" to
> > virtio_gpu_vbuffer and use that maybe?
>
> I'd name that *cb_data, but yes, that makes sense.
Sounds great.
>
> cheers,
> Gerd
>