Skip to content

Commit 6ddf37d

Browse files
committed
Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux
Pull drm fixes from Dave Airlie: "Nothing too crazy in here: a bunch of AMD fixes/quirks, two msm fixes, some rockchip fixes, and a udl warning fix, along with one locking fix for displayport that seems to fix some dodgy monitors" * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux: drm/udl: Use unlocked gem unreferencing drm/dp: move hw_mutex up the call stack drm/amdgpu: Don't move pinned BOs drm/radeon: Don't move pinned BOs drm/radeon: add a dpm quirk for all R7 370 parts drm/radeon: add another R7 370 quirk drm/rockchip: dw_hdmi: Don't call platform_set_drvdata() drm/rockchip: vop: Fix vop crtc cleanup drm/rockchip: dw_hdmi: Call drm_encoder_cleanup() in error path drm/rockchip: vop: Disable planes when disabling CRTC drm/rockchip: vop: Don't reject empty modesets drm/rockchip: cancel pending vblanks on close drm/rockchip: vop: fix crtc size in plane check drm/radeon: add a dpm quirk for sapphire Dual-X R7 370 2G D5 drm/amd: Beef up ACP Kconfig menu text drm/msm: fix typo in the !COMMON_CLK case drm/msm: fix bug after preclose removal
2 parents 52bef0c + 72b9ff0 commit 6ddf37d

File tree

16 files changed

+152
-34
lines changed

16 files changed

+152
-34
lines changed

drivers/gpu/drm/amd/acp/Kconfig

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
menu "ACP Configuration"
1+
menu "ACP (Audio CoProcessor) Configuration"
22

33
config DRM_AMD_ACP
4-
bool "Enable ACP IP support"
4+
bool "Enable AMD Audio CoProcessor IP support"
55
select MFD_CORE
66
select PM_GENERIC_DOMAINS if PM
77
help
88
Choose this option to enable ACP IP support for AMD SOCs.
9+
This adds the ACP (Audio CoProcessor) IP driver and wires
10+
it up into the amdgpu driver. The ACP block provides the DMA
11+
engine for the i2s-based ALSA driver. It is required for audio
12+
on APUs which utilize an i2s codec.
913

1014
endmenu

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,10 @@ int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
608608
if ((offset + size) <= adev->mc.visible_vram_size)
609609
return 0;
610610

