Lines Matching +full:layer +full:- +full:primary
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright © 2018-2020 Intel Corporation
27 /* Conversion (yuv->rgb) matrix from myriadx */
30 1024, -352, -731,
32 -179, 125, -226
35 /* Graphics layer (layers 2 & 3) formats, only packed formats are supported */
48 /* Video layer ( 0 & 1) formats, packed and planar formats are supported */
72 int plane_id = kmb_plane->id; in check_pixel_format()
75 kmb = to_kmb(plane->dev); in check_pixel_format()
76 init_disp_cfg = kmb->init_disp_cfg[plane_id]; in check_pixel_format()
81 drm_dbg(&kmb->drm, "Cannot change format after initial plane configuration"); in check_pixel_format()
82 return -EINVAL; in check_pixel_format()
84 for (i = 0; i < plane->format_count; i++) { in check_pixel_format()
85 if (plane->format_types[i] == format) in check_pixel_format()
88 return -EINVAL; in check_pixel_format()
98 int plane_id = kmb_plane->id; in kmb_plane_atomic_check()
105 kmb = to_kmb(plane->dev); in kmb_plane_atomic_check()
106 init_disp_cfg = kmb->init_disp_cfg[plane_id]; in kmb_plane_atomic_check()
107 fb = new_plane_state->fb; in kmb_plane_atomic_check()
108 if (!fb || !new_plane_state->crtc) in kmb_plane_atomic_check()
111 ret = check_pixel_format(plane, fb->format->format); in kmb_plane_atomic_check()
115 if (new_plane_state->crtc_w > KMB_FB_MAX_WIDTH || in kmb_plane_atomic_check()
116 new_plane_state->crtc_h > KMB_FB_MAX_HEIGHT || in kmb_plane_atomic_check()
117 new_plane_state->crtc_w < KMB_FB_MIN_WIDTH || in kmb_plane_atomic_check()
118 new_plane_state->crtc_h < KMB_FB_MIN_HEIGHT) in kmb_plane_atomic_check()
119 return -EINVAL; in kmb_plane_atomic_check()
125 (init_disp_cfg.width != fb->width || in kmb_plane_atomic_check()
126 init_disp_cfg.height != fb->height)) { in kmb_plane_atomic_check()
127 drm_dbg(&kmb->drm, "Cannot change plane height or width after initial configuration"); in kmb_plane_atomic_check()
128 return -EINVAL; in kmb_plane_atomic_check()
130 can_position = (plane->type == DRM_PLANE_TYPE_OVERLAY); in kmb_plane_atomic_check()
133 new_plane_state->crtc); in kmb_plane_atomic_check()
145 int plane_id = kmb_plane->id; in kmb_plane_atomic_disable()
148 kmb = to_kmb(plane->dev); in kmb_plane_atomic_disable()
155 kmb->plane_status[plane_id].ctrl = LCD_CTRL_VL1_ENABLE; in kmb_plane_atomic_disable()
158 kmb->plane_status[plane_id].ctrl = LCD_CTRL_VL2_ENABLE; in kmb_plane_atomic_disable()
162 kmb->plane_status[plane_id].disable = true; in kmb_plane_atomic_disable()
260 if (format->num_planes > 1) { in get_bits_per_pixel()
265 bpp += 8 * format->cpp[0]; in get_bits_per_pixel()
308 u16 plane_alpha = state->alpha; in kmb_plane_set_alpha()
309 u16 pixel_blend_mode = state->pixel_blend_mode; in kmb_plane_set_alpha()
310 int has_alpha = state->fb->format->has_alpha; in kmb_plane_set_alpha()
365 fb = new_plane_state->fb; in kmb_plane_atomic_update()
369 num_planes = fb->format->num_planes; in kmb_plane_atomic_update()
372 kmb = to_kmb(plane->dev); in kmb_plane_atomic_update()
373 plane_id = kmb_plane->id; in kmb_plane_atomic_update()
375 spin_lock_irq(&kmb->irq_lock); in kmb_plane_atomic_update()
376 if (kmb->kmb_under_flow || kmb->kmb_flush_done) { in kmb_plane_atomic_update()
377 spin_unlock_irq(&kmb->irq_lock); in kmb_plane_atomic_update()
378 drm_dbg(&kmb->drm, "plane_update:underflow!!!! returning"); in kmb_plane_atomic_update()
381 spin_unlock_irq(&kmb->irq_lock); in kmb_plane_atomic_update()
383 init_disp_cfg = &kmb->init_disp_cfg[plane_id]; in kmb_plane_atomic_update()
384 src_w = new_plane_state->src_w >> 16; in kmb_plane_atomic_update()
385 src_h = new_plane_state->src_h >> 16; in kmb_plane_atomic_update()
386 crtc_x = new_plane_state->crtc_x; in kmb_plane_atomic_update()
387 crtc_y = new_plane_state->crtc_y; in kmb_plane_atomic_update()
389 drm_dbg(&kmb->drm, in kmb_plane_atomic_update()
390 "src_w=%d src_h=%d, fb->format->format=0x%x fb->flags=0x%x\n", in kmb_plane_atomic_update()
391 src_w, src_h, fb->format->format, fb->flags); in kmb_plane_atomic_update()
393 width = fb->width; in kmb_plane_atomic_update()
394 height = fb->height; in kmb_plane_atomic_update()
395 dma_len = (width * height * fb->format->cpp[0]); in kmb_plane_atomic_update()
396 drm_dbg(&kmb->drm, "dma_len=%d ", dma_len); in kmb_plane_atomic_update()
400 fb->pitches[0]); in kmb_plane_atomic_update()
402 (width * fb->format->cpp[0])); in kmb_plane_atomic_update()
406 addr[Y_PLANE] + fb->offsets[0]); in kmb_plane_atomic_update()
407 val = get_pixel_format(fb->format->format); in kmb_plane_atomic_update()
408 val |= get_bits_per_pixel(fb->format); in kmb_plane_atomic_update()
412 width * fb->format->cpp[0]); in kmb_plane_atomic_update()
414 (width * fb->format->cpp[0])); in kmb_plane_atomic_update()
431 ((width) * fb->format->cpp[0])); in kmb_plane_atomic_update()
435 ((width) * fb->format->cpp[0])); in kmb_plane_atomic_update()
453 kmb_write_lcd(kmb, LCD_LAYERn_WIDTH(plane_id), src_w - 1); in kmb_plane_atomic_update()
454 kmb_write_lcd(kmb, LCD_LAYERn_HEIGHT(plane_id), src_h - 1); in kmb_plane_atomic_update()
467 kmb_plane_set_alpha(kmb, plane->state, plane_id, &val); in kmb_plane_atomic_update()
474 /* Set layer blending config */ in kmb_plane_atomic_update()
529 if (!init_disp_cfg->width || in kmb_plane_atomic_update()
530 !init_disp_cfg->height || in kmb_plane_atomic_update()
531 !init_disp_cfg->format) { in kmb_plane_atomic_update()
532 init_disp_cfg->width = width; in kmb_plane_atomic_update()
533 init_disp_cfg->height = height; in kmb_plane_atomic_update()
534 init_disp_cfg->format = fb->format->format; in kmb_plane_atomic_update()
537 drm_dbg(&kmb->drm, "dma_cfg=0x%x LCD_DMA_CFG=0x%x\n", dma_cfg, in kmb_plane_atomic_update()
573 struct kmb_plane *primary = NULL; in kmb_plane_init() local
588 return ERR_PTR(-ENOMEM); in kmb_plane_init()
601 ret = drm_universal_plane_init(drm, &plane->base_plane, in kmb_plane_init()
613 drm_plane_create_alpha_property(&plane->base_plane); in kmb_plane_init()
615 drm_plane_create_blend_mode_property(&plane->base_plane, in kmb_plane_init()
618 drm_plane_create_zpos_immutable_property(&plane->base_plane, i); in kmb_plane_init()
620 drm_plane_helper_add(&plane->base_plane, in kmb_plane_init()
624 primary = plane; in kmb_plane_init()
625 kmb->plane = plane; in kmb_plane_init()
627 drm_dbg(drm, "%s : %d primary=%p\n", __func__, __LINE__, in kmb_plane_init()
628 &primary->base_plane); in kmb_plane_init()
629 plane->id = i; in kmb_plane_init()
637 return primary; in kmb_plane_init()