Merge lp:~smspillaz/compiz-core/compiz-core.work_923683 into lp:compiz-core/0.9.5
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Daniel van Vugt | 2012-01-31 | Resubmit on 2012-02-06 | |
Alan Griffiths | Needs Fixing on 2012-02-02 | ||
Review via email:
|
This proposal has been superseded by a proposal from 2012-02-06.
Description of the change
A lot of the work that I've wanted to do in order to properly fix this, but in a far more condensed form. (bug 923683). Proposing early so that ~vanvugt will see it :)
Always use the asynchronous codepaths in core. This commit changes the following:
* CompWindow::move is now just a wrapper around CompWindow:
* CompWindow:
* moveNotify is only ever called pre-request to the server in the case of
managed windows (SubstructureRe
the right place) and post ConfigureNotify for override redirect windows
* resizeNotify is always called post ConfigureNotify regardless of whether
or not the window is managed or not
* composite and opengl now use the geometry last sent to the server in order
to compute display matrices and window positions as well as damage regions
* decor now also does the above
* const correctness in include/
* removed priv->width and priv->height , which was just redundant data used for
window shading and honestly, is a ticking time bomb for future maintainers.
* CompWindow:
* Removed the majority of PrivateWindow:
of redundant code which PrivateWindow:
there was to send synthetic ConfigureNotify events to ourselves to notify about windows
moving within frame windows that don't move themselves. Its safer to use reconfigureXWindow
in this case and probably more sane too. We should look into removing the other update* functions.
Caveats:
0) There are no tests yet
1) Window movement performance will regress with this branch. This is *probably* due to the fact that for every slight movement, we send a full ConfigureWindow request to the X Server and it has to post back to us a full ConfigureNotify, for pretty much every pixel the window moves. In the case that we're not doing compositing thats fine, but in every other case its *super* chatty and largely unnecessary. This can probably be optimized a lot, but that will require work to gather up requests that we want to send to the X server - combine them (eg, merging the stack of requests based on the change mask and using the latest values where appropriate). Thats a lot of work and probably not appropriate in this branch
2) The diff is a little big
3) No tests
4) Window shading is more than likely going to break again, mostly because I haven't tested it yet, but also because shading does some strange things and manipulated geometry values in strange ways
5) No tests
Testing plan?
I would imagine here that the PendingConfigur
We'll need to get CompRegion into a testable state though, which is probably easily done.
- 2977. By Sam Spilsbury on 2012-01-31
-
Dump a bunch of debugging code
- 2978. By Sam Spilsbury on 2012-01-31
-
Dump more code nobody cares about
- 2979. By Sam Spilsbury on 2012-01-31
-
Dump more hacks
Sam Spilsbury (smspillaz) wrote : | # |
Sam Spilsbury (smspillaz) wrote : | # |
824 -
825 - if (!pendingConfig
826 - {
827 - /* Tell plugins its ok to start doing stupid things again but
828 - * obviously FIXME */
829 - CompOption::Vector options;
830 - CompOption::Value v;
831 -
832 - options.push_back (CompOption ("window", CompOption:
833 - v.set ((int) id);
834 - options.back ().set (v);
835 - options.push_back (CompOption ("active", CompOption:
836 - v.set ((int) 0);
837 - options.back ().set (v);
838 -
839 - /* Notify other plugins that it is unsafe to change geometry or serverGeometry
840 - * FIXME: That API should not be accessible to plugins, this is a hack to avoid
841 - * breaking ABI */
842 -
843 - screen-
844 - }
DIE
924 -bool
925 -PrivateWindow:
926 -{
927 - if (pendingConfigu
928 - {
929 - /* FIXME: This is a hack to avoid performance regressions
930 - * and must be removed in 0.9.6 */
931 - compLogMessage ("core", CompLogLevelWarn, "failed to receive ConfigureNotify event on 0x%x\n",
932 - id);
933 - pendingConfigur
934 - pendingConfigur
935 - }
936 -
937 - return false;
938 -}
939 -
940 void
941 compiz:
942 {
943 @@ -2454,21 +2148,6 @@
944 mValueMask (valueMask),
945 mXwc (*xwc)
946 {
947 - CompOption::Vector options;
948 - CompOption::Value v;
949 -
950 - options.push_back (CompOption ("window", CompOption:
951 - v.set ((int) w);
952 - options.back ().set (v);
953 - options.push_back (CompOption ("active", CompOption:
954 - v.set ((int) 1);
955 - options.back ().set (v);
956 -
957 - /* Notify other plugins that it is unsafe to change geometry or serverGeometry
958 - * FIXME: That API should not be accessible to plugins, this is a hack to avoid
959 - * breaking ABI */
960 -
961 - screen-
962 }
DIE
Daniel van Vugt (vanvugt) wrote : | # |
GOOD IN THEORY:
* Most of the description sounds like steps in the right direction.
* Simplified: Replacing 559 lines of code with 247.
UNSURE ABOUT THE THEORY:
* "composite and opengl now use the geometry last sent to the server"
This should give maximum performance, sure, but what if (for some reason) the server rejects the configure request as being somehow invalid? Would you ever encounter that, like moving a window to an invalid location?
For stability and correctness (which should be the primary goal right now) don't we want "composite and opengl now use the geometry last received from the server"?
* Caveat #1 is not really a caveat. It's the right (intended) design. But if you want to see a (buggy) example of how to solve the chattiness look at the timer code here:
https:/
This was slightly buggy though as it broke keyboatrd-initiated moves (incorrect pointer warp). Simple to fix, probably.
* Still no XFlush's to ensure XConfigureWindow happens immediately. Or are there adequate XSyncs already?
BAD IN THEORY:
* The diff is too big for a mere mortal (who hasn't worked on all the code before) to fully load into their mental interpreter and evaluate its theoretical correctness. Please read that sentence again; it's important.
GOOD IN PRACTICE:
* Window movement is smooth and predictable, but not really better than in oneiric.
BAD IN PRACTICE:
* The bug introduced is worse than the bug being fixed; Window contents offset from the frame/decorations whenever a window is created or maximized.
* All that code, but we still haven't reduced the lag below oneiric-levels. Still not as good as Gnome Shell.
CONCLUSION:
The theory is mostly good but there is at least one serious bug that needs fixing. We probably shouldn't risk 0.9.7.0 any more with large changes like this. We should aim to get this code into a later release when it's more stable, not 0.9.7.0.
Sam Spilsbury (smspillaz) wrote : | # |
> GOOD IN THEORY:
>
> * Most of the description sounds like steps in the right direction.
>
> * Simplified: Replacing 559 lines of code with 247.
>
>
> UNSURE ABOUT THE THEORY:
>
> * "composite and opengl now use the geometry last sent to the server"
> This should give maximum performance, sure, but what if (for some reason) the
> server rejects the configure request as being somehow invalid? Would you ever
> encounter that, like moving a window to an invalid location?
> For stability and correctness (which should be the primary goal right now)
> don't we want "composite and opengl now use the geometry last received from
> the server"?
See http://
Since we have SubstructureRed
The only error cases I can think of is where you ask for a window to be of a size < 0 or > MAXSHORT. Ideally we should check for that case.
>
> * Caveat #1 is not really a caveat. It's the right (intended) design. But if
> you want to see a (buggy) example of how to solve the chattiness look at the
> timer code here:
> https:/
> This was slightly buggy though as it broke keyboatrd-initiated moves
> (incorrect pointer warp). Simple to fix, probably.
>
There are some optimizations that can be done here - for example, if a window is grabbed, you can withold sending positions to the server until it is ungrabbed, or there is some other reason why you would want to do that. When that happens you can send it all at once.
> * Still no XFlush's to ensure XConfigureWindow happens immediately. Or are
> there adequate XSyncs already?
The GLib mainloop work introduced an XFlush as soon as we have finished dispatching the X event source.
>
>
> BAD IN THEORY:
>
> * The diff is too big for a mere mortal (who hasn't worked on all the code
> before) to fully load into their mental interpreter and evaluate its
> theoretical correctness. Please read that sentence again; it's important.
Indeed. The good thing is that its mostly all deletion and consolidation.
>
>
> GOOD IN PRACTICE:
>
> * Window movement is smooth and predictable, but not really better than in
> oneiric.
>
>
> BAD IN PRACTICE:
>
> * The bug introduced is worse than the bug being fixed; Window contents offset
> from the frame/decorations whenever a window is created or maximized.
Alright. I haven't seen this yet, but I have an idea of what might cause it. Will have a look into it when I get some time.
>
> * All that code, but we still haven't reduced the lag below oneiric-levels.
> Still not as good as Gnome Shell.
This will be fixed once the chattyness goes away. (as above). Watch your X.org CPU usage as you move windows - it skyrockets because at the moment we flood it with requests.
>
>
> CONCLUSION:
>
> The theory is mostly good but there is at least one serious bug that needs
> fixing. We probably shouldn't risk 0.9.7.0 any more with large changes like
> this. We should aim to get this code into a later r...
Alan Griffiths (alan-griffiths) wrote : | # |
OK, I'm still wading through the changes. But I feel like a rant...
1307 CompSize
1308 CompWindow::size () const
1309 {
1310 - return CompSize (priv->width + priv->geometry.
1311 - priv->height + priv->geometry.
1312 + return CompSize (priv->
1313 + priv->geometry.
1314 }
As a change this doesn't look too bad - but it ignores a horrid design!
1. Chained operations like "priv->
That is "priv->width ()" would reflect less coupling.
2. You're tracing the path "priv->geometry..." many times, which suggests that the logic belongs in "geometry".
"return priv->geometry.size ()" or "return CompSize(
So, assuming (because borders may be optional?) that there's an unambiguous mapping from CompWindow:
a. Add a constructor to CompSize: "explicit CompSize(
b. Add an inline method "CompSize PrivateWindow::size () const { return CompSize(
c. Rewrite the above as "CompSize CompWindow::size () const { "return priv->size ()"; }"
Alan Griffiths (alan-griffiths) wrote : | # |
264 - /* been shaded */
265 + /* been shaded
266 if (w->priv->height == 0)
267 {
268 if (w->id () == priv->activeWindow)
269 w->moveInputFocusTo ();
270 - }
271 + }*/
Comments are not for storing old versions of the code - that's what we use bzr for. ;)
Alan Griffiths (alan-griffiths) wrote : | # |
There's a lot of "<blah>.width () + <blah>.border () * 2" and "<blah>.height () + <blah>.border () * 2" around. Surely CompWindow:
I'm tempted by
template<Typename T>
inline int heightWithBorders(T const& blah) { return blah.height () + blah.border () * 2; }
Sam Spilsbury (smspillaz) wrote : | # |
> OK, I'm still wading through the changes. But I feel like a rant...
>
> 1307 CompSize
> 1308 CompWindow::size () const
> 1309 {
> 1310 - return CompSize (priv->width + priv->geometry.
> 1311 - priv->height + priv->geometry.
> 1312 + return CompSize (priv->
> * 2,
> 1313 + priv->geometry.
> 1314 }
>
> As a change this doesn't look too bad - but it ignores a horrid design!
>
> 1. Chained operations like "priv->
> of the details of "priv".
> That is "priv->width ()" would reflect less coupling.
Probably, although priv is just a private member with implementation details, I don't really see this as a large design problem.
>
> 2. You're tracing the path "priv->geometry..." many times, which suggests that
> the logic belongs in "geometry".
> "return priv->geometry.size ()" or "return CompSize(
> reflect better coherence.
>
> So, assuming (because borders may be optional?) that there's an unambiguous
> mapping from CompWindow:
>
> a. Add a constructor to CompSize: "explicit CompSize(
> const& g) : mWidth(g.width () + g.border () * 2) ..."
> b. Add an inline method "CompSize PrivateWindow::size () const { return
> CompSize(
> c. Rewrite the above as "CompSize CompWindow::size () const { "return
> priv->size ()"; }"
+1 for all three
Sam Spilsbury (smspillaz) wrote : | # |
> 264 - /* been shaded */
> 265 + /* been shaded
> 266 if (w->priv->height == 0)
> 267 {
> 268 if (w->id () == priv->activeWindow)
> 269 w->moveInputFocusTo ();
> 270 - }
> 271 + }*/
>
> Comments are not for storing old versions of the code - that's what we use bzr
> for. ;)
Indeed, this is a small portion of the code and I'm not yet sure what to do with it. When I get around to revisiting this section (when I actually get time to look at this again, wanted to get it up for review early) I'll see what can be done.
Sam Spilsbury (smspillaz) wrote : | # |
> There's a lot of "<blah>.width () + <blah>.border () * 2" and "<blah>.height
> () + <blah>.border () * 2" around. Surely CompWindow:
> "widthWithBorders" method - or maybe a free function?
>
> I'm tempted by
>
> template<Typename T>
> inline int heightWithBorders(T const& blah) { return blah.height () +
> blah.border () * 2; }
I'm not really sure ?
The complexity here comes from a legacy part of the X Server coming into play - a window could have fixed dimentions, but also specify a "border" which would be exclusive of the fixed dimentions, so you'd have to take this into account for all positioning operations (Xterm comes to mind here).
I definitely agree that geom.width () + geom.border () * 2 feels fragile and indeed, that has tripped me up many times before. Maybe a default parameter with a bitflag makes sense here, eg IncludeBorder , IncludeBorderFirst , IncludeBorderSecond (as it is on both sides)
Sam Spilsbury (smspillaz) wrote : | # |
I'll note that the above isn't *really* all that relevant to this merge though, but good things to keep in mind in any case. I'd rather not see the diff get any better except for adding tests.
Daniel van Vugt (vanvugt) wrote : | # |
Please resubmit for target branch lp:compiz-core (0.9.7)
- 2980. By Sam Spilsbury on 2012-02-07
-
Use serverGeometry for rectsToRegion so that there isn't a race condition
when we fetch the shape rectangles from the server and remove a mostly useless
section of configureXWindow - 2981. By Sam Spilsbury on 2012-02-07
-
Remove commented code, use serverGeometry where appropriate
- 2982. By Sam Spilsbury on 2012-02-07
-
Remove XSynchronize
- 2983. By Sam Spilsbury on 2012-02-07
-
Merged from lp:compiz-core
- 2984. By Sam Spilsbury on 2012-02-08
-
Fix a memory leak in the decor plugin ... use shared_ptr etc
- 2985. By Sam Spilsbury on 2012-02-08
-
Don't spuriously re-create decorations when we don't need to. Also handle the
race between the decorator and the decor plugin when attempting to bind a pixmap
that hasn't been fully formed yet. (Should really use XSync barriers in future) - 2986. By Sam Spilsbury on 2012-02-25
-
Merged from lp:compiz-core
- 2987. By Sam Spilsbury on 2012-02-25
-
Update PrivateWindow:
:isInvisible - 2988. By Sam Spilsbury on 2012-02-25
-
Also adjust the client position inside the frame whenever the frame value mask
indicates that it might have moved. - 2989. By Sam Spilsbury on 2012-02-25
-
Added a note for a fixme
- 2990. By Sam Spilsbury on 2012-02-25
-
Also send moveNotify for override redirect windows
- 2991. By Sam Spilsbury on 2012-02-28
-
Cleanup, fix removal of XSynchronize and detect error conditions
- 2992. By Sam Spilsbury on 2012-02-28
-
Fix silly typo
- 2993. By Sam Spilsbury on 2012-02-28
-
Merge lp:compiz-core
- 2994. By Sam Spilsbury on 2012-02-29
-
Use reference
- 2995. By Sam Spilsbury on 2012-04-03
-
Merge trunk
- 2996. By Sam Spilsbury on 2012-04-04
-
Removed a lot of width () / height () + border () * 2 sillyness, replace with
more sturdy abstraction - 2997. By Sam Spilsbury on 2012-04-05
-
Fix LP #932520 - Update regions correctly when sending geometry updates
Use information last sent to server to determine window regions and shape
regions, update regions for resizing when we send the information to the server
as the shape rectangles will be correct anyways (even though it costs us a
round trip). - 2998. By Sam Spilsbury on 2012-04-05
-
Replace instances of geometry with serverGeoemtry where appropriate
- 2999. By Sam Spilsbury on 2012-04-05
-
Merge lp:compiz-core
- 3000. By Sam Spilsbury on 2012-04-07
-
Fix typoo
- 3001. By Sam Spilsbury on 2012-04-11
-
Merge trunk
- 3002. By Sam Spilsbury on 2012-04-11
-
Remove abi breaks
- 3003. By Sam Spilsbury on 2012-04-11
-
Don't break abi
- 3004. By Sam Spilsbury on 2012-04-11
-
Use geometry last sent to server to calculate damage rects
- 3005. By Sam Spilsbury on 2012-04-11
-
Use server side rects for calculating clip regions
- 3006. By Sam Spilsbury on 2012-04-12
-
Use serverGeometry
- 3007. By Sam Spilsbury on 2012-04-12
-
Damage the screen when windows are resized
- 3008. By Sam Spilsbury on 2012-04-12
-
Style issue
- 3009. By Sam Spilsbury on 2012-04-14
-
Merged trunk and fixed a number of problems with resize synchronization
- 3010. By Sam Spilsbury on 2012-04-14
-
Send resize notification immediately for windows that aren't override redirect
- 3011. By Sam Spilsbury on 2012-04-14
-
Fix jumping around on resize because we were rebinding way too much at the wrong time.
Only rebind on paints.
- 3012. By Sam Spilsbury on 2012-04-14
-
Don't not update decorations when we're grabbed for resizing
- 3013. By Sam Spilsbury on 2012-04-14
-
Null check
- 3014. By Sam Spilsbury on 2012-04-15
-
resize: unconditionally finish the resize operation when releasing the button
- 3015. By Sam Spilsbury on 2012-04-16
-
Merge trunk
- 3016. By Sam Spilsbury on 2012-04-16
-
Don't send a moveNotify and resizeNotify if the window was moved and resized
- 3017. By Sam Spilsbury on 2012-04-16
-
Cleanup wobbly model update code
- 3018. By Sam Spilsbury on 2012-04-17
-
Ensure that override redirect windows get their regions set correctly.
Also they can't have input extents. - 3019. By Sam Spilsbury on 2012-04-18
-
Force all override redirect windows to use geometry last received from
server. Force all managed windows to use geometry last sent.The difference between geometry and server* is now moot and can be
removed in a future release - 3020. By Sam Spilsbury on 2012-04-18
-
Clean some cruft
- 3021. By Sam Spilsbury on 2012-04-18
-
Update decoration matrix of shaded windows
- 3022. By Sam Spilsbury on 2012-04-18
-
Send a resizeNotify to indicate to plugins when map operations have completed
- 3023. By Sam Spilsbury on 2012-04-18
-
Merge lp:compiz-core
- 3024. By Sam Spilsbury on 2012-04-18
-
Don't notify plugins of unreparent in the right place
- 3025. By Sam Spilsbury on 2012-04-18
-
Merged lp:~vanvugt/compiz-core/compiz-core/fix-981703-properly
- 3026. By Sam Spilsbury on 2012-04-18
-
updateState is bitwise, so never clobber it
- 3027. By Sam Spilsbury on 2012-04-18
-
Base decision to send notifications to plugins on absolute position
changes - 3028. By Sam Spilsbury on 2012-04-19
-
Don't set height = 0 if the window still has a pixmap
- 3029. By Sam Spilsbury on 2012-04-19
-
Remove some unnecessary cahgnes in the wobbly plugin
- 3030. By Sam Spilsbury on 2012-04-19
-
Merge lp:compiz-core
- 3031. By Sam Spilsbury on 2012-04-19
-
Now that geometry and serverGeometry both return the same thing, the changes
in client code don't make any sense to keep - 3032. By Sam Spilsbury on 2012-04-20
-
Fix logic errors
- 3033. By Sam Spilsbury on 2012-04-20
-
!= 0 not necessary
- 3034. By Sam Spilsbury on 2012-04-23
-
Merge lp:compiz-core
Unmerged revisions
- 3034. By Sam Spilsbury on 2012-04-23
-
Merge lp:compiz-core
- 3033. By Sam Spilsbury on 2012-04-20
-
!= 0 not necessary
- 3032. By Sam Spilsbury on 2012-04-20
-
Fix logic errors
- 3031. By Sam Spilsbury on 2012-04-19
-
Now that geometry and serverGeometry both return the same thing, the changes
in client code don't make any sense to keep - 3030. By Sam Spilsbury on 2012-04-19
-
Merge lp:compiz-core
- 3029. By Sam Spilsbury on 2012-04-19
-
Remove some unnecessary cahgnes in the wobbly plugin
- 3028. By Sam Spilsbury on 2012-04-19
-
Don't set height = 0 if the window still has a pixmap
- 3027. By Sam Spilsbury on 2012-04-18
-
Base decision to send notifications to plugins on absolute position
changes - 3026. By Sam Spilsbury on 2012-04-18
-
updateState is bitwise, so never clobber it
- 3025. By Sam Spilsbury on 2012-04-18
-
Merged lp:~vanvugt/compiz-core/compiz-core/fix-981703-properly
The diff is big and scary, but its not too complicated. I'll explain each separate part
1 === modified file 'include/ core/window. h' core/window. h 2012-01-20 15:20:44 +0000 core/window. h 2012-01-31 17:12:59 +0000 tes);
2 --- include/
3 +++ include/
4 @@ -398,9 +398,9 @@
5
6 bool hasUnmapReference ();
7
8 - bool resize (XWindowAttribu
9 + bool resize (const XWindowAttributes &);
10
11 - bool resize (Geometry);
12 + bool resize (const Geometry &);
13
14 bool resize (int x, int y, int width, int height,
15 int border = 0);
const correctness
31 int x1, x2, y1, y2; :Geometry geom = priv->window- >geometry (); >output (); :Geometry &geom = priv->window- >serverGeometry (); >output ();
32
33 - CompWindow:
34 - CompWindowExtents output = priv->window-
35 + const CompWindow:
36 + const CompWindowExtents &output = priv->window-
more const correctness
35 + const CompWindow: :Geometry &geom = priv->window- >serverGeometry (); >output ();
36 + const CompWindowExtents &output = priv->window-
Lots of this - in paint code we want to use serverFoo because it was the last thing sent to the server. And this is always guarunteed to come back to us.
166 - unsigned int width = window->size ().width ();
167 - unsigned int height = window->size ().height ();
168 + unsigned int width = window->geometry ().width ();
169 + unsigned int height = window->geometry ().height ();
CompWindow::size was just returning CompSize (priv->width, priv->height) which was just redundant data which should be removed. Replaced it with geometry () for clarity
299 + void move (int dx, int dy, bool sync); :Geometry &g);
300 + bool resize (int dx, int dy, int dwidth, int dheight, int dborder);
301 + bool resize (const CompWindow:
302 + bool resize (const XWindowAttributes &attrib);
303 +
Added PrivateWindow::move and PrivateWindow: :resize - to be called whenever a new position / size comes back from the server. (cut'n'paste code from CompWindow::move and CompWindow::resize
335 - Request, NULL); >syncPosition (); border () * 2; width () + serverInput.left + serverInput.right + bw; height () + serverInput.top + serverInput.bottom + bw; metry.x () == xwc.x) etry.setX (xwc.x); width (), serverGeometry. height ()); >sendConfigureN otify (); >windowNotify (CompWindowNoti fyFrameUpdate. ..
336 - gettimeofday (&lastConfigure
337 - /* Flush any changes made to serverFrameGeometry or serverGeometry to the server
338 - * since there is a race condition where geometries will go out-of-sync with
339 - * window movement */
340 -
341 - window-
342 -
343 - if (serverInput.left || serverInput.right || serverInput.top || serverInput.bottom)
344 - {
345 - int bw = serverGeometry.
346 -
347 - xwc.x = serverGeometry.x () - serverInput.left;
348 - xwc.y = serverGeometry.y () - serverInput.top;
349 - xwc.width = serverGeometry.
350 - if (shaded)
351 - xwc.height = serverInput.top + serverInput.bottom + bw;
352 - else
353 - xwc.height = serverGeometry.
354 -
355 - if (shaded)
356 - height = serverInput.top + serverInput.bottom;
357 -
358 - if (serverFrameGeo
359 - valueMask &= ~(CWX);
360 - else
361 - serverFrameGeom
362 -
*snip*
616 - XMoveResizeWindow (screen->dpy (), id, 0, 0,
617 - serverGeometry.
618 - window-
619 - window-