aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vc4/vc4_gem.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2018-02-15 18:29:27 -0500
committerDave Airlie <airlied@redhat.com>2018-02-15 18:29:27 -0500
commit76ea0f334e7fb13226e64ee7de928611f5303faf (patch)
tree4a6b8d8f1b19a68072f2ce8f33add59be9a67be7 /drivers/gpu/drm/vc4/vc4_gem.c
parentf0308d76906a5b65ec4fcc3b133394caa9f00638 (diff)
parent1bc3d3cce8c3b44c2b5ac6cee98c830bb40e6b0f (diff)
Merge tag 'drm-misc-next-2018-02-13' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
drm-misc-next for 4.17: UAPI Changes: - drm/vc4: Expose performance counters to userspace (Boris) Cross-subsystem Changes: - MAINTAINERS: Linus to maintain panel-arm-versatile in -misc (Linus) Core Changes: - Only use swiotlb when necessary (Chunming) Driver Changes: - drm/panel: Add support for ARM Versatile panels (Linus) - pl111: Improvements around versatile panel support (Linus) ---------------------------------------- Tagged on 2018-02-06: drm-misc-next for 4.17: UAPI Changes: - Validate mode flags + type (Ville) - Deprecate unused mode flags PIXMUX, BCAST (Ville) - Deprecate unused mode types BUILTIN, CRTC_C, CLOCK_C, DEFAULT (Ville) Cross-subsystem Changes: - MAINTAINERS: s/Daniel/Maarten/ for drm-misc (Daniel) Core Changes: - gem: Export gem functions for drivers to use (Samuel) - bridge: Introduce bridge timings in drm_bridge (Linus) - dma-buf: Allow exclusive fence to be bundled in fence array when calling reservation_object_get_fences_rcu (Christian) - dp: Add training pattern 4 and HBR3 support to dp helpers (Manasi) - fourcc: Add alpha bit to formats to avoid driver format LUTs (Maxime) - mode: Various cleanups + add new device-wide .mode_valid hook (Ville) - atomic: Fix state leak when non-blocking commits fail (Leo) NOTE: IIRC, this was cross-picked to -fixes so it might fall out - crc: Allow polling on the data fd (Maarten) Driver Changes: - bridge/vga-dac: Add THS8134* support (Linus) - tinydrm: Various MIPI DBI improvements/cleanups (Noralf) - bridge/dw-mipi-dsi: Cleanups + use create_packet helper (Brian) - drm/sun4i: Add Display Engine frontend support (Maxime) - drm/sun4i: Add zpos support + increase num planes from 2 to 4 (Maxime) - various: Use drm_mode_get_hv_timing() to fill plane clip rectangle (Ville) - stm: Add 8-bit clut support, add dsi phy v1.31 support, +fixes (Phillipe) Cc: Boris Brezillon <boris.brezillon@free-electrons.com> Cc: Chunming Zhou <david1.zhou@amd.com> Cc: Samuel Li <Samuel.Li@amd.com> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Noralf Trønnes <noralf@tronnes.org> Cc: Brian Norris <briannorris@chromium.org> Cc: Maxime Ripard <maxime.ripard@free-electrons.com> Cc: Ville Syrjala <ville.syrjala@linux.intel.com> Cc: Christian König <christian.koenig@amd.com> Cc: Manasi Navare <manasi.d.navare@intel.com> Cc: Philippe Cornu <philippe.cornu@st.com> Cc: Leo (Sunpeng) Li <sunpeng.li@amd.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> * tag 'drm-misc-next-2018-02-13' of git://anongit.freedesktop.org/drm/drm-misc: (115 commits) drm/radeon: only enable swiotlb path when need v2 drm/amdgpu: only enable swiotlb alloc when need v2 drm: add func to get max iomem address v2 drm/vc4: Expose performance counters to userspace drm: Print the pid when debug logging an ioctl error. drm/stm: ltdc: remove non-alpha color formats on layer 2 for older hw drm/stm: ltdc: add non-alpha color formats drm/bridge/synopsys: dsi: Add 1.31 version support drm/bridge/synopsys: dsi: Add read feature drm/pl111: Support multiple endpoints on the CLCD drm/pl111: Support variants with broken VBLANK drm/pl111: Support variants with broken clock divider drm/pl111: Handle the Versatile RGB/BGR565 mode drm/pl111: Properly detect the ARM PL110 variants drm/panel: Add support for ARM Versatile panels drm/panel: Device tree bindings for ARM Versatile panels drm/bridge: Rename argument from crtc to bridge drm/crc: Add support for polling on the data fd. drm/sun4i: Use drm_mode_get_hv_timing() to populate plane clip rectangle drm/rcar-du: Use drm_mode_get_hv_timing() to populate plane clip rectangle ...
Diffstat (limited to 'drivers/gpu/drm/vc4/vc4_gem.c')
-rw-r--r--drivers/gpu/drm/vc4/vc4_gem.c48
1 files changed, 43 insertions, 5 deletions
diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c
index c94cce96544c..2107b0daf8ef 100644
--- a/drivers/gpu/drm/vc4/vc4_gem.c
+++ b/drivers/gpu/drm/vc4/vc4_gem.c
@@ -467,14 +467,30 @@ again:
467 467
468 vc4_flush_caches(dev); 468 vc4_flush_caches(dev);
469 469
470 /* Only start the perfmon if it was not already started by a previous
471 * job.
472 */
473 if (exec->perfmon && vc4->active_perfmon != exec->perfmon)
474 vc4_perfmon_start(vc4, exec->perfmon);
475
470 /* Either put the job in the binner if it uses the binner, or 476 /* Either put the job in the binner if it uses the binner, or
471 * immediately move it to the to-be-rendered queue. 477 * immediately move it to the to-be-rendered queue.
472 */ 478 */
473 if (exec->ct0ca != exec->ct0ea) { 479 if (exec->ct0ca != exec->ct0ea) {
474 submit_cl(dev, 0, exec->ct0ca, exec->ct0ea); 480 submit_cl(dev, 0, exec->ct0ca, exec->ct0ea);
475 } else { 481 } else {
482 struct vc4_exec_info *next;
483
476 vc4_move_job_to_render(dev, exec); 484 vc4_move_job_to_render(dev, exec);
477 goto again; 485 next = vc4_first_bin_job(vc4);
486
487 /* We can't start the next bin job if the previous job had a
488 * different perfmon instance attached to it. The same goes
489 * if one of them had a perfmon attached to it and the other
490 * one doesn't.
491 */
492 if (next && next->perfmon == exec->perfmon)
493 goto again;
478 } 494 }
479} 495}
480 496
@@ -642,6 +658,7 @@ vc4_queue_submit(struct drm_device *dev, struct vc4_exec_info *exec,
642 struct ww_acquire_ctx *acquire_ctx) 658 struct ww_acquire_ctx *acquire_ctx)
643{ 659{
644 struct vc4_dev *vc4 = to_vc4_dev(dev); 660 struct vc4_dev *vc4 = to_vc4_dev(dev);
661 struct vc4_exec_info *renderjob;
645 uint64_t seqno; 662 uint64_t seqno;
646 unsigned long irqflags; 663 unsigned long irqflags;
647 struct vc4_fence *fence; 664 struct vc4_fence *fence;
@@ -667,11 +684,14 @@ vc4_queue_submit(struct drm_device *dev, struct vc4_exec_info *exec,
667 684
668 list_add_tail(&exec->head, &vc4->bin_job_list); 685 list_add_tail(&exec->head, &vc4->bin_job_list);
669 686
670 /* If no job was executing, kick ours off. Otherwise, it'll 687 /* If no bin job was executing and if the render job (if any) has the
671 * get started when the previous job's flush done interrupt 688 * same perfmon as our job attached to it (or if both jobs don't have
672 * occurs. 689 * perfmon activated), then kick ours off. Otherwise, it'll get
690 * started when the previous job's flush/render done interrupt occurs.
673 */ 691 */
674 if (vc4_first_bin_job(vc4) == exec) { 692 renderjob = vc4_first_render_job(vc4);
693 if (vc4_first_bin_job(vc4) == exec &&
694 (!renderjob || renderjob->perfmon == exec->perfmon)) {
675 vc4_submit_next_bin_job(dev); 695 vc4_submit_next_bin_job(dev);
676 vc4_queue_hangcheck(dev); 696 vc4_queue_hangcheck(dev);
677 } 697 }
@@ -936,6 +956,9 @@ vc4_complete_exec(struct drm_device *dev, struct vc4_exec_info *exec)
936 vc4->bin_alloc_used &= ~exec->bin_slots; 956 vc4->bin_alloc_used &= ~exec->bin_slots;
937 spin_unlock_irqrestore(&vc4->job_lock, irqflags); 957 spin_unlock_irqrestore(&vc4->job_lock, irqflags);
938 958
959 /* Release the reference we had on the perf monitor. */
960 vc4_perfmon_put(exec->perfmon);
961
939 mutex_lock(&vc4->power_lock); 962 mutex_lock(&vc4->power_lock);
940 if (--vc4->power_refcount == 0) { 963 if (--vc4->power_refcount == 0) {
941 pm_runtime_mark_last_busy(&vc4->v3d->pdev->dev); 964 pm_runtime_mark_last_busy(&vc4->v3d->pdev->dev);
@@ -1088,6 +1111,7 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data,
1088 struct drm_file *file_priv) 1111 struct drm_file *file_priv)
1089{ 1112{
1090 struct vc4_dev *vc4 = to_vc4_dev(dev); 1113 struct vc4_dev *vc4 = to_vc4_dev(dev);
1114 struct vc4_file *vc4file = file_priv->driver_priv;
1091 struct drm_vc4_submit_cl *args = data; 1115 struct drm_vc4_submit_cl *args = data;
1092 struct vc4_exec_info *exec; 1116 struct vc4_exec_info *exec;
1093 struct ww_acquire_ctx acquire_ctx; 1117 struct ww_acquire_ctx acquire_ctx;
@@ -1101,6 +1125,11 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data,
1101 return -EINVAL; 1125 return -EINVAL;
1102 } 1126 }
1103 1127
1128 if (args->pad2 != 0) {
1129 DRM_DEBUG("->pad2 must be set to zero\n");
1130 return -EINVAL;
1131 }
1132
1104 exec = kcalloc(1, sizeof(*exec), GFP_KERNEL); 1133 exec = kcalloc(1, sizeof(*exec), GFP_KERNEL);
1105 if (!exec) { 1134 if (!exec) {
1106 DRM_ERROR("malloc failure on exec struct\n"); 1135 DRM_ERROR("malloc failure on exec struct\n");
@@ -1126,6 +1155,15 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data,
1126 if (ret) 1155 if (ret)
1127 goto fail; 1156 goto fail;
1128 1157
1158 if (args->perfmonid) {
1159 exec->perfmon = vc4_perfmon_find(vc4file,
1160 args->perfmonid);
1161 if (!exec->perfmon) {
1162 ret = -ENOENT;
1163 goto fail;
1164 }
1165 }
1166
1129 if (exec->args->bin_cl_size != 0) { 1167 if (exec->args->bin_cl_size != 0) {
1130 ret = vc4_get_bcl(dev, exec); 1168 ret = vc4_get_bcl(dev, exec);
1131 if (ret) 1169 if (ret)