summaryrefslogtreecommitdiffstats
path: root/common.h
diff options
context:
space:
mode:
authorRichard Grenville <[email protected]>2013-04-05 21:05:19 +0800
committerRichard Grenville <[email protected]>2013-04-05 21:05:19 +0800
commit53870fb7fe83f5ab54a0e37a553f3dd769e2fbbf (patch)
tree570c68806c57c2a5dd76f398bcb4d519f527fcb3 /common.h
parentab53e73ce77aa44458de55f62abf6273ac44d540 (diff)
downloadtdebase-53870fb7fe83f5ab54a0e37a553f3dd769e2fbbf.tar.gz
tdebase-53870fb7fe83f5ab54a0e37a553f3dd769e2fbbf.zip
Improvement: GLX: Cache region contents & --glx-no-rebind-pixmap
- Cache region contents in is_region_empty(), mostly useful only for GLX backend to save one roundtrip to X. - GLX backend: Add --glx-no-rebind-pixmap, which prevents rebinding of GLX texture to pixmap on content change. It doesn't work on some drivers, but it saves some CPU on those where it does. - Wrap XFree() with a new function cxfree() since its man page claims NULL pointers are not acceptable (although in fact it does...). - Use macro to save some code in get_cfg(). Code clean-up.
Diffstat (limited to 'common.h')
-rw-r--r--common.h23
1 files changed, 19 insertions, 4 deletions
diff --git a/common.h b/common.h
index 2f5b831d1..eb57250b0 100644
--- a/common.h
+++ b/common.h
@@ -357,12 +357,15 @@ typedef struct {
char *display;
/// The backend in use.
enum backend backend;
- /// Whether to avoid using stencil buffer under GLX backend. Might be unsafe.
+ /// Whether to avoid using stencil buffer under GLX backend. Might be
+ /// unsafe.
bool glx_no_stencil;
/// Whether to copy unmodified regions from front buffer.
bool glx_copy_from_front;
/// Whether to use glXCopySubBufferMESA() to update screen.
bool glx_use_copysubbuffermesa;
+ /// Whether to avoid rebinding pixmap on window damage.
+ bool glx_no_rebind_pixmap;
/// Whether to try to detect WM windows and mark them as focused.
bool mark_wmwin_focused;
/// Whether to mark override-redirect windows as focused.
@@ -1425,6 +1428,17 @@ fds_poll(session_t *ps, struct timeval *ptv) {
#undef CPY_FDS
/**
+ * Wrapper of XFree() for convenience.
+ *
+ * Because a NULL pointer cannot be passed to XFree(), its man page says.
+ */
+static inline void
+cxfree(void *data) {
+ if (data)
+ XFree(data);
+}
+
+/**
* Wrapper of XInternAtom() for convenience.
*/
static inline Atom
@@ -1544,7 +1558,7 @@ wid_has_prop(const session_t *ps, Window w, Atom atom) {
if (Success == XGetWindowProperty(ps->dpy, w, atom, 0, 0, False,
AnyPropertyType, &type, &format, &nitems, &after, &data)) {
- XFree(data);
+ cxfree(data);
if (type) return true;
}
@@ -1598,7 +1612,7 @@ static inline void
free_winprop(winprop_t *pprop) {
// Empty the whole structure to avoid possible issues
if (pprop->data.p8) {
- XFree(pprop->data.p8);
+ cxfree(pprop->data.p8);
pprop->data.p8 = NULL;
}
pprop->nitems = 0;
@@ -1647,7 +1661,8 @@ glx_tex_binded(const glx_texture_t *ptex, Pixmap pixmap) {
}
void
-glx_set_clip(session_t *ps, XserverRegion reg);
+glx_set_clip(session_t *ps, XserverRegion reg,
+ const XRectangle * const cache_rects, const int cache_nrects);
bool
glx_blur_dst(session_t *ps, int dx, int dy, int width, int height, float z,