Lines Matching +full:offset +full:- +full:y

2  * Copyright 2007-8 Advanced Micro Devices, Inc.
34 struct radeon_device *rdev = crtc->dev->dev_private; in radeon_lock_cursor()
39 cur_lock = RREG32(EVERGREEN_CUR_UPDATE + radeon_crtc->crtc_offset); in radeon_lock_cursor()
44 WREG32(EVERGREEN_CUR_UPDATE + radeon_crtc->crtc_offset, cur_lock); in radeon_lock_cursor()
46 cur_lock = RREG32(AVIVO_D1CUR_UPDATE + radeon_crtc->crtc_offset); in radeon_lock_cursor()
51 WREG32(AVIVO_D1CUR_UPDATE + radeon_crtc->crtc_offset, cur_lock); in radeon_lock_cursor()
53 cur_lock = RREG32(RADEON_CUR_OFFSET + radeon_crtc->crtc_offset); in radeon_lock_cursor()
58 WREG32(RADEON_CUR_OFFSET + radeon_crtc->crtc_offset, cur_lock); in radeon_lock_cursor()
65 struct radeon_device *rdev = crtc->dev->dev_private; in radeon_hide_cursor()
68 WREG32_IDX(EVERGREEN_CUR_CONTROL + radeon_crtc->crtc_offset, in radeon_hide_cursor()
72 WREG32_IDX(AVIVO_D1CUR_CONTROL + radeon_crtc->crtc_offset, in radeon_hide_cursor()
76 switch (radeon_crtc->crtc_id) { in radeon_hide_cursor()
93 struct radeon_device *rdev = crtc->dev->dev_private; in radeon_show_cursor()
95 if (radeon_crtc->cursor_out_of_bounds) in radeon_show_cursor()
99 WREG32(EVERGREEN_CUR_SURFACE_ADDRESS_HIGH + radeon_crtc->crtc_offset, in radeon_show_cursor()
100 upper_32_bits(radeon_crtc->cursor_addr)); in radeon_show_cursor()
101 WREG32(EVERGREEN_CUR_SURFACE_ADDRESS + radeon_crtc->crtc_offset, in radeon_show_cursor()
102 lower_32_bits(radeon_crtc->cursor_addr)); in radeon_show_cursor()
103 WREG32(RADEON_MM_INDEX, EVERGREEN_CUR_CONTROL + radeon_crtc->crtc_offset); in radeon_show_cursor()
108 if (rdev->family >= CHIP_RV770) { in radeon_show_cursor()
109 if (radeon_crtc->crtc_id) in radeon_show_cursor()
111 upper_32_bits(radeon_crtc->cursor_addr)); in radeon_show_cursor()
114 upper_32_bits(radeon_crtc->cursor_addr)); in radeon_show_cursor()
117 WREG32(AVIVO_D1CUR_SURFACE_ADDRESS + radeon_crtc->crtc_offset, in radeon_show_cursor()
118 lower_32_bits(radeon_crtc->cursor_addr)); in radeon_show_cursor()
119 WREG32(RADEON_MM_INDEX, AVIVO_D1CUR_CONTROL + radeon_crtc->crtc_offset); in radeon_show_cursor()
123 /* offset is from DISP(2)_BASE_ADDRESS */ in radeon_show_cursor()
124 WREG32(RADEON_CUR_OFFSET + radeon_crtc->crtc_offset, in radeon_show_cursor()
125 radeon_crtc->cursor_addr - radeon_crtc->legacy_display_base_addr); in radeon_show_cursor()
127 switch (radeon_crtc->crtc_id) { in radeon_show_cursor()
144 static int radeon_cursor_move_locked(struct drm_crtc *crtc, int x, int y) in radeon_cursor_move_locked() argument
147 struct radeon_device *rdev = crtc->dev->dev_private; in radeon_cursor_move_locked()
149 int w = radeon_crtc->cursor_width; in radeon_cursor_move_locked()
151 radeon_crtc->cursor_x = x; in radeon_cursor_move_locked()
152 radeon_crtc->cursor_y = y; in radeon_cursor_move_locked()
155 /* avivo cursor are offset into the total surface */ in radeon_cursor_move_locked()
156 x += crtc->x; in radeon_cursor_move_locked()
157 y += crtc->y; in radeon_cursor_move_locked()
161 xorigin = min(-x, radeon_crtc->max_cursor_width - 1); in radeon_cursor_move_locked()
162 if (y < 0) in radeon_cursor_move_locked()
163 yorigin = min(-y, radeon_crtc->max_cursor_height - 1); in radeon_cursor_move_locked()
166 x += crtc->x; in radeon_cursor_move_locked()
167 y += crtc->y; in radeon_cursor_move_locked()
169 DRM_DEBUG("x %d y %d c->x %d c->y %d\n", x, y, crtc->x, crtc->y); in radeon_cursor_move_locked()
180 * NOTE: It is safe to access crtc->enabled of other crtcs in radeon_cursor_move_locked()
185 list_for_each_entry(crtc_p, &crtc->dev->mode_config.crtc_list, head) { in radeon_cursor_move_locked()
186 if (crtc_p->enabled) in radeon_cursor_move_locked()
193 frame_end = crtc->x + crtc->mode.crtc_hdisplay; in radeon_cursor_move_locked()
195 w = w - (cursor_end - frame_end); in radeon_cursor_move_locked()
197 w--; in radeon_cursor_move_locked()
201 w--; in radeon_cursor_move_locked()
209 if (x <= (crtc->x - w) || y <= (crtc->y - radeon_crtc->cursor_height) || in radeon_cursor_move_locked()
210 x >= (crtc->x + crtc->mode.hdisplay) || in radeon_cursor_move_locked()
211 y >= (crtc->y + crtc->mode.vdisplay)) in radeon_cursor_move_locked()
215 y += yorigin; in radeon_cursor_move_locked()
218 WREG32(EVERGREEN_CUR_POSITION + radeon_crtc->crtc_offset, (x << 16) | y); in radeon_cursor_move_locked()
219 WREG32(EVERGREEN_CUR_HOT_SPOT + radeon_crtc->crtc_offset, (xorigin << 16) | yorigin); in radeon_cursor_move_locked()
220 WREG32(EVERGREEN_CUR_SIZE + radeon_crtc->crtc_offset, in radeon_cursor_move_locked()
221 ((w - 1) << 16) | (radeon_crtc->cursor_height - 1)); in radeon_cursor_move_locked()
223 WREG32(AVIVO_D1CUR_POSITION + radeon_crtc->crtc_offset, (x << 16) | y); in radeon_cursor_move_locked()
224 WREG32(AVIVO_D1CUR_HOT_SPOT + radeon_crtc->crtc_offset, (xorigin << 16) | yorigin); in radeon_cursor_move_locked()
225 WREG32(AVIVO_D1CUR_SIZE + radeon_crtc->crtc_offset, in radeon_cursor_move_locked()
226 ((w - 1) << 16) | (radeon_crtc->cursor_height - 1)); in radeon_cursor_move_locked()
228 x -= crtc->x; in radeon_cursor_move_locked()
229 y -= crtc->y; in radeon_cursor_move_locked()
231 if (crtc->mode.flags & DRM_MODE_FLAG_DBLSCAN) in radeon_cursor_move_locked()
232 y *= 2; in radeon_cursor_move_locked()
234 WREG32(RADEON_CUR_HORZ_VERT_OFF + radeon_crtc->crtc_offset, in radeon_cursor_move_locked()
238 WREG32(RADEON_CUR_HORZ_VERT_POSN + radeon_crtc->crtc_offset, in radeon_cursor_move_locked()
241 | y)); in radeon_cursor_move_locked()
242 /* offset is from DISP(2)_BASE_ADDRESS */ in radeon_cursor_move_locked()
243 WREG32(RADEON_CUR_OFFSET + radeon_crtc->crtc_offset, in radeon_cursor_move_locked()
244 radeon_crtc->cursor_addr - radeon_crtc->legacy_display_base_addr + in radeon_cursor_move_locked()
248 if (radeon_crtc->cursor_out_of_bounds) { in radeon_cursor_move_locked()
249 radeon_crtc->cursor_out_of_bounds = false; in radeon_cursor_move_locked()
250 if (radeon_crtc->cursor_bo) in radeon_cursor_move_locked()
257 if (!radeon_crtc->cursor_out_of_bounds) { in radeon_cursor_move_locked()
259 radeon_crtc->cursor_out_of_bounds = true; in radeon_cursor_move_locked()
265 int x, int y) in radeon_crtc_cursor_move() argument
270 ret = radeon_cursor_move_locked(crtc, x, y); in radeon_crtc_cursor_move()
285 struct radeon_device *rdev = crtc->dev->dev_private; in radeon_crtc_cursor_set2()
297 if ((width > radeon_crtc->max_cursor_width) || in radeon_crtc_cursor_set2()
298 (height > radeon_crtc->max_cursor_height)) { in radeon_crtc_cursor_set2()
300 return -EINVAL; in radeon_crtc_cursor_set2()
305 DRM_ERROR("Cannot find cursor object %x for crtc %d\n", handle, radeon_crtc->crtc_id); in radeon_crtc_cursor_set2()
306 return -ENOENT; in radeon_crtc_cursor_set2()
315 /* Only 27 bit offset for legacy cursor */ in radeon_crtc_cursor_set2()
318 &radeon_crtc->cursor_addr); in radeon_crtc_cursor_set2()
328 if (width != radeon_crtc->cursor_width || in radeon_crtc_cursor_set2()
329 height != radeon_crtc->cursor_height || in radeon_crtc_cursor_set2()
330 hot_x != radeon_crtc->cursor_hot_x || in radeon_crtc_cursor_set2()
331 hot_y != radeon_crtc->cursor_hot_y) { in radeon_crtc_cursor_set2()
332 int x, y; in radeon_crtc_cursor_set2() local
334 x = radeon_crtc->cursor_x + radeon_crtc->cursor_hot_x - hot_x; in radeon_crtc_cursor_set2()
335 y = radeon_crtc->cursor_y + radeon_crtc->cursor_hot_y - hot_y; in radeon_crtc_cursor_set2()
337 radeon_crtc->cursor_width = width; in radeon_crtc_cursor_set2()
338 radeon_crtc->cursor_height = height; in radeon_crtc_cursor_set2()
339 radeon_crtc->cursor_hot_x = hot_x; in radeon_crtc_cursor_set2()
340 radeon_crtc->cursor_hot_y = hot_y; in radeon_crtc_cursor_set2()
342 radeon_cursor_move_locked(crtc, x, y); in radeon_crtc_cursor_set2()
350 if (radeon_crtc->cursor_bo) { in radeon_crtc_cursor_set2()
351 struct radeon_bo *robj = gem_to_radeon_bo(radeon_crtc->cursor_bo); in radeon_crtc_cursor_set2()
357 drm_gem_object_put(radeon_crtc->cursor_bo); in radeon_crtc_cursor_set2()
360 radeon_crtc->cursor_bo = obj; in radeon_crtc_cursor_set2()
365 * radeon_cursor_reset - Re-set the current cursor, if any.
376 if (radeon_crtc->cursor_bo) { in radeon_cursor_reset()
379 radeon_cursor_move_locked(crtc, radeon_crtc->cursor_x, in radeon_cursor_reset()
380 radeon_crtc->cursor_y); in radeon_cursor_reset()