mirror of https://gitee.com/openkylin/linux.git
drm/amdgpu/dce11: Move hotspot handling out of set_cursor
It's only needed in dce11 crtc_cursor_set2.
Port of radeon commit:
2e007e611b
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
8ddef5a5e5
commit
1996ea09cd
|
@ -2514,8 +2514,7 @@ static int dce_v11_0_cursor_move_locked(struct drm_crtc *crtc,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dce_v11_0_set_cursor(struct drm_crtc *crtc, struct drm_gem_object *obj,
|
static int dce_v11_0_set_cursor(struct drm_crtc *crtc, struct drm_gem_object *obj)
|
||||||
int hot_x, int hot_y)
|
|
||||||
{
|
{
|
||||||
struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
|
struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
|
||||||
struct amdgpu_device *adev = crtc->dev->dev_private;
|
struct amdgpu_device *adev = crtc->dev->dev_private;
|
||||||
|
@ -2537,19 +2536,6 @@ static int dce_v11_0_set_cursor(struct drm_crtc *crtc, struct drm_gem_object *ob
|
||||||
WREG32(mmCUR_SURFACE_ADDRESS + amdgpu_crtc->crtc_offset,
|
WREG32(mmCUR_SURFACE_ADDRESS + amdgpu_crtc->crtc_offset,
|
||||||
lower_32_bits(gpu_addr));
|
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_v11_0_cursor_move_locked(crtc, x, y);
|
|
||||||
|
|
||||||
amdgpu_crtc->cursor_hot_x = hot_x;
|
|
||||||
amdgpu_crtc->cursor_hot_y = hot_y;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
@ -2605,7 +2591,21 @@ static int dce_v11_0_crtc_cursor_set2(struct drm_crtc *crtc,
|
||||||
amdgpu_crtc->cursor_height = height;
|
amdgpu_crtc->cursor_height = height;
|
||||||
|
|
||||||
dce_v11_0_lock_cursor(crtc, true);
|
dce_v11_0_lock_cursor(crtc, true);
|
||||||
ret = dce_v11_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_v11_0_cursor_move_locked(crtc, x, y);
|
||||||
|
|
||||||
|
amdgpu_crtc->cursor_hot_x = hot_x;
|
||||||
|
amdgpu_crtc->cursor_hot_y = hot_y;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = dce_v11_0_set_cursor(crtc, obj);
|
||||||
if (ret)
|
if (ret)
|
||||||
DRM_ERROR("dce_v11_0_set_cursor returned %d, not changing cursor\n",
|
DRM_ERROR("dce_v11_0_set_cursor returned %d, not changing cursor\n",
|
||||||
ret);
|
ret);
|
||||||
|
@ -2640,9 +2640,7 @@ static void dce_v11_0_cursor_reset(struct drm_crtc *crtc)
|
||||||
dce_v11_0_cursor_move_locked(crtc, amdgpu_crtc->cursor_x,
|
dce_v11_0_cursor_move_locked(crtc, amdgpu_crtc->cursor_x,
|
||||||
amdgpu_crtc->cursor_y);
|
amdgpu_crtc->cursor_y);
|
||||||
|
|
||||||
ret = dce_v11_0_set_cursor(crtc, amdgpu_crtc->cursor_bo,
|
ret = dce_v11_0_set_cursor(crtc, amdgpu_crtc->cursor_bo);
|
||||||
amdgpu_crtc->cursor_hot_x,
|
|
||||||
amdgpu_crtc->cursor_hot_y);
|
|
||||||
if (ret)
|
if (ret)
|
||||||
DRM_ERROR("dce_v11_0_set_cursor returned %d, not showing "
|
DRM_ERROR("dce_v11_0_set_cursor returned %d, not showing "
|
||||||
"cursor\n", ret);
|
"cursor\n", ret);
|
||||||
|
|
Loading…
Reference in New Issue