diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2015-12-14 06:16:48 -0500 |
---|---|---|
committer | Jani Nikula <jani.nikula@intel.com> | 2015-12-22 04:51:28 -0500 |
commit | 615cb24326bbe19834a1aba47677a6c80bdcfc01 (patch) | |
tree | 966e73b7c9384a0596afca13bdb52c9d65d6a04c /drivers/gpu | |
parent | 4ef7675344d687a0ef5b0d7c0cee12da005870c0 (diff) |
drm/i915: Drop the broken cursor base==0 special casing
The cursor code tries to treat base==0 to mean disabled. That fails
when the cursor bo gets bound at ggtt offset 0, and the user is left
looking at an invisible cursor.
We lose the disabled->disabled optimization, but that seems like
something better handled at a slightly higher level.
Cc: drm-intel-fixes@lists.freedesktop.org
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1450091808-32607-3-git-send-email-ville.syrjala@linux.intel.com
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
(cherry picked from commit 663f3122d00c0b412d429f105dca129aa8f4f094)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 62211abe4922..1bdf995a98df 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -9910,14 +9910,14 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc, | |||
9910 | return true; | 9910 | return true; |
9911 | } | 9911 | } |
9912 | 9912 | ||
9913 | static void i845_update_cursor(struct drm_crtc *crtc, u32 base) | 9913 | static void i845_update_cursor(struct drm_crtc *crtc, u32 base, bool on) |
9914 | { | 9914 | { |
9915 | struct drm_device *dev = crtc->dev; | 9915 | struct drm_device *dev = crtc->dev; |
9916 | struct drm_i915_private *dev_priv = dev->dev_private; | 9916 | struct drm_i915_private *dev_priv = dev->dev_private; |
9917 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 9917 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
9918 | uint32_t cntl = 0, size = 0; | 9918 | uint32_t cntl = 0, size = 0; |
9919 | 9919 | ||
9920 | if (base) { | 9920 | if (on) { |
9921 | unsigned int width = intel_crtc->base.cursor->state->crtc_w; | 9921 | unsigned int width = intel_crtc->base.cursor->state->crtc_w; |
9922 | unsigned int height = intel_crtc->base.cursor->state->crtc_h; | 9922 | unsigned int height = intel_crtc->base.cursor->state->crtc_h; |
9923 | unsigned int stride = roundup_pow_of_two(width) * 4; | 9923 | unsigned int stride = roundup_pow_of_two(width) * 4; |
@@ -9972,16 +9972,15 @@ static void i845_update_cursor(struct drm_crtc *crtc, u32 base) | |||
9972 | } | 9972 | } |
9973 | } | 9973 | } |
9974 | 9974 | ||
9975 | static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base) | 9975 | static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base, bool on) |
9976 | { | 9976 | { |
9977 | struct drm_device *dev = crtc->dev; | 9977 | struct drm_device *dev = crtc->dev; |
9978 | struct drm_i915_private *dev_priv = dev->dev_private; | 9978 | struct drm_i915_private *dev_priv = dev->dev_private; |
9979 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 9979 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
9980 | int pipe = intel_crtc->pipe; | 9980 | int pipe = intel_crtc->pipe; |
9981 | uint32_t cntl; | 9981 | uint32_t cntl = 0; |
9982 | 9982 | ||
9983 | cntl = 0; | 9983 | if (on) { |
9984 | if (base) { | ||
9985 | cntl = MCURSOR_GAMMA_ENABLE; | 9984 | cntl = MCURSOR_GAMMA_ENABLE; |
9986 | switch (intel_crtc->base.cursor->state->crtc_w) { | 9985 | switch (intel_crtc->base.cursor->state->crtc_w) { |
9987 | case 64: | 9986 | case 64: |
@@ -10032,18 +10031,17 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc, | |||
10032 | int y = cursor_state->crtc_y; | 10031 | int y = cursor_state->crtc_y; |
10033 | u32 base = 0, pos = 0; | 10032 | u32 base = 0, pos = 0; |
10034 | 10033 | ||
10035 | if (on) | 10034 | base = intel_crtc->cursor_addr; |
10036 | base = intel_crtc->cursor_addr; | ||
10037 | 10035 | ||
10038 | if (x >= intel_crtc->config->pipe_src_w) | 10036 | if (x >= intel_crtc->config->pipe_src_w) |
10039 | base = 0; | 10037 | on = false; |
10040 | 10038 | ||
10041 | if (y >= intel_crtc->config->pipe_src_h) | 10039 | if (y >= intel_crtc->config->pipe_src_h) |
10042 | base = 0; | 10040 | on = false; |
10043 | 10041 | ||
10044 | if (x < 0) { | 10042 | if (x < 0) { |
10045 | if (x + cursor_state->crtc_w <= 0) | 10043 | if (x + cursor_state->crtc_w <= 0) |
10046 | base = 0; | 10044 | on = false; |
10047 | 10045 | ||
10048 | pos |= CURSOR_POS_SIGN << CURSOR_X_SHIFT; | 10046 | pos |= CURSOR_POS_SIGN << CURSOR_X_SHIFT; |
10049 | x = -x; | 10047 | x = -x; |
@@ -10052,16 +10050,13 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc, | |||
10052 | 10050 | ||
10053 | if (y < 0) { | 10051 | if (y < 0) { |
10054 | if (y + cursor_state->crtc_h <= 0) | 10052 | if (y + cursor_state->crtc_h <= 0) |
10055 | base = 0; | 10053 | on = false; |
10056 | 10054 | ||
10057 | pos |= CURSOR_POS_SIGN << CURSOR_Y_SHIFT; | 10055 | pos |= CURSOR_POS_SIGN << CURSOR_Y_SHIFT; |
10058 | y = -y; | 10056 | y = -y; |
10059 | } | 10057 | } |
10060 | pos |= y << CURSOR_Y_SHIFT; | 10058 | pos |= y << CURSOR_Y_SHIFT; |
10061 | 10059 | ||
10062 | if (base == 0 && intel_crtc->cursor_base == 0) | ||
10063 | return; | ||
10064 | |||
10065 | I915_WRITE(CURPOS(pipe), pos); | 10060 | I915_WRITE(CURPOS(pipe), pos); |
10066 | 10061 | ||
10067 | /* ILK+ do this automagically */ | 10062 | /* ILK+ do this automagically */ |
@@ -10072,9 +10067,9 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc, | |||
10072 | } | 10067 | } |
10073 | 10068 | ||
10074 | if (IS_845G(dev) || IS_I865G(dev)) | 10069 | if (IS_845G(dev) || IS_I865G(dev)) |
10075 | i845_update_cursor(crtc, base); | 10070 | i845_update_cursor(crtc, base, on); |
10076 | else | 10071 | else |
10077 | i9xx_update_cursor(crtc, base); | 10072 | i9xx_update_cursor(crtc, base, on); |
10078 | } | 10073 | } |
10079 | 10074 | ||
10080 | static bool cursor_size_ok(struct drm_device *dev, | 10075 | static bool cursor_size_ok(struct drm_device *dev, |