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"
20 #include "intel_fb_pin.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 u32 intel_cursor_base(const struct intel_plane_state *plane_state)
33 struct drm_i915_private *dev_priv =
34 to_i915(plane_state->uapi.plane->dev);
35 const struct drm_framebuffer *fb = plane_state->hw.fb;
36 const struct drm_i915_gem_object *obj = intel_fb_obj(fb);
39 if (INTEL_INFO(dev_priv)->display.cursor_needs_physical)
40 base = sg_dma_address(obj->mm.pages->sgl);
42 base = intel_plane_ggtt_offset(plane_state);
44 return base + plane_state->view.color_plane[0].offset;
47 static u32 intel_cursor_position(const struct intel_plane_state *plane_state)
49 int x = plane_state->uapi.dst.x1;
50 int y = plane_state->uapi.dst.y1;
54 pos |= CURSOR_POS_X_SIGN;
57 pos |= CURSOR_POS_X(x);
60 pos |= CURSOR_POS_Y_SIGN;
63 pos |= CURSOR_POS_Y(y);
68 static bool intel_cursor_size_ok(const struct intel_plane_state *plane_state)
70 const struct drm_mode_config *config =
71 &plane_state->uapi.plane->dev->mode_config;
72 int width = drm_rect_width(&plane_state->uapi.dst);
73 int height = drm_rect_height(&plane_state->uapi.dst);
75 return width > 0 && width <= config->cursor_width &&
76 height > 0 && height <= config->cursor_height;
79 static int intel_cursor_check_surface(struct intel_plane_state *plane_state)
81 struct drm_i915_private *dev_priv =
82 to_i915(plane_state->uapi.plane->dev);
83 unsigned int rotation = plane_state->hw.rotation;
88 ret = intel_plane_compute_gtt(plane_state);
92 if (!plane_state->uapi.visible)
95 src_x = plane_state->uapi.src.x1 >> 16;
96 src_y = plane_state->uapi.src.y1 >> 16;
98 intel_add_fb_offsets(&src_x, &src_y, plane_state, 0);
99 offset = intel_plane_compute_aligned_offset(&src_x, &src_y,
102 if (src_x != 0 || src_y != 0) {
103 drm_dbg_kms(&dev_priv->drm,
104 "Arbitrary cursor panning not supported\n");
109 * Put the final coordinates back so that the src
110 * coordinate checks will see the right values.
112 drm_rect_translate_to(&plane_state->uapi.src,
113 src_x << 16, src_y << 16);
115 /* ILK+ do this automagically in hardware */
116 if (HAS_GMCH(dev_priv) && rotation & DRM_MODE_ROTATE_180) {
117 const struct drm_framebuffer *fb = plane_state->hw.fb;
118 int src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
119 int src_h = drm_rect_height(&plane_state->uapi.src) >> 16;
121 offset += (src_h * src_w - 1) * fb->format->cpp[0];
124 plane_state->view.color_plane[0].offset = offset;
125 plane_state->view.color_plane[0].x = src_x;
126 plane_state->view.color_plane[0].y = src_y;
131 static int intel_check_cursor(struct intel_crtc_state *crtc_state,
132 struct intel_plane_state *plane_state)
134 const struct drm_framebuffer *fb = plane_state->hw.fb;
135 struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev);
136 const struct drm_rect src = plane_state->uapi.src;
137 const struct drm_rect dst = plane_state->uapi.dst;
140 if (fb && fb->modifier != DRM_FORMAT_MOD_LINEAR) {
141 drm_dbg_kms(&i915->drm, "cursor cannot be tiled\n");
145 ret = intel_atomic_plane_check_clipping(plane_state, crtc_state,
146 DRM_PLANE_HELPER_NO_SCALING,
147 DRM_PLANE_HELPER_NO_SCALING,
152 /* Use the unclipped src/dst rectangles, which we program to hw */
153 plane_state->uapi.src = src;
154 plane_state->uapi.dst = dst;
156 /* final plane coordinates will be relative to the plane's pipe */
157 drm_rect_translate(&plane_state->uapi.dst,
158 -crtc_state->pipe_src.x1,
159 -crtc_state->pipe_src.y1);
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_PIPE_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].mapping_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].mapping_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 /* TODO: split into noarm+arm pair */
257 static void i845_cursor_update_arm(struct intel_plane *plane,
258 const struct intel_crtc_state *crtc_state,
259 const struct intel_plane_state *plane_state)
261 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
262 u32 cntl = 0, base = 0, pos = 0, size = 0;
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 = CURSOR_HEIGHT(height) | CURSOR_WIDTH(width);
273 base = intel_cursor_base(plane_state);
274 pos = intel_cursor_position(plane_state);
277 /* On these chipsets we can only modify the base/size/stride
278 * whilst the cursor is disabled.
280 if (plane->cursor.base != base ||
281 plane->cursor.size != size ||
282 plane->cursor.cntl != cntl) {
283 intel_de_write_fw(dev_priv, CURCNTR(PIPE_A), 0);
284 intel_de_write_fw(dev_priv, CURBASE(PIPE_A), base);
285 intel_de_write_fw(dev_priv, CURSIZE(PIPE_A), size);
286 intel_de_write_fw(dev_priv, CURPOS(PIPE_A), pos);
287 intel_de_write_fw(dev_priv, CURCNTR(PIPE_A), cntl);
289 plane->cursor.base = base;
290 plane->cursor.size = size;
291 plane->cursor.cntl = cntl;
293 intel_de_write_fw(dev_priv, CURPOS(PIPE_A), pos);
297 static void i845_cursor_disable_arm(struct intel_plane *plane,
298 const struct intel_crtc_state *crtc_state)
300 i845_cursor_update_arm(plane, crtc_state, NULL);
303 static bool i845_cursor_get_hw_state(struct intel_plane *plane,
306 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
307 enum intel_display_power_domain power_domain;
308 intel_wakeref_t wakeref;
311 power_domain = POWER_DOMAIN_PIPE(PIPE_A);
312 wakeref = intel_display_power_get_if_enabled(dev_priv, power_domain);
316 ret = intel_de_read(dev_priv, CURCNTR(PIPE_A)) & CURSOR_ENABLE;
320 intel_display_power_put(dev_priv, power_domain, wakeref);
326 i9xx_cursor_max_stride(struct intel_plane *plane,
327 u32 pixel_format, u64 modifier,
328 unsigned int rotation)
330 return plane->base.dev->mode_config.cursor_width * 4;
333 static u32 i9xx_cursor_ctl_crtc(const struct intel_crtc_state *crtc_state)
335 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
336 struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
339 if (DISPLAY_VER(dev_priv) >= 11)
342 if (crtc_state->gamma_enable)
343 cntl = MCURSOR_PIPE_GAMMA_ENABLE;
345 if (crtc_state->csc_enable)
346 cntl |= MCURSOR_PIPE_CSC_ENABLE;
348 if (DISPLAY_VER(dev_priv) < 5 && !IS_G4X(dev_priv))
349 cntl |= MCURSOR_PIPE_SEL(crtc->pipe);
354 static u32 i9xx_cursor_ctl(const struct intel_crtc_state *crtc_state,
355 const struct intel_plane_state *plane_state)
357 struct drm_i915_private *dev_priv =
358 to_i915(plane_state->uapi.plane->dev);
361 if (IS_SANDYBRIDGE(dev_priv) || IS_IVYBRIDGE(dev_priv))
362 cntl |= MCURSOR_TRICKLE_FEED_DISABLE;
364 switch (drm_rect_width(&plane_state->uapi.dst)) {
366 cntl |= MCURSOR_MODE_64_ARGB_AX;
369 cntl |= MCURSOR_MODE_128_ARGB_AX;
372 cntl |= MCURSOR_MODE_256_ARGB_AX;
375 MISSING_CASE(drm_rect_width(&plane_state->uapi.dst));
379 if (plane_state->hw.rotation & DRM_MODE_ROTATE_180)
380 cntl |= MCURSOR_ROTATE_180;
382 /* Wa_22012358565:adl-p */
383 if (DISPLAY_VER(dev_priv) == 13)
384 cntl |= MCURSOR_ARB_SLOTS(1);
389 static bool i9xx_cursor_size_ok(const struct intel_plane_state *plane_state)
391 struct drm_i915_private *dev_priv =
392 to_i915(plane_state->uapi.plane->dev);
393 int width = drm_rect_width(&plane_state->uapi.dst);
394 int height = drm_rect_height(&plane_state->uapi.dst);
396 if (!intel_cursor_size_ok(plane_state))
399 /* Cursor width is limited to a few power-of-two sizes */
410 * IVB+ have CUR_FBC_CTL which allows an arbitrary cursor
411 * height from 8 lines up to the cursor width, when the
412 * cursor is not rotated. Everything else requires square
415 if (HAS_CUR_FBC(dev_priv) &&
416 plane_state->hw.rotation & DRM_MODE_ROTATE_0) {
417 if (height < 8 || height > width)
427 static int i9xx_check_cursor(struct intel_crtc_state *crtc_state,
428 struct intel_plane_state *plane_state)
430 struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
431 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
432 const struct drm_framebuffer *fb = plane_state->hw.fb;
433 enum pipe pipe = plane->pipe;
436 ret = intel_check_cursor(crtc_state, plane_state);
440 /* if we want to turn off the cursor ignore width and height */
444 /* Check for which cursor types we support */
445 if (!i9xx_cursor_size_ok(plane_state)) {
446 drm_dbg(&dev_priv->drm,
447 "Cursor dimension %dx%d not supported\n",
448 drm_rect_width(&plane_state->uapi.dst),
449 drm_rect_height(&plane_state->uapi.dst));
453 drm_WARN_ON(&dev_priv->drm, plane_state->uapi.visible &&
454 plane_state->view.color_plane[0].mapping_stride != fb->pitches[0]);
456 if (fb->pitches[0] !=
457 drm_rect_width(&plane_state->uapi.dst) * fb->format->cpp[0]) {
458 drm_dbg_kms(&dev_priv->drm,
459 "Invalid cursor stride (%u) (cursor width %d)\n",
461 drm_rect_width(&plane_state->uapi.dst));
466 * There's something wrong with the cursor on CHV pipe C.
467 * If it straddles the left edge of the screen then
468 * moving it away from the edge or disabling it often
469 * results in a pipe underrun, and often that can lead to
470 * dead pipe (constant underrun reported, and it scans
471 * out just a solid color). To recover from that, the
472 * display power well must be turned off and on again.
473 * Refuse the put the cursor into that compromised position.
475 if (IS_CHERRYVIEW(dev_priv) && pipe == PIPE_C &&
476 plane_state->uapi.visible && plane_state->uapi.dst.x1 < 0) {
477 drm_dbg_kms(&dev_priv->drm,
478 "CHV cursor C not allowed to straddle the left screen edge\n");
482 plane_state->ctl = i9xx_cursor_ctl(crtc_state, plane_state);
487 /* TODO: split into noarm+arm pair */
488 static void i9xx_cursor_update_arm(struct intel_plane *plane,
489 const struct intel_crtc_state *crtc_state,
490 const struct intel_plane_state *plane_state)
492 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
493 enum pipe pipe = plane->pipe;
494 u32 cntl = 0, base = 0, pos = 0, fbc_ctl = 0;
496 if (plane_state && plane_state->uapi.visible) {
497 int width = drm_rect_width(&plane_state->uapi.dst);
498 int height = drm_rect_height(&plane_state->uapi.dst);
500 cntl = plane_state->ctl |
501 i9xx_cursor_ctl_crtc(crtc_state);
504 fbc_ctl = CUR_FBC_EN | CUR_FBC_HEIGHT(height - 1);
506 base = intel_cursor_base(plane_state);
507 pos = intel_cursor_position(plane_state);
511 * On some platforms writing CURCNTR first will also
512 * cause CURPOS to be armed by the CURBASE write.
513 * Without the CURCNTR write the CURPOS write would
514 * arm itself. Thus we always update CURCNTR before
517 * On other platforms CURPOS always requires the
518 * CURBASE write to arm the update. Additonally
519 * a write to any of the cursor register will cancel
520 * an already armed cursor update. Thus leaving out
521 * the CURBASE write after CURPOS could lead to a
522 * cursor that doesn't appear to move, or even change
523 * shape. Thus we always write CURBASE.
525 * The other registers are armed by the CURBASE write
526 * except when the plane is getting enabled at which time
527 * the CURCNTR write arms the update.
530 if (DISPLAY_VER(dev_priv) >= 9)
531 skl_write_cursor_wm(plane, crtc_state);
534 intel_psr2_program_plane_sel_fetch(plane, crtc_state, plane_state, 0);
536 intel_psr2_disable_plane_sel_fetch(plane, crtc_state);
538 if (plane->cursor.base != base ||
539 plane->cursor.size != fbc_ctl ||
540 plane->cursor.cntl != cntl) {
541 if (HAS_CUR_FBC(dev_priv))
542 intel_de_write_fw(dev_priv, CUR_FBC_CTL(pipe),
544 intel_de_write_fw(dev_priv, CURCNTR(pipe), cntl);
545 intel_de_write_fw(dev_priv, CURPOS(pipe), pos);
546 intel_de_write_fw(dev_priv, CURBASE(pipe), base);
548 plane->cursor.base = base;
549 plane->cursor.size = fbc_ctl;
550 plane->cursor.cntl = cntl;
552 intel_de_write_fw(dev_priv, CURPOS(pipe), pos);
553 intel_de_write_fw(dev_priv, CURBASE(pipe), base);
557 static void i9xx_cursor_disable_arm(struct intel_plane *plane,
558 const struct intel_crtc_state *crtc_state)
560 i9xx_cursor_update_arm(plane, crtc_state, NULL);
563 static bool i9xx_cursor_get_hw_state(struct intel_plane *plane,
566 struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
567 enum intel_display_power_domain power_domain;
568 intel_wakeref_t wakeref;
573 * Not 100% correct for planes that can move between pipes,
574 * but that's only the case for gen2-3 which don't have any
575 * display power wells.
577 power_domain = POWER_DOMAIN_PIPE(plane->pipe);
578 wakeref = intel_display_power_get_if_enabled(dev_priv, power_domain);
582 val = intel_de_read(dev_priv, CURCNTR(plane->pipe));
584 ret = val & MCURSOR_MODE_MASK;
586 if (DISPLAY_VER(dev_priv) >= 5 || IS_G4X(dev_priv))
589 *pipe = REG_FIELD_GET(MCURSOR_PIPE_SEL_MASK, val);
591 intel_display_power_put(dev_priv, power_domain, wakeref);
596 static bool intel_cursor_format_mod_supported(struct drm_plane *_plane,
597 u32 format, u64 modifier)
599 if (!intel_fb_plane_supports_modifier(to_intel_plane(_plane), modifier))
602 return format == DRM_FORMAT_ARGB8888;
606 intel_legacy_cursor_update(struct drm_plane *_plane,
607 struct drm_crtc *_crtc,
608 struct drm_framebuffer *fb,
609 int crtc_x, int crtc_y,
610 unsigned int crtc_w, unsigned int crtc_h,
611 u32 src_x, u32 src_y,
612 u32 src_w, u32 src_h,
613 struct drm_modeset_acquire_ctx *ctx)
615 struct intel_plane *plane = to_intel_plane(_plane);
616 struct intel_crtc *crtc = to_intel_crtc(_crtc);
617 struct intel_plane_state *old_plane_state =
618 to_intel_plane_state(plane->base.state);
619 struct intel_plane_state *new_plane_state;
620 struct intel_crtc_state *crtc_state =
621 to_intel_crtc_state(crtc->base.state);
622 struct intel_crtc_state *new_crtc_state;
626 * When crtc is inactive or there is a modeset pending,
627 * wait for it to complete in the slowpath.
628 * PSR2 selective fetch also requires the slow path as
629 * PSR2 plane and transcoder registers can only be updated during
632 * FIXME bigjoiner fastpath would be good
634 if (!crtc_state->hw.active || intel_crtc_needs_modeset(crtc_state) ||
635 crtc_state->update_pipe || crtc_state->bigjoiner_pipes)
639 * Don't do an async update if there is an outstanding commit modifying
640 * the plane. This prevents our async update's changes from getting
641 * overridden by a previous synchronous update's state.
643 if (old_plane_state->uapi.commit &&
644 !try_wait_for_completion(&old_plane_state->uapi.commit->hw_done))
648 * If any parameters change that may affect watermarks,
649 * take the slowpath. Only changing fb or position should be
652 if (old_plane_state->uapi.crtc != &crtc->base ||
653 old_plane_state->uapi.src_w != src_w ||
654 old_plane_state->uapi.src_h != src_h ||
655 old_plane_state->uapi.crtc_w != crtc_w ||
656 old_plane_state->uapi.crtc_h != crtc_h ||
657 !old_plane_state->uapi.fb != !fb)
660 new_plane_state = to_intel_plane_state(intel_plane_duplicate_state(&plane->base));
661 if (!new_plane_state)
664 new_crtc_state = to_intel_crtc_state(intel_crtc_duplicate_state(&crtc->base));
665 if (!new_crtc_state) {
670 drm_atomic_set_fb_for_plane(&new_plane_state->uapi, fb);
672 new_plane_state->uapi.src_x = src_x;
673 new_plane_state->uapi.src_y = src_y;
674 new_plane_state->uapi.src_w = src_w;
675 new_plane_state->uapi.src_h = src_h;
676 new_plane_state->uapi.crtc_x = crtc_x;
677 new_plane_state->uapi.crtc_y = crtc_y;
678 new_plane_state->uapi.crtc_w = crtc_w;
679 new_plane_state->uapi.crtc_h = crtc_h;
681 intel_plane_copy_uapi_to_hw_state(new_plane_state, new_plane_state, crtc);
683 ret = intel_plane_atomic_check_with_state(crtc_state, new_crtc_state,
684 old_plane_state, new_plane_state);
688 ret = intel_plane_pin_fb(new_plane_state);
692 intel_frontbuffer_flush(to_intel_frontbuffer(new_plane_state->hw.fb),
693 ORIGIN_CURSOR_UPDATE);
694 intel_frontbuffer_track(to_intel_frontbuffer(old_plane_state->hw.fb),
695 to_intel_frontbuffer(new_plane_state->hw.fb),
696 plane->frontbuffer_bit);
698 /* Swap plane state */
699 plane->base.state = &new_plane_state->uapi;
702 * We cannot swap crtc_state as it may be in use by an atomic commit or
703 * page flip that's running simultaneously. If we swap crtc_state and
704 * destroy the old state, we will cause a use-after-free there.
706 * Only update active_planes, which is needed for our internal
707 * bookkeeping. Either value will do the right thing when updating
708 * planes atomically. If the cursor was part of the atomic update then
709 * we would have taken the slowpath.
711 crtc_state->active_planes = new_crtc_state->active_planes;
714 * Technically we should do a vblank evasion here to make
715 * sure all the cursor registers update on the same frame.
716 * For now just make sure the register writes happen as
717 * quickly as possible to minimize the race window.
721 if (new_plane_state->uapi.visible) {
722 intel_plane_update_noarm(plane, crtc_state, new_plane_state);
723 intel_plane_update_arm(plane, crtc_state, new_plane_state);
725 intel_plane_disable_arm(plane, crtc_state);
730 intel_plane_unpin_fb(old_plane_state);
734 intel_crtc_destroy_state(&crtc->base, &new_crtc_state->uapi);
736 intel_plane_destroy_state(&plane->base, &new_plane_state->uapi);
738 intel_plane_destroy_state(&plane->base, &old_plane_state->uapi);
742 return drm_atomic_helper_update_plane(&plane->base, &crtc->base, fb,
743 crtc_x, crtc_y, crtc_w, crtc_h,
744 src_x, src_y, src_w, src_h, ctx);
747 static const struct drm_plane_funcs intel_cursor_plane_funcs = {
748 .update_plane = intel_legacy_cursor_update,
749 .disable_plane = drm_atomic_helper_disable_plane,
750 .destroy = intel_plane_destroy,
751 .atomic_duplicate_state = intel_plane_duplicate_state,
752 .atomic_destroy_state = intel_plane_destroy_state,
753 .format_mod_supported = intel_cursor_format_mod_supported,
757 intel_cursor_plane_create(struct drm_i915_private *dev_priv,
760 struct intel_plane *cursor;
764 cursor = intel_plane_alloc();
769 cursor->i9xx_plane = (enum i9xx_plane_id) pipe;
770 cursor->id = PLANE_CURSOR;
771 cursor->frontbuffer_bit = INTEL_FRONTBUFFER(pipe, cursor->id);
773 if (IS_I845G(dev_priv) || IS_I865G(dev_priv)) {
774 cursor->max_stride = i845_cursor_max_stride;
775 cursor->update_arm = i845_cursor_update_arm;
776 cursor->disable_arm = i845_cursor_disable_arm;
777 cursor->get_hw_state = i845_cursor_get_hw_state;
778 cursor->check_plane = i845_check_cursor;
780 cursor->max_stride = i9xx_cursor_max_stride;
781 cursor->update_arm = i9xx_cursor_update_arm;
782 cursor->disable_arm = i9xx_cursor_disable_arm;
783 cursor->get_hw_state = i9xx_cursor_get_hw_state;
784 cursor->check_plane = i9xx_check_cursor;
787 cursor->cursor.base = ~0;
788 cursor->cursor.cntl = ~0;
790 if (IS_I845G(dev_priv) || IS_I865G(dev_priv) || HAS_CUR_FBC(dev_priv))
791 cursor->cursor.size = ~0;
793 modifiers = intel_fb_plane_get_modifiers(dev_priv, INTEL_PLANE_CAP_NONE);
795 ret = drm_universal_plane_init(&dev_priv->drm, &cursor->base,
796 0, &intel_cursor_plane_funcs,
797 intel_cursor_formats,
798 ARRAY_SIZE(intel_cursor_formats),
800 DRM_PLANE_TYPE_CURSOR,
801 "cursor %c", pipe_name(pipe));
808 if (DISPLAY_VER(dev_priv) >= 4)
809 drm_plane_create_rotation_property(&cursor->base,
812 DRM_MODE_ROTATE_180);
814 zpos = RUNTIME_INFO(dev_priv)->num_sprites[pipe] + 1;
815 drm_plane_create_zpos_immutable_property(&cursor->base, zpos);
817 if (DISPLAY_VER(dev_priv) >= 12)
818 drm_plane_enable_fb_damage_clips(&cursor->base);
820 intel_plane_helper_add(cursor);
825 intel_plane_free(cursor);