Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 42783296 authored by Amit Pundir's avatar Amit Pundir
Browse files

HACK: ANDROID: goldfish_sync_timeline: Rename fence to dma_fence



Rename fence interfaces to dma_fence to match with the upstream
commit, f54d1867 ("dma-buf: Rename struct fence to dma_fence"),
changes.

FIXME: Remove goldfish_sync_timeline and use sync_timeline interfaces
instead.

Signed-off-by: default avatarAmit Pundir <amit.pundir@linaro.org>
parent 03043a92
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@
#include <linux/fs.h>
#include <linux/syscalls.h>
#include <linux/sync_file.h>
#include <linux/fence.h>
#include <linux/dma-fence.h>

#include "goldfish_sync_timeline_fence.h"

@@ -325,7 +325,7 @@ goldfish_sync_fence_create(struct goldfish_sync_timeline_obj *obj,
err_cleanup_fd_pt:
	put_unused_fd(fd);
err_cleanup_pt:
	fence_put(&syncpt->base);
	dma_fence_put(&syncpt->base);
	return -1;
}

+23 −23
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
#include <linux/fs.h>
#include <linux/syscalls.h>
#include <linux/sync_file.h>
#include <linux/fence.h>
#include <linux/dma-fence.h>

#include "goldfish_sync_timeline_fence.h"

@@ -46,15 +46,15 @@ struct goldfish_sync_timeline {
	struct list_head	active_list_head;
};

static inline struct goldfish_sync_timeline *fence_parent(struct fence *fence)
static inline struct goldfish_sync_timeline *goldfish_dma_fence_parent(struct dma_fence *fence)
{
	return container_of(fence->lock, struct goldfish_sync_timeline,
				child_list_lock);
}

static const struct fence_ops goldfish_sync_timeline_fence_ops;
static const struct dma_fence_ops goldfish_sync_timeline_fence_ops;

