]> git.pld-linux.org Git - packages/qt4.git/blame - 0274-shm-native-image-fix.diff
- new qt-copy patches
[packages/qt4.git] / 0274-shm-native-image-fix.diff
CommitLineData
74c11577
AM
1qt-bugs@ issue : none
2Qt Software task ID : none
3bugs.kde.org number : none
4applied: no
5author: Fredrik Höglund <fredrik@kde.org>
6
7This patch makes the raster graphics system use shared images instead
8of shared pixmaps.
9
10Shared memory pixmaps are deprecated since they are slower than shared
11images with modern graphics hardware. They are also not supported by EXA
12drivers and can be disabled in the latest version of the NVidia driver.
13
14Index: src/gui/kernel/qapplication_x11.cpp
15===================================================================
16--- src/gui/kernel/qapplication_x11.cpp (revision 934506)
17+++ src/gui/kernel/qapplication_x11.cpp (working copy)
18@@ -1943,7 +1943,7 @@ void qt_init(QApplicationPrivate *priv,
19 // to determine whether the display is local or not (not 100 % accurate)
20 bool local = displayName.isEmpty() || displayName.lastIndexOf(QLatin1Char(':')) == 0;
21 if (local && (qgetenv("QT_X11_NO_MITSHM").toInt() == 0))
22- X11->use_mitshm = mitshm_pixmaps;
23+ X11->use_mitshm = true;
24 }
25 #endif // QT_NO_MITSHM
26
27Index: src/gui/image/qnativeimage_p.h
28===================================================================
29--- src/gui/image/qnativeimage_p.h (revision 930645)
30+++ src/gui/image/qnativeimage_p.h (working copy)
31@@ -85,7 +85,6 @@
32
33 #elif defined(Q_WS_X11) && !defined(QT_NO_MITSHM)
34 XImage *xshmimg;
35- Pixmap xshmpm;
36 XShmSegmentInfo xshminfo;
37
38 #elif defined(Q_WS_MAC)
39Index: src/gui/image/qnativeimage.cpp
40===================================================================
41--- src/gui/image/qnativeimage.cpp (revision 930645)
42+++ src/gui/image/qnativeimage.cpp (working copy)
43@@ -140,7 +140,6 @@
44 {
45 if (!X11->use_mitshm) {
46 xshmimg = 0;
47- xshmpm = 0;
48 image = QImage(width, height, format);
49 return;
50 }
51@@ -184,11 +183,6 @@
52 shmctl(xshminfo.shmid, IPC_RMID, 0);
53 return;
54 }
55- xshmpm = XShmCreatePixmap(X11->display, DefaultRootWindow(X11->display), xshmimg->data,
56- &xshminfo, width, height, dd);
57- if (!xshmpm) {
58- qWarning() << "QNativeImage: Unable to create shared Pixmap.";
59- }
60 }
61
62
63@@ -197,10 +191,6 @@
64 if (!xshmimg)
65 return;
66
67- if (xshmpm) {
68- XFreePixmap(X11->display, xshmpm);
69- xshmpm = 0;
70- }
71 XShmDetach(X11->display, &xshminfo);
72 xshmimg->data = 0;
73 XDestroyImage(xshmimg);
74Index: src/gui/painting/qwindowsurface_raster.cpp
75===================================================================
76--- src/gui/painting/qwindowsurface_raster.cpp (revision 930645)
77+++ src/gui/painting/qwindowsurface_raster.cpp (working copy)
78@@ -228,9 +228,16 @@
79
80 QRect br = rgn.boundingRect().translated(offset);
81 #ifndef QT_NO_MITSHM
82- if (d_ptr->image->xshmpm) {
83- XCopyArea(X11->display, d_ptr->image->xshmpm, widget->handle(), d_ptr->gc,
84- br.x(), br.y(), br.width(), br.height(), wbr.x(), wbr.y());
85+ if (d_ptr->image->xshmimg && (br.width() * br.height() > 65536)) {
86+ const QImage &src = d->image->image;
87+ br = br.intersected(src.rect());
88+ // Hack to make sure we satisify the PutImage() constraints in the X server,
89+ // since the doShmPutImage() route currently forces a migration to system ram.
90+ wbr.setX(wbr.x() - br.x());
91+ br.setX(0);
92+ br.setWidth(src.width());
93+ XShmPutImage(X11->display, widget->handle(), d_ptr->gc, d_ptr->image->xshmimg,
94+ br.x(), br.y(), wbr.x(), wbr.y(), br.width(), br.height(), False);
95 XSync(X11->display, False);
96 } else
97 #endif
This page took 0.533878 seconds and 4 git commands to generate.