cregit-Linux how code gets into the kernel

Release 4.11 drivers/gpu/drm/virtio/virtgpu_fence.c

/*
 * Copyright (C) 2015 Red Hat, Inc.
 * All Rights Reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice (including the
 * next paragraph) shall be included in all copies or substantial
 * portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

#include <drm/drmP.h>
#include "virtgpu_drv.h"


static const char *virtio_get_driver_name(struct dma_fence *f) { return "virtio_gpu"; }

Contributors

PersonTokensPropCommitsCommitProp
Dave Airlie1593.75%150.00%
Chris Wilson16.25%150.00%
Total16100.00%2100.00%


static const char *virtio_get_timeline_name(struct dma_fence *f) { return "controlq"; }

Contributors

PersonTokensPropCommitsCommitProp
Dave Airlie1593.75%150.00%
Chris Wilson16.25%150.00%
Total16100.00%2100.00%


static bool virtio_enable_signaling(struct dma_fence *f) { return true; }

Contributors

PersonTokensPropCommitsCommitProp
Dave Airlie1392.86%150.00%
Chris Wilson17.14%150.00%
Total14100.00%2100.00%


static bool virtio_signaled(struct dma_fence *f) { struct virtio_gpu_fence *fence = to_virtio_fence(f); if (atomic64_read(&fence->drv->last_seq) >= fence->seq) return true; return false; }

Contributors

PersonTokensPropCommitsCommitProp
Dave Airlie4297.67%150.00%
Chris Wilson12.33%150.00%
Total43100.00%2100.00%


static void virtio_fence_value_str(struct dma_fence *f, char *str, int size) { struct virtio_gpu_fence *fence = to_virtio_fence(f); snprintf(str, size, "%llu", fence->seq); }

Contributors

PersonTokensPropCommitsCommitProp
Dave Airlie4097.56%150.00%
Chris Wilson12.44%150.00%
Total41100.00%2100.00%


static void virtio_timeline_value_str(struct dma_fence *f, char *str, int size) { struct virtio_gpu_fence *fence = to_virtio_fence(f); snprintf(str, size, "%llu", (u64)atomic64_read(&fence->drv->last_seq)); }

Contributors

PersonTokensPropCommitsCommitProp
Dave Airlie4590.00%133.33%
Arnd Bergmann48.00%133.33%
Chris Wilson12.00%133.33%
Total50100.00%3100.00%

static const struct dma_fence_ops virtio_fence_ops = { .get_driver_name = virtio_get_driver_name, .get_timeline_name = virtio_get_timeline_name, .enable_signaling = virtio_enable_signaling, .signaled = virtio_signaled, .wait = dma_fence_default_wait, .fence_value_str = virtio_fence_value_str, .timeline_value_str = virtio_timeline_value_str, };
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_driver *drv = &vgdev->fence_drv; unsigned long irq_flags; *fence = kmalloc(sizeof(struct virtio_gpu_fence), GFP_ATOMIC); if ((*fence) == NULL) return -ENOMEM; spin_lock_irqsave(&drv->lock, irq_flags); (*fence)->drv = drv; (*fence)->seq = ++drv->sync_seq; dma_fence_init(&(*fence)->f, &virtio_fence_ops, &drv->lock, drv->context, (*fence)->seq); dma_fence_get(&(*fence)->f); list_add_tail(&(*fence)->node, &drv->fences); spin_unlock_irqrestore(&drv->lock, irq_flags); cmd_hdr->flags |= cpu_to_le32(VIRTIO_GPU_FLAG_FENCE); cmd_hdr->fence_id = cpu_to_le64((*fence)->seq); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Dave Airlie18096.77%125.00%
Gustavo Fernando Padovan31.61%125.00%
Chris Wilson21.08%125.00%
Gerd Hoffmann10.54%125.00%
Total186100.00%4100.00%


void virtio_gpu_fence_event_process(struct virtio_gpu_device *vgdev, u64 last_seq) { struct virtio_gpu_fence_driver *drv = &vgdev->fence_drv; struct virtio_gpu_fence *fence, *tmp; unsigned long irq_flags; spin_lock_irqsave(&drv->lock, irq_flags); atomic64_set(&vgdev->fence_drv.last_seq, last_seq); list_for_each_entry_safe(fence, tmp, &drv->fences, node) { if (last_seq < fence->seq) continue; dma_fence_signal_locked(&fence->f); list_del(&fence->node); dma_fence_put(&fence->f); } spin_unlock_irqrestore(&drv->lock, irq_flags); }

Contributors

PersonTokensPropCommitsCommitProp
Dave Airlie11098.21%150.00%
Chris Wilson21.79%150.00%
Total112100.00%2100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
Dave Airlie50896.21%120.00%
Chris Wilson122.27%120.00%
Arnd Bergmann40.76%120.00%
Gustavo Fernando Padovan30.57%120.00%
Gerd Hoffmann10.19%120.00%
Total528100.00%5100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.