mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 18:44:58 -06:00
virtio-gpu: replace PIXMAN for region/rect test
Use a simpler implementation for rectangle geometry & intersect, drop the need for (more complex) PIXMAN functions. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
f38aa2c7c0
commit
a200d53b1f
2 changed files with 70 additions and 19 deletions
|
@ -16,6 +16,7 @@
|
|||
#include "qemu/iov.h"
|
||||
#include "sysemu/cpus.h"
|
||||
#include "ui/console.h"
|
||||
#include "ui/rect.h"
|
||||
#include "trace.h"
|
||||
#include "sysemu/dma.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
|
@ -503,7 +504,7 @@ static void virtio_gpu_resource_flush(VirtIOGPU *g,
|
|||
struct virtio_gpu_simple_resource *res;
|
||||
struct virtio_gpu_resource_flush rf;
|
||||
struct virtio_gpu_scanout *scanout;
|
||||
pixman_region16_t flush_region;
|
||||
QemuRect flush_rect;
|
||||
bool within_bounds = false;
|
||||
bool update_submitted = false;
|
||||
int i;
|
||||
|
@ -565,34 +566,25 @@ static void virtio_gpu_resource_flush(VirtIOGPU *g,
|
|||
return;
|
||||
}
|
||||
|
||||
pixman_region_init_rect(&flush_region,
|
||||
rf.r.x, rf.r.y, rf.r.width, rf.r.height);
|
||||
qemu_rect_init(&flush_rect, rf.r.x, rf.r.y, rf.r.width, rf.r.height);
|
||||
for (i = 0; i < g->parent_obj.conf.max_outputs; i++) {
|
||||
pixman_region16_t region, finalregion;
|
||||
pixman_box16_t *extents;
|
||||
QemuRect rect;
|
||||
|
||||
if (!(res->scanout_bitmask & (1 << i))) {
|
||||
continue;
|
||||
}
|
||||
scanout = &g->parent_obj.scanout[i];
|
||||
|
||||
pixman_region_init(&finalregion);
|
||||
pixman_region_init_rect(®ion, scanout->x, scanout->y,
|
||||
scanout->width, scanout->height);
|
||||
qemu_rect_init(&rect, scanout->x, scanout->y,
|
||||
scanout->width, scanout->height);
|
||||
|
||||
pixman_region_intersect(&finalregion, &flush_region, ®ion);
|
||||
pixman_region_translate(&finalregion, -scanout->x, -scanout->y);
|
||||
extents = pixman_region_extents(&finalregion);
|
||||
/* work out the area we need to update for each console */
|
||||
dpy_gfx_update(g->parent_obj.scanout[i].con,
|
||||
extents->x1, extents->y1,
|
||||
extents->x2 - extents->x1,
|
||||
extents->y2 - extents->y1);
|
||||
|
||||
pixman_region_fini(®ion);
|
||||
pixman_region_fini(&finalregion);
|
||||
if (qemu_rect_intersect(&flush_rect, &rect, &rect)) {
|
||||
qemu_rect_translate(&rect, -scanout->x, -scanout->y);
|
||||
dpy_gfx_update(g->parent_obj.scanout[i].con,
|
||||
rect.x, rect.y, rect.width, rect.height);
|
||||
}
|
||||
}
|
||||
pixman_region_fini(&flush_region);
|
||||
}
|
||||
|
||||
static void virtio_unref_resource(pixman_image_t *image, void *data)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue