From a9785995d5f22aaeb659285f8aeb64d8b56982e0 Mon Sep 17 00:00:00 2001 From: Arto Merilainen Date: Wed, 19 Mar 2014 09:38:25 +0200 Subject: gpu: nvgpu: Add NVIDIA GPU Driver This patch moves the NVIDIA GPU driver to a new location. Bug 1482562 Change-Id: I24293810b9d0f1504fd9be00135e21dad656ccb6 Signed-off-by: Arto Merilainen Reviewed-on: http://git-master/r/383722 Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h | 102 +++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h (limited to 'drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h') diff --git a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h new file mode 100644 index 00000000..69feb89f --- /dev/null +++ b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h @@ -0,0 +1,102 @@ +/* + * drivers/video/tegra/host/gk20a/channel_sync_gk20a.h + * + * GK20A Channel Synchronization Abstraction + * + * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +#ifndef _GK20A_CHANNEL_SYNC_H_ +#define _GK20A_CHANNEL_SYNC_H_ + +#include + +struct gk20a_channel_sync; +struct priv_cmd_entry; +struct channel_gk20a; + +struct gk20a_channel_fence { + bool valid; + bool wfi; /* was issued with preceding wfi */ + u32 thresh; /* either semaphore or syncpoint value */ +}; + +struct gk20a_channel_sync { + /* CPU wait for a fence returned by incr_syncpt() or incr_fd(). */ + int (*wait_cpu)(struct gk20a_channel_sync *s, + struct gk20a_channel_fence *fence, + int timeout); + + /* Test whether a fence returned by incr_syncpt() or incr_fd() is + * expired. */ + bool (*is_expired)(struct gk20a_channel_sync *s, + struct gk20a_channel_fence *fence); + + /* Generate a gpu wait cmdbuf from syncpoint. */ + int (*wait_syncpt)(struct gk20a_channel_sync *s, u32 id, u32 thresh, + struct priv_cmd_entry **entry); + + /* Generate a gpu wait cmdbuf from sync fd. */ + int (*wait_fd)(struct gk20a_channel_sync *s, int fd, + struct priv_cmd_entry **entry); + + /* Increment syncpoint/semaphore. + * Returns + * - a gpu cmdbuf that performs the increment when executed, + * - a fence that can be passed to wait_cpu() and is_expired(). + */ + int (*incr)(struct gk20a_channel_sync *s, + struct priv_cmd_entry **entry, + struct gk20a_channel_fence *fence); + + /* Increment syncpoint/semaphore, preceded by a wfi. + * Returns + * - a gpu cmdbuf that performs the increment when executed, + * - a fence that can be passed to wait_cpu() and is_expired(). + */ + int (*incr_wfi)(struct gk20a_channel_sync *s, + struct priv_cmd_entry **entry, + struct gk20a_channel_fence *fence); + + /* Increment syncpoint, so that the returned fence represents + * work completion (may need wfi) and can be returned to user space. + * Returns + * - a gpu cmdbuf that performs the increment when executed, + * - a fence that can be passed to wait_cpu() and is_expired(), + * - a syncpoint id/value pair that can be returned to user space. + */ + int (*incr_user_syncpt)(struct gk20a_channel_sync *s, + struct priv_cmd_entry **entry, + struct gk20a_channel_fence *fence, + u32 *id, u32 *thresh); + + /* Increment syncpoint/semaphore, so that the returned fence represents + * work completion (may need wfi) and can be returned to user space. + * Returns + * - a gpu cmdbuf that performs the increment when executed, + * - a fence that can be passed to wait_cpu() and is_expired(), + * - a sync fd that can be returned to user space. + */ + int (*incr_user_fd)(struct gk20a_channel_sync *s, + struct priv_cmd_entry **entry, + struct gk20a_channel_fence *fence, + int *fd); + + /* Reset the channel syncpoint/semaphore. */ + void (*set_min_eq_max)(struct gk20a_channel_sync *s); + + /* Free the resources allocated by gk20a_channel_sync_create. */ + void (*destroy)(struct gk20a_channel_sync *s); +}; + +struct gk20a_channel_sync *gk20a_channel_sync_create(struct channel_gk20a *c); +#endif -- cgit v1.2.2