/* * Copyright 2007-8 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: Dave Airlie * Alex Deucher
*/
if (ASIC_IS_AVIVO(rdev)) { /* avivo cursor are offset into the total surface */
x += crtc->x;
y += crtc->y;
}
if (x < 0)
xorigin = min(-x, radeon_crtc->max_cursor_width - 1); if (y < 0)
yorigin = min(-y, radeon_crtc->max_cursor_height - 1);
if (!ASIC_IS_AVIVO(rdev)) {
x += crtc->x;
y += crtc->y;
}
DRM_DEBUG("x %d y %d c->x %d c->y %d\n", x, y, crtc->x, crtc->y);
/* fixed on DCE6 and newer */ if (ASIC_IS_AVIVO(rdev) && !ASIC_IS_DCE6(rdev)) { int i = 0; struct drm_crtc *crtc_p;
/* * avivo cursor image can't end on 128 pixel boundary or * go past the end of the frame if both crtcs are enabled * * NOTE: It is safe to access crtc->enabled of other crtcs * without holding either the mode_config lock or the other * crtc's lock as long as write access to this flag _always_ * grabs all locks.
*/
list_for_each_entry(crtc_p, &crtc->dev->mode_config.crtc_list, head) { if (crtc_p->enabled)
i++;
} if (i > 1) { int cursor_end, frame_end;
cursor_end = x + w;
frame_end = crtc->x + crtc->mode.crtc_hdisplay; if (cursor_end >= frame_end) {
w = w - (cursor_end - frame_end); if (!(frame_end & 0x7f))
w--;
} elseif (cursor_end <= 0) { goto out_of_bounds;
} elseif (!(cursor_end & 0x7f)) {
w--;
} if (w <= 0) { goto out_of_bounds;
}
}
}
if (x <= (crtc->x - w) || y <= (crtc->y - radeon_crtc->cursor_height) ||
x >= (crtc->x + crtc->mode.hdisplay) ||
y >= (crtc->y + crtc->mode.vdisplay)) goto out_of_bounds;
unpin: if (radeon_crtc->cursor_bo) { struct radeon_bo *robj = gem_to_radeon_bo(radeon_crtc->cursor_bo);
ret = radeon_bo_reserve(robj, false); if (likely(ret == 0)) {
radeon_bo_unpin(robj);
radeon_bo_unreserve(robj);
}
drm_gem_object_put(radeon_crtc->cursor_bo);
}
radeon_crtc->cursor_bo = obj; return 0;
}
/** * radeon_cursor_reset - Re-set the current cursor, if any. * * @crtc: drm crtc * * If the CRTC passed in currently has a cursor assigned, this function * makes sure it's visible.
*/ void radeon_cursor_reset(struct drm_crtc *crtc)
{ struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
if (radeon_crtc->cursor_bo) {
radeon_lock_cursor(crtc, true);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.