Skip to content

Commit 7952410

Browse files
committed
Merge tag 'drm-misc-next-2018-09-19' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
drm-misc-next for 4.20: UAPI Changes: - None Cross-subsystem Changes: - None Core Changes: - Allow drivers to disable features with per-device granularity (Ville) - Use EOPNOTSUPP when iface/feature is unsupported instead of EINVAL/errno soup (Chris) - Simplify M/N DP quirk by using constant N to limit size of M/N (Shawn) - add quirk for LG LP140WF6-SPM1 eDP panel (Shawn) Driver Changes: - i915/amdgpu: Disable DRIVER_ATOMIC for older/unsupported devices (Ville) - sun4i: add support for R40 HDMI PHY (Icenowy) Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Icenowy Zheng <icenowy@aosc.io> Cc: Lee, Shawn C <shawn.c.lee@intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com> From: Sean Paul <sean@poorly.run> Link: https://patchwork.freedesktop.org/patch/msgid/20180919200218.GA186644@art_vandelay
2 parents 2dc7bad + e884818 commit 7952410

40 files changed

+191
-133
lines changed

Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ Required properties:
107107
- compatible: value must be one of:
108108
* allwinner,sun8i-a83t-hdmi-phy
109109
* allwinner,sun8i-h3-hdmi-phy
110+
* allwinner,sun8i-r40-hdmi-phy
110111
* allwinner,sun50i-a64-hdmi-phy
111112
- reg: base address and size of memory-mapped region
112113
- clocks: phandles to the clocks feeding the HDMI PHY
@@ -116,9 +117,9 @@ Required properties:
116117
- resets: phandle to the reset controller driving the PHY
117118
- reset-names: must be "phy"
118119

119-
H3 and A64 HDMI PHY require additional clocks:
120+
H3, A64 and R40 HDMI PHY require additional clocks:
120121
- pll-0: parent of phy clock
121-
- pll-1: second possible phy clock parent (A64 only)
122+
- pll-1: second possible phy clock parent (A64/R40 only)
122123

123124
TV Encoder
124125
----------

drivers/dma-buf/udmabuf.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,10 @@ static struct sg_table *map_udmabuf(struct dma_buf_attachment *at,
6161
GFP_KERNEL);
6262
if (ret < 0)
6363
goto err;
64-
if (!dma_map_sg(at->dev, sg->sgl, sg->nents, direction))
64+
if (!dma_map_sg(at->dev, sg->sgl, sg->nents, direction)) {
65+
ret = -EINVAL;
6566
goto err;
67+
}
6668
return sg;
6769

6870
err:

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -816,17 +816,13 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
816816
if (ret)
817817
return ret;
818818

819-
/* warn the user if they mix atomic and non-atomic capable GPUs */
820-
if ((kms_driver.driver_features & DRIVER_ATOMIC) && !supports_atomic)
821-
DRM_ERROR("Mixing atomic and non-atomic capable GPUs!\n");
822-
/* support atomic early so the atomic debugfs stuff gets created */
823-
if (supports_atomic)
824-
kms_driver.driver_features |= DRIVER_ATOMIC;
825-
826819
dev = drm_dev_alloc(&kms_driver, &pdev->dev);
827820
if (IS_ERR(dev))
828821
return PTR_ERR(dev);
829822

823+
if (!supports_atomic)
824+
dev->driver_features &= ~DRIVER_ATOMIC;
825+
830826
ret = pci_enable_device(pdev);
831827
if (ret)
832828
goto err_free;
@@ -1078,7 +1074,7 @@ amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
10781074

