Skip to contentSkip to conversation

drm/vc4: improve throughput by pipelining binning and rendering jobs

PATCH In review Varad Gautam 2 participants 4 messages Feb 17, 2016 – Mar 14, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/vc4: improve throughput by pipelining binning and rendering jobs

The hardware provides us with separate threads for binning and rendering, and the existing model waits for them both to complete before submitting the next job.

Splitting the binning and rendering submissions reduces idle time and gives us approx 20-30% speedup with several x11perf tests.

Thanks to anholt for suggesting this.

---
 drivers/gpu/drm/vc4/vc4_drv.h |  37 +++++++++++----
 drivers/gpu/drm/vc4/vc4_gem.c | 108 ++++++++++++++++++++++++++++++------------
 drivers/gpu/drm/vc4/vc4_irq.c |  58 +++++++++++++++++++----
 3 files changed, 156 insertions(+), 47 deletions(-)
drivers/gpu/drm/vc4/vc4_drv.h +28 -9
index 4c734d0..9c2304b 100644
@@ -52,7 +52,7 @@ struct vc4_dev {
 	/* Protects bo_cache and the BO stats. */
 	struct mutex bo_lock;
 
-	/* Sequence number for the last job queued in job_list.
+	/* Sequence number for the last job queued in bin_job_list.
 	 * Starts at 0 (no jobs emitted).
 	 */
 	uint64_t emit_seqno;
@@ -62,11 +62,19 @@ struct vc4_dev {
 	 */
 	uint64_t finished_seqno;
 
-	/* List of all struct vc4_exec_info for jobs to be executed.
-	 * The first job in the list is the one currently programmed
-	 * into ct0ca/ct1ca for execution.
+	/* List of all struct vc4_exec_info for jobs to be executed in
+	 * the binner.  The first job in the list is the one currently
+	 * programmed into ct0ca for execution.
 	 */
-	struct list_head job_list;
+	struct list_head bin_job_list;
+
+	/* List of all struct vc4_exec_info for jobs that have
+	 * completed binning and are ready for rendering.  The first
+	 * job in the list is the one currently programmed into ct1ca
+	 * for execution.
+	 */
+	struct list_head render_job_list;
+
 	/* List of the finished vc4_exec_infos waiting to be freed by
 	 * job_done_work.
 	 */
@@ -276,11 +284,20 @@ struct vc4_exec_info {
 };
 
 static inline struct vc4_exec_info *
-vc4_first_job(struct vc4_dev *vc4)
+vc4_first_bin_job(struct vc4_dev *vc4)
+{
+	if (list_empty(&vc4->bin_job_list))
+		return NULL;
+	return list_first_entry(&vc4->bin_job_list, struct vc4_exec_info, head);
+}
+
+static inline struct vc4_exec_info *
+vc4_first_render_job(struct vc4_dev *vc4)
 {
-	if (list_empty(&vc4->job_list))
+	if (list_empty(&vc4->render_job_list))
 		return NULL;
-	return list_first_entry(&vc4->job_list, struct vc4_exec_info, head);
+	return list_first_entry(&vc4->render_job_list,
+				struct vc4_exec_info, head);
 }
 
 /**
@@ -394,7 +411,9 @@ int vc4_wait_seqno_ioctl(struct drm_device *dev, void *data,
 			 struct drm_file *file_priv);
 int vc4_wait_bo_ioctl(struct drm_device *dev, void *data,
 		      struct drm_file *file_priv);
-void vc4_submit_next_job(struct drm_device *dev);
+void vc4_submit_next_bin_job(struct drm_device *dev);
+void vc4_submit_next_render_job(struct drm_device *dev);
+void vc4_move_job_to_render(struct drm_device *dev, struct vc4_exec_info *exec);
 int vc4_wait_for_seqno(struct drm_device *dev, uint64_t seqno,
 		       uint64_t timeout_ns, bool interruptible);
 void vc4_job_handle_completed(struct vc4_dev *vc4);
drivers/gpu/drm/vc4/vc4_gem.c +79 -29

176 lines not on this page · raw message

drivers/gpu/drm/vc4/vc4_irq.c +49 -9

109 lines not on this page · raw message

Signature · 6 lines
2.6.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Varad Gautam

The hardware provides us with separate threads for binning and rendering, and the existing model waits for them both to complete before submitting the next job.

Splitting the binning and rendering submissions reduces idle time and gives us approx 20-30% speedup with several x11perf tests.

This patch is:

Which tests did you find improved, specifically? I'm seeing openarena improved by 1.01897% +/- 0.247857% (n=16). x11perf -aa24text and -copypixwin looked like they had about the same level of improvement.

This conflicts with a change in -fixes. I think this means that it should go in -next once -fixes gets pulled in that.

Peter Brown had suggested to me at one point that we could queue up multiple jobs at once by patching the last few bytes of the current job to jump to the next one. I haven't fully thought through how you'd interlock to make sure that the CL wasn't going to execute the old contents before you go to sleep, but it has the promise of being able to mask out the flush/frame done interrupts.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw

Hi Eric,

Quoted 9 lines · Eric Anholt
Quoted 6 lines · Varad Gautam

The hardware provides us with separate threads for binning and rendering, and the existing model waits for them both to complete before submitting the next job.

Splitting the binning and rendering submissions reduces idle time and gives us approx 20-30% speedup with several x11perf tests.

Quoted 7 lines

This patch is:

Which tests did you find improved, specifically? I'm seeing openarena improved by 1.01897% +/- 0.247857% (n=16). x11perf -aa24text and -copypixwin looked like they had about the same level of improvement.

Here's a sample of the speedups I've noticed with x11perf:

without queue  with queue    % delta  test
-(reps/sec)-   -(reps/sec)-  ---      ---
1840000        2360000       28.26%   10x10 tiled rectangle (17x15 tile)
1920000        2440000       27.08%   10x10 tiled rectangle (4x4 tile)
1340000        1620000       20.90%   10x10 tiled rectangle (216x208
tile)
9900000        11900000      20.20%   10-pixel line
1310000        1570000       19.85%   10x10 tiled rectangle (161x145
tile)
2800000        3270000       16.79%   10x10 rectangle
2720000        3140000       15.44%   100-pixel vertical line segment
876000         1010000       15.30%   100-pixel line segment (2 kids)
199000         229000        15.08%   Circulate Unmapped window (200
kids)
1190000        1350000       13.45%   100-pixel line segment (1 kid)
176000         199000        13.07%   500-pixel line segment
172000         194000        12.79%   500-pixel line
116000         129000        11.21%   Destroy window via parent (100
kids)
2030000        2250000       10.84%   100-pixel horizontal line segment
635000         697000         9.76%   100-pixel line segment (3 kids)
Quoted 4 lines

This conflicts with a change in -fixes. I think this means that it should go in -next once -fixes gets pulled in that.

Quoted 8 lines

Peter Brown had suggested to me at one point that we could queue up multiple jobs at once by patching the last few bytes of the current job
to jump to the next one. I haven't fully thought through how you'd interlock to make sure that the CL wasn't going to execute the old contents before you go to sleep, but it has the promise of being able to
mask out the flush/frame done interrupts.

A rough idea is to keep track of our current job's start address (which may be the previous job's jump destination) and resubmit from here if we come back from sleep. Will see if I can build up on this.

Thanks,
Varad

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
Quoted 36 lines · Varad Gautam

Hi Eric,

Quoted 6 lines · Eric Anholt
Quoted 4 lines · Varad Gautam

The hardware provides us with separate threads for binning and rendering, and the existing model waits for them both to complete before submitting the next job.

Quoted 8 lines
Quoted 2 lines

Splitting the binning and rendering submissions reduces idle time and gives us approx 20-30% speedup with several x11perf tests.

This patch is:

Which tests did you find improved, specifically? I'm seeing

openarena

Quoted 2 lines

improved by 1.01897% +/- 0.247857% (n=16). x11perf -aa24text and -copypixwin looked like they had about the same level of improvement.

Here's a sample of the speedups I've noticed with x11perf:

without queue  with queue    % delta  test
-(reps/sec)-   -(reps/sec)-  ---      ---
1840000        2360000       28.26%   10x10 tiled rectangle (17x15 tile)
1920000        2440000       27.08%   10x10 tiled rectangle (4x4 tile)
1340000        1620000       20.90%   10x10 tiled rectangle (216x208
tile)
9900000        11900000      20.20%   10-pixel line
1310000        1570000       19.85%   10x10 tiled rectangle (161x145
tile)
2800000        3270000       16.79%   10x10 rectangle
2720000        3140000       15.44%   100-pixel vertical line segment
876000         1010000       15.30%   100-pixel line segment (2 kids)
199000         229000        15.08%   Circulate Unmapped window (200
Quoted 8 lines

kids)

1190000        1350000       13.45%   100-pixel line segment (1 kid)
176000         199000        13.07%   500-pixel line segment
172000         194000        12.79%   500-pixel line
116000         129000        11.21%   Destroy window via parent (100
kids)
2030000        2250000       10.84%   100-pixel horizontal line segment
635000         697000         9.76%   100-pixel line segment (3 kids)

Some of these results seem to be spurious (ucirculate, for example). However, -line10 and -tilerect10 seem to be good.

Pulled for -next. Thanks!

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel