summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <freddy77@gmail.com>2021-05-26 21:14:21 +0100
committerFrediano Ziglio <freddy77@gmail.com>2023-11-22 07:39:19 +0000
commitb1233d11b27c5025430e33728ebafb2e3f330e9d (patch)
treeb812fb90a22b85e9d419bb2c6a93c09e7a7c94ae
parent9f791a26d52278227e42f7cd886080225c3d1af0 (diff)
SAVE
mark primary, surfaces -> surfaces_ (again)
-rw-r--r--server/dcc.cpp2
-rw-r--r--server/display-channel-private.h2
-rw-r--r--server/display-channel.cpp36
-rw-r--r--server/red-worker.cpp11
-rw-r--r--server/video-stream.cpp5
5 files changed, 31 insertions, 25 deletions
diff --git a/server/dcc.cpp b/server/dcc.cpp
index 01c16ab7..696a93fa 100644
--- a/server/dcc.cpp
+++ b/server/dcc.cpp
@@ -406,7 +406,7 @@ void dcc_start(DisplayChannelClient *dcc)
red::shared_ptr<DisplayChannelClient> self(dcc);
dcc->ack_zero_messages_window();
- auto surface0 = display->priv->surfaces[0];
+ auto surface0 = display->priv->surfaces_[0];
if (surface0) {
display_channel_current_flush(display, surface0);
dcc->pipe_add_type(RED_PIPE_ITEM_TYPE_INVAL_PALETTE_CACHE);
diff --git a/server/display-channel-private.h b/server/display-channel-private.h
index 04ac2c0d..69348996 100644
--- a/server/display-channel-private.h
+++ b/server/display-channel-private.h
@@ -115,7 +115,7 @@ struct DisplayChannelPrivate
uint32_t next_item_trace;
uint64_t streams_size_total;
- std::array<RedSurface *, NUM_SURFACES> surfaces;
+ std::array<RedSurface *, NUM_SURFACES> surfaces_;
uint32_t n_surfaces;
SpiceImageSurfaces image_surfaces;
diff --git a/server/display-channel.cpp b/server/display-channel.cpp
index b1b22a4c..85f61bb2 100644
--- a/server/display-channel.cpp
+++ b/server/display-channel.cpp
@@ -44,7 +44,7 @@ DisplayChannel::~DisplayChannel()
spice_assert(count == priv->streams_buf.size());
spice_assert(ring_is_empty(&priv->streams));
- for (const auto &surface : priv->surfaces) {
+ for (const auto &surface : priv->surfaces_) {
spice_assert(!surface);
}
}
@@ -257,8 +257,8 @@ static void display_channel_surface_unref(DisplayChannel *display, RedSurface *s
void display_channel_surface_id_unref(DisplayChannel *display, uint32_t surface_id)
{
- display_channel_surface_unref(display, display->priv->surfaces[surface_id]);
- display->priv->surfaces[surface_id] = nullptr;
+ display_channel_surface_unref(display, display->priv->surfaces_[surface_id]);
+ display->priv->surfaces_[surface_id] = nullptr;
}
static void streams_update_visible_region(DisplayChannel *display, Drawable *drawable)
@@ -1115,7 +1115,7 @@ static void drawable_ref_surface_deps(DisplayChannel *display, Drawable *drawabl
continue;
}
- RedSurface *surface = display->priv->surfaces[surface_id];
+ RedSurface *surface = display->priv->surfaces_[surface_id];
surface->refs++;
drawable->surface_deps[x] = surface;
}
@@ -1208,6 +1208,7 @@ static bool handle_surface_deps(DisplayChannel *display, Drawable *drawable)
surface_add_reverse_dependency(display, drawable->surface_deps[x],
&drawable->depend_items[x], drawable);
+ // XXX primary
if (drawable->surface_deps[x] && drawable->surface_deps[x]->id == 0) {
QRegion depend_region;
region_init(&depend_region);
@@ -1294,7 +1295,7 @@ static Drawable *display_channel_get_drawable(DisplayChannel *display, uint8_t e
drawable->tree_item.effect = effect;
- drawable->surface = display->priv->surfaces[red_drawable->surface_id];
+ drawable->surface = display->priv->surfaces_[red_drawable->surface_id];
drawable->surface->refs++;
drawable->red_drawable = red_drawable;
@@ -1419,7 +1420,7 @@ bool display_channel_wait_for_migrate_data(DisplayChannel *display)
void display_channel_flush_all_surfaces(DisplayChannel *display)
{
- for (const auto& surface : display->priv->surfaces) {
+ for (const auto& surface : display->priv->surfaces_) {
if (surface) {
display_channel_current_flush(display, surface);
}
@@ -1902,12 +1903,12 @@ void display_channel_draw(DisplayChannel *display, const SpiceRect *area, int su
{
RedSurface *surface;
- spice_return_if_fail(surface_id >= 0 && surface_id < display->priv->surfaces.size());
+ spice_return_if_fail(surface_id >= 0 && surface_id < display->priv->surfaces_.size());
spice_return_if_fail(area);
spice_return_if_fail(area->left >= 0 && area->top >= 0 &&
area->left < area->right && area->top < area->bottom);
- surface = display->priv->surfaces[surface_id];
+ surface = display->priv->surfaces_[surface_id];
display_channel_surface_draw(display, surface, area);
}
@@ -2011,7 +2012,7 @@ void display_channel_destroy_surfaces(DisplayChannel *display)
{
spice_debug("trace");
//to handle better
- for (auto& surface : display->priv->surfaces) {
+ for (auto& surface : display->priv->surfaces_) {
if (surface) {
display_channel_destroy_surface_wait(display, surface->id);
if (surface) {
@@ -2071,7 +2072,7 @@ display_channel_create_surface(DisplayChannel *display, uint32_t surface_id, uin
{
RedSurface *surface = new RedSurface;
- spice_warn_if_fail(!display->priv->surfaces[surface_id]);
+ spice_warn_if_fail(!display->priv->surfaces_[surface_id]);
surface->context.canvas_draws_on_surface = FALSE;
surface->context.width = width;
@@ -2119,10 +2120,10 @@ display_channel_create_surface(DisplayChannel *display, uint32_t surface_id, uin
ring_init(&surface->depend_on_me);
region_init(&surface->draw_dirty_region);
- if (display->priv->surfaces[surface_id]) {
- display_channel_surface_unref(display, display->priv->surfaces[surface_id]);
+ if (display->priv->surfaces_[surface_id]) {
+ display_channel_surface_unref(display, display->priv->surfaces_[surface_id]);
}
- display->priv->surfaces[surface_id] = surface;
+ display->priv->surfaces_[surface_id] = surface;
if (send_client) {
send_create_surface(display, surface, data_is_valid);
@@ -2191,7 +2192,7 @@ DisplayChannel::DisplayChannel(RedsState *reds,
image_surfaces_get,
};
- priv->n_surfaces = MIN(n_surfaces, priv->surfaces.size());
+ priv->n_surfaces = MIN(n_surfaces, priv->surfaces_.size());
priv->qxl = qxl;
/* must be manually allocated here since g_type_class_add_private() only
@@ -2246,7 +2247,7 @@ void display_channel_process_surface_cmd(DisplayChannel *display,
return;
}
- surface = display->priv->surfaces[surface_id];
+ surface = display->priv->surfaces_[surface_id];
switch (surface_cmd->type) {
case QXL_SURFACE_CMD_CREATE: {
@@ -2282,7 +2283,7 @@ void display_channel_process_surface_cmd(DisplayChannel *display,
}
surface->destroy_cmd = surface_cmd;
display_channel_destroy_surface(display, surface);
- display->priv->surfaces[surface_id] = nullptr;
+ display->priv->surfaces_[surface_id] = nullptr;
break;
default:
spice_warn_if_reached();
@@ -2352,7 +2353,7 @@ RedSurface *display_channel_validate_surface(DisplayChannel *display, uint32_t s
return nullptr;
}
- RedSurface *surface = display->priv->surfaces[surface_id];
+ RedSurface *surface = display->priv->surfaces_[surface_id];
if (!surface) {
spice_warning("surface %d is NULL", surface_id);
return nullptr;
@@ -2385,6 +2386,7 @@ void display_channel_update_monitors_config(DisplayChannel *display,
void display_channel_set_monitors_config_to_primary(DisplayChannel *display)
{
+ // XXX primary
RedSurface *surface = display_channel_validate_surface(display, 0);
spice_return_if_fail(surface);
diff --git a/server/red-worker.cpp b/server/red-worker.cpp
index 912b7d55..c4ef90ad 100644
--- a/server/red-worker.cpp
+++ b/server/red-worker.cpp
@@ -364,6 +364,7 @@ handle_dev_del_memslot(RedWorker* worker, RedWorkerMessageDelMemslot* msg)
static void
handle_dev_destroy_surface_wait(RedWorker* worker, RedWorkerMessageDestroySurfaceWait* msg)
{
+ // XXX surface_id
spice_return_if_fail(msg->surface_id == 0);
flush_all_qxl_commands(worker);
@@ -385,6 +386,7 @@ static void dev_create_primary_surface(RedWorker *worker, uint32_t surface_id,
uint8_t *line_0;
spice_debug("trace");
+ // XXX surface_id
spice_warn_if_fail(surface_id == 0);
spice_warn_if_fail(surface.height != 0);
@@ -411,9 +413,9 @@ static void dev_create_primary_surface(RedWorker *worker, uint32_t surface_id,
line_0 -= static_cast<int32_t>(surface.stride * (surface.height - 1));
}
- display_channel_create_surface(display, 0, surface.width, surface.height, surface.stride, surface.format,
+ display_channel_create_surface(display, surface_id, surface.width, surface.height, surface.stride, surface.format,
line_0, surface.flags & QXL_SURF_FLAG_KEEP_DATA, TRUE);
- display_channel_set_monitors_config_to_primary(display);
+ display_channel_set_monitors_config_to_primary(display); // XXX surface_id
CommonGraphicsChannel *common = display;
if (display->is_connected() &&
@@ -444,11 +446,12 @@ static void destroy_primary_surface(RedWorker *worker, uint32_t surface_id)
spice_warning("double destroy of primary surface");
return;
}
+ // XXX surface_id
spice_warn_if_fail(surface_id == 0);
flush_all_qxl_commands(worker);
- display_channel_destroy_surface_wait(display, 0);
- display_channel_surface_id_unref(display, 0);
+ display_channel_destroy_surface_wait(display, surface_id);
+ display_channel_surface_id_unref(display, surface_id);
worker->cursor_channel->reset();
}
diff --git a/server/video-stream.cpp b/server/video-stream.cpp
index 056d0c31..9c8bf4bc 100644
--- a/server/video-stream.cpp
+++ b/server/video-stream.cpp
@@ -846,12 +846,13 @@ static void dcc_detach_stream_gracefully(DisplayChannelClient *dcc,
spice_debug("stream %d: upgrade by screenshot. has current %d. box ==>",
stream_id, stream->current != nullptr);
rect_debug(&upgrade_area);
+ // XXX primary surface
if (update_area_limit) {
- display_channel_draw_until(display, &upgrade_area, display->priv->surfaces[0], update_area_limit);
+ display_channel_draw_until(display, &upgrade_area, display->priv->surfaces_[0], update_area_limit);
} else {
display_channel_draw(display, &upgrade_area, 0);
}
- dcc_add_surface_area_image(dcc, display->priv->surfaces[0], &upgrade_area,
+ dcc_add_surface_area_image(dcc, display->priv->surfaces_[0], &upgrade_area,
dcc->get_pipe().end(), false);
}
clear_vis_region: