Skip to content

Commit ae25ec2

Browse files
committed
Merge tag 'drm-misc-next-2021-05-17' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
drm-misc-next for 5.14: UAPI Changes: Cross-subsystem Changes: Core Changes: * aperture: Fix unlocking on errors * legacy: Fix some doc comments Driver Changes: * drm/amdgpu: Free resource on fence usage query; Fix fence calculation; * drm/bridge: Lt9611: Add missing MODULE_DEVICE_TABLE * drm/i915: Print formats with %p4cc * drm/ingenic: IPU planes are now always of type OVERLAY * drm/nouveau: Remove left-over reference to struct drm_device.pdev * drm/panfrost: Disable devfreq if num_supplies > 1; Add Mediatek MT8183 + DT bindings; Cleanups * drm/simpledrm: Print resources with %pr; Fix use-after-free errors; Fix NULL deref; Fix MAINTAINERS entry * drm/vmwgfx: Fix memory allocation and leak in FIFO allocation; Fix return value in PCI resource setup Signed-off-by: Dave Airlie <[email protected]> From: Thomas Zimmermann <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 41ab70e + 3003940 commit ae25ec2

File tree

17 files changed

+108
-32
lines changed

17 files changed

+108
-32
lines changed

Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ properties:
1717
items:
1818
- enum:
1919
- amlogic,meson-g12a-mali
20+
- mediatek,mt8183-mali
2021
- realtek,rtd1619-mali
2122
- rockchip,px30-mali
2223
- const: arm,mali-bifrost # Mali Bifrost GPU model/revision is fully discoverable
@@ -41,10 +42,13 @@ properties:
4142

4243
mali-supply: true
4344

45+
sram-supply: true
46+
4447
operating-points-v2: true
4548

4649
power-domains:
47-
maxItems: 1
50+
minItems: 1
51+
maxItems: 3
4852

4953
resets:
5054
maxItems: 2
@@ -89,6 +93,30 @@ allOf:
8993
then:
9094
required:
9195
- resets
96+
- if:
97+
properties:
98+
compatible:
99+
contains:
100+
const: mediatek,mt8183-mali
101+
then:
102+
properties:
103+
power-domains:
104+
minItems: 3
105+
power-domain-names:
106+
items:
107+
- const: core0
108+
- const: core1
109+
- const: core2
110+
111+
required:
112+
- sram-supply
113+
- power-domains
114+
- power-domain-names
115+
else:
116+
properties:
117+
power-domains:
118+
maxItems: 1
119+
sram-supply: false
92120

93121
examples:
94122
- |

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5875,7 +5875,7 @@ M: Thomas Zimmermann <[email protected]>
58755875
58765876
S: Maintained
58775877
T: git git://anongit.freedesktop.org/drm/drm-misc
5878-
F: drivers/gpu/drm/tiny/simplekms.c
5878+
F: drivers/gpu/drm/tiny/simpledrm.c
58795879

58805880
DRM DRIVER FOR SIS VIDEO CARDS
58815881
S: Orphan / Obsolete

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

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -652,12 +652,14 @@ void amdgpu_ctx_mgr_fini(struct amdgpu_ctx_mgr *mgr)
652652
mutex_destroy(&mgr->lock);
653653
}
654654

