Skip to content

Commit

Permalink
msm: kgsl: Remove sync fence names
Browse files Browse the repository at this point in the history
Generating a sync fence name by allocating memory dynamically and using
scnprintf in a hot path results in excessive CPU time wasted on unneeded
debug info. Remove the name generation entirely to cut down CPU waste in
the GPU's rendering hot path.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
  • Loading branch information
kerneltoast authored and acuicultor committed Feb 12, 2021
1 parent 25c71e7 commit 9884681
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 27 deletions.
2 changes: 1 addition & 1 deletion drivers/gpu/msm/kgsl.c
Expand Up @@ -2331,7 +2331,7 @@ static long gpuobj_free_on_fence(struct kgsl_device_private *dev_priv,
}

handle = kgsl_sync_fence_async_wait(event.fd,
gpuobj_free_fence_func, entry, NULL);
gpuobj_free_fence_func, entry);

if (IS_ERR(handle)) {
kgsl_mem_entry_unset_pend(entry);
Expand Down
15 changes: 1 addition & 14 deletions drivers/gpu/msm/kgsl_drawobj.c
Expand Up @@ -34,18 +34,6 @@
static struct kmem_cache *memobjs_cache;
static struct kmem_cache *sparseobjs_cache;

static void free_fence_names(struct kgsl_drawobj_sync *syncobj)
{
unsigned int i;

for (i = 0; i < syncobj->numsyncs; i++) {
struct kgsl_drawobj_sync_event *event = &syncobj->synclist[i];

if (event->type == KGSL_CMD_SYNCPOINT_TYPE_FENCE)
kfree(event->info.fences);
}
}

void kgsl_drawobj_destroy_object(struct kref *kref)
{
struct kgsl_drawobj *drawobj = container_of(kref,
Expand Down Expand Up @@ -378,8 +366,7 @@ static int drawobj_add_sync_fence(struct kgsl_device *device,
set_bit(event->id, &syncobj->pending);

event->handle = kgsl_sync_fence_async_wait(sync->fd,
drawobj_sync_fence_func, event,
&event->info);
drawobj_sync_fence_func, event);

if (IS_ERR_OR_NULL(event->handle)) {
int ret = PTR_ERR(event->handle);
Expand Down
7 changes: 0 additions & 7 deletions drivers/gpu/msm/kgsl_drawobj.h
Expand Up @@ -100,12 +100,6 @@ struct kgsl_drawobj_sync {
unsigned long timeout_jiffies;
};

#define KGSL_FENCE_NAME_LEN 74

struct event_fence_info {
int num_fences;
};

/**
* struct kgsl_drawobj_sync_event
* @id: identifer (positiion within the pending bitmap)
Expand All @@ -126,7 +120,6 @@ struct kgsl_drawobj_sync_event {
unsigned int timestamp;
struct kgsl_sync_fence_cb *handle;
struct kgsl_device *device;
struct event_fence_info info;
};

/**
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/msm/kgsl_sync.c
Expand Up @@ -397,7 +397,7 @@ static void kgsl_sync_fence_callback(struct dma_fence *fence,
}

struct kgsl_sync_fence_cb *kgsl_sync_fence_async_wait(int fd,
bool (*func)(void *priv), void *priv, struct event_fence_info *info_ptr)
bool (*func)(void *priv), void *priv)
{
struct kgsl_sync_fence_cb *kcb;
struct dma_fence *fence;
Expand Down
6 changes: 2 additions & 4 deletions drivers/gpu/msm/kgsl_sync.h
Expand Up @@ -84,8 +84,7 @@ void kgsl_sync_timeline_destroy(struct kgsl_context *context);
void kgsl_sync_timeline_put(struct kgsl_sync_timeline *ktimeline);

struct kgsl_sync_fence_cb *kgsl_sync_fence_async_wait(int fd,
bool (*func)(void *priv), void *priv,
struct event_fence_info *info_ptr);
bool (*func)(void *priv), void *priv);

void kgsl_sync_fence_async_cancel(struct kgsl_sync_fence_cb *kcb);

Expand Down Expand Up @@ -127,8 +126,7 @@ static inline void kgsl_sync_timeline_put(struct kgsl_sync_timeline *ktimeline)


static inline struct kgsl_sync_fence_cb *kgsl_sync_fence_async_wait(int fd,
bool (*func)(void *priv), void *priv,
struct event_fence_info *info_ptr)
bool (*func)(void *priv), void *priv)
{
return NULL;
}
Expand Down

0 comments on commit 9884681

Please sign in to comment.