mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-31 02:41:52 +00:00
Pass surface directly calling dcc_clear_surface_drawables_from_pipe
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Victor Toso <victortoso@redhat.com>
This commit is contained in:
parent
2b219cace5
commit
58a612a039
@ -99,22 +99,16 @@ bool dcc_drawable_is_in_pipe(DisplayChannelClient *dcc, Drawable *drawable)
|
||||
}
|
||||
|
||||
/*
|
||||
* Return: TRUE if wait_if_used == FALSE, or otherwise, if all of the pipe items that
|
||||
* Return: true if wait_if_used == false, or otherwise, if all of the pipe items that
|
||||
* are related to the surface have been cleared (or sent) from the pipe.
|
||||
*/
|
||||
bool dcc_clear_surface_drawables_from_pipe(DisplayChannelClient *dcc, int surface_id,
|
||||
int wait_if_used)
|
||||
bool dcc_clear_surface_drawables_from_pipe(DisplayChannelClient *dcc, RedSurface *surface,
|
||||
bool wait_if_used)
|
||||
{
|
||||
DisplayChannel *display;
|
||||
RedSurface *surface;
|
||||
|
||||
spice_return_val_if_fail(dcc != nullptr, TRUE);
|
||||
/* removing the newest drawables that their destination is surface_id and
|
||||
/* removing the newest drawables that their destination is surface and
|
||||
no other drawable depends on them */
|
||||
|
||||
display = DCC_TO_DC(dcc);
|
||||
surface = &display->priv->surfaces[surface_id];
|
||||
|
||||
auto &pipe = dcc->get_pipe();
|
||||
for (auto l = pipe.begin(); l != pipe.end(); ) {
|
||||
Drawable *drawable;
|
||||
@ -141,16 +135,16 @@ bool dcc_clear_surface_drawables_from_pipe(DisplayChannelClient *dcc, int surfac
|
||||
std::find(std::begin(drawable->surface_deps), std::end(drawable->surface_deps),
|
||||
surface) != std::end(drawable->surface_deps);
|
||||
if (depend_found) {
|
||||
spice_debug("surface %d dependent item found %p, %p", surface_id, drawable, item);
|
||||
spice_debug("surface %d dependent item found %p, %p", surface->id, drawable, item);
|
||||
if (!wait_if_used) {
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
return dcc->wait_pipe_item_sent(item_pos, COMMON_CLIENT_TIMEOUT);
|
||||
}
|
||||
}
|
||||
|
||||
if (!wait_if_used) {
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -81,6 +81,7 @@ public:
|
||||
struct DisplayChannel;
|
||||
struct VideoStream;
|
||||
struct VideoStreamAgent;
|
||||
struct RedSurface;
|
||||
|
||||
typedef struct WaitForChannels {
|
||||
SpiceMsgWaitForChannels header;
|
||||
@ -131,9 +132,6 @@ void dcc_append_drawable (DisplayCha
|
||||
void dcc_add_drawable_after (DisplayChannelClient *dcc,
|
||||
Drawable *drawable,
|
||||
RedPipeItem *pos);
|
||||
bool dcc_clear_surface_drawables_from_pipe (DisplayChannelClient *dcc,
|
||||
int surface_id,
|
||||
int wait_if_used);
|
||||
bool dcc_drawable_is_in_pipe (DisplayChannelClient *dcc,
|
||||
Drawable *drawable);
|
||||
|
||||
@ -142,6 +140,8 @@ int dcc_compress_image (DisplayCha
|
||||
int can_lossy,
|
||||
compress_send_data_t* o_comp_data);
|
||||
|
||||
bool dcc_clear_surface_drawables_from_pipe(DisplayChannelClient *dcc,
|
||||
RedSurface *surface, bool wait_if_used);
|
||||
void dcc_add_surface_area_image(DisplayChannelClient *dcc, int surface_id,
|
||||
SpiceRect *area, RedChannelClient::Pipe::iterator pipe_item_pos,
|
||||
int can_lossy);
|
||||
|
||||
@ -1965,13 +1965,13 @@ void display_channel_update(DisplayChannel *display,
|
||||
region_clear(&surface->draw_dirty_region);
|
||||
}
|
||||
|
||||
static void clear_surface_drawables_from_pipes(DisplayChannel *display, int surface_id,
|
||||
static void clear_surface_drawables_from_pipes(DisplayChannel *display, RedSurface *surface,
|
||||
int wait_if_used)
|
||||
{
|
||||
DisplayChannelClient *dcc;
|
||||
|
||||
FOREACH_DCC(display, dcc) {
|
||||
if (!dcc_clear_surface_drawables_from_pipe(dcc, surface_id, wait_if_used)) {
|
||||
if (!dcc_clear_surface_drawables_from_pipe(dcc, surface, wait_if_used)) {
|
||||
dcc->disconnect();
|
||||
}
|
||||
}
|
||||
@ -1985,7 +1985,7 @@ static void display_channel_destroy_surface(DisplayChannel *display, RedSurface
|
||||
otherwise "current" will hold items that other drawables may depend on, and then
|
||||
current_remove_all will remove them from the pipe. */
|
||||
current_remove_all(display, surface);
|
||||
clear_surface_drawables_from_pipes(display, surface->id, false);
|
||||
clear_surface_drawables_from_pipes(display, surface, false);
|
||||
display_channel_surface_unref(display, surface);
|
||||
}
|
||||
|
||||
@ -2002,7 +2002,7 @@ void display_channel_destroy_surface_wait(DisplayChannel *display, uint32_t surf
|
||||
otherwise "current" will hold items that other drawables may depend on, and then
|
||||
current_remove_all will remove them from the pipe. */
|
||||
current_remove_all(display, surface);
|
||||
clear_surface_drawables_from_pipes(display, surface_id, TRUE);
|
||||
clear_surface_drawables_from_pipes(display, surface, true);
|
||||
}
|
||||
|
||||
/* called upon device reset */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user