All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nirmoy Das <nirmoy.aiemd@gmail.com>
To: amd-gfx@lists.freedesktop.org
Cc: Boyuan.Zhang@amd.com, nirmoy.das@amd.com,
	alexander.deucher@amd.com, James.Zhu@amd.com, Leo.Liu@amd.com,
	christian.koenig@amd.com
Subject: [RFC PATCH 1/2] drm/sched: implement drm_sched_entity_num_jobs
Date: Wed, 11 Mar 2020 18:18:08 +0100	[thread overview]
Message-ID: <20200311171809.7115-1-nirmoy.das@amd.com> (raw)

Implement drm_sched_entity_num_jobs() so that drm drivers can
query number of jobs in an entity.

Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
---
 drivers/gpu/drm/scheduler/sched_entity.c | 15 +++++++++++++++
 include/drm/gpu_scheduler.h              |  1 +
 2 files changed, 16 insertions(+)

diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c
index 90fd9c30ae5a..dfe8216f2d52 100644
--- a/drivers/gpu/drm/scheduler/sched_entity.c
+++ b/drivers/gpu/drm/scheduler/sched_entity.c
@@ -119,6 +119,21 @@ static bool drm_sched_entity_is_idle(struct drm_sched_entity *entity)
 	return false;
 }
 
+/**
+ * drm_sched_entity_num_job - Get number of jobs in the entity
+ *
+ * @entity: scheduler entity
+ *
+ * Returns number of jobs in the entity
+ */
+int drm_sched_entity_num_jobs(struct drm_sched_entity *entity)
+{
+	if (drm_sched_entity_is_idle(entity))
+		return 0;
+
+	return spsc_queue_count(&entity->job_queue);
+}
+EXPORT_SYMBOL(drm_sched_entity_num_jobs);
 /**
  * drm_sched_entity_is_ready - Check if entity is ready
  *
diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h
index d8972836d248..b5ceff75cbbe 100644
--- a/include/drm/gpu_scheduler.h
+++ b/include/drm/gpu_scheduler.h
@@ -341,5 +341,6 @@ void drm_sched_fence_finished(struct drm_sched_fence *fence);
 unsigned long drm_sched_suspend_timeout(struct drm_gpu_scheduler *sched);
 void drm_sched_resume_timeout(struct drm_gpu_scheduler *sched,
 		                unsigned long remaining);
+int drm_sched_entity_num_jobs(struct drm_sched_entity *entity);
 
 #endif
-- 
2.25.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

             reply	other threads:[~2020-03-11 17:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-11 17:18 Nirmoy Das [this message]
2020-03-11 17:18 ` [RFC PATCH 2/2] drm/amdgpu: disable gpu load balancer for vcn jobs Nirmoy Das
2020-03-11 18:03   ` Christian König
2020-03-11 18:47     ` Nirmoy
2020-03-11 17:23 ` [RFC PATCH 1/2] drm/sched: implement drm_sched_entity_num_jobs Andrey Grodzovsky
2020-03-11 17:58   ` Nirmoy
2020-03-11 17:57     ` Christian König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200311171809.7115-1-nirmoy.das@amd.com \
    --to=nirmoy.aiemd@gmail.com \
    --cc=Boyuan.Zhang@amd.com \
    --cc=James.Zhu@amd.com \
    --cc=Leo.Liu@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=nirmoy.das@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.