1 // SPDX-License-Identifier: MIT
3 * Copyright © 2020 Intel Corporation
5 #include <linux/kernel.h>
7 #include <drm/drm_atomic_helper.h>
8 #include <drm/drm_atomic_uapi.h>
9 #include <drm/drm_damage_helper.h>
10 #include <drm/drm_plane_helper.h>
11 #include <drm/drm_fourcc.h>
13 #include "intel_atomic.h"
14 #include "intel_atomic_plane.h"
15 #include "intel_cursor.h"
17 #include "intel_display_types.h"
18 #include "intel_display.h"
21 #include "intel_frontbuffer.h"
23 #include "intel_psr.h"
24 #include "intel_sprite.h"
27 static const u32 intel_cursor_formats[] = {
31 static const u64 cursor_format_modifiers[] = {
32 DRM_FORMAT_MOD_LINEAR,
33 DRM_FORMAT_MOD_INVALID
36 static u32 intel_cursor_base(const struct intel_plane_state *plane_state)
38 struct drm_i915_private *dev_priv =
39 to_i915(plane_state->uapi.plane->dev);
40 const struct drm_framebuffer *fb = plane_state->hw.fb;
41 const struct drm_i915_gem_object *obj = intel_fb_obj(fb);
44 if (INTEL_INFO(dev_priv)->display.cursor_needs_physical)
45 base = sg_dma_address(obj->mm.pages->sgl);
47 base = intel_plane_ggtt_offset(plane_state);
49 return base + plane_state->view.color_plane[0].offset;
52 static u32 intel_cursor_position(const struct intel_plane_state *plane_state)
54 int x = plane_state->uapi.dst.x1;
55 int y = plane_state->uapi.dst.y1;
59 pos |= CURSOR_POS_SIGN << CURSOR_X_SHIFT;
62 pos |= x << CURSOR_X_SHIFT;
65 pos |= CURSOR_POS_SIGN << CURSOR_Y_SHIFT;
68 pos |= y << CURSOR_Y_SHIFT;
73 static bool intel_cursor_size_ok(const struct intel_plane_state *plane_state)
75 const struct drm_mode_config *config =
76 &plane_state->uapi.plane->dev->mode_config;
77 int width = drm_rect_width(&plane_state->uapi.dst);
78 int height = drm_rect_height(&plane_state->uapi.dst);
80 return width > 0 && width <= config->cursor_width &&
81 height > 0 && height <= config->cursor_height;
84 static int intel_cursor_check_surface(struct intel_plane_state *plane_state)
86 struct drm_i915_private *dev_priv =
87 to_i915(plane_state->uapi.plane->dev);
88 unsigned int rotation = plane_state->hw.rotation;
93 ret = intel_plane_compute_gtt(plane_state);
97 if (!plane_state->uapi.visible)
100 src_x = plane_state->uapi.src.x1 >> 16;
101 src_y = plane_state->uapi.src.y1 >> 16;
103 intel_add_fb_offsets(&src_x, &src_y, plane_state, 0);
104 offset = intel_plane_compute_aligned_offset(&src_x, &src_y,
107 if (src_x != 0 || src_y != 0) {
108 drm_dbg_kms(&dev_priv->drm,
109 "Arbitrary cursor panning not supported\n");
114 * Put the final coordinates back so that the src
115 * coordinate checks will see the right values.
117 drm_rect_translate_to(&plane_state->uapi.src,
118 src_x << 16, src_y << 16);
120 /* ILK+ do this automagically in hardware */
121 if (HAS_GMCH(dev_priv) && rotation & DRM_MODE_ROTATE_180) {
122 const struct drm_framebuffer *fb = plane_state->hw.fb;
123 int src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
124 int src_h = drm_rect_height(&plane_state->uapi.src) >> 16;
126 offset += (src_h * src_w - 1) * fb->format->cpp[0];
129 plane_state->view.color_plane[0].offset = offset;
130 plane_state->view.color_plane[0].x = src_x;
131 plane_state->view.color_plane[0].y = src_y;
136 static int intel_check_cursor(struct intel_crtc_state *crtc_state,
137 struct intel_plane_state *plane_state)
139 const struct drm_framebuffer *fb = plane_state->hw.fb;
140 struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev);
141 const struct drm_rect src = plane_state->uapi.src;
142 const struct drm_rect dst = plane_state->uapi.dst;
145 if (fb && fb->modifier != DRM_FORMAT_MOD_LINEAR) {
146 drm_dbg_kms(&i915->drm, "cursor cannot be tiled\n");
150 ret = intel_atomic_plane_check_clipping(plane_state, crtc_state,
151 DRM_PLANE_HELPER_NO_SCALING,
152 DRM_PLANE_HELPER_NO_SCALING,
157 /* Use the unclipped src/dst rectangles, which we program to hw */
158 plane_state->uapi.src = src;
159 plane_state->uapi.dst = dst;
161 ret = intel_cursor_check_surface(plane_state);
165 if (!plane_state->uapi.visible)
168 ret = intel_plane_check_src_coordinates(plane_state);
176 i845_cursor_max_stride(struct intel_plane *plane,
177 u32 pixel_format, u64 modifier,
178 unsigned int rotation)
183 static u32 i845_cursor_ctl_crtc(const struct intel_crtc_state *crtc_state)
187 if (crtc_state->gamma_enable)
188 cntl |= CURSOR_GAMMA_ENABLE;
193 static u32 i845_cursor_ctl(const struct intel_crtc_state *crtc_state,
194 const struct intel_plane_state *plane_state)
196 return CURSOR_ENABLE |
198 CURSOR_STRIDE(plane_state->view.color_plane[0].stride);
201 static bool i845_cursor_size_ok(const struct intel_plane_state *plane_state)
203 int width = drm_rect_width(&plane_state->uapi.dst);
206 * 845g/865g are only limited by the width of their cursors,
207 * the height is arbitrary up to the precision of the register.
209 return intel_cursor_size_ok(plane_state) && IS_ALIGNED(width, 64);
212 static int i845_check_cursor(struct intel_crtc_state *crtc_state,
213 struct intel_plane_state *plane_state)
215 const struct drm_framebuffer *fb = plane_state->hw.fb;
216 struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev);
219 ret = intel_check_cursor(crtc_state, plane_state);
223 /* if we want to turn off the cursor ignore width and height */
227 /* Check for which cursor types we support */
228 if (!i845_cursor_size_ok(plane_state)) {
229 drm_dbg_kms(&i915->drm,
230 "Cursor dimension %dx%d not supported\n",
231 drm_rect_width(&plane_state->uapi.dst),
232 drm_rect_height(&plane_state->uapi.dst));
236 drm_WARN_ON(&i915->drm, plane_state->uapi.visible &&
237 plane_state->view.color_plane[0].stride != fb->pitches[0]);
239 switch (fb->pitches[0]) {
246 drm_dbg_kms(&i915->drm, "Invalid cursor stride (%u)\n",
251 plane_state->ctl = i845_cursor_ctl(crtc_state, plane_state);
256 static void i845_update_cursor(struct intel_plane *plane,
257 const struct intel_crtc_state *crtc_state,
258 const struct intel_plane_state *plane_state)
260 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
261 u32 cntl = 0, base = 0, pos = 0, size = 0;
262 unsigned long irqflags;
264 if (plane_state && plane_state->uapi.visible) {
265 unsigned int width = drm_rect_width(&plane_state->uapi.dst);
266 unsigned int height = drm_rect_height(&plane_state->uapi.dst);
268 cntl = plane_state->ctl |
269 i845_cursor_ctl_crtc(crtc_state);
271 size = (height << 12) | width;
273 base = intel_cursor_base(plane_state);
274 pos = intel_cursor_position(plane_state);
277 spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
279 /* On these chipsets we can only modify the base/size/stride
280 * whilst the cursor is disabled.
282 if (plane->cursor.base != base ||
283 plane->cursor.size != size ||
284 plane->cursor.cntl != cntl) {
285 intel_de_write_fw(dev_priv, CURCNTR(PIPE_A), 0);
286 intel_de_write_fw(dev_priv, CURBASE(PIPE_A), base);
287 intel_de_write_fw(dev_priv, CURSIZE, size);
288 intel_de_write_fw(dev_priv, CURPOS(PIPE_A), pos);
289 intel_de_write_fw(dev_priv, CURCNTR(PIPE_A), cntl);
291 plane->cursor.base = base;
292 plane->cursor.size = size;
293 plane->cursor.cntl = cntl;
295 intel_de_write_fw(dev_priv, CURPOS(PIPE_A), pos);
298 spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
301 static void i845_disable_cursor(struct intel_plane *plane,
302 const struct intel_crtc_state *crtc_state)
304 i845_update_cursor(plane, crtc_state, NULL);
307 static bool i845_cursor_get_hw_state(struct intel_plane *plane,
310 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
311 enum intel_display_power_domain power_domain;
312 intel_wakeref_t wakeref;
315 power_domain = POWER_DOMAIN_PIPE(PIPE_A);
316 wakeref = intel_display_power_get_if_enabled(dev_priv, power_domain);
320 ret = intel_de_read(dev_priv, CURCNTR(PIPE_A)) & CURSOR_ENABLE;
324 intel_display_power_put(dev_priv, power_domain, wakeref);
330 i9xx_cursor_max_stride(struct intel_plane *plane,
331 u32 pixel_format, u64 modifier,
332 unsigned int rotation)
334 return plane->base.dev->mode_config.cursor_width * 4;
337 static u32 i9xx_cursor_ctl_crtc(const struct intel_crtc_state *crtc_state)
339 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
340 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
343 if (DISPLAY_VER(dev_priv) >= 11)
346 if (crtc_state->gamma_enable)
347 cntl = MCURSOR_GAMMA_ENABLE;
349 if (crtc_state->csc_enable)
350 cntl |= MCURSOR_PIPE_CSC_ENABLE;
352 if (DISPLAY_VER(dev_priv) < 5 && !IS_G4X(dev_priv))
353 cntl |= MCURSOR_PIPE_SELECT(crtc->pipe);
358 static u32 i9xx_cursor_ctl(const struct intel_crtc_state *crtc_state,
359 const struct intel_plane_state *plane_state)
361 struct drm_i915_private *dev_priv =
362 to_i915(plane_state->uapi.plane->dev);
365 if (IS_SANDYBRIDGE(dev_priv) || IS_IVYBRIDGE(dev_priv))
366 cntl |= MCURSOR_TRICKLE_FEED_DISABLE;
368 switch (drm_rect_width(&plane_state->uapi.dst)) {
370 cntl |= MCURSOR_MODE_64_ARGB_AX;
373 cntl |= MCURSOR_MODE_128_ARGB_AX;
376 cntl |= MCURSOR_MODE_256_ARGB_AX;
379 MISSING_CASE(drm_rect_width(&plane_state->uapi.dst));
383 if (plane_state->hw.rotation & DRM_MODE_ROTATE_180)
384 cntl |= MCURSOR_ROTATE_180;
386 /* Wa_22012358565:adlp */
387 if (DISPLAY_VER(dev_priv) == 13)
388 cntl |= MCURSOR_ARB_SLOTS(1);
393 static bool i9xx_cursor_size_ok(const struct intel_plane_state *plane_state)
395 struct drm_i915_private *dev_priv =
396 to_i915(plane_state->uapi.plane->dev);
397 int width = drm_rect_width(&plane_state->uapi.dst);
398 int height = drm_rect_height(&plane_state->uapi.dst);
400 if (!intel_cursor_size_ok(plane_state))
403 /* Cursor width is limited to a few power-of-two sizes */
414 * IVB+ have CUR_FBC_CTL which allows an arbitrary cursor
415 * height from 8 lines up to the cursor width, when the
416 * cursor is not rotated. Everything else requires square
419 if (HAS_CUR_FBC(dev_priv) &&
420 plane_state->hw.rotation & DRM_MODE_ROTATE_0) {
421 if (height < 8 || height > width)
431 static int i9xx_check_cursor(struct intel_crtc_state *crtc_state,
432 struct intel_plane_state *plane_state)
434 struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
435 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
436 const struct drm_framebuffer *fb = plane_state->hw.fb;
437 enum pipe pipe = plane->pipe;
440 ret = intel_check_cursor(crtc_state, plane_state);
444 /* if we want to turn off the cursor ignore width and height */
448 /* Check for which cursor types we support */
449 if (!i9xx_cursor_size_ok(plane_state)) {
450 drm_dbg(&dev_priv->drm,
451 "Cursor dimension %dx%d not supported\n",
452 drm_rect_width(&plane_state->uapi.dst),
453 drm_rect_height(&plane_state->uapi.dst));
457 drm_WARN_ON(&dev_priv->drm, plane_state->uapi.visible &&
458 plane_state->view.color_plane[0].stride != fb->pitches[0]);
460 if (fb->pitches[0] !=
461 drm_rect_width(&plane_state->uapi.dst) * fb->format->cpp[0]) {
462 drm_dbg_kms(&dev_priv->drm,
463 "Invalid cursor stride (%u) (cursor width %d)\n",
465 drm_rect_width(&plane_state->uapi.dst));
470 * There's something wrong with the cursor on CHV pipe C.
471 * If it straddles the left edge of the screen then
472 * moving it away from the edge or disabling it often
473 * results in a pipe underrun, and often that can lead to
474 * dead pipe (constant underrun reported, and it scans
475 * out just a solid color). To recover from that, the
476 * display power well must be turned off and on again.
477 * Refuse the put the cursor into that compromised position.
479 if (IS_CHERRYVIEW(dev_priv) && pipe == PIPE_C &&
480 plane_state->uapi.visible && plane_state->uapi.dst.x1 < 0) {
481 drm_dbg_kms(&dev_priv->drm,
482 "CHV cursor C not allowed to straddle the left screen edge\n");
486 plane_state->ctl = i9xx_cursor_ctl(crtc_state, plane_state);
491 static void i9xx_update_cursor(struct intel_plane *plane,
492 const struct intel_crtc_state *crtc_state,
493 const struct intel_plane_state *plane_state)
495 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
496 enum pipe pipe = plane->pipe;
497 u32 cntl = 0, base = 0, pos = 0, fbc_ctl = 0;
498 unsigned long irqflags;
500 if (plane_state && plane_state->uapi.visible) {
501 int width = drm_rect_width(&plane_state->uapi.dst);
502 int height = drm_rect_height(&plane_state->uapi.dst);
504 cntl = plane_state->ctl |
505 i9xx_cursor_ctl_crtc(crtc_state);
508 fbc_ctl = CUR_FBC_CTL_EN | (height - 1);
510 base = intel_cursor_base(plane_state);
511 pos = intel_cursor_position(plane_state);
514 spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
517 * On some platforms writing CURCNTR first will also
518 * cause CURPOS to be armed by the CURBASE write.
519 * Without the CURCNTR write the CURPOS write would
520 * arm itself. Thus we always update CURCNTR before
523 * On other platforms CURPOS always requires the
524 * CURBASE write to arm the update. Additonally
525 * a write to any of the cursor register will cancel
526 * an already armed cursor update. Thus leaving out
527 * the CURBASE write after CURPOS could lead to a
528 * cursor that doesn't appear to move, or even change
529 * shape. Thus we always write CURBASE.
531 * The other registers are armed by the CURBASE write
532 * except when the plane is getting enabled at which time
533 * the CURCNTR write arms the update.
536 if (DISPLAY_VER(dev_priv) >= 9)
537 skl_write_cursor_wm(plane, crtc_state);
539 if (!intel_crtc_needs_modeset(crtc_state))
540 intel_psr2_program_plane_sel_fetch(plane, crtc_state, plane_state, 0);
542 if (plane->cursor.base != base ||
543 plane->cursor.size != fbc_ctl ||
544 plane->cursor.cntl != cntl) {
545 if (HAS_CUR_FBC(dev_priv))
546 intel_de_write_fw(dev_priv, CUR_FBC_CTL(pipe),
548 intel_de_write_fw(dev_priv, CURCNTR(pipe), cntl);
549 intel_de_write_fw(dev_priv, CURPOS(pipe), pos);
550 intel_de_write_fw(dev_priv, CURBASE(pipe), base);
552 plane->cursor.base = base;
553 plane->cursor.size = fbc_ctl;
554 plane->cursor.cntl = cntl;
556 intel_de_write_fw(dev_priv, CURPOS(pipe), pos);
557 intel_de_write_fw(dev_priv, CURBASE(pipe), base);
560 spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
563 static void i9xx_disable_cursor(struct intel_plane *plane,
564 const struct intel_crtc_state *crtc_state)
566 i9xx_update_cursor(plane, crtc_state, NULL);
569 static bool i9xx_cursor_get_hw_state(struct intel_plane *plane,
572 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
573 enum intel_display_power_domain power_domain;
574 intel_wakeref_t wakeref;
579 * Not 100% correct for planes that can move between pipes,
580 * but that's only the case for gen2-3 which don't have any
581 * display power wells.
583 power_domain = POWER_DOMAIN_PIPE(plane->pipe);
584 wakeref = intel_display_power_get_if_enabled(dev_priv, power_domain);
588 val = intel_de_read(dev_priv, CURCNTR(plane->pipe));
590 ret = val & MCURSOR_MODE;
592 if (DISPLAY_VER(dev_priv) >= 5 || IS_G4X(dev_priv))
595 *pipe = (val & MCURSOR_PIPE_SELECT_MASK) >>
596 MCURSOR_PIPE_SELECT_SHIFT;
598 intel_display_power_put(dev_priv, power_domain, wakeref);
603 static bool intel_cursor_format_mod_supported(struct drm_plane *_plane,
604 u32 format, u64 modifier)
606 return modifier == DRM_FORMAT_MOD_LINEAR &&
607 format == DRM_FORMAT_ARGB8888;
611 intel_legacy_cursor_update(struct drm_plane *_plane,
612 struct drm_crtc *_crtc,
613 struct drm_framebuffer *fb,
614 int crtc_x, int crtc_y,
615 unsigned int crtc_w, unsigned int crtc_h,
616 u32 src_x, u32 src_y,
617 u32 src_w, u32 src_h,
618 struct drm_modeset_acquire_ctx *ctx)
620 struct intel_plane *plane = to_intel_plane(_plane);
621 struct intel_crtc *crtc = to_intel_crtc(_crtc);
622 struct intel_plane_state *old_plane_state =
623 to_intel_plane_state(plane->base.state);
624 struct intel_plane_state *new_plane_state;
625 struct intel_crtc_state *crtc_state =
626 to_intel_crtc_state(crtc->base.state);
627 struct intel_crtc_state *new_crtc_state;
631 * When crtc is inactive or there is a modeset pending,
632 * wait for it to complete in the slowpath
634 * FIXME bigjoiner fastpath would be good
636 if (!crtc_state->hw.active || intel_crtc_needs_modeset(crtc_state) ||
637 crtc_state->update_pipe || crtc_state->bigjoiner)
641 * Don't do an async update if there is an outstanding commit modifying
642 * the plane. This prevents our async update's changes from getting
643 * overridden by a previous synchronous update's state.
645 if (old_plane_state->uapi.commit &&
646 !try_wait_for_completion(&old_plane_state->uapi.commit->hw_done))
650 * If any parameters change that may affect watermarks,
651 * take the slowpath. Only changing fb or position should be
654 if (old_plane_state->uapi.crtc != &crtc->base ||
655 old_plane_state->uapi.src_w != src_w ||
656 old_plane_state->uapi.src_h != src_h ||
657 old_plane_state->uapi.crtc_w != crtc_w ||
658 old_plane_state->uapi.crtc_h != crtc_h ||
659 !old_plane_state->uapi.fb != !fb)
662 new_plane_state = to_intel_plane_state(intel_plane_duplicate_state(&plane->base));
663 if (!new_plane_state)
666 new_crtc_state = to_intel_crtc_state(intel_crtc_duplicate_state(&crtc->base));
667 if (!new_crtc_state) {
672 drm_atomic_set_fb_for_plane(&new_plane_state->uapi, fb);
674 new_plane_state->uapi.src_x = src_x;
675 new_plane_state->uapi.src_y = src_y;
676 new_plane_state->uapi.src_w = src_w;
677 new_plane_state->uapi.src_h = src_h;
678 new_plane_state->uapi.crtc_x = crtc_x;
679 new_plane_state->uapi.crtc_y = crtc_y;
680 new_plane_state->uapi.crtc_w = crtc_w;
681 new_plane_state->uapi.crtc_h = crtc_h;
683 intel_plane_copy_uapi_to_hw_state(new_plane_state, new_plane_state, crtc);
685 ret = intel_plane_atomic_check_with_state(crtc_state, new_crtc_state,
686 old_plane_state, new_plane_state);
690 ret = intel_plane_pin_fb(new_plane_state);
694 intel_frontbuffer_flush(to_intel_frontbuffer(new_plane_state->hw.fb),
696 intel_frontbuffer_track(to_intel_frontbuffer(old_plane_state->hw.fb),
697 to_intel_frontbuffer(new_plane_state->hw.fb),
698 plane->frontbuffer_bit);
700 /* Swap plane state */
701 plane->base.state = &new_plane_state->uapi;
704 * We cannot swap crtc_state as it may be in use by an atomic commit or
705 * page flip that's running simultaneously. If we swap crtc_state and
706 * destroy the old state, we will cause a use-after-free there.
708 * Only update active_planes, which is needed for our internal
709 * bookkeeping. Either value will do the right thing when updating
710 * planes atomically. If the cursor was part of the atomic update then
711 * we would have taken the slowpath.
713 crtc_state->active_planes = new_crtc_state->active_planes;
715 if (new_plane_state->uapi.visible)
716 intel_update_plane(plane, crtc_state, new_plane_state);
718 intel_disable_plane(plane, crtc_state);
720 intel_plane_unpin_fb(old_plane_state);
724 intel_crtc_destroy_state(&crtc->base, &new_crtc_state->uapi);
726 intel_plane_destroy_state(&plane->base, &new_plane_state->uapi);
728 intel_plane_destroy_state(&plane->base, &old_plane_state->uapi);
732 return drm_atomic_helper_update_plane(&plane->base, &crtc->base, fb,
733 crtc_x, crtc_y, crtc_w, crtc_h,
734 src_x, src_y, src_w, src_h, ctx);
737 static const struct drm_plane_funcs intel_cursor_plane_funcs = {
738 .update_plane = intel_legacy_cursor_update,
739 .disable_plane = drm_atomic_helper_disable_plane,
740 .destroy = intel_plane_destroy,
741 .atomic_duplicate_state = intel_plane_duplicate_state,
742 .atomic_destroy_state = intel_plane_destroy_state,
743 .format_mod_supported = intel_cursor_format_mod_supported,
747 intel_cursor_plane_create(struct drm_i915_private *dev_priv,
750 struct intel_plane *cursor;
753 cursor = intel_plane_alloc();
758 cursor->i9xx_plane = (enum i9xx_plane_id) pipe;
759 cursor->id = PLANE_CURSOR;
760 cursor->frontbuffer_bit = INTEL_FRONTBUFFER(pipe, cursor->id);
762 if (IS_I845G(dev_priv) || IS_I865G(dev_priv)) {
763 cursor->max_stride = i845_cursor_max_stride;
764 cursor->update_plane = i845_update_cursor;
765 cursor->disable_plane = i845_disable_cursor;
766 cursor->get_hw_state = i845_cursor_get_hw_state;
767 cursor->check_plane = i845_check_cursor;
769 cursor->max_stride = i9xx_cursor_max_stride;
770 cursor->update_plane = i9xx_update_cursor;
771 cursor->disable_plane = i9xx_disable_cursor;
772 cursor->get_hw_state = i9xx_cursor_get_hw_state;
773 cursor->check_plane = i9xx_check_cursor;
776 cursor->cursor.base = ~0;
777 cursor->cursor.cntl = ~0;
779 if (IS_I845G(dev_priv) || IS_I865G(dev_priv) || HAS_CUR_FBC(dev_priv))
780 cursor->cursor.size = ~0;
782 ret = drm_universal_plane_init(&dev_priv->drm, &cursor->base,
783 0, &intel_cursor_plane_funcs,
784 intel_cursor_formats,
785 ARRAY_SIZE(intel_cursor_formats),
786 cursor_format_modifiers,
787 DRM_PLANE_TYPE_CURSOR,
788 "cursor %c", pipe_name(pipe));
792 if (DISPLAY_VER(dev_priv) >= 4)
793 drm_plane_create_rotation_property(&cursor->base,
796 DRM_MODE_ROTATE_180);
798 zpos = RUNTIME_INFO(dev_priv)->num_sprites[pipe] + 1;
799 drm_plane_create_zpos_immutable_property(&cursor->base, zpos);
801 if (DISPLAY_VER(dev_priv) >= 12)
802 drm_plane_enable_fb_damage_clips(&cursor->base);
804 drm_plane_helper_add(&cursor->base, &intel_plane_helper_funcs);
809 intel_plane_free(cursor);