611+
/* Can't move a pinned BO to visible VRAM */
612+
if (abo->pin_count > 0)
613+
return -EINVAL;
614+
611615
/* hurrah the memory is not visible ! */
612616
amdgpu_ttm_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_VRAM);
613617
lpfn = adev->mc.visible_vram_size >> PAGE_SHIFT;

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,9 +384,15 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo,
384384
struct ttm_mem_reg *new_mem)
385385
{
386386
struct amdgpu_device *adev;
387+
struct amdgpu_bo *abo;
387388
struct ttm_mem_reg *old_mem = &bo->mem;
388389
int r;
389390

391+
/* Can't move a pinned BO */
392+
abo = container_of(bo, struct amdgpu_bo, tbo);
393+
if (WARN_ON_ONCE(abo->pin_count > 0))
394+
return -EINVAL;
395+
390396
adev = amdgpu_get_adev(bo->bdev);
391397
if (old_mem->mem_type == TTM_PL_SYSTEM && bo->ttm == NULL) {
392398
amdgpu_move_null(bo, new_mem);

drivers/gpu/drm/drm_dp_helper.c

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,16 @@ static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request,
179179
{
180180
struct drm_dp_aux_msg msg;
181181
unsigned int retry;
182-
int err;
182+
int err = 0;
183183

184184
memset(&msg, 0, sizeof(msg));
185185
msg.address = offset;
186186
msg.request = request;
187187
msg.buffer = buffer;
188188
msg.size = size;
189189

190+
mutex_lock(&aux->hw_mutex);
191+
190192
/*
191193
* The specification doesn't give any recommendation on how often to
192194
* retry native transactions. We used to retry 7 times like for
@@ -195,25 +197,24 @@ static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request,
195197
*/
196198
for (retry = 0; retry < 32; retry++) {
197199

198-
mutex_lock(&aux->hw_mutex);
199200
err = aux->transfer(aux, &msg);
200-
mutex_unlock(&aux->hw_mutex);
201201
if (err < 0) {
202202
if (err == -EBUSY)
203203
continue;
204204

205-
return err;
205+
goto unlock;
206206
}
207207

208208

209209
switch (msg.reply & DP_AUX_NATIVE_REPLY_MASK) {
210210
case DP_AUX_NATIVE_REPLY_ACK:
211211
if (err < size)
212-
return -EPROTO;
213-
return err;
212+
err = -EPROTO;
213+
goto unlock;
214214

215215
case DP_AUX_NATIVE_REPLY_NACK:
216-
return -EIO;
216+
err = -EIO;
217+
goto unlock;
217218

218219
case DP_AUX_NATIVE_REPLY_DEFER:
219220
usleep_range(AUX_RETRY_INTERVAL, AUX_RETRY_INTERVAL + 100);
@@ -222,7 +223,11 @@ static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request,
222223
}
223224

224225
DRM_DEBUG_KMS("too many retries, giving up\n");
225-
return -EIO;
226+
err = -EIO;
227+
228+
unlock:
229+
mutex_unlock(&aux->hw_mutex);
230+
return err;
226231
}
227232

228233
/**
@@ -544,9 +549,7 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
544549
int max_retries = max(7, drm_dp_i2c_retry_count(msg, dp_aux_i2c_speed_khz));
545550

546551
for (retry = 0, defer_i2c = 0; retry < (max_retries + defer_i2c); retry++) {
547-
mutex_lock(&aux->hw_mutex);
548552
ret = aux->transfer(aux, msg);
549-
mutex_unlock(&aux->hw_mutex);
550553
if (ret < 0) {
551554
if (ret == -EBUSY)
552555
continue;
@@ -685,6 +688,8 @@ static int drm_dp_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs,
685688

686689
memset(&msg, 0, sizeof(msg));
687690

691+
mutex_lock(&aux->hw_mutex);
692+
688693
for (i = 0; i < num; i++) {
689694
msg.address = msgs[i].addr;
690695
drm_dp_i2c_msg_set_request(&msg, &msgs[i]);
@@ -739,6 +744,8 @@ static int drm_dp_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs,
739744
msg.size = 0;
740745
(void)drm_dp_i2c_do_msg(aux, &msg);
741746

747+
mutex_unlock(&aux->hw_mutex);
748+
742749
return err;
743750
}
744751

drivers/gpu/drm/msm/hdmi/hdmi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ void __exit msm_hdmi_phy_driver_unregister(void);
196196
int msm_hdmi_pll_8960_init(struct platform_device *pdev);
197197
int msm_hdmi_pll_8996_init(struct platform_device *pdev);
198198
#else
199-
static inline int msm_hdmi_pll_8960_init(struct platform_device *pdev);
199+
static inline int msm_hdmi_pll_8960_init(struct platform_device *pdev)
200200
{
201201
return -ENODEV;
202202
}

drivers/gpu/drm/msm/msm_drv.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -467,9 +467,6 @@ static void msm_preclose(struct drm_device *dev, struct drm_file *file)
467467
struct msm_file_private *ctx = file->driver_priv;
468468
struct msm_kms *kms = priv->kms;
469469

470-
if (kms)
471-
kms->funcs->preclose(kms, file);
472-
473470
mutex_lock(&dev->struct_mutex);
474471
if (ctx == priv->lastctx)
475472
priv->lastctx = NULL;

drivers/gpu/drm/msm/msm_kms.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ struct msm_kms_funcs {
5555
struct drm_encoder *slave_encoder,
5656
bool is_cmd_mode);
5757
/* cleanup: */
58-
void (*preclose)(struct msm_kms *kms, struct drm_file *file);
5958
void (*destroy)(struct msm_kms *kms);
6059
};
6160

drivers/gpu/drm/radeon/radeon_object.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,10 @@ int radeon_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
799799
if ((offset + size) <= rdev->mc.visible_vram_size)
800800
return 0;
801801

802+
/* Can't move a pinned BO to visible VRAM */
803+
if (rbo->pin_count > 0)
804+
return -EINVAL;
805+
802806
/* hurrah the memory is not visible ! */
803807
radeon_ttm_placement_from_domain(rbo, RADEON_GEM_DOMAIN_VRAM);
804808
lpfn = rdev->mc.visible_vram_size >> PAGE_SHIFT;

drivers/gpu/drm/radeon/radeon_ttm.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,9 +397,15 @@ static int radeon_bo_move(struct ttm_buffer_object *bo,
397397
struct ttm_mem_reg *new_mem)
398398
{
399399
struct radeon_device *rdev;
400+
struct radeon_bo *rbo;
400401
struct ttm_mem_reg *old_mem = &bo->mem;
401402
int r;
402403

404+
/* Can't move a pinned BO */
405+
rbo = container_of(bo, struct radeon_bo, tbo);
406+
if (WARN_ON_ONCE(rbo->pin_count > 0))
407+
return -EINVAL;
408+
403409
rdev = radeon_get_rdev(bo->bdev);
404410
if (old_mem->mem_type == TTM_PL_SYSTEM && bo->ttm == NULL) {
405411
radeon_move_null(bo, new_mem);

drivers/gpu/drm/radeon/si_dpm.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2926,9 +2926,11 @@ static struct si_dpm_quirk si_dpm_quirk_list[] = {
29262926
/* PITCAIRN - https://bugs.freedesktop.org/show_bug.cgi?id=76490 */
29272927
{ PCI_VENDOR_ID_ATI, 0x6810, 0x1462, 0x3036, 0, 120000 },
29282928
{ PCI_VENDOR_ID_ATI, 0x6811, 0x174b, 0xe271, 0, 120000 },
2929+
{ PCI_VENDOR_ID_ATI, 0x6811, 0x174b, 0x2015, 0, 120000 },
29292930
{ PCI_VENDOR_ID_ATI, 0x6810, 0x174b, 0xe271, 85000, 90000 },
29302931
{ PCI_VENDOR_ID_ATI, 0x6811, 0x1462, 0x2015, 0, 120000 },
29312932
{ PCI_VENDOR_ID_ATI, 0x6811, 0x1043, 0x2015, 0, 120000 },
2933+
{ PCI_VENDOR_ID_ATI, 0x6811, 0x148c, 0x2015, 0, 120000 },
29322934
{ 0, 0, 0, 0 },
29332935
};
29342936

@@ -3008,6 +3010,10 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev,
30083010
}
30093011
++p;
30103012
}
3013+
/* limit mclk on all R7 370 parts for stability */
3014+
if (rdev->pdev->device == 0x6811 &&
3015+
rdev->pdev->revision == 0x81)
3016+
max_mclk = 120000;
30113017

30123018
if (rps->vce_active) {
30133019
rps->evclk = rdev->pm.dpm.vce_states[rdev->pm.dpm.vce_level].evclk;

drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,6 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
271271
if (!iores)
272272
return -ENXIO;
273273

274-
platform_set_drvdata(pdev, hdmi);
275-
276274
encoder->possible_crtcs = drm_of_find_possible_crtcs(drm, dev->of_node);
277275
/*
278276
* If we failed to find the CRTC(s) which this encoder is
@@ -293,7 +291,16 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
293291
drm_encoder_init(drm, encoder, &dw_hdmi_rockchip_encoder_funcs,
294292
DRM_MODE_ENCODER_TMDS, NULL);
295293

296-
return dw_hdmi_bind(dev, master, data, encoder, iores, irq, plat_data);
294+
ret = dw_hdmi_bind(dev, master, data, encoder, iores, irq, plat_data);
295+
296+
/*
297+
* If dw_hdmi_bind() fails we'll never call dw_hdmi_unbind(),
298+
* which would have called the encoder cleanup. Do it manually.
299+
*/
300+
if (ret)
301+
drm_encoder_cleanup(encoder);
302+
303+
return ret;
297304
}
298305

299306
static void dw_hdmi_rockchip_unbind(struct device *dev, struct device *master,

drivers/gpu/drm/rockchip/rockchip_drm_drv.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,27 @@ static int rockchip_drm_unload(struct drm_device *drm_dev)
251251
return 0;
252252
}
253253

254+
static void rockchip_drm_crtc_cancel_pending_vblank(struct drm_crtc *crtc,
255+
struct drm_file *file_priv)
256+
{
257+
struct rockchip_drm_private *priv = crtc->dev->dev_private;
258+
int pipe = drm_crtc_index(crtc);
259+
260+
if (pipe < ROCKCHIP_MAX_CRTC &&
261+
priv->crtc_funcs[pipe] &&
262+
priv->crtc_funcs[pipe]->cancel_pending_vblank)
263+
priv->crtc_funcs[pipe]->cancel_pending_vblank(crtc, file_priv);
264+
}
265+
266+
static void rockchip_drm_preclose(struct drm_device *dev,
267+
struct drm_file *file_priv)
268+
{
269+
struct drm_crtc *crtc;
270+
271+
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
272+
rockchip_drm_crtc_cancel_pending_vblank(crtc, file_priv);
273+
}
274+
254275
void rockchip_drm_lastclose(struct drm_device *dev)
255276
{
256277
struct rockchip_drm_private *priv = dev->dev_private;
@@ -281,6 +302,7 @@ static struct drm_driver rockchip_drm_driver = {
281302
DRIVER_PRIME | DRIVER_ATOMIC,
282303
.load = rockchip_drm_load,
283304
.unload = rockchip_drm_unload,
305+
.preclose = rockchip_drm_preclose,
284306
.lastclose = rockchip_drm_lastclose,
285307
.get_vblank_counter = drm_vblank_no_hw_counter,
286308
.enable_vblank = rockchip_drm_crtc_enable_vblank,

drivers/gpu/drm/rockchip/rockchip_drm_drv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ struct rockchip_crtc_funcs {
4040
int (*enable_vblank)(struct drm_crtc *crtc);
4141
void (*disable_vblank)(struct drm_crtc *crtc);
4242
void (*wait_for_update)(struct drm_crtc *crtc);
43+
void (*cancel_pending_vblank)(struct drm_crtc *crtc, struct drm_file *file_priv);
4344
};
4445

4546
struct rockchip_atomic_commit {

0 commit comments

Comments
 (0)