10791075
static struct drm_driver kms_driver = {
10801076
.driver_features =
1081-
DRIVER_USE_AGP |
1077+
DRIVER_USE_AGP | DRIVER_ATOMIC |
10821078
DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM |
10831079
DRIVER_PRIME | DRIVER_RENDER | DRIVER_MODESET | DRIVER_SYNCOBJ,
10841080
.load = amdgpu_driver_load_kms,

drivers/gpu/drm/drm_atomic_uapi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
12511251

12521252
/* disallow for drivers not supporting atomic: */
12531253
if (!drm_core_check_feature(dev, DRIVER_ATOMIC))
1254-
return -EINVAL;
1254+
return -EOPNOTSUPP;
12551255

12561256
/* disallow for userspace that has not enabled atomic cap (even
12571257
* though this may be a bit overkill, since legacy userspace

drivers/gpu/drm/drm_bufs.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ int drm_legacy_addmap_ioctl(struct drm_device *dev, void *data,
398398

399399
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
400400
!drm_core_check_feature(dev, DRIVER_LEGACY))
401-
return -EINVAL;
401+
return -EOPNOTSUPP;
402402

403403
err = drm_addmap_core(dev, map->offset, map->size, map->type,
404404
map->flags, &maplist);
@@ -444,7 +444,7 @@ int drm_legacy_getmap_ioctl(struct drm_device *dev, void *data,
444444

445445
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
446446
!drm_core_check_feature(dev, DRIVER_LEGACY))
447-
return -EINVAL;
447+
return -EOPNOTSUPP;
448448

449449
idx = map->offset;
450450
if (idx < 0)
@@ -596,7 +596,7 @@ int drm_legacy_rmmap_ioctl(struct drm_device *dev, void *data,
596596

597597
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
598598
!drm_core_check_feature(dev, DRIVER_LEGACY))
599-
return -EINVAL;
599+
return -EOPNOTSUPP;
600600

601601
mutex_lock(&dev->struct_mutex);
602602
list_for_each_entry(r_list, &dev->maplist, head) {
@@ -860,7 +860,7 @@ int drm_legacy_addbufs_pci(struct drm_device *dev,
860860
struct drm_buf **temp_buflist;
861861

862862
if (!drm_core_check_feature(dev, DRIVER_PCI_DMA))
863-
return -EINVAL;
863+
return -EOPNOTSUPP;
864864

865865
if (!dma)
866866
return -EINVAL;
@@ -1064,7 +1064,7 @@ static int drm_legacy_addbufs_sg(struct drm_device *dev,
10641064
struct drm_buf **temp_buflist;
10651065

10661066
if (!drm_core_check_feature(dev, DRIVER_SG))
1067-
return -EINVAL;
1067+
return -EOPNOTSUPP;
10681068

10691069
if (!dma)
10701070
return -EINVAL;
@@ -1221,10 +1221,10 @@ int drm_legacy_addbufs(struct drm_device *dev, void *data,
12211221
int ret;
12221222

12231223
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
1224-
return -EINVAL;
1224+
return -EOPNOTSUPP;
12251225

12261226
if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
1227-
return -EINVAL;
1227+
return -EOPNOTSUPP;
12281228

12291229
#if IS_ENABLED(CONFIG_AGP)
12301230
if (request->flags & _DRM_AGP_BUFFER)
@@ -1267,10 +1267,10 @@ int __drm_legacy_infobufs(struct drm_device *dev,
12671267
int count;
12681268

12691269
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
1270-
return -EINVAL;
1270+
return -EOPNOTSUPP;
12711271

12721272
if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
1273-
return -EINVAL;
1273+
return -EOPNOTSUPP;
12741274

12751275
if (!dma)
12761276
return -EINVAL;
@@ -1352,10 +1352,10 @@ int drm_legacy_markbufs(struct drm_device *dev, void *data,
13521352
struct drm_buf_entry *entry;
13531353

13541354
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
1355-
return -EINVAL;
1355+
return -EOPNOTSUPP;
13561356

13571357
if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
1358-
return -EINVAL;
1358+
return -EOPNOTSUPP;
13591359

13601360
if (!dma)
13611361
return -EINVAL;
@@ -1400,10 +1400,10 @@ int drm_legacy_freebufs(struct drm_device *dev, void *data,
14001400
struct drm_buf *buf;
14011401

14021402
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
1403-
return -EINVAL;
1403+
return -EOPNOTSUPP;
14041404

14051405
if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
1406-
return -EINVAL;
1406+
return -EOPNOTSUPP;
14071407

14081408
if (!dma)
14091409
return -EINVAL;
@@ -1455,10 +1455,10 @@ int __drm_legacy_mapbufs(struct drm_device *dev, void *data, int *p,
14551455
int i;
14561456

14571457
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
1458-
return -EINVAL;
1458+
return -EOPNOTSUPP;
14591459

14601460
if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
1461-
return -EINVAL;
1461+
return -EOPNOTSUPP;
14621462

14631463
if (!dma)
14641464
return -EINVAL;
@@ -1545,7 +1545,7 @@ int drm_legacy_dma_ioctl(struct drm_device *dev, void *data,
15451545
struct drm_file *file_priv)
15461546
{
15471547
if (!drm_core_check_feature(dev, DRIVER_LEGACY))
1548-
return -EINVAL;
1548+
return -EOPNOTSUPP;
15491549

15501550
if (dev->driver->dma_ioctl)
15511551
return dev->driver->dma_ioctl(dev, data, file_priv);

drivers/gpu/drm/drm_client.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ int drm_client_new(struct drm_device *dev, struct drm_client_dev *client,
8282

8383
if (!drm_core_check_feature(dev, DRIVER_MODESET) ||
8484
!dev->driver->dumb_create || !dev->driver->gem_prime_vmap)
85-
return -ENOTSUPP;
85+
return -EOPNOTSUPP;
8686

8787
if (funcs && !try_module_get(funcs->owner))
8888
return -ENODEV;

drivers/gpu/drm/drm_color_mgmt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev,
242242
int ret = 0;
243243

244244
if (!drm_core_check_feature(dev, DRIVER_MODESET))
245-
return -EINVAL;
245+
return -EOPNOTSUPP;
246246

247247
crtc = drm_crtc_find(dev, file_priv, crtc_lut->crtc_id);
248248
if (!crtc)
@@ -320,7 +320,7 @@ int drm_mode_gamma_get_ioctl(struct drm_device *dev,
320320
int ret = 0;
321321

322322
if (!drm_core_check_feature(dev, DRIVER_MODESET))
323-
return -EINVAL;
323+
return -EOPNOTSUPP;
324324

325325
crtc = drm_crtc_find(dev, file_priv, crtc_lut->crtc_id);
326326
if (!crtc)

drivers/gpu/drm/drm_connector.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1725,7 +1725,7 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
17251725
LIST_HEAD(export_list);
17261726

17271727
if (!drm_core_check_feature(dev, DRIVER_MODESET))
1728-
return -EINVAL;
1728+
return -EOPNOTSUPP;
17291729

17301730
memset(&u_mode, 0, sizeof(struct drm_mode_modeinfo));
17311731

drivers/gpu/drm/drm_context.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ int drm_legacy_getsareactx(struct drm_device *dev, void *data,
178178

179179
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
180180
!drm_core_check_feature(dev, DRIVER_LEGACY))
181-
return -EINVAL;
181+
return -EOPNOTSUPP;
182182

183183
mutex_lock(&dev->struct_mutex);
184184

@@ -226,7 +226,7 @@ int drm_legacy_setsareactx(struct drm_device *dev, void *data,
226226

227227
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
228228
!drm_core_check_feature(dev, DRIVER_LEGACY))
229-
return -EINVAL;
229+
return -EOPNOTSUPP;
230230

231231
mutex_lock(&dev->struct_mutex);
232232
list_for_each_entry(r_list, &dev->maplist, head) {
@@ -330,7 +330,7 @@ int drm_legacy_resctx(struct drm_device *dev, void *data,
330330

331331
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
332332
!drm_core_check_feature(dev, DRIVER_LEGACY))
333-
return -EINVAL;
333+
return -EOPNOTSUPP;
334334

335335
if (res->count >= DRM_RESERVED_CONTEXTS) {
336336
memset(&ctx, 0, sizeof(ctx));
@@ -364,7 +364,7 @@ int drm_legacy_addctx(struct drm_device *dev, void *data,
364364

365365
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
366366
!drm_core_check_feature(dev, DRIVER_LEGACY))
367-
return -EINVAL;
367+
return -EOPNOTSUPP;
368368

369369
ctx->handle = drm_legacy_ctxbitmap_next(dev);
370370
if (ctx->handle == DRM_KERNEL_CONTEXT) {
@@ -411,7 +411,7 @@ int drm_legacy_getctx(struct drm_device *dev, void *data,
411411

412412
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
413413
!drm_core_check_feature(dev, DRIVER_LEGACY))
414-
return -EINVAL;
414+
return -EOPNOTSUPP;
415415

416416
/* This is 0, because we don't handle any context flags */
417417
ctx->flags = 0;
@@ -437,7 +437,7 @@ int drm_legacy_switchctx(struct drm_device *dev, void *data,
437437

438438
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
439439
!drm_core_check_feature(dev, DRIVER_LEGACY))
440-
return -EINVAL;
440+
return -EOPNOTSUPP;
441441

442442
DRM_DEBUG("%d\n", ctx->handle);
443443
return drm_context_switch(dev, dev->last_context, ctx->handle);
@@ -461,7 +461,7 @@ int drm_legacy_newctx(struct drm_device *dev, void *data,
461461

462462
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
463463
!drm_core_check_feature(dev, DRIVER_LEGACY))
464-
return -EINVAL;
464+
return -EOPNOTSUPP;
465465

466466
DRM_DEBUG("%d\n", ctx->handle);
467467
drm_context_switch_complete(dev, file_priv, ctx->handle);
@@ -487,7 +487,7 @@ int drm_legacy_rmctx(struct drm_device *dev, void *data,
487487

488488
if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
489489
!drm_core_check_feature(dev, DRIVER_LEGACY))
490-
return -EINVAL;
490+
return -EOPNOTSUPP;
491491

492492
DRM_DEBUG("%d\n", ctx->handle);
493493
if (ctx->handle != DRM_KERNEL_CONTEXT) {

drivers/gpu/drm/drm_crtc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ int drm_mode_getcrtc(struct drm_device *dev,
405405
struct drm_plane *plane;
406406

407407
if (!drm_core_check_feature(dev, DRIVER_MODESET))
408-
return -EINVAL;
408+
return -EOPNOTSUPP;
409409

410410
crtc = drm_crtc_find(dev, file_priv, crtc_resp->crtc_id);
411411
if (!crtc)
@@ -580,7 +580,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
580580
int i;
581581

582582
if (!drm_core_check_feature(dev, DRIVER_MODESET))
583-
return -EINVAL;
583+
return -EOPNOTSUPP;
584584

585585
/*
586586
* Universal plane src offsets are only 16.16, prevent havoc for

drivers/gpu/drm/drm_dp_helper.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1257,15 +1257,22 @@ EXPORT_SYMBOL(drm_dp_stop_crc);
12571257

12581258
struct dpcd_quirk {
12591259
u8 oui[3];
1260+
u8 device_id[6];
12601261
bool is_branch;
12611262
u32 quirks;
12621263
};
12631264

12641265
#define OUI(first, second, third) { (first), (second), (third) }
1266+
#define DEVICE_ID(first, second, third, fourth, fifth, sixth) \
1267+
{ (first), (second), (third), (fourth), (fifth), (sixth) }
1268+
1269+
#define DEVICE_ID_ANY DEVICE_ID(0, 0, 0, 0, 0, 0)
12651270

12661271
static const struct dpcd_quirk dpcd_quirk_list[] = {
12671272
/* Analogix 7737 needs reduced M and N at HBR2 link rates */
1268-
{ OUI(0x00, 0x22, 0xb9), true, BIT(DP_DPCD_QUIRK_LIMITED_M_N) },
1273+
{ OUI(0x00, 0x22, 0xb9), DEVICE_ID_ANY, true, BIT(DP_DPCD_QUIRK_CONSTANT_N) },
1274+
/* LG LP140WF6-SPM1 eDP panel */
1275+
{ OUI(0x00, 0x22, 0xb9), DEVICE_ID('s', 'i', 'v', 'a', 'r', 'T'), false, BIT(DP_DPCD_QUIRK_CONSTANT_N) },
12691276
};
12701277

12711278
#undef OUI
@@ -1284,6 +1291,7 @@ drm_dp_get_quirks(const struct drm_dp_dpcd_ident *ident, bool is_branch)
12841291
const struct dpcd_quirk *quirk;
12851292
u32 quirks = 0;
12861293
int i;
1294+
u8 any_device[] = DEVICE_ID_ANY;
12871295

12881296
for (i = 0; i < ARRAY_SIZE(dpcd_quirk_list); i++) {
12891297
quirk = &dpcd_quirk_list[i];
@@ -1294,12 +1302,19 @@ drm_dp_get_quirks(const struct drm_dp_dpcd_ident *ident, bool is_branch)
12941302
if (memcmp(quirk->oui, ident->oui, sizeof(ident->oui)) != 0)
12951303
continue;
12961304

1305+
if (memcmp(quirk->device_id, any_device, sizeof(any_device)) != 0 &&
1306+
memcmp(quirk->device_id, ident->device_id, sizeof(ident->device_id)) != 0)
1307+
continue;
1308+
12971309
quirks |= quirk->quirks;
12981310
}
12991311

13001312
return quirks;
13011313
}
13021314

1315+
#undef DEVICE_ID_ANY
1316+
#undef DEVICE_ID
1317+
13031318
/**
13041319
* drm_dp_read_desc - read sink/branch descriptor from DPCD
13051320
* @aux: DisplayPort AUX channel

drivers/gpu/drm/drm_drv.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,9 @@ int drm_dev_init(struct drm_device *dev,
506506
dev->dev = parent;
507507
dev->driver = driver;
508508

509+
/* no per-device feature limits by default */
510+
dev->driver_features = ~0u;
511+
509512
INIT_LIST_HEAD(&dev->filelist);
510513
INIT_LIST_HEAD(&dev->filelist_internal);
511514
INIT_LIST_HEAD(&dev->clientlist);

drivers/gpu/drm/drm_encoder.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ int drm_mode_getencoder(struct drm_device *dev, void *data,
222222
struct drm_crtc *crtc;
223223

224224
if (!drm_core_check_feature(dev, DRIVER_MODESET))
225-
return -EINVAL;
225+
return -EOPNOTSUPP;
226226

227227
encoder = drm_encoder_find(dev, file_priv, enc_resp->encoder_id);
228228
if (!encoder)

0 commit comments

Comments
 (0)