aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h4
-rw-r--r--drivers/gpu/drm/i915/intel_display.c53
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h7
3 files changed, 59 insertions, 5 deletions
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 6174fda4d58e..74f7d853eb58 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -3553,7 +3553,11 @@ enum punit_power_well {
3553/* New style CUR*CNTR flags */ 3553/* New style CUR*CNTR flags */
3554#define CURSOR_MODE 0x27 3554#define CURSOR_MODE 0x27
3555#define CURSOR_MODE_DISABLE 0x00 3555#define CURSOR_MODE_DISABLE 0x00
3556#define CURSOR_MODE_128_32B_AX 0x02
3557#define CURSOR_MODE_256_32B_AX 0x03
3556#define CURSOR_MODE_64_32B_AX 0x07 3558#define CURSOR_MODE_64_32B_AX 0x07
3559#define CURSOR_MODE_128_ARGB_AX ((1 << 5) | CURSOR_MODE_128_32B_AX)
3560#define CURSOR_MODE_256_ARGB_AX ((1 << 5) | CURSOR_MODE_256_32B_AX)
3557#define CURSOR_MODE_64_ARGB_AX ((1 << 5) | CURSOR_MODE_64_32B_AX) 3561#define CURSOR_MODE_64_ARGB_AX ((1 << 5) | CURSOR_MODE_64_32B_AX)
3558#define MCURSOR_PIPE_SELECT (1 << 28) 3562#define MCURSOR_PIPE_SELECT (1 << 28)
3559#define MCURSOR_PIPE_A 0x00 3563#define MCURSOR_PIPE_A 0x00
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 5f68491ae99a..7be5984431bb 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -7599,10 +7599,26 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base)
7599 bool visible = base != 0; 7599 bool visible = base != 0;
7600 7600
7601 if (intel_crtc->cursor_visible != visible) { 7601 if (intel_crtc->cursor_visible != visible) {
7602 int16_t width = intel_crtc->cursor_width;
7602 uint32_t cntl = I915_READ(CURCNTR(pipe)); 7603 uint32_t cntl = I915_READ(CURCNTR(pipe));
7603 if (base) { 7604 if (base) {
7604 cntl &= ~(CURSOR_MODE | MCURSOR_PIPE_SELECT); 7605 cntl &= ~(CURSOR_MODE | MCURSOR_PIPE_SELECT);
7605 cntl |= CURSOR_MODE_64_ARGB_AX | MCURSOR_GAMMA_ENABLE; 7606 cntl |= MCURSOR_GAMMA_ENABLE;
7607
7608 switch (width) {
7609 case 64:
7610 cntl |= CURSOR_MODE_64_ARGB_AX;
7611 break;
7612 case 128:
7613 cntl |= CURSOR_MODE_128_ARGB_AX;
7614 break;
7615 case 256:
7616 cntl |= CURSOR_MODE_256_ARGB_AX;
7617 break;
7618 default:
7619 WARN_ON(1);
7620 return;
7621 }
7606 cntl |= pipe << 28; /* Connect to correct pipe */ 7622 cntl |= pipe << 28; /* Connect to correct pipe */
7607 } else { 7623 } else {
7608 cntl &= ~(CURSOR_MODE | MCURSOR_GAMMA_ENABLE); 7624 cntl &= ~(CURSOR_MODE | MCURSOR_GAMMA_ENABLE);
@@ -7627,10 +7643,25 @@ static void ivb_update_cursor(struct drm_crtc *crtc, u32 base)
7627 bool visible = base != 0; 7643 bool visible = base != 0;
7628 7644
7629 if (intel_crtc->cursor_visible != visible) { 7645 if (intel_crtc->cursor_visible != visible) {
7646 int16_t width = intel_crtc->cursor_width;
7630 uint32_t cntl = I915_READ(CURCNTR_IVB(pipe)); 7647 uint32_t cntl = I915_READ(CURCNTR_IVB(pipe));
7631 if (base) { 7648 if (base) {
7632 cntl &= ~CURSOR_MODE; 7649 cntl &= ~CURSOR_MODE;
7633 cntl |= CURSOR_MODE_64_ARGB_AX | MCURSOR_GAMMA_ENABLE; 7650 cntl |= MCURSOR_GAMMA_ENABLE;
7651 switch (width) {
7652 case 64:
7653 cntl |= CURSOR_MODE_64_ARGB_AX;
7654 break;
7655 case 128:
7656 cntl |= CURSOR_MODE_128_ARGB_AX;
7657 break;
7658 case 256:
7659 cntl |= CURSOR_MODE_256_ARGB_AX;
7660 break;
7661 default:
7662 WARN_ON(1);
7663 return;
7664 }
7634 } else { 7665 } else {
7635 cntl &= ~(CURSOR_MODE | MCURSOR_GAMMA_ENABLE); 7666 cntl &= ~(CURSOR_MODE | MCURSOR_GAMMA_ENABLE);
7636 cntl |= CURSOR_MODE_DISABLE; 7667 cntl |= CURSOR_MODE_DISABLE;
@@ -7726,9 +7757,11 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
7726 goto finish; 7757 goto finish;
7727 } 7758 }
7728 7759
7729 /* Currently we only support 64x64 cursors */ 7760 /* Check for which cursor types we support */
7730 if (width != 64 || height != 64) { 7761 if (!((width == 64 && height == 64) ||
7731 DRM_ERROR("we currently only support 64x64 cursors\n"); 7762 (width == 128 && height == 128 && !IS_GEN2(dev)) ||
7763 (width == 256 && height == 256 && !IS_GEN2(dev)))) {
7764 DRM_DEBUG("Cursor dimension not supported\n");
7732 return -EINVAL; 7765 return -EINVAL;
7733 } 7766 }
7734 7767
@@ -10514,6 +10547,16 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)
10514 10547
10515 drm_crtc_init(dev, &intel_crtc->base, &intel_crtc_funcs); 10548 drm_crtc_init(dev, &intel_crtc->base, &intel_crtc_funcs);
10516 10549
10550 if (IS_GEN2(dev)) {
10551 intel_crtc->max_cursor_width = GEN2_CURSOR_WIDTH;
10552 intel_crtc->max_cursor_height = GEN2_CURSOR_HEIGHT;
10553 } else {
10554 intel_crtc->max_cursor_width = CURSOR_WIDTH;
10555 intel_crtc->max_cursor_height = CURSOR_HEIGHT;
10556 }
10557 dev->mode_config.cursor_width = intel_crtc->max_cursor_width;
10558 dev->mode_config.cursor_height = intel_crtc->max_cursor_height;
10559
10517 drm_mode_crtc_set_gamma_size(&intel_crtc->base, 256); 10560 drm_mode_crtc_set_gamma_size(&intel_crtc->base, 256);
10518 for (i = 0; i < 256; i++) { 10561 for (i = 0; i < 256; i++) {
10519 intel_crtc->lut_r[i] = i; 10562 intel_crtc->lut_r[i] = i;
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 60ffad376390..fa9910481ab0 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -78,6 +78,12 @@
78#define MAX_OUTPUTS 6 78#define MAX_OUTPUTS 6
79/* maximum connectors per crtcs in the mode set */ 79/* maximum connectors per crtcs in the mode set */
80 80
81/* Maximum cursor sizes */
82#define GEN2_CURSOR_WIDTH 64
83#define GEN2_CURSOR_HEIGHT 64
84#define CURSOR_WIDTH 256
85#define CURSOR_HEIGHT 256
86
81#define INTEL_I2C_BUS_DVO 1 87#define INTEL_I2C_BUS_DVO 1
82#define INTEL_I2C_BUS_SDVO 2 88#define INTEL_I2C_BUS_SDVO 2
83 89
@@ -367,6 +373,7 @@ struct intel_crtc {
367 uint32_t cursor_addr; 373 uint32_t cursor_addr;
368 int16_t cursor_x, cursor_y; 374 int16_t cursor_x, cursor_y;
369 int16_t cursor_width, cursor_height; 375 int16_t cursor_width, cursor_height;
376 int16_t max_cursor_width, max_cursor_height;
370 bool cursor_visible; 377 bool cursor_visible;
371 378
372 struct intel_plane_config plane_config; 379 struct intel_plane_config plane_config;