Skip to content

Commit 77dd114

Browse files
committed
Merge tag 'drm-fixes-2021-08-27' of git://anongit.freedesktop.org/drm/drm
Pull drm fixes from Dave Airlie: "Last set of fixes for 5.14, nothing major a couple of i915, couple of imx and a few amdgpu. All pretty small. i915: - Fix syncmap memory leak - Drop redundant display port debug print amdgpu: - Fix for pinning display buffers multiple times - Fix delayed work handling for GFXOFF - Fix build when CONFIG_SUSPEND is not set imx: - fix planar offset calculations - fix accidental partial revert" * tag 'drm-fixes-2021-08-27' of git://anongit.freedesktop.org/drm/drm: drm/i915/dp: Drop redundant debug print drm/i915: Fix syncmap memory leak drm/amdgpu: Fix build with missing pm_suspend_target_state module export drm/amdgpu: Cancel delayed work when GFXOFF is disabled drm/amdgpu: use the preferred pin domain after the check drm/imx: ipuv3-plane: fix accidental partial revert of 8 pixel alignment fix gpu: ipu-v3: Fix i.MX IPU-v3 offset calculations for (semi)planar U/V formats
2 parents 73367f0 + 9fe4f5a commit 77dd114

File tree

8 files changed

+63
-46
lines changed

8 files changed

+63
-46
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ void amdgpu_acpi_detect(void)
10401040
*/
10411041
bool amdgpu_acpi_is_s0ix_supported(struct amdgpu_device *adev)
10421042
{
1043-
#if IS_ENABLED(CONFIG_AMD_PMC) && IS_ENABLED(CONFIG_PM_SLEEP)
1043+
#if IS_ENABLED(CONFIG_AMD_PMC) && IS_ENABLED(CONFIG_SUSPEND)
10441044
if (acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0) {
10451045
if (adev->flags & AMD_IS_APU)
10461046
return pm_suspend_target_state == PM_SUSPEND_TO_IDLE;

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2777,12 +2777,11 @@ static void amdgpu_device_delay_enable_gfx_off(struct work_struct *work)
27772777
struct amdgpu_device *adev =
27782778
container_of(work, struct amdgpu_device, gfx.gfx_off_delay_work.work);
27792779

2780-
mutex_lock(&adev->gfx.gfx_off_mutex);
2781-
if (!adev->gfx.gfx_off_state && !adev->gfx.gfx_off_req_count) {
2782-
if (!amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_GFX, true))
2783-
adev->gfx.gfx_off_state = true;
2784-
}
2785-
mutex_unlock(&adev->gfx.gfx_off_mutex);
2780+
WARN_ON_ONCE(adev->gfx.gfx_off_state);
2781+
WARN_ON_ONCE(adev->gfx.gfx_off_req_count);
2782+
2783+
if (!amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_GFX, true))
2784+
adev->gfx.gfx_off_state = true;
27862785
}
27872786

27882787
/**

drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -563,24 +563,38 @@ void amdgpu_gfx_off_ctrl(struct amdgpu_device *adev, bool enable)
563563

564564
mutex_lock(&adev->gfx.gfx_off_mutex);
565565

566-
if (!enable)
567-
adev->gfx.gfx_off_req_count++;
568-
else if (adev->gfx.gfx_off_req_count > 0)
566+
if (enable) {
567+
/* If the count is already 0, it means there's an imbalance bug somewhere.
568+
* Note that the bug may be in a different caller than the one which triggers the
569+
* WARN_ON_ONCE.
570+
*/
571+
if (WARN_ON_ONCE(adev->gfx.gfx_off_req_count == 0))
572+
goto unlock;
573+
569574
adev->gfx.gfx_off_req_count--;
570575

571-
if (enable && !adev->gfx.gfx_off_state && !adev->gfx.gfx_off_req_count) {
572-
schedule_delayed_work(&adev->gfx.gfx_off_delay_work, GFX_OFF_DELAY_ENABLE);
573-
} else if (!enable && adev->gfx.gfx_off_state) {
574-
if (!amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_GFX, false)) {
575-
adev->gfx.gfx_off_state = false;
576+
if (adev->gfx.gfx_off_req_count == 0 && !adev->gfx.gfx_off_state)
577+
schedule_delayed_work(&adev->gfx.gfx_off_delay_work, GFX_OFF_DELAY_ENABLE);
578+
} else {
579+
if (adev->gfx.gfx_off_req_count == 0) {
580+
cancel_delayed_work_sync(&adev->gfx.gfx_off_delay_work);
581+
582+
if (adev->gfx.gfx_off_state &&
583+
!amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_GFX, false)) {
584+
adev->gfx.gfx_off_state = false;
576585

577-
if (adev->gfx.funcs->init_spm_golden) {
578-
dev_dbg(adev->dev, "GFXOFF is disabled, re-init SPM golden settings\n");
579-
amdgpu_gfx_init_spm_golden(adev);
586+
if (adev->gfx.funcs->init_spm_golden) {
587+
dev_dbg(adev->dev,
588+
"GFXOFF is disabled, re-init SPM golden settings\n");
589+
amdgpu_gfx_init_spm_golden(adev);
590+
}
580591
}
581592
}
593+
594+
adev->gfx.gfx_off_req_count++;
582595
}
583596

597+
unlock:
584598
mutex_unlock(&adev->gfx.gfx_off_mutex);
585599
}
586600

drivers/gpu/drm/amd/amdgpu/amdgpu_object.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -920,11 +920,6 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
920920
return -EINVAL;
921921
}
922922

