Skip to content

Commit b28a130

Browse files
committed
Merge tag 'drm-misc-fixes-2021-10-06' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes
Rebased drm-misc-fixes for v5.15-rc5: - Dropped vc4 patches. - Compiler fix for vc4. - Cursor fix for nouveau. - Fix ttm buffer moves for ampere gpu's by adding minimal acceleration support. - Small rockchip fixes. - Fix DT bindings indent for ili9341. - Fix y030xx067a init sequence to not get a yellow tint. - Kconfig fix for fb_simple vs simpledrm. - Assorted nouvaeu memory leaks. - Fix gbefb when built with COMPILE_TEST. Signed-off-by: Dave Airlie <[email protected]> From: Maarten Lankhorst <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 7d80cc7 + f5a8703 commit b28a130

File tree

30 files changed

+504
-109
lines changed

30 files changed

+504
-109
lines changed

Documentation/devicetree/bindings/display/panel/ilitek,ili9341.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ properties:
2222
items:
2323
- enum:
2424
# ili9341 240*320 Color on stm32f429-disco board
25-
- st,sf-tc240t-9370-t
25+
- st,sf-tc240t-9370-t
2626
- const: ilitek,ili9341
2727

2828
reg: true

Documentation/gpu/drm-internals.rst

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,6 @@ Component Helper Usage
111111
.. kernel-doc:: drivers/gpu/drm/drm_drv.c
112112
:doc: component helper usage recommendations
113113

114-
IRQ Helper Library
115-
~~~~~~~~~~~~~~~~~~
116-
117-
.. kernel-doc:: drivers/gpu/drm/drm_irq.c
118-
:doc: irq helpers
119-
120-
.. kernel-doc:: drivers/gpu/drm/drm_irq.c
121-
:export:
122-
123114
Memory Manager Initialization
124115
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
125116

drivers/gpu/drm/kmb/kmb_drv.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,10 @@ static int kmb_setup_mode_config(struct drm_device *drm)
172172
ret = drmm_mode_config_init(drm);
173173
if (ret)
174174
return ret;
175-
drm->mode_config.min_width = KMB_MIN_WIDTH;
176-
drm->mode_config.min_height = KMB_MIN_HEIGHT;
177-
drm->mode_config.max_width = KMB_MAX_WIDTH;
178-
drm->mode_config.max_height = KMB_MAX_HEIGHT;
175+
drm->mode_config.min_width = KMB_FB_MIN_WIDTH;
176+
drm->mode_config.min_height = KMB_FB_MIN_HEIGHT;
177+
drm->mode_config.max_width = KMB_FB_MAX_WIDTH;
178+
drm->mode_config.max_height = KMB_FB_MAX_HEIGHT;
179179
drm->mode_config.funcs = &kmb_mode_config_funcs;
180180

181181
ret = kmb_setup_crtc(drm);

drivers/gpu/drm/kmb/kmb_drv.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
#define DRIVER_MAJOR 1
2121
#define DRIVER_MINOR 1
2222

23+
#define KMB_FB_MAX_WIDTH 1920
24+
#define KMB_FB_MAX_HEIGHT 1080
25+
#define KMB_FB_MIN_WIDTH 1
26+
#define KMB_FB_MIN_HEIGHT 1
27+
2328
#define KMB_LCD_DEFAULT_CLK 200000000
2429
#define KMB_SYS_CLK_MHZ 500
2530

drivers/gpu/drm/kmb/kmb_plane.c

Lines changed: 72 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,10 @@ static int kmb_plane_atomic_check(struct drm_plane *plane,
9494
if (ret)
9595
return ret;
9696

97-
if (new_plane_state->crtc_w > KMB_MAX_WIDTH || new_plane_state->crtc_h > KMB_MAX_HEIGHT)
98-
return -EINVAL;
99-
if (new_plane_state->crtc_w < KMB_MIN_WIDTH || new_plane_state->crtc_h < KMB_MIN_HEIGHT)
97+
if (new_plane_state->crtc_w > KMB_FB_MAX_WIDTH ||
98+
new_plane_state->crtc_h > KMB_FB_MAX_HEIGHT ||
99+
new_plane_state->crtc_w < KMB_FB_MIN_WIDTH ||
100+
new_plane_state->crtc_h < KMB_FB_MIN_HEIGHT)
100101
return -EINVAL;
101102
can_position = (plane->type == DRM_PLANE_TYPE_OVERLAY);
102103
crtc_state =
@@ -277,6 +278,44 @@ static void config_csc(struct kmb_drm_private *kmb, int plane_id)
277278
kmb_write_lcd(kmb, LCD_LAYERn_CSC_OFF3(plane_id), csc_coef_lcd[11]);
278279
}
279280

