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

From: Gerd Hoffmann
Date: Thu Feb 06 2020 - 01:44:30 EST


> > -
> > - 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.

> > + /*
> > + * 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.

cheers,
Gerd