Re: [PATCH 1/5] drm/virtio: add virtio_gpu_alloc_fence()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey Emil,

On 2018-10-31 10:38, Emil Velikov wrote:
Hi Rob,

On Thu, 25 Oct 2018 at 19:38, Robert Foss <robert.foss@xxxxxxxxxxxxx> wrote:

From: Gustavo Padovan <gustavo.padovan@xxxxxxxxxxxxx>

Refactor fence creation to remove the potential allocation failure from
the cmd_submit and atomic_commit paths. Now the fence should be allocated
first and just after we should proceed with the rest of the execution.


Commit does a bit more that what the above says:
  - dummy, factor out fence creation/destruction
  - use per virtio_gpu_framebuffer fence

Personally I'd keep the two separate patches and elaborate on the latter.
Obviously in that case, one will need to add 3 lines worth of
virtio_gpu_fence_alloc() in virtio_gpu_cursor_plane_update which will be nuked
with the next patch.

Not a big deal, but it's up-to the maintainer to make the final call if it's
worth splitting or not.

Agreed, I'll hold off with this change until then.


Couple of minor nitpicks below.

         struct virtio_gpu_device *vgdev = dev->dev_private;
         struct virtio_gpu_output *output = NULL;
         struct virtio_gpu_framebuffer *vgfb;
-       struct virtio_gpu_fence *fence = NULL;
         struct virtio_gpu_object *bo = NULL;
         uint32_t handle;
         int ret = 0;

Add the virtio_gpu_fence_alloc()? And yes it will be nuked with patch 2/...



+struct virtio_gpu_fence *virtio_gpu_fence_alloc(struct virtio_gpu_device *vgdev)
+{
+       struct virtio_gpu_fence_driver *drv = &vgdev->fence_drv;
+       struct virtio_gpu_fence *fence = kzalloc(sizeof(struct virtio_gpu_fence), GFP_ATOMIC);
+       if (!fence)
+               return fence;
+
+       fence->drv = drv;
+       dma_fence_init(&fence->f, &virtio_fence_ops, &drv->lock, drv->context, 0);
Oh no, lines over 80 col... while the original code is pretty and neat.

Ack


+
+       return fence;
+}
+
+void virtio_gpu_fence_cleanup(struct virtio_gpu_fence *fence)
+{
+       if (!fence)
+               return;
+
+       if (fence->drv)
+               dma_fence_put(&fence->f);
+       else
+               kfree(fence);
I'm not sure if/how we reach the else case here?

That case should never be hit, and if it is that's a bug.
Fixed in v4.


+}
+
  int virtio_gpu_fence_emit(struct virtio_gpu_device *vgdev,
                           struct virtio_gpu_ctrl_hdr *cmd_hdr,
-                         struct virtio_gpu_fence **fence)
+                         struct virtio_gpu_fence *fence)
  {

With a follow-up commit, we can drop the no longer needed return type.
Which it turns out was never checked ...


Fixed during drm-misc-next rebase for v4.



@@ -319,6 +332,8 @@ static int virtio_gpu_resource_create_ioctl(struct drm_device *dev, void *data,
                 dma_fence_put(&fence->f);
         }
         return 0;
+fail_fence:

The error labels seems to be called after what they do, not what
fails. fail_backoff seems better IMHO.

Agreed. Fixed in v4.


+ttm_eu_backoff_reservation(&ticket, &validate_list);
Indentation seems off (or my client ate it)?

No, the indentation is bad here. Fixed in v4.

Thanks for the feedback Emil.
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux