[mutter] mutter-window: request DamageReportBoundingBox report level
- From: Robert Bragg <rbragg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] mutter-window: request DamageReportBoundingBox report level
- Date: Thu, 3 Jun 2010 23:37:39 +0000 (UTC)
commit 91d82bf8c78ac7d2ae8a39f5ed619a413e2d6320
Author: Robert Bragg <robert linux intel com>
Date: Thu May 13 21:43:30 2010 +0100
mutter-window: request DamageReportBoundingBox report level
In commit d34ae764769 I switched mutter-window to ask for Raw rectangles
from the X server. This avoided 2 non synchronous and 2 synchronous X
requests per window with damage, per frame; 2 (non-sync) to
create/destroy a temporary region to copy the damage region into, 1 to
request the server to copy the damage region into a our given region and
another to fetch that region back into the client. The problem with raw
events though is that it's possible to DOS the compositor with them.
Instead of receiving an event for every bit of damage this patch instead
asks the server to only report BoundingBox changes to the damage region.
https://bugzilla.gnome.org/show_bug.cgi?id=611838
src/compositor/mutter-window.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/src/compositor/mutter-window.c b/src/compositor/mutter-window.c
index 5116b31..f253494 100644
--- a/src/compositor/mutter-window.c
+++ b/src/compositor/mutter-window.c
@@ -68,6 +68,7 @@ struct _MutterWindowPrivate
guint redecorating : 1;
guint needs_damage_all : 1;
+ guint received_damage : 1;
guint needs_pixmap : 1;
guint needs_reshape : 1;
@@ -337,7 +338,7 @@ mutter_window_constructed (GObject *object)
priv->damage = None;
else
priv->damage = XDamageCreate (xdisplay, xwindow,
- XDamageReportRawRectangles);
+ XDamageReportBoundingBox);
format = XRenderFindVisualFormat (xdisplay, priv->attrs.visual);
@@ -1652,6 +1653,8 @@ mutter_window_process_damage (MutterWindow *self,
MutterWindowPrivate *priv = self->priv;
ClutterX11TexturePixmap *texture_x11 = CLUTTER_X11_TEXTURE_PIXMAP (priv->actor);
+ priv->received_damage = TRUE;
+
if (is_frozen (self))
{
/* The window is frozen due to an effect in progress: we ignore damage
@@ -1748,6 +1751,11 @@ mutter_window_update_shape (MutterWindow *self,
void
mutter_window_pre_paint (MutterWindow *self)
{
+ MutterWindowPrivate *priv = self->priv;
+ MetaScreen *screen = priv->screen;
+ MetaDisplay *display = meta_screen_get_display (screen);
+ Display *xdisplay = meta_display_get_xdisplay (display);
+
if (is_frozen (self))
{
/* The window is frozen due to a pending animation: we'll wait until
@@ -1755,6 +1763,12 @@ mutter_window_pre_paint (MutterWindow *self)
return;
}
+ if (priv->received_damage)
+ {
+ XDamageSubtract (xdisplay, priv->damage, None, None);
+ priv->received_damage = FALSE;
+ }
+
check_needs_reshape (self);
check_needs_pixmap (self);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]