/* * Copyright 2011 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 * on the rights to use, copy, modify, merge, publish, distribute, sub * license, 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 (including the next * paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS 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.
*/
/* returns a pointer to the already allocated qxl_rect array inside * the qxl_clip_rects. This is *not* the same as the memory allocated
* on the device, it is offset to qxl_clip_rects.chunk.data */ staticstruct qxl_rect *drawable_set_clipping(struct qxl_device *qdev, unsignedint num_clips, struct qxl_bo *clips_bo)
{ struct iosys_map map; struct qxl_clip_rects *dev_clips; int ret;
ret = qxl_bo_vmap_locked(clips_bo, &map); if (ret) return NULL;
dev_clips = map.vaddr; /* TODO: Use mapping abstraction properly */
/* release needs to be reserved at this point */ staticint
make_drawable(struct qxl_device *qdev, int surface, uint8_t type, conststruct qxl_rect *rect, struct qxl_release *release)
{ struct qxl_drawable *drawable; int i;
drawable = (struct qxl_drawable *)qxl_release_map(qdev, release); if (!drawable) return -ENOMEM;
/* * surfaces_dest[i] should apparently be filled out with the * surfaces that we depend on, and surface_rects should be * filled with the rectangles of those surfaces that we * are going to use.
*/ for (i = 0; i < 3; ++i)
drawable->surfaces_dest[i] = -1;
/* push a draw command using the given clipping rectangles as * the sources from the shadow framebuffer. * * Right now implementing with a single draw and a clip list. Clip * lists are known to be a problem performance wise, this can be solved * by treating them differently in the server.
*/ void qxl_draw_dirty_fb(struct qxl_device *qdev, struct drm_framebuffer *fb, struct qxl_bo *bo, unsignedint flags, unsignedint color, struct drm_clip_rect *clips, unsignedint num_clips, int inc,
uint32_t dumb_shadow_offset)
{ /* * TODO: if flags & DRM_MODE_FB_DIRTY_ANNOTATE_FILL then we should * send a fill command instead, much cheaper. * * See include/drm/drm_mode.h
*/ struct drm_clip_rect *clips_ptr; int i; int left, right, top, bottom; int width, height; struct qxl_drawable *drawable; struct qxl_rect drawable_rect; struct qxl_rect *rects; int stride = fb->pitches[0]; /* depth is not actually interesting, we don't mask with it */ int depth = fb->format->cpp[0] * 8; struct iosys_map surface_map;
uint8_t *surface_base; struct qxl_release *release; struct qxl_bo *clips_bo; struct qxl_drm_image *dimage; int ret;
ret = alloc_drawable(qdev, &release); if (ret) return;
left = clips->x1;
right = clips->x2;
top = clips->y1;
bottom = clips->y2;
/* skip the first clip rect */ for (i = 1, clips_ptr = clips + inc;
i < num_clips; i++, clips_ptr += inc) {
left = min_t(int, left, (int)clips_ptr->x1);
right = max_t(int, right, (int)clips_ptr->x2);
top = min_t(int, top, (int)clips_ptr->y1);
bottom = max_t(int, bottom, (int)clips_ptr->y2);
}
width = right - left;
height = bottom - top;
ret = alloc_clips(qdev, release, num_clips, &clips_bo); if (ret) goto out_free_drawable;
ret = qxl_image_alloc_objects(qdev, release,
&dimage,
height, stride); if (ret) goto out_free_clips;
/* do a reservation run over all the objects we just allocated */
ret = qxl_release_reserve_list(release, true); if (ret) goto out_free_image;
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.