static inline struct sync_pt *goldfish_sync_fence_to_sync_pt(struct fence *fence)
static inline struct sync_pt *goldfish_sync_fence_to_sync_pt(struct dma_fence *fence)
{
	if (fence->ops != &goldfish_sync_timeline_fence_ops)
		return NULL;
@@ -78,7 +78,7 @@ struct goldfish_sync_timeline
		return NULL;

	kref_init(&obj->kref);
	obj->context = fence_context_alloc(1);
	obj->context = dma_fence_context_alloc(1);
	strlcpy(obj->name, name, sizeof(obj->name));

	INIT_LIST_HEAD(&obj->child_list_head);
@@ -128,7 +128,7 @@ void goldfish_sync_timeline_signal_internal(struct goldfish_sync_timeline *obj,

	list_for_each_entry_safe(pt, next, &obj->active_list_head,
				 active_list) {
		if (fence_is_signaled_locked(&pt->base))
		if (dma_fence_is_signaled_locked(&pt->base))
			list_del_init(&pt->active_list);
	}

@@ -162,7 +162,7 @@ struct sync_pt *goldfish_sync_pt_create_internal(

	spin_lock_irqsave(&obj->child_list_lock, flags);
	goldfish_sync_timeline_get_internal(obj);
	fence_init(&pt->base, &goldfish_sync_timeline_fence_ops, &obj->child_list_lock,
	dma_fence_init(&pt->base, &goldfish_sync_timeline_fence_ops, &obj->child_list_lock,
		   obj->context, value);
	list_add_tail(&pt->child_list, &obj->child_list_head);
	INIT_LIST_HEAD(&pt->active_list);
@@ -171,23 +171,23 @@ struct sync_pt *goldfish_sync_pt_create_internal(
}

static const char *goldfish_sync_timeline_fence_get_driver_name(
						struct fence *fence)
						struct dma_fence *fence)
{
	return "sw_sync";
}

static const char *goldfish_sync_timeline_fence_get_timeline_name(
						struct fence *fence)
						struct dma_fence *fence)
{
	struct goldfish_sync_timeline *parent = fence_parent(fence);
	struct goldfish_sync_timeline *parent = goldfish_dma_fence_parent(fence);

	return parent->name;
}

static void goldfish_sync_timeline_fence_release(struct fence *fence)
static void goldfish_sync_timeline_fence_release(struct dma_fence *fence)
{
	struct sync_pt *pt = goldfish_sync_fence_to_sync_pt(fence);
	struct goldfish_sync_timeline *parent = fence_parent(fence);
	struct goldfish_sync_timeline *parent = goldfish_dma_fence_parent(fence);
	unsigned long flags;

	spin_lock_irqsave(fence->lock, flags);
@@ -197,20 +197,20 @@ static void goldfish_sync_timeline_fence_release(struct fence *fence)
	spin_unlock_irqrestore(fence->lock, flags);

	goldfish_sync_timeline_put_internal(parent);
	fence_free(fence);
	dma_fence_free(fence);
}

static bool goldfish_sync_timeline_fence_signaled(struct fence *fence)
static bool goldfish_sync_timeline_fence_signaled(struct dma_fence *fence)
{
	struct goldfish_sync_timeline *parent = fence_parent(fence);
	struct goldfish_sync_timeline *parent = goldfish_dma_fence_parent(fence);

	return (fence->seqno > parent->value) ? false : true;
}

static bool goldfish_sync_timeline_fence_enable_signaling(struct fence *fence)
static bool goldfish_sync_timeline_fence_enable_signaling(struct dma_fence *fence)
{
	struct sync_pt *pt = goldfish_sync_fence_to_sync_pt(fence);
	struct goldfish_sync_timeline *parent = fence_parent(fence);
	struct goldfish_sync_timeline *parent = goldfish_dma_fence_parent(fence);

	if (goldfish_sync_timeline_fence_signaled(fence))
		return false;
@@ -219,35 +219,35 @@ static bool goldfish_sync_timeline_fence_enable_signaling(struct fence *fence)
	return true;
}

static void goldfish_sync_timeline_fence_disable_signaling(struct fence *fence)
static void goldfish_sync_timeline_fence_disable_signaling(struct dma_fence *fence)
{
	struct sync_pt *pt = container_of(fence, struct sync_pt, base);

	list_del_init(&pt->active_list);
}

static void goldfish_sync_timeline_fence_value_str(struct fence *fence,
static void goldfish_sync_timeline_fence_value_str(struct dma_fence *fence,
					char *str, int size)
{
	snprintf(str, size, "%d", fence->seqno);
}

static void goldfish_sync_timeline_fence_timeline_value_str(
				struct fence *fence,
				struct dma_fence *fence,
				char *str, int size)
{
	struct goldfish_sync_timeline *parent = fence_parent(fence);
	struct goldfish_sync_timeline *parent = goldfish_dma_fence_parent(fence);

	snprintf(str, size, "%d", parent->value);
}

static const struct fence_ops goldfish_sync_timeline_fence_ops = {
static const struct dma_fence_ops goldfish_sync_timeline_fence_ops = {
	.get_driver_name = goldfish_sync_timeline_fence_get_driver_name,
	.get_timeline_name = goldfish_sync_timeline_fence_get_timeline_name,
	.enable_signaling = goldfish_sync_timeline_fence_enable_signaling,
	.disable_signaling = goldfish_sync_timeline_fence_disable_signaling,
	.signaled = goldfish_sync_timeline_fence_signaled,
	.wait = fence_default_wait,
	.wait = dma_fence_default_wait,
	.release = goldfish_sync_timeline_fence_release,
	.fence_value_str = goldfish_sync_timeline_fence_value_str,
	.timeline_value_str = goldfish_sync_timeline_fence_timeline_value_str,
+3 −3
Original line number Diff line number Diff line
#include <linux/sync_file.h>
#include <linux/fence.h>
#include <linux/dma-fence.h>

/**
 * struct sync_pt - sync_pt object
 * @base: base fence object
 * @base: base dma_fence object
 * @child_list: sync timeline child's list
 * @active_list: sync timeline active child's list
 */
struct sync_pt {
	struct fence base;
	struct dma_fence base;
	struct list_head child_list;
	struct list_head active_list;
};