923-
/* This assumes only APU display buffers are pinned with (VRAM|GTT).
924-
* See function amdgpu_display_supported_domains()
925-
*/
926-
domain = amdgpu_bo_get_preferred_pin_domain(adev, domain);
927-
928923
if (bo->tbo.pin_count) {
929924
uint32_t mem_type = bo->tbo.resource->mem_type;
930925
uint32_t mem_flags = bo->tbo.resource->placement;
@@ -949,6 +944,11 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
949944
return 0;
950945
}
951946

947+
/* This assumes only APU display buffers are pinned with (VRAM|GTT).
948+
* See function amdgpu_display_supported_domains()
949+
*/
950+
domain = amdgpu_bo_get_preferred_pin_domain(adev, domain);
951+
952952
if (bo->tbo.base.import_attach)
953953
dma_buf_pin(bo->tbo.base.import_attach);
954954

drivers/gpu/drm/i915/display/intel_dp.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3850,23 +3850,18 @@ static void intel_dp_check_device_service_irq(struct intel_dp *intel_dp)
38503850

38513851
static void intel_dp_check_link_service_irq(struct intel_dp *intel_dp)
38523852
{
3853-
struct drm_i915_private *i915 = dp_to_i915(intel_dp);
38543853
u8 val;
38553854

38563855
if (intel_dp->dpcd[DP_DPCD_REV] < 0x11)
38573856
return;
38583857

38593858
if (drm_dp_dpcd_readb(&intel_dp->aux,
3860-
DP_LINK_SERVICE_IRQ_VECTOR_ESI0, &val) != 1 || !val) {
3861-
drm_dbg_kms(&i915->drm, "Error in reading link service irq vector\n");
3859+
DP_LINK_SERVICE_IRQ_VECTOR_ESI0, &val) != 1 || !val)
38623860
return;
3863-
}
38643861

38653862
if (drm_dp_dpcd_writeb(&intel_dp->aux,
3866-
DP_LINK_SERVICE_IRQ_VECTOR_ESI0, val) != 1) {
3867-
drm_dbg_kms(&i915->drm, "Error in writing link service irq vector\n");
3863+
DP_LINK_SERVICE_IRQ_VECTOR_ESI0, val) != 1)
38683864
return;
3869-
}
38703865

38713866
if (val & HDMI_LINK_STATUS_CHANGED)
38723867
intel_dp_handle_hdmi_link_status_change(intel_dp);

drivers/gpu/drm/i915/gt/intel_timeline.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,15 @@ static void intel_timeline_fini(struct rcu_head *rcu)
127127

128128
i915_vma_put(timeline->hwsp_ggtt);
129129
i915_active_fini(&timeline->active);
130+
131+
/*
132+
* A small race exists between intel_gt_retire_requests_timeout and
133+
* intel_timeline_exit which could result in the syncmap not getting
134+
* free'd. Rather than work to hard to seal this race, simply cleanup
135+
* the syncmap on fini.
136+
*/
137+
i915_syncmap_free(&timeline->sync);
138+
130139
kfree(timeline);
131140
}
132141

drivers/gpu/drm/imx/ipuv3-plane.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ static void ipu_plane_atomic_update(struct drm_plane *plane,
683683
break;
684684
}
685685

686-
ipu_dmfc_config_wait4eot(ipu_plane->dmfc, drm_rect_width(dst));
686+
ipu_dmfc_config_wait4eot(ipu_plane->dmfc, ALIGN(drm_rect_width(dst), 8));
687687

688688
width = ipu_src_rect_width(new_state);
689689
height = drm_rect_height(&new_state->src) >> 16;

drivers/gpu/ipu-v3/ipu-cpmem.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -585,21 +585,21 @@ static const struct ipu_rgb def_bgra_16 = {
585585
.bits_per_pixel = 16,
586586
};
587587

588-
#define Y_OFFSET(pix, x, y) ((x) + pix->width * (y))
589-
#define U_OFFSET(pix, x, y) ((pix->width * pix->height) + \
590-
(pix->width * ((y) / 2) / 2) + (x) / 2)
591-
#define V_OFFSET(pix, x, y) ((pix->width * pix->height) + \
592-
(pix->width * pix->height / 4) + \
593-
(pix->width * ((y) / 2) / 2) + (x) / 2)
594-
#define U2_OFFSET(pix, x, y) ((pix->width * pix->height) + \
595-
(pix->width * (y) / 2) + (x) / 2)
596-
#define V2_OFFSET(pix, x, y) ((pix->width * pix->height) + \
597-
(pix->width * pix->height / 2) + \
598-
(pix->width * (y) / 2) + (x) / 2)
599-
#define UV_OFFSET(pix, x, y) ((pix->width * pix->height) + \
600-
(pix->width * ((y) / 2)) + (x))
601-
#define UV2_OFFSET(pix, x, y) ((pix->width * pix->height) + \
602-
(pix->width * y) + (x))
588+
#define Y_OFFSET(pix, x, y) ((x) + pix->bytesperline * (y))
589+
#define U_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \
590+
(pix->bytesperline * ((y) / 2) / 2) + (x) / 2)
591+
#define V_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \
592+
(pix->bytesperline * pix->height / 4) + \
593+
(pix->bytesperline * ((y) / 2) / 2) + (x) / 2)
594+
#define U2_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \
595+
(pix->bytesperline * (y) / 2) + (x) / 2)
596+
#define V2_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \
597+
(pix->bytesperline * pix->height / 2) + \
598+
(pix->bytesperline * (y) / 2) + (x) / 2)
599+
#define UV_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \
600+
(pix->bytesperline * ((y) / 2)) + (x))
601+
#define UV2_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \
602+
(pix->bytesperline * y) + (x))
603603

604604
#define NUM_ALPHA_CHANNELS 7
605605

0 commit comments

Comments
 (0)