281+
static void kmb_plane_set_alpha(struct kmb_drm_private *kmb,
282+
const struct drm_plane_state *state,
283+
unsigned char plane_id,
284+
unsigned int *val)
285+
{
286+
u16 plane_alpha = state->alpha;
287+
u16 pixel_blend_mode = state->pixel_blend_mode;
288+
int has_alpha = state->fb->format->has_alpha;
289+
290+
if (plane_alpha != DRM_BLEND_ALPHA_OPAQUE)
291+
*val |= LCD_LAYER_ALPHA_STATIC;
292+
293+
if (has_alpha) {
294+
switch (pixel_blend_mode) {
295+
case DRM_MODE_BLEND_PIXEL_NONE:
296+
break;
297+
case DRM_MODE_BLEND_PREMULTI:
298+
*val |= LCD_LAYER_ALPHA_EMBED | LCD_LAYER_ALPHA_PREMULT;
299+
break;
300+
case DRM_MODE_BLEND_COVERAGE:
301+
*val |= LCD_LAYER_ALPHA_EMBED;
302+
break;
303+
default:
304+
DRM_DEBUG("Missing pixel blend mode case (%s == %ld)\n",
305+
__stringify(pixel_blend_mode),
306+
(long)pixel_blend_mode);
307+
break;
308+
}
309+
}
310+
311+
if (plane_alpha == DRM_BLEND_ALPHA_OPAQUE && !has_alpha) {
312+
*val &= LCD_LAYER_ALPHA_DISABLED;
313+
return;
314+
}
315+
316+
kmb_write_lcd(kmb, LCD_LAYERn_ALPHA(plane_id), plane_alpha);
317+
}
318+
280319
static void kmb_plane_atomic_update(struct drm_plane *plane,
281320
struct drm_atomic_state *state)
282321
{
@@ -303,11 +342,12 @@ static void kmb_plane_atomic_update(struct drm_plane *plane,
303342
fb = new_plane_state->fb;
304343
if (!fb)
305344
return;
345+
306346
num_planes = fb->format->num_planes;
307347
kmb_plane = to_kmb_plane(plane);
308-
plane_id = kmb_plane->id;
309348

310349
kmb = to_kmb(plane->dev);
350+
plane_id = kmb_plane->id;
311351

312352
spin_lock_irq(&kmb->irq_lock);
313353
if (kmb->kmb_under_flow || kmb->kmb_flush_done) {
@@ -400,20 +440,32 @@ static void kmb_plane_atomic_update(struct drm_plane *plane,
400440
config_csc(kmb, plane_id);
401441
}
402442

443+
kmb_plane_set_alpha(kmb, plane->state, plane_id, &val);
444+
403445
kmb_write_lcd(kmb, LCD_LAYERn_CFG(plane_id), val);
404446

447+
/* Configure LCD_CONTROL */
448+
ctrl = kmb_read_lcd(kmb, LCD_CONTROL);
449+
450+
/* Set layer blending config */
451+
ctrl &= ~LCD_CTRL_ALPHA_ALL;
452+
ctrl |= LCD_CTRL_ALPHA_BOTTOM_VL1 |
453+
LCD_CTRL_ALPHA_BLEND_VL2;
454+
455+
ctrl &= ~LCD_CTRL_ALPHA_BLEND_BKGND_DISABLE;
456+
405457
switch (plane_id) {
406458
case LAYER_0:
407-
ctrl = LCD_CTRL_VL1_ENABLE;
459+
ctrl |= LCD_CTRL_VL1_ENABLE;
408460
break;
409461
case LAYER_1:
410-
ctrl = LCD_CTRL_VL2_ENABLE;
462+
ctrl |= LCD_CTRL_VL2_ENABLE;
411463
break;
412464
case LAYER_2:
413-
ctrl = LCD_CTRL_GL1_ENABLE;
465+
ctrl |= LCD_CTRL_GL1_ENABLE;
414466
break;
415467
case LAYER_3:
416-
ctrl = LCD_CTRL_GL2_ENABLE;
468+
ctrl |= LCD_CTRL_GL2_ENABLE;
417469
break;
418470
}
419471

@@ -425,7 +477,7 @@ static void kmb_plane_atomic_update(struct drm_plane *plane,
425477
*/
426478
ctrl |= LCD_CTRL_VHSYNC_IDLE_LVL;
427479

428-
kmb_set_bitmask_lcd(kmb, LCD_CONTROL, ctrl);
480+
kmb_write_lcd(kmb, LCD_CONTROL, ctrl);
429481

430482
/* Enable pipeline AXI read transactions for the DMA
431483
* after setting graphics layers. This must be done
@@ -490,6 +542,9 @@ struct kmb_plane *kmb_plane_init(struct drm_device *drm)
490542
enum drm_plane_type plane_type;
491543
const u32 *plane_formats;
492544
int num_plane_formats;
545+
unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) |
546+
BIT(DRM_MODE_BLEND_PREMULTI) |
547+
BIT(DRM_MODE_BLEND_COVERAGE);
493548

494549
for (i = 0; i < KMB_MAX_PLANES; i++) {
495550
plane = drmm_kzalloc(drm, sizeof(*plane), GFP_KERNEL);
@@ -521,8 +576,16 @@ struct kmb_plane *kmb_plane_init(struct drm_device *drm)
521576
drm_dbg(drm, "%s : %d i=%d type=%d",
522577
__func__, __LINE__,
523578
i, plane_type);
579+
drm_plane_create_alpha_property(&plane->base_plane);
580+
581+
drm_plane_create_blend_mode_property(&plane->base_plane,
582+
blend_caps);
583+
584+
drm_plane_create_zpos_immutable_property(&plane->base_plane, i);
585+
524586
drm_plane_helper_add(&plane->base_plane,
525587
&kmb_plane_helper_funcs);
588+
526589
if (plane_type == DRM_PLANE_TYPE_PRIMARY) {
527590
primary = plane;
528591
kmb->plane = plane;

drivers/gpu/drm/kmb/kmb_plane.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
#define POSSIBLE_CRTCS 1
3636
#define to_kmb_plane(x) container_of(x, struct kmb_plane, base_plane)
3737

38+
#define POSSIBLE_CRTCS 1
39+
#define KMB_MAX_PLANES 2
40+
3841
enum layer_id {
3942
LAYER_0,
4043
LAYER_1,
@@ -43,8 +46,6 @@ enum layer_id {
4346
/* KMB_MAX_PLANES */
4447
};
4548

46-
#define KMB_MAX_PLANES 1
47-
4849
enum sub_plane_id {
4950
Y_PLANE,
5051
U_PLANE,

drivers/gpu/drm/kmb/kmb_regs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@
4343
#define LCD_CTRL_OUTPUT_ENABLED BIT(19)
4444
#define LCD_CTRL_BPORCH_ENABLE BIT(21)
4545
#define LCD_CTRL_FPORCH_ENABLE BIT(22)
46+
#define LCD_CTRL_ALPHA_BLEND_BKGND_DISABLE BIT(23)
4647
#define LCD_CTRL_PIPELINE_DMA BIT(28)
4748
#define LCD_CTRL_VHSYNC_IDLE_LVL BIT(31)
49+
#define LCD_CTRL_ALPHA_ALL (0xff << 6)
4850

4951
/* interrupts */
5052
#define LCD_INT_STATUS (0x4 * 0x001)
@@ -115,6 +117,7 @@
115117
#define LCD_LAYER_ALPHA_EMBED BIT(5)
116118
#define LCD_LAYER_ALPHA_COMBI (LCD_LAYER_ALPHA_STATIC | \
117119
LCD_LAYER_ALPHA_EMBED)
120+
#define LCD_LAYER_ALPHA_DISABLED ~(LCD_LAYER_ALPHA_COMBI)
118121
/* RGB multiplied with alpha */
119122
#define LCD_LAYER_ALPHA_PREMULT BIT(6)
120123
#define LCD_LAYER_INVERT_COL BIT(7)

drivers/gpu/drm/nouveau/dispnv50/crc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,7 @@ static const struct file_operations nv50_crc_flip_threshold_fops = {
704704
.open = nv50_crc_debugfs_flip_threshold_open,
705705
.read = seq_read,
706706
.write = nv50_crc_debugfs_flip_threshold_set,
707+
.release = single_release,
707708
};
708709

709710
int nv50_head_crc_late_register(struct nv50_head *head)

drivers/gpu/drm/nouveau/dispnv50/head.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ nv50_head_flush_clr(struct nv50_head *head,
5252
void
5353
nv50_head_flush_set_wndw(struct nv50_head *head, struct nv50_head_atom *asyh)
5454
{
55+
if (asyh->set.curs ) head->func->curs_set(head, asyh);
5556
if (asyh->set.olut ) {
5657
asyh->olut.offset = nv50_lut_load(&head->olut,
5758
asyh->olut.buffer,
@@ -67,7 +68,6 @@ nv50_head_flush_set(struct nv50_head *head, struct nv50_head_atom *asyh)
6768
if (asyh->set.view ) head->func->view (head, asyh);
6869
if (asyh->set.mode ) head->func->mode (head, asyh);
6970
if (asyh->set.core ) head->func->core_set(head, asyh);
70-
if (asyh->set.curs ) head->func->curs_set(head, asyh);
7171
if (asyh->set.base ) head->func->base (head, asyh);
7272
if (asyh->set.ovly ) head->func->ovly (head, asyh);
7373
if (asyh->set.dither ) head->func->dither (head, asyh);

drivers/gpu/drm/nouveau/include/nvif/class.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
#define PASCAL_CHANNEL_GPFIFO_A /* cla06f.h */ 0x0000c06f
7272
#define VOLTA_CHANNEL_GPFIFO_A /* clc36f.h */ 0x0000c36f
7373
#define TURING_CHANNEL_GPFIFO_A /* clc36f.h */ 0x0000c46f
74+
#define AMPERE_CHANNEL_GPFIFO_B /* clc36f.h */ 0x0000c76f
7475

7576
#define NV50_DISP /* cl5070.h */ 0x00005070
7677
#define G82_DISP /* cl5070.h */ 0x00008270
@@ -200,6 +201,7 @@
200201
#define PASCAL_DMA_COPY_B 0x0000c1b5
201202
#define VOLTA_DMA_COPY_A 0x0000c3b5
202203
#define TURING_DMA_COPY_A 0x0000c5b5
204+
#define AMPERE_DMA_COPY_B 0x0000c7b5
203205

204206
#define FERMI_DECOMPRESS 0x000090b8
205207

0 commit comments

Comments
 (0)