host/gpu: Upgrade to new fence-based sync implementation

Signed-off-by: Dan Willemsen <dwillemsen@nvidia.com>
This commit is contained in:
Dan Willemsen
2015-02-16 21:42:47 -08:00
parent e6292247ad
commit 6e3d5ac13f
2 changed files with 13 additions and 9 deletions

View File

@@ -91,7 +91,6 @@ static int gk20a_channel_syncpt_wait_fd(struct gk20a_channel_sync *s, int fd,
#ifdef CONFIG_SYNC
int i;
int num_wait_cmds;
struct sync_pt *pt;
struct sync_fence *sync_fence;
struct priv_cmd_entry *wait_cmd = NULL;
struct gk20a_channel_syncpt *sp =
@@ -103,7 +102,8 @@ static int gk20a_channel_syncpt_wait_fd(struct gk20a_channel_sync *s, int fd,
return -EINVAL;
/* validate syncpt ids */
list_for_each_entry(pt, &sync_fence->pt_list_head, pt_list) {
for (i = 0; i < sync_fence->num_fences; i++) {
struct sync_pt *pt = sync_pt_from_fence(sync_fence->cbs[i].sync_pt);
u32 wait_id = nvhost_sync_pt_id(pt);
if (!wait_id ||
wait_id >= nvhost_syncpt_nb_pts_ext(sp->host1x_pdev)) {
@@ -122,7 +122,9 @@ static int gk20a_channel_syncpt_wait_fd(struct gk20a_channel_sync *s, int fd,
}
i = 0;
list_for_each_entry(pt, &sync_fence->pt_list_head, pt_list) {
for (i = 0; i < sync_fence->num_fences; i++) {
struct fence *f = sync_fence->cbs[i].sync_pt;
struct sync_pt *pt = sync_pt_from_fence(f);
u32 wait_id = nvhost_sync_pt_id(pt);
u32 wait_value = nvhost_sync_pt_thresh(pt);

View File

@@ -141,7 +141,7 @@ static struct gk20a_sync_pt *gk20a_sync_pt_create_shared(
/* Store the dependency fence for this pt. */
if (dependency) {
if (dependency->status == 0) {
if (!atomic_read(&dependency->status)) {
shared->dep = dependency;
} else {
shared->dep_timestamp = ktime_get();
@@ -198,7 +198,6 @@ static int gk20a_sync_pt_has_signaled(struct sync_pt *sync_pt)
{
struct gk20a_sync_pt *pt = to_gk20a_sync_pt(sync_pt);
struct gk20a_sync_timeline *obj = pt->obj;
struct sync_pt *pos;
bool signaled;
if (!pt->sema)
@@ -217,9 +216,12 @@ static int gk20a_sync_pt_has_signaled(struct sync_pt *sync_pt)
* first.*/
if (pt->dep) {
s64 ns = 0;
struct list_head *dep_pts = &pt->dep->pt_list_head;
list_for_each_entry(pos, dep_pts, pt_list) {
ns = max(ns, ktime_to_ns(pos->timestamp));
struct fence *fence;
int i;
for (i = 0; i < pt->dep->num_fences; i++) {
fence = pt->dep->cbs[i].sync_pt;
ns = max(ns, ktime_to_ns(fence->timestamp));
}
pt->dep_timestamp = ns_to_ktime(ns);
sync_fence_put(pt->dep);
@@ -238,7 +240,7 @@ static inline ktime_t gk20a_sync_pt_duration(struct sync_pt *sync_pt)
struct gk20a_sync_pt *pt = to_gk20a_sync_pt(sync_pt);
if (!gk20a_sync_pt_has_signaled(sync_pt) || !pt->dep_timestamp.tv64)
return ns_to_ktime(0);
return ktime_sub(sync_pt->timestamp, pt->dep_timestamp);
return ktime_sub(sync_pt->base.timestamp, pt->dep_timestamp);
}
static int gk20a_sync_pt_compare(struct sync_pt *a, struct sync_pt *b)