Lines Matching refs:plane
29 #include "plane.h"
54 static inline unsigned int tegra_plane_offset(struct tegra_plane *plane,
59 return plane->offset + offset;
64 return plane->offset + offset;
69 return plane->offset + offset;
72 dev_WARN(plane->dc->dev, "invalid offset: %x\n", offset);
74 return plane->offset + offset;
77 static inline u32 tegra_plane_readl(struct tegra_plane *plane,
80 return tegra_dc_readl(plane->dc, tegra_plane_offset(plane, offset));
83 static inline void tegra_plane_writel(struct tegra_plane *plane, u32 value,
86 tegra_dc_writel(plane->dc, value, tegra_plane_offset(plane, offset));
160 static void tegra_plane_setup_blending_legacy(struct tegra_plane *plane)
175 tegra_plane_writel(plane, blendnokey, DC_WIN_BLEND_NOKEY);
176 tegra_plane_writel(plane, foreground, DC_WIN_BLEND_1WIN);
178 state = to_tegra_plane_state(plane->base.state);
188 * plane.
255 tegra_plane_writel(plane, background[0], DC_WIN_BLEND_2WIN_X);
256 tegra_plane_writel(plane, background[1], DC_WIN_BLEND_2WIN_Y);
257 tegra_plane_writel(plane, background[2], DC_WIN_BLEND_3WIN_XY);
274 tegra_plane_writel(plane, blending[0], DC_WIN_BLEND_2WIN_X);
275 tegra_plane_writel(plane, blending[1], DC_WIN_BLEND_2WIN_Y);
276 tegra_plane_writel(plane, background[2], DC_WIN_BLEND_3WIN_XY);
280 tegra_plane_writel(plane, foreground, DC_WIN_BLEND_2WIN_X);
281 tegra_plane_writel(plane, foreground, DC_WIN_BLEND_2WIN_Y);
282 tegra_plane_writel(plane, foreground, DC_WIN_BLEND_3WIN_XY);
287 static void tegra_plane_setup_blending(struct tegra_plane *plane,
295 tegra_plane_writel(plane, value, DC_WIN_BLEND_MATCH_SELECT);
300 tegra_plane_writel(plane, value, DC_WIN_BLEND_NOMATCH_SELECT);
303 tegra_plane_writel(plane, value, DC_WIN_BLEND_LAYER_CONTROL);
307 tegra_plane_use_horizontal_filtering(struct tegra_plane *plane,
310 struct tegra_dc *dc = plane->dc;
315 if (plane->index == 0 && dc->soc->has_win_a_without_filters)
322 tegra_plane_use_vertical_filtering(struct tegra_plane *plane,
325 struct tegra_dc *dc = plane->dc;
330 if (plane->index == 0 && dc->soc->has_win_a_without_filters)
333 if (plane->index == 2 && dc->soc->has_win_c_without_vert_filter)
339 static void tegra_dc_setup_window(struct tegra_plane *plane,
343 struct tegra_dc *dc = plane->dc;
357 tegra_plane_writel(plane, window->format, DC_WIN_COLOR_DEPTH);
358 tegra_plane_writel(plane, window->swap, DC_WIN_BYTE_SWAP);
361 tegra_plane_writel(plane, value, DC_WIN_POSITION);
364 tegra_plane_writel(plane, value, DC_WIN_SIZE);
378 tegra_plane_writel(plane, value, DC_WIN_PRESCALED_SIZE);
391 tegra_plane_writel(plane, value, DC_WIN_DDA_INC);
396 tegra_plane_writel(plane, h_dda, DC_WIN_H_INITIAL_DDA);
397 tegra_plane_writel(plane, v_dda, DC_WIN_V_INITIAL_DDA);
399 tegra_plane_writel(plane, 0, DC_WIN_UV_BUF_STRIDE);
400 tegra_plane_writel(plane, 0, DC_WIN_BUF_STRIDE);
402 tegra_plane_writel(plane, window->base[0], DC_WINBUF_START_ADDR);
405 tegra_plane_writel(plane, window->base[1], DC_WINBUF_START_ADDR_U);
406 tegra_plane_writel(plane, window->base[2], DC_WINBUF_START_ADDR_V);
408 tegra_plane_writel(plane, value, DC_WIN_LINE_STRIDE);
410 tegra_plane_writel(plane, window->stride[0], DC_WIN_LINE_STRIDE);
413 tegra_plane_writel(plane, h_offset, DC_WINBUF_ADDR_H_OFFSET);
414 tegra_plane_writel(plane, v_offset, DC_WINBUF_ADDR_V_OFFSET);
434 tegra_plane_writel(plane, value, DC_WINBUF_SURFACE_KIND);
455 tegra_plane_writel(plane, value, DC_WIN_BUFFER_ADDR_MODE);
462 tegra_plane_writel(plane, 0x00f0, DC_WIN_CSC_YOF);
463 tegra_plane_writel(plane, 0x012a, DC_WIN_CSC_KYRGB);
464 tegra_plane_writel(plane, 0x0000, DC_WIN_CSC_KUR);
465 tegra_plane_writel(plane, 0x0198, DC_WIN_CSC_KVR);
466 tegra_plane_writel(plane, 0x039b, DC_WIN_CSC_KUG);
467 tegra_plane_writel(plane, 0x032f, DC_WIN_CSC_KVG);
468 tegra_plane_writel(plane, 0x0204, DC_WIN_CSC_KUB);
469 tegra_plane_writel(plane, 0x0000, DC_WIN_CSC_KVB);
482 if (tegra_plane_use_horizontal_filtering(plane, window)) {
487 tegra_plane_writel(plane, 0x00008000, DC_WIN_H_FILTER_P(0));
488 tegra_plane_writel(plane, 0x3e087ce1, DC_WIN_H_FILTER_P(1));
489 tegra_plane_writel(plane, 0x3b117ac1, DC_WIN_H_FILTER_P(2));
490 tegra_plane_writel(plane, 0x591b73aa, DC_WIN_H_FILTER_P(3));
491 tegra_plane_writel(plane, 0x57256d9a, DC_WIN_H_FILTER_P(4));
492 tegra_plane_writel(plane, 0x552f668b, DC_WIN_H_FILTER_P(5));
493 tegra_plane_writel(plane, 0x73385e8b, DC_WIN_H_FILTER_P(6));
494 tegra_plane_writel(plane, 0x72435583, DC_WIN_H_FILTER_P(7));
495 tegra_plane_writel(plane, 0x714c4c8b, DC_WIN_H_FILTER_P(8));
496 tegra_plane_writel(plane, 0x70554393, DC_WIN_H_FILTER_P(9));
497 tegra_plane_writel(plane, 0x715e389b, DC_WIN_H_FILTER_P(10));
498 tegra_plane_writel(plane, 0x71662faa, DC_WIN_H_FILTER_P(11));
499 tegra_plane_writel(plane, 0x536d25ba, DC_WIN_H_FILTER_P(12));
500 tegra_plane_writel(plane, 0x55731bca, DC_WIN_H_FILTER_P(13));
501 tegra_plane_writel(plane, 0x387a11d9, DC_WIN_H_FILTER_P(14));
502 tegra_plane_writel(plane, 0x3c7c08f1, DC_WIN_H_FILTER_P(15));
507 if (tegra_plane_use_vertical_filtering(plane, window)) {
515 tegra_plane_writel(plane, k, DC_WIN_V_FILTER_P(i));
520 tegra_plane_writel(plane, value, DC_WIN_WIN_OPTIONS);
523 tegra_plane_setup_blending_legacy(plane);
525 tegra_plane_setup_blending(plane, window);
606 static int tegra_plane_atomic_check(struct drm_plane *plane,
615 struct tegra_plane *tegra = to_tegra_plane(plane);
619 /* no need for further checks if the plane is being disabled */
633 * be emulated by disabling alpha blending for the plane.
679 DRM_ERROR("unsupported UV-plane configuration\n");
691 static void tegra_plane_atomic_disable(struct drm_plane *plane,
694 struct tegra_plane *p = to_tegra_plane(plane);
706 static void tegra_plane_atomic_update(struct drm_plane *plane,
709 struct tegra_plane_state *state = to_tegra_plane_state(plane->state);
710 struct drm_framebuffer *fb = plane->state->fb;
711 struct tegra_plane *p = to_tegra_plane(plane);
716 if (!plane->state->crtc || !plane->state->fb)
719 if (!plane->state->visible)
720 return tegra_plane_atomic_disable(plane, old_state);
723 window.src.x = plane->state->src.x1 >> 16;
724 window.src.y = plane->state->src.y1 >> 16;
725 window.src.w = drm_rect_width(&plane->state->src) >> 16;
726 window.src.h = drm_rect_height(&plane->state->src) >> 16;
727 window.dst.x = plane->state->dst.x1;
728 window.dst.y = plane->state->dst.y1;
729 window.dst.w = drm_rect_width(&plane->state->dst);
730 window.dst.h = drm_rect_height(&plane->state->dst);
736 window.zpos = plane->state->normalized_zpos;
747 * function, so it's safe to ignore the V-plane pitch here.
786 struct tegra_plane *plane;
792 plane = kzalloc(sizeof(*plane), GFP_KERNEL);
793 if (!plane)
797 plane->offset = 0xa00;
798 plane->index = 0;
799 plane->dc = dc;
805 err = drm_universal_plane_init(drm, &plane->base, possible_crtcs,
809 kfree(plane);
813 drm_plane_helper_add(&plane->base, &tegra_plane_helper_funcs);
814 drm_plane_create_zpos_property(&plane->base, plane->index, 0, 255);
816 err = drm_plane_create_rotation_property(&plane->base,
826 return &plane->base;
833 static int tegra_cursor_atomic_check(struct drm_plane *plane,
836 struct tegra_plane *tegra = to_tegra_plane(plane);
839 /* no need for further checks if the plane is being disabled */
863 static void tegra_cursor_atomic_update(struct drm_plane *plane,
866 struct tegra_plane_state *state = to_tegra_plane_state(plane->state);
867 struct tegra_dc *dc = to_tegra_dc(plane->state->crtc);
871 if (!plane->state->crtc || !plane->state->fb)
874 switch (plane->state->crtc_w) {
893 plane->state->crtc_w, plane->state->crtc_h);
920 value = (plane->state->crtc_y & 0x3fff) << 16 |
921 (plane->state->crtc_x & 0x3fff);
925 static void tegra_cursor_atomic_disable(struct drm_plane *plane,
959 struct tegra_plane *plane;
964 plane = kzalloc(sizeof(*plane), GFP_KERNEL);
965 if (!plane)
969 * This index is kind of fake. The cursor isn't a regular plane, but
973 * need to special-casing the cursor plane.
975 plane->index = 6;
976 plane->dc = dc;
981 err = drm_universal_plane_init(drm, &plane->base, possible_crtcs,
986 kfree(plane);
990 drm_plane_helper_add(&plane->base, &tegra_cursor_plane_helper_funcs);
991 drm_plane_create_zpos_immutable_property(&plane->base, 255);
993 return &plane->base;
1078 struct tegra_plane *plane;
1084 plane = kzalloc(sizeof(*plane), GFP_KERNEL);
1085 if (!plane)
1088 plane->offset = 0xa00 + 0x200 * index;
1089 plane->index = index;
1090 plane->dc = dc;
1100 err = drm_universal_plane_init(drm, &plane->base, possible_crtcs,
1105 kfree(plane);
1109 drm_plane_helper_add(&plane->base, &tegra_plane_helper_funcs);
1110 drm_plane_create_zpos_property(&plane->base, plane->index, 0, 255);
1112 err = drm_plane_create_rotation_property(&plane->base,
1122 return &plane->base;
1128 struct drm_plane *plane, *primary = NULL;
1138 plane = tegra_shared_plane_create(drm, dc,
1141 if (IS_ERR(plane))
1142 return plane;
1145 * Choose the first shared plane owned by this
1146 * head as the primary plane.
1149 plane->type = DRM_PLANE_TYPE_PRIMARY;
1150 primary = plane;
2042 * assign a primary plane to them, which in turn will cause KMS to