mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-29 00:41:33 +00:00
Change RedGlzDrawable::drawable from pointer to boolean
The field was used just as a flag. This has the advantage to make clear to not use the pointer as we don't have ownership. Also makes the structure a bit smaller. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
This commit is contained in:
parent
9939496a93
commit
49e2899ea8
@ -469,9 +469,7 @@ static void image_encoders_free_glz_drawable_instance(ImageEncoders *enc,
|
||||
if (ring_is_empty(&glz_drawable->instances)) {
|
||||
spice_assert(glz_drawable->instances_count == 0);
|
||||
|
||||
Drawable *drawable = glz_drawable->drawable;
|
||||
|
||||
if (drawable) {
|
||||
if (glz_drawable->has_drawable) {
|
||||
ring_remove(&glz_drawable->drawable_link);
|
||||
}
|
||||
red_drawable_unref(glz_drawable->red_drawable);
|
||||
@ -533,7 +531,7 @@ int image_encoders_free_some_independent_glz_drawables(ImageEncoders *enc)
|
||||
while ((n < RED_RELEASE_BUNCH_SIZE) && (ring_link != NULL)) {
|
||||
RedGlzDrawable *glz_drawable = SPICE_CONTAINEROF(ring_link, RedGlzDrawable, link);
|
||||
ring_link = ring_next(&enc->glz_drawables, ring_link);
|
||||
if (!glz_drawable->drawable) {
|
||||
if (!glz_drawable->has_drawable) {
|
||||
image_encoders_free_glz_drawable(enc, glz_drawable);
|
||||
n++;
|
||||
}
|
||||
@ -1078,7 +1076,7 @@ static RedGlzDrawable *get_glz_drawable(ImageEncoders *enc, Drawable *drawable)
|
||||
|
||||
ret->encoders = enc;
|
||||
ret->red_drawable = red_drawable_ref(drawable->red_drawable);
|
||||
ret->drawable = drawable;
|
||||
ret->has_drawable = TRUE;
|
||||
ret->instances_count = 0;
|
||||
ring_init(&ret->instances);
|
||||
|
||||
|
||||
@ -160,10 +160,10 @@ struct RedGlzDrawable {
|
||||
RingItem link; // ordered by the time it was encoded
|
||||
RingItem drawable_link;
|
||||
RedDrawable *red_drawable;
|
||||
Drawable *drawable;
|
||||
GlzDrawableInstanceItem instances_pool[MAX_GLZ_DRAWABLE_INSTANCES];
|
||||
Ring instances;
|
||||
uint8_t instances_count;
|
||||
gboolean has_drawable;
|
||||
ImageEncoders *encoders;
|
||||
};
|
||||
|
||||
|
||||
@ -1354,7 +1354,7 @@ void drawable_unref(Drawable *drawable)
|
||||
display_channel_surface_unref(display, drawable->surface_id);
|
||||
|
||||
RING_FOREACH_SAFE(item, next, &drawable->glz_ring) {
|
||||
SPICE_CONTAINEROF(item, RedGlzDrawable, drawable_link)->drawable = NULL;
|
||||
SPICE_CONTAINEROF(item, RedGlzDrawable, drawable_link)->has_drawable = FALSE;
|
||||
ring_remove(item);
|
||||
}
|
||||
if (drawable->red_drawable) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user