[Spice-devel] [PATCH RFC 09/14] New function to pass surface directly to display_channel_draw
Frediano Ziglio
fziglio at redhat.com
Thu Sep 29 08:44:08 UTC 2016
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
server/display-channel.c | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/server/display-channel.c b/server/display-channel.c
index 7627df9..e0a91a3 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -25,6 +25,8 @@
static void drawable_draw(DisplayChannel *display, Drawable *drawable);
static Drawable *display_channel_drawable_try_new(DisplayChannel *display,
uint32_t process_commands_generation);
+static void display_channel_surface_draw(DisplayChannel *display, RedSurface *surface,
+ const SpiceRect *area);
uint32_t display_channel_generate_uid(DisplayChannel *display)
{
@@ -895,7 +897,8 @@ static void handle_self_bitmap(DisplayChannel *display, Drawable *drawable)
image->u.bitmap.data = spice_chunks_new_linear(dest, height * dest_stride);
image->u.bitmap.data->flags |= SPICE_CHUNKS_FLAGS_FREE;
- display_channel_draw(display, &red_drawable->self_bitmap_area, drawable->surface->id);
+ display_channel_surface_draw(display, drawable->surface,
+ &red_drawable->self_bitmap_area);
surface_read_bits(display, drawable->surface,
&red_drawable->self_bitmap_area, dest, dest_stride);
@@ -957,7 +960,8 @@ static void draw_depend_on_me(DisplayChannel *display, RedSurface *surface)
Drawable *drawable;
DependItem *depended_item = SPICE_CONTAINEROF(ring_item, DependItem, ring_item);
drawable = depended_item->drawable;
- display_channel_draw(display, &drawable->red_drawable->bbox, drawable->surface->id);
+ display_channel_surface_draw(display, drawable->surface,
+ &drawable->red_drawable->bbox);
}
}
@@ -1373,7 +1377,8 @@ static void drawable_deps_draw(DisplayChannel *display, Drawable *drawable)
RedSurface *surface = drawable->surface_deps[x];
if (surface != NULL && drawable->depend_items[x].drawable) {
depended_item_remove(&drawable->depend_items[x]);
- display_channel_draw(display, &drawable->red_drawable->surfaces_rects[x], surface->id);
+ display_channel_surface_draw(display, surface,
+ &drawable->red_drawable->surfaces_rects[x]);
}
}
}
@@ -1635,7 +1640,6 @@ void display_channel_draw_until(DisplayChannel *display, const SpiceRect *area,
void display_channel_draw(DisplayChannel *display, const SpiceRect *area, int surface_id)
{
RedSurface *surface;
- Drawable *last;
spice_debug("surface %d: area ==>", surface_id);
rect_debug(area);
@@ -1647,6 +1651,14 @@ void display_channel_draw(DisplayChannel *display, const SpiceRect *area, int su
surface = &display->priv->surfaces[surface_id];
+ display_channel_surface_draw(display, surface, area);
+}
+
+static void display_channel_surface_draw(DisplayChannel *display, RedSurface *surface,
+ const SpiceRect *area)
+{
+ Drawable *last;
+
last = current_find_intersects_rect(&surface->current_list, NULL, area);
if (last)
draw_until(display, surface, last);
@@ -1680,9 +1692,9 @@ void display_channel_update(DisplayChannel *display,
spice_return_if_fail(display_channel_validate_surface(display, surface_id));
red_get_rect_ptr(&rect, area);
- display_channel_draw(display, &rect, surface_id);
-
surface = &display->priv->surfaces[surface_id];
+ display_channel_surface_draw(display, surface, &rect);
+
if (*qxl_dirty_rects == NULL) {
*num_dirty_rects = pixman_region32_n_rects(&surface->draw_dirty_region);
*qxl_dirty_rects = spice_new0(QXLRect, *num_dirty_rects);
@@ -1722,10 +1734,10 @@ void display_channel_destroy_surface_wait(DisplayChannel *display, uint32_t surf
{
if (!display_channel_validate_surface(display, surface_id))
return;
- if (!display->priv->surfaces[surface_id].context.canvas)
+ RedSurface *surface = &display->priv->surfaces[surface_id];
+ if (!surface->context.canvas)
return;
- RedSurface *surface = &display->priv->surfaces[surface_id];
draw_depend_on_me(display, surface);
/* note that draw_depend_on_me must be called before current_remove_all.
otherwise "current" will hold items that other drawables may depend on, and then
--
2.7.4
More information about the Spice-devel
mailing list