lkml.org 
[lkml]   [2018]   [Nov]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/5] drm/virtio: add virtio_gpu_alloc_fence()
From
Date
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@collabora.com> wrote:
>>
>> From: Gustavo Padovan <gustavo.padovan@collabora.com>
>>
>> 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.

\
 
 \ /
  Last update: 2018-11-01 13:45    [W:1.365 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site