655-
void amdgpu_ctx_fence_time(struct amdgpu_ctx *ctx, struct amdgpu_ctx_entity *centity,
656-
ktime_t *total, ktime_t *max)
655+
static void amdgpu_ctx_fence_time(struct amdgpu_ctx *ctx,
656+
struct amdgpu_ctx_entity *centity, ktime_t *total, ktime_t *max)
657657
{
658658
ktime_t now, t1;
659659
uint32_t i;
660660

661+
*total = *max = 0;
662+
661663
now = ktime_get();
662664
for (i = 0; i < amdgpu_sched_jobs; i++) {
663665
struct dma_fence *fence;
@@ -669,11 +671,15 @@ void amdgpu_ctx_fence_time(struct amdgpu_ctx *ctx, struct amdgpu_ctx_entity *cen
669671
if (!fence)
670672
continue;
671673
s_fence = to_drm_sched_fence(fence);
672-
if (!dma_fence_is_signaled(&s_fence->scheduled))
674+
if (!dma_fence_is_signaled(&s_fence->scheduled)) {
675+
dma_fence_put(fence);
673676
continue;
677+
}
674678
t1 = s_fence->scheduled.timestamp;
675-
if (t1 >= now)
679+
if (!ktime_before(t1, now)) {
680+
dma_fence_put(fence);
676681
continue;
682+
}
677683
if (dma_fence_is_signaled(&s_fence->finished) &&
678684
s_fence->finished.timestamp < now)
679685
*total += ktime_sub(s_fence->finished.timestamp, t1);
@@ -699,11 +705,22 @@ ktime_t amdgpu_ctx_mgr_fence_usage(struct amdgpu_ctx_mgr *mgr, uint32_t hwip,
699705
idp = &mgr->ctx_handles;
700706
mutex_lock(&mgr->lock);
701707
idr_for_each_entry(idp, ctx, id) {
708+
ktime_t ttotal, tmax;
709+
702710
if (!ctx->entities[hwip][idx])
703711
continue;
704712

705713
centity = ctx->entities[hwip][idx];
706-
amdgpu_ctx_fence_time(ctx, centity, &total, &max);
714+
amdgpu_ctx_fence_time(ctx, centity, &ttotal, &tmax);
715+
716+
/* Harmonic mean approximation diverges for very small
717+
* values. If ratio < 0.01% ignore
718+
*/
719+
if (AMDGPU_CTX_FENCE_USAGE_MIN_RATIO(tmax, ttotal))
720+
continue;
721+
722+
total = ktime_add(total, ttotal);
723+
max = ktime_after(tmax, max) ? tmax : max;
707724
}
708725

709726
mutex_unlock(&mgr->lock);

drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ struct drm_file;
3030
struct amdgpu_fpriv;
3131

3232
#define AMDGPU_MAX_ENTITY_NUM 4
33+
#define AMDGPU_CTX_FENCE_USAGE_MIN_RATIO(max, total) ((max) > 16384ULL*(total))
3334

3435
struct amdgpu_ctx_entity {
3536
uint64_t sequence;
@@ -89,6 +90,4 @@ long amdgpu_ctx_mgr_entity_flush(struct amdgpu_ctx_mgr *mgr, long timeout);
8990
void amdgpu_ctx_mgr_fini(struct amdgpu_ctx_mgr *mgr);
9091
ktime_t amdgpu_ctx_mgr_fence_usage(struct amdgpu_ctx_mgr *mgr, uint32_t hwip,
9192
uint32_t idx, uint64_t *elapsed);
92-
void amdgpu_ctx_fence_time(struct amdgpu_ctx *ctx, struct amdgpu_ctx_entity *centity,
93-
ktime_t *total, ktime_t *max);
9493
#endif

drivers/gpu/drm/bridge/lontium-lt9611.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,7 @@ static struct i2c_device_id lt9611_id[] = {
12151215
{ "lontium,lt9611", 0 },
12161216
{}
12171217
};
1218+
MODULE_DEVICE_TABLE(i2c, lt9611_id);
12181219

12191220
static const struct of_device_id lt9611_match_table[] = {
12201221
{ .compatible = "lontium,lt9611" },

drivers/gpu/drm/drm_aperture.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,17 @@ static int devm_aperture_acquire(struct drm_device *dev,
164164

165165
list_for_each(pos, &drm_apertures) {
166166
ap = container_of(pos, struct drm_aperture, lh);
167-
if (overlap(base, end, ap->base, ap->base + ap->size))
167+
if (overlap(base, end, ap->base, ap->base + ap->size)) {
168+
mutex_unlock(&drm_apertures_lock);
168169
return -EBUSY;
170+
}
169171
}
170172

171173
ap = devm_kzalloc(dev->dev, sizeof(*ap), GFP_KERNEL);
172-
if (!ap)
174+
if (!ap) {
175+
mutex_unlock(&drm_apertures_lock);
173176
return -ENOMEM;
177+
}
174178

175179
ap->dev = dev;
176180
ap->base = base;

drivers/gpu/drm/drm_context.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ void drm_legacy_ctxbitmap_cleanup(struct drm_device * dev)
124124
}
125125

126126
/**
127-
* drm_ctxbitmap_flush() - Flush all contexts owned by a file
127+
* drm_legacy_ctxbitmap_flush() - Flush all contexts owned by a file
128128
* @dev: DRM device to operate on
129129
* @file: Open file to flush contexts for
130130
*

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,6 @@ static int skl_plane_check_fb(const struct intel_crtc_state *crtc_state,
10821082
struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
10831083
const struct drm_framebuffer *fb = plane_state->hw.fb;
10841084
unsigned int rotation = plane_state->hw.rotation;
1085-
struct drm_format_name_buf format_name;
10861085

10871086
if (!fb)
10881087
return 0;
@@ -1130,9 +1129,8 @@ static int skl_plane_check_fb(const struct intel_crtc_state *crtc_state,
11301129
case DRM_FORMAT_XVYU12_16161616:
11311130
case DRM_FORMAT_XVYU16161616:
11321131
drm_dbg_kms(&dev_priv->drm,
1133-
"Unsupported pixel format %s for 90/270!\n",
1134-
drm_get_format_name(fb->format->format,
1135-
&format_name));
1132+
"Unsupported pixel format %p4cc for 90/270!\n",
1133+
&fb->format->format);
11361134
return -EINVAL;
11371135
default:
11381136
break;

drivers/gpu/drm/ingenic/ingenic-drm-drv.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ static void ingenic_drm_plane_enable(struct ingenic_drm *priv,
419419
unsigned int en_bit;
420420

421421
if (priv->soc_info->has_osd) {
422-
if (plane->type == DRM_PLANE_TYPE_PRIMARY)
422+
if (plane != &priv->f0)
423423
en_bit = JZ_LCD_OSDC_F1EN;
424424
else
425425
en_bit = JZ_LCD_OSDC_F0EN;
@@ -434,7 +434,7 @@ void ingenic_drm_plane_disable(struct device *dev, struct drm_plane *plane)
434434
unsigned int en_bit;
435435

436436
if (priv->soc_info->has_osd) {
437-
if (plane->type == DRM_PLANE_TYPE_PRIMARY)
437+
if (plane != &priv->f0)
438438
en_bit = JZ_LCD_OSDC_F1EN;
439439
else
440440
en_bit = JZ_LCD_OSDC_F0EN;
@@ -461,8 +461,7 @@ void ingenic_drm_plane_config(struct device *dev,
461461

462462
ingenic_drm_plane_enable(priv, plane);
463463

464-
if (priv->soc_info->has_osd &&
465-
plane->type == DRM_PLANE_TYPE_PRIMARY) {
464+
if (priv->soc_info->has_osd && plane != &priv->f0) {
466465
switch (fourcc) {
467466
case DRM_FORMAT_XRGB1555:
468467
ctrl |= JZ_LCD_OSDCTRL_RGB555;
@@ -510,7 +509,7 @@ void ingenic_drm_plane_config(struct device *dev,
510509
}
511510

512511
if (priv->soc_info->has_osd) {
513-
if (plane->type == DRM_PLANE_TYPE_PRIMARY) {
512+
if (plane != &priv->f0) {
514513
xy_reg = JZ_REG_LCD_XYP1;
515514
size_reg = JZ_REG_LCD_SIZE1;
516515
} else {
@@ -561,7 +560,7 @@ static void ingenic_drm_plane_atomic_update(struct drm_plane *plane,
561560
height = newstate->src_h >> 16;
562561
cpp = newstate->fb->format->cpp[0];
563562

564-
if (!priv->soc_info->has_osd || plane->type == DRM_PLANE_TYPE_OVERLAY)
563+
if (!priv->soc_info->has_osd || plane == &priv->f0)
565564
hwdesc = &priv->dma_hwdescs->hwdesc_f0;
566565
else
567566
hwdesc = &priv->dma_hwdescs->hwdesc_f1;

drivers/gpu/drm/ingenic/ingenic-ipu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ static int ingenic_ipu_bind(struct device *dev, struct device *master, void *d)
767767

768768
err = drm_universal_plane_init(drm, plane, 1, &ingenic_ipu_plane_funcs,
769769
soc_info->formats, soc_info->num_formats,
770-
NULL, DRM_PLANE_TYPE_PRIMARY, NULL);
770+
NULL, DRM_PLANE_TYPE_OVERLAY, NULL);
771771
if (err) {
772772
dev_err(dev, "Failed to init plane: %i\n", err);
773773
return err;

0 commit comments

Comments
 (0)