diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2015-10-07 23:38:03 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2015-10-14 16:16:33 -0400 |
commit | c4e0dfadb2d4c054ca06641da77294fd5c61725a (patch) | |
tree | 9868d8b8056261ade239060f5398d8e349415b3f | |
parent | fd70cf63e24a0cf3105853e3b59eaa52d8b9df17 (diff) |
drm/amdgpu/dce8: Move hotspot handling out of set_cursor
It's only needed in dce8 crtc_cursor_set2.
Port of radeon commit:
2e007e611bc0a46dfed1547e0228a57f800e703d
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c index d7f88f33cd73..aac998010128 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c @@ -2449,8 +2449,7 @@ static int dce_v8_0_cursor_move_locked(struct drm_crtc *crtc, return 0; } -static int dce_v8_0_set_cursor(struct drm_crtc *crtc, struct drm_gem_object *obj, - int hot_x, int hot_y) +static int dce_v8_0_set_cursor(struct drm_crtc *crtc, struct drm_gem_object *obj) { struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); struct amdgpu_device *adev = crtc->dev->dev_private; @@ -2472,19 +2471,6 @@ static int dce_v8_0_set_cursor(struct drm_crtc *crtc, struct drm_gem_object *obj WREG32(mmCUR_SURFACE_ADDRESS + amdgpu_crtc->crtc_offset, lower_32_bits(gpu_addr)); - if (hot_x != amdgpu_crtc->cursor_hot_x || - hot_y != amdgpu_crtc->cursor_hot_y) { - int x, y; - - x = amdgpu_crtc->cursor_x + amdgpu_crtc->cursor_hot_x - hot_x; - y = amdgpu_crtc->cursor_y + amdgpu_crtc->cursor_hot_y - hot_y; - - dce_v8_0_cursor_move_locked(crtc, x, y); - - amdgpu_crtc->cursor_hot_x = hot_x; - amdgpu_crtc->cursor_hot_y = hot_y; - } - return 0; fail: @@ -2540,7 +2526,21 @@ static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc, amdgpu_crtc->cursor_height = height; dce_v8_0_lock_cursor(crtc, true); - ret = dce_v8_0_set_cursor(crtc, obj, hot_x, hot_y); + + if (hot_x != amdgpu_crtc->cursor_hot_x || + hot_y != amdgpu_crtc->cursor_hot_y) { + int x, y; + + x = amdgpu_crtc->cursor_x + amdgpu_crtc->cursor_hot_x - hot_x; + y = amdgpu_crtc->cursor_y + amdgpu_crtc->cursor_hot_y - hot_y; + + dce_v8_0_cursor_move_locked(crtc, x, y); + + amdgpu_crtc->cursor_hot_x = hot_x; + amdgpu_crtc->cursor_hot_y = hot_y; + } + + ret = dce_v8_0_set_cursor(crtc, obj); if (ret) DRM_ERROR("dce_v8_0_set_cursor returned %d, not changing cursor\n", ret); @@ -2575,9 +2575,7 @@ static void dce_v8_0_cursor_reset(struct drm_crtc *crtc) dce_v8_0_cursor_move_locked(crtc, amdgpu_crtc->cursor_x, amdgpu_crtc->cursor_y); - ret = dce_v8_0_set_cursor(crtc, amdgpu_crtc->cursor_bo, - amdgpu_crtc->cursor_hot_x, - amdgpu_crtc->cursor_hot_y); + ret = dce_v8_0_set_cursor(crtc, amdgpu_crtc->cursor_bo); if (ret) DRM_ERROR("dce_v8_0_set_cursor returned %d, not showing " "cursor\n", ret); |