Lines Matching refs:plane

49 static inline unsigned int tegra_plane_offset(struct tegra_plane *plane,  in tegra_plane_offset()  argument
54 return plane->offset + offset; in tegra_plane_offset()
59 return plane->offset + offset; in tegra_plane_offset()
64 return plane->offset + offset; in tegra_plane_offset()
67 dev_WARN(plane->dc->dev, "invalid offset: %x\n", offset); in tegra_plane_offset()
69 return plane->offset + offset; in tegra_plane_offset()
72 static inline u32 tegra_plane_readl(struct tegra_plane *plane, in tegra_plane_readl() argument
75 return tegra_dc_readl(plane->dc, tegra_plane_offset(plane, offset)); in tegra_plane_readl()
78 static inline void tegra_plane_writel(struct tegra_plane *plane, u32 value, in tegra_plane_writel() argument
81 tegra_dc_writel(plane->dc, value, tegra_plane_offset(plane, offset)); in tegra_plane_writel()
155 static void tegra_plane_setup_blending_legacy(struct tegra_plane *plane) in tegra_plane_setup_blending_legacy() argument
170 tegra_plane_writel(plane, blendnokey, DC_WIN_BLEND_NOKEY); in tegra_plane_setup_blending_legacy()
171 tegra_plane_writel(plane, foreground, DC_WIN_BLEND_1WIN); in tegra_plane_setup_blending_legacy()
173 state = to_tegra_plane_state(plane->base.state); in tegra_plane_setup_blending_legacy()
250 tegra_plane_writel(plane, background[0], DC_WIN_BLEND_2WIN_X); in tegra_plane_setup_blending_legacy()
251 tegra_plane_writel(plane, background[1], DC_WIN_BLEND_2WIN_Y); in tegra_plane_setup_blending_legacy()
252 tegra_plane_writel(plane, background[2], DC_WIN_BLEND_3WIN_XY); in tegra_plane_setup_blending_legacy()
269 tegra_plane_writel(plane, blending[0], DC_WIN_BLEND_2WIN_X); in tegra_plane_setup_blending_legacy()
270 tegra_plane_writel(plane, blending[1], DC_WIN_BLEND_2WIN_Y); in tegra_plane_setup_blending_legacy()
271 tegra_plane_writel(plane, background[2], DC_WIN_BLEND_3WIN_XY); in tegra_plane_setup_blending_legacy()
275 tegra_plane_writel(plane, foreground, DC_WIN_BLEND_2WIN_X); in tegra_plane_setup_blending_legacy()
276 tegra_plane_writel(plane, foreground, DC_WIN_BLEND_2WIN_Y); in tegra_plane_setup_blending_legacy()
277 tegra_plane_writel(plane, foreground, DC_WIN_BLEND_3WIN_XY); in tegra_plane_setup_blending_legacy()
282 static void tegra_plane_setup_blending(struct tegra_plane *plane, in tegra_plane_setup_blending() argument
290 tegra_plane_writel(plane, value, DC_WIN_BLEND_MATCH_SELECT); in tegra_plane_setup_blending()
295 tegra_plane_writel(plane, value, DC_WIN_BLEND_NOMATCH_SELECT); in tegra_plane_setup_blending()
298 tegra_plane_writel(plane, value, DC_WIN_BLEND_LAYER_CONTROL); in tegra_plane_setup_blending()
302 tegra_plane_use_horizontal_filtering(struct tegra_plane *plane, in tegra_plane_use_horizontal_filtering() argument
305 struct tegra_dc *dc = plane->dc; in tegra_plane_use_horizontal_filtering()
310 if (plane->index == 0 && dc->soc->has_win_a_without_filters) in tegra_plane_use_horizontal_filtering()
317 tegra_plane_use_vertical_filtering(struct tegra_plane *plane, in tegra_plane_use_vertical_filtering() argument
320 struct tegra_dc *dc = plane->dc; in tegra_plane_use_vertical_filtering()
325 if (plane->index == 0 && dc->soc->has_win_a_without_filters) in tegra_plane_use_vertical_filtering()
328 if (plane->index == 2 && dc->soc->has_win_c_without_vert_filter) in tegra_plane_use_vertical_filtering()
334 static void tegra_dc_setup_window(struct tegra_plane *plane, in tegra_dc_setup_window() argument
338 struct tegra_dc *dc = plane->dc; in tegra_dc_setup_window()
352 tegra_plane_writel(plane, window->format, DC_WIN_COLOR_DEPTH); in tegra_dc_setup_window()
353 tegra_plane_writel(plane, window->swap, DC_WIN_BYTE_SWAP); in tegra_dc_setup_window()
356 tegra_plane_writel(plane, value, DC_WIN_POSITION); in tegra_dc_setup_window()
359 tegra_plane_writel(plane, value, DC_WIN_SIZE); in tegra_dc_setup_window()
367 tegra_plane_writel(plane, value, DC_WIN_PRESCALED_SIZE); in tegra_dc_setup_window()
380 tegra_plane_writel(plane, value, DC_WIN_DDA_INC); in tegra_dc_setup_window()
385 tegra_plane_writel(plane, h_dda, DC_WIN_H_INITIAL_DDA); in tegra_dc_setup_window()
386 tegra_plane_writel(plane, v_dda, DC_WIN_V_INITIAL_DDA); in tegra_dc_setup_window()
388 tegra_plane_writel(plane, 0, DC_WIN_UV_BUF_STRIDE); in tegra_dc_setup_window()
389 tegra_plane_writel(plane, 0, DC_WIN_BUF_STRIDE); in tegra_dc_setup_window()
391 tegra_plane_writel(plane, window->base[0], DC_WINBUF_START_ADDR); in tegra_dc_setup_window()
394 tegra_plane_writel(plane, window->base[1], DC_WINBUF_START_ADDR_U); in tegra_dc_setup_window()
395 tegra_plane_writel(plane, window->base[2], DC_WINBUF_START_ADDR_V); in tegra_dc_setup_window()
397 tegra_plane_writel(plane, value, DC_WIN_LINE_STRIDE); in tegra_dc_setup_window()
399 tegra_plane_writel(plane, window->stride[0], DC_WIN_LINE_STRIDE); in tegra_dc_setup_window()
405 tegra_plane_writel(plane, h_offset, DC_WINBUF_ADDR_H_OFFSET); in tegra_dc_setup_window()
406 tegra_plane_writel(plane, v_offset, DC_WINBUF_ADDR_V_OFFSET); in tegra_dc_setup_window()
426 tegra_plane_writel(plane, value, DC_WINBUF_SURFACE_KIND); in tegra_dc_setup_window()
447 tegra_plane_writel(plane, value, DC_WIN_BUFFER_ADDR_MODE); in tegra_dc_setup_window()
454 tegra_plane_writel(plane, 0x00f0, DC_WIN_CSC_YOF); in tegra_dc_setup_window()
455 tegra_plane_writel(plane, 0x012a, DC_WIN_CSC_KYRGB); in tegra_dc_setup_window()
456 tegra_plane_writel(plane, 0x0000, DC_WIN_CSC_KUR); in tegra_dc_setup_window()
457 tegra_plane_writel(plane, 0x0198, DC_WIN_CSC_KVR); in tegra_dc_setup_window()
458 tegra_plane_writel(plane, 0x039b, DC_WIN_CSC_KUG); in tegra_dc_setup_window()
459 tegra_plane_writel(plane, 0x032f, DC_WIN_CSC_KVG); in tegra_dc_setup_window()
460 tegra_plane_writel(plane, 0x0204, DC_WIN_CSC_KUB); in tegra_dc_setup_window()
461 tegra_plane_writel(plane, 0x0000, DC_WIN_CSC_KVB); in tegra_dc_setup_window()
471 if (tegra_plane_use_horizontal_filtering(plane, window)) { in tegra_dc_setup_window()
476 tegra_plane_writel(plane, 0x00008000, DC_WIN_H_FILTER_P(0)); in tegra_dc_setup_window()
477 tegra_plane_writel(plane, 0x3e087ce1, DC_WIN_H_FILTER_P(1)); in tegra_dc_setup_window()
478 tegra_plane_writel(plane, 0x3b117ac1, DC_WIN_H_FILTER_P(2)); in tegra_dc_setup_window()
479 tegra_plane_writel(plane, 0x591b73aa, DC_WIN_H_FILTER_P(3)); in tegra_dc_setup_window()
480 tegra_plane_writel(plane, 0x57256d9a, DC_WIN_H_FILTER_P(4)); in tegra_dc_setup_window()
481 tegra_plane_writel(plane, 0x552f668b, DC_WIN_H_FILTER_P(5)); in tegra_dc_setup_window()
482 tegra_plane_writel(plane, 0x73385e8b, DC_WIN_H_FILTER_P(6)); in tegra_dc_setup_window()
483 tegra_plane_writel(plane, 0x72435583, DC_WIN_H_FILTER_P(7)); in tegra_dc_setup_window()
484 tegra_plane_writel(plane, 0x714c4c8b, DC_WIN_H_FILTER_P(8)); in tegra_dc_setup_window()
485 tegra_plane_writel(plane, 0x70554393, DC_WIN_H_FILTER_P(9)); in tegra_dc_setup_window()
486 tegra_plane_writel(plane, 0x715e389b, DC_WIN_H_FILTER_P(10)); in tegra_dc_setup_window()
487 tegra_plane_writel(plane, 0x71662faa, DC_WIN_H_FILTER_P(11)); in tegra_dc_setup_window()
488 tegra_plane_writel(plane, 0x536d25ba, DC_WIN_H_FILTER_P(12)); in tegra_dc_setup_window()
489 tegra_plane_writel(plane, 0x55731bca, DC_WIN_H_FILTER_P(13)); in tegra_dc_setup_window()
490 tegra_plane_writel(plane, 0x387a11d9, DC_WIN_H_FILTER_P(14)); in tegra_dc_setup_window()
491 tegra_plane_writel(plane, 0x3c7c08f1, DC_WIN_H_FILTER_P(15)); in tegra_dc_setup_window()
496 if (tegra_plane_use_vertical_filtering(plane, window)) { in tegra_dc_setup_window()
504 tegra_plane_writel(plane, k, DC_WIN_V_FILTER_P(i)); in tegra_dc_setup_window()
509 tegra_plane_writel(plane, value, DC_WIN_WIN_OPTIONS); in tegra_dc_setup_window()
512 tegra_plane_setup_blending_legacy(plane); in tegra_dc_setup_window()
514 tegra_plane_setup_blending(plane, window); in tegra_dc_setup_window()
595 static int tegra_plane_atomic_check(struct drm_plane *plane, in tegra_plane_atomic_check() argument
601 struct tegra_plane *tegra = to_tegra_plane(plane); in tegra_plane_atomic_check()
663 static void tegra_plane_atomic_disable(struct drm_plane *plane, in tegra_plane_atomic_disable() argument
666 struct tegra_plane *p = to_tegra_plane(plane); in tegra_plane_atomic_disable()
678 static void tegra_plane_atomic_update(struct drm_plane *plane, in tegra_plane_atomic_update() argument
681 struct tegra_plane_state *state = to_tegra_plane_state(plane->state); in tegra_plane_atomic_update()
682 struct drm_framebuffer *fb = plane->state->fb; in tegra_plane_atomic_update()
683 struct tegra_plane *p = to_tegra_plane(plane); in tegra_plane_atomic_update()
688 if (!plane->state->crtc || !plane->state->fb) in tegra_plane_atomic_update()
691 if (!plane->state->visible) in tegra_plane_atomic_update()
692 return tegra_plane_atomic_disable(plane, old_state); in tegra_plane_atomic_update()
695 window.src.x = plane->state->src.x1 >> 16; in tegra_plane_atomic_update()
696 window.src.y = plane->state->src.y1 >> 16; in tegra_plane_atomic_update()
697 window.src.w = drm_rect_width(&plane->state->src) >> 16; in tegra_plane_atomic_update()
698 window.src.h = drm_rect_height(&plane->state->src) >> 16; in tegra_plane_atomic_update()
699 window.dst.x = plane->state->dst.x1; in tegra_plane_atomic_update()
700 window.dst.y = plane->state->dst.y1; in tegra_plane_atomic_update()
701 window.dst.w = drm_rect_width(&plane->state->dst); in tegra_plane_atomic_update()
702 window.dst.h = drm_rect_height(&plane->state->dst); in tegra_plane_atomic_update()
707 window.zpos = plane->state->normalized_zpos; in tegra_plane_atomic_update()
757 struct tegra_plane *plane; in tegra_primary_plane_create() local
763 plane = kzalloc(sizeof(*plane), GFP_KERNEL); in tegra_primary_plane_create()
764 if (!plane) in tegra_primary_plane_create()
768 plane->offset = 0xa00; in tegra_primary_plane_create()
769 plane->index = 0; in tegra_primary_plane_create()
770 plane->dc = dc; in tegra_primary_plane_create()
776 err = drm_universal_plane_init(drm, &plane->base, possible_crtcs, in tegra_primary_plane_create()
780 kfree(plane); in tegra_primary_plane_create()
784 drm_plane_helper_add(&plane->base, &tegra_plane_helper_funcs); in tegra_primary_plane_create()
785 drm_plane_create_zpos_property(&plane->base, plane->index, 0, 255); in tegra_primary_plane_create()
787 err = drm_plane_create_rotation_property(&plane->base, in tegra_primary_plane_create()
795 return &plane->base; in tegra_primary_plane_create()
802 static int tegra_cursor_atomic_check(struct drm_plane *plane, in tegra_cursor_atomic_check() argument
805 struct tegra_plane *tegra = to_tegra_plane(plane); in tegra_cursor_atomic_check()
832 static void tegra_cursor_atomic_update(struct drm_plane *plane, in tegra_cursor_atomic_update() argument
835 struct tegra_bo *bo = tegra_fb_get_plane(plane->state->fb, 0); in tegra_cursor_atomic_update()
836 struct tegra_dc *dc = to_tegra_dc(plane->state->crtc); in tegra_cursor_atomic_update()
837 struct drm_plane_state *state = plane->state; in tegra_cursor_atomic_update()
841 if (!plane->state->crtc || !plane->state->fb) in tegra_cursor_atomic_update()
894 static void tegra_cursor_atomic_disable(struct drm_plane *plane, in tegra_cursor_atomic_disable() argument
921 struct tegra_plane *plane; in tegra_dc_cursor_plane_create() local
926 plane = kzalloc(sizeof(*plane), GFP_KERNEL); in tegra_dc_cursor_plane_create()
927 if (!plane) in tegra_dc_cursor_plane_create()
937 plane->index = 6; in tegra_dc_cursor_plane_create()
938 plane->dc = dc; in tegra_dc_cursor_plane_create()
943 err = drm_universal_plane_init(drm, &plane->base, possible_crtcs, in tegra_dc_cursor_plane_create()
948 kfree(plane); in tegra_dc_cursor_plane_create()
952 drm_plane_helper_add(&plane->base, &tegra_cursor_plane_helper_funcs); in tegra_dc_cursor_plane_create()
954 return &plane->base; in tegra_dc_cursor_plane_create()
1039 struct tegra_plane *plane; in tegra_dc_overlay_plane_create() local
1045 plane = kzalloc(sizeof(*plane), GFP_KERNEL); in tegra_dc_overlay_plane_create()
1046 if (!plane) in tegra_dc_overlay_plane_create()
1049 plane->offset = 0xa00 + 0x200 * index; in tegra_dc_overlay_plane_create()
1050 plane->index = index; in tegra_dc_overlay_plane_create()
1051 plane->dc = dc; in tegra_dc_overlay_plane_create()
1061 err = drm_universal_plane_init(drm, &plane->base, possible_crtcs, in tegra_dc_overlay_plane_create()
1065 kfree(plane); in tegra_dc_overlay_plane_create()
1069 drm_plane_helper_add(&plane->base, &tegra_plane_helper_funcs); in tegra_dc_overlay_plane_create()
1070 drm_plane_create_zpos_property(&plane->base, plane->index, 0, 255); in tegra_dc_overlay_plane_create()
1072 err = drm_plane_create_rotation_property(&plane->base, in tegra_dc_overlay_plane_create()
1080 return &plane->base; in tegra_dc_overlay_plane_create()
1086 struct drm_plane *plane, *primary = NULL; in tegra_dc_add_shared_planes() local
1096 plane = tegra_shared_plane_create(drm, dc, in tegra_dc_add_shared_planes()
1099 if (IS_ERR(plane)) in tegra_dc_add_shared_planes()
1100 return plane; in tegra_dc_add_shared_planes()
1107 plane->type = DRM_PLANE_TYPE_PRIMARY; in tegra_dc_add_shared_planes()
1108 primary = plane; in tegra_dc_add_shared_planes()