Commit Graph

70 Commits

Author SHA1 Message Date
Caolán McNamara
044deb37ae coverity#1323754 we apparently can survive std::abort for a while
so try and suppress this warning

Change-Id: I096352af0116f1ba0911cc201eb884267095a797
2015-09-11 09:40:31 +01:00
Michael Meeks
055f76b8f1 tdf#93870 - GL accel. via VCL canvas for presentations when GL enabled.
Change-Id: Ia31a88cb3d9e6baa987b22f77f407a3f592031f1
Reviewed-on: https://gerrit.libreoffice.org/18285
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
2015-09-03 09:37:33 +00:00
Michael Meeks
16b0e217c1 tdf#93867 - clear current GL context before thread switch.
Fixes regression from otherwise a nice cleanup in:
    d20092259c

Also get polarity of debug logging only with a context right.

Change-Id: Id322471f01e5656e758aefc57b0d4d5ad073ec54
2015-09-02 22:46:48 +01:00
Michael Meeks
7164ec07ca Don't call GL debugging methods if there is no context.
Change-Id: Ie6b824953b8ad19fd1b6a146cb6bf52bbb152ef7
Reviewed-on: https://gerrit.libreoffice.org/18276
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2015-09-02 17:37:11 +00:00
Michael Meeks
998c64eaad Add SAL_DISABLE_GL_WATCHDOG env. var for obvious reasons.
Change-Id: Iec7cb6504a389972d8187954d5ed7aff94f2e01c
2015-09-02 16:09:39 +01:00
Michael Meeks
daa869222e tdf#93850 - Defer watchdog during shader compiles.
Shader compilation can take a while the first time; best not to
disable GL at that point. Have more of a hair trigger at other times.
Also explicitly exit if we appear to have hung in std::abort handling.

Change-Id: I45f0873672f950fb3baba0ca859d854a0bb25064
2015-09-02 12:12:01 +01:00
Michael Meeks
59618d22a0 tdf#93822 - disable horror legacy menu background saving for OpenGL.
Change-Id: Icaa5fb197f3fa234da4538a2a7b21131cab89277
2015-08-31 21:30:53 +01:00
Michael Meeks
6cf43cf6b9 Extended GL painting debug tracing.
Change-Id: I52158729d240ca3cb9e7977bc6d1f5acb14437ad
2015-08-31 20:18:54 +01:00
Michael Meeks
884bea629d tdf#93798 - avoid apitrace provoked infinite loop dumping errors.
Change-Id: I6c42e6a9ead90ed6fad2f289cd686a72cffa0c2d
2015-08-31 11:20:12 +01:00
Michael Meeks
b051c3716a tdf#93529 - add glDebugMessageInsert wrappers to help with API tracing.
Change-Id: Icf75e0e477be1b2bbbe5095aee33e681d212be0b
2015-08-28 11:31:38 +01:00
Michael Meeks
a7f07e4dfe Revert "tdf#93530 - the VCL GDI flushing abstraction should glFlush too."
This reverts commit e16e64dd86.

I somehow forgot that glFlush is context specific, (gl always gets
me that way).
2015-08-28 08:03:59 +01:00
Stephan Bergmann
44994d9511 Fully drain glGetError
...according to <https://www.opengl.org/sdk/docs/man/html/glGetError.xhtml>:
"To allow for distributed implementations, there may be several error flags. If
any single error flag has recorded an error, the value of that flag is returned
and that flag is reset to GL_NO_ERROR when glGetError is called. If more than
one flag has recorded an error, glGetError returns and clears an arbitrary error
flag value. Thus, glGetError should always be called in a loop, until it returns
GL_NO_ERROR, if all error flags are to be reset."

(The original code was flagged by clang-tidy's
clang-analyzer-deadcode.DeadStores.)

Change-Id: Ia64e2133b6a4581230b999d4b8b63aa59199ee32
2015-08-27 12:13:05 +02:00
Michael Meeks
e16e64dd86 tdf#93530 - the VCL GDI flushing abstraction should glFlush too.
Change-Id: I45cb0e62278d8c3154ae8ad54ca4c93b3e177969
Reviewed-on: https://gerrit.libreoffice.org/18030
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2015-08-26 21:10:27 +00:00
Michael Meeks
74bc7cb59c tdf#93614 - detect hanging OpenGL drivers with a watchdog.
If an OpenGL zone takes >2s to make progress, disable OpenGL.
If an OpenGL zone takes >5s to make progress, abort the app.

Change-Id: I776c06a3f8ba460ff9842a9130c21f9ee2147eee
Reviewed-on: https://gerrit.libreoffice.org/17986
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2015-08-25 17:08:46 +00:00
Michael Meeks
d20e7e3864 tdf#93547 - Disable OpenGL if we have a SEGV on windows in that code.
Annotate when we are in an OpenGL rendering zone.
Check for this in the VCL signal handler, and force OpenGL off here
if exception occurred inside an OpenGL code-path.

Change-Id: I85a4b3d4a374593dc55d01a39ec4c7c3c262c332
Reviewed-on: https://gerrit.libreoffice.org/17881
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2015-08-21 06:43:48 +00:00
Noel Grandin
8dc5f89346 loplugin: defaultparams
Change-Id: I79a889c68e91712d2abdacc559c78813f730e623
2015-08-11 09:48:18 +02:00
Tomaž Vajngerl
f7f0486376 tdf#88831 fix inverted textures when OpenGL is enabled
GLX returns a wrong value if the y coords are inverted. Most other
programs don't even ask for this (gnome-shell for example) and just
assumes "true" (and this works because most relevant X servers work
like this). We make this more robust and assume true only if the
returned value is GLX_DONT_CARE (-1).

Change-Id: I4800b3364fd00f5f4a8f5a459472bfa8d97827ba
2015-07-03 14:52:28 +09:00
Takeshi Abe
0980095619 Replace boost::scoped_array<T> with std::unique_ptr<T[]>
This may reduce some degree of dependency on boost.
Done by running a script like:

git grep -l '#include  *.boost/scoped_array.hpp.' \
 | xargs sed -i -e 's@#include  *.boost/scoped_array.hpp.@#include <memory>@'
git grep -l '\(boost::\)\?scoped_array<\([^<>]*\)>' \
 | xargs sed -i -e 's/\(boost::\)\?scoped_array<\([^<>]*\)>/std::unique_ptr<\2[]>/'

... and then killing duplicate or unnecessary includes,
while changing manually
m_xOutlineStylesCandidates in xmloff/source/text/txtimp.cxx,
extensions/source/ole/unoconversionutilities.hxx, and
extensions/source/ole/oleobjw.cxx.

Change-Id: I3955ed3ad99b94499a7bd0e6e3a09078771f9bfd
Reviewed-on: https://gerrit.libreoffice.org/16289
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2015-06-17 15:50:45 +00:00
Noel Grandin
d5129a9dd6 new clang plugin: loopvartoosmall
Idea from bubli - look for loops where the index variable is of such
size that it cannot cover the range revealed by examining the length
part of the condition.

So far, I have only run the plugin up till the VCL module.

Also the plugin deliberately excludes anything more complicated than a
straightforward incrementing for loop.

Change-Id: Ifced18b01c03ea537c64168465ce0b8287a42015
2015-05-28 12:49:54 +02:00
Stephan Bergmann
a9a4d46ce7 loplugin:simplifybool
Change-Id: I8276e8b356ff26241613de64bcd90b5dbcd92f29
2015-04-24 12:36:31 +02:00
Markus Mohrhard
ed043994a5 missing space in log message
Change-Id: I464dbf8cf9c65f2dd5e88236be8ddf4c0676bfdd
2015-03-16 02:56:04 +01:00
Caolán McNamara
124a3e680f coverity#1268023 Logically dead code
Change-Id: I8fcda18101071db7dddc304c29e4130b04a70f89
2015-03-09 21:27:31 +00:00
Riccardo Magliocchetti
b9a847b78c Fixup --without-x build
Accept gl linkage in hope of future offscreen mesa support.
Avoid linking with GLX though.

Change-Id: I4e666f60e74fe34075a8da9eeba95807cf8fe38c
Signed-off-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/13452
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
2015-02-07 00:01:41 +00:00
Caolán McNamara
dcf8f9622c help coverity out wrt coverity#1267682 String not null terminated
Change-Id: Ib72c0daf8573314d601d7acea3a1fbb3183b4bb6
2015-02-01 22:10:39 +00:00
Chris Sherlock
a2b94b9562 vcl: OpenGL code for adding preambles to glsl fragments now handles #version
If you include the #version directive then it must be on the first non-comment
line in a glsl fragment. This is now handled.

Change-Id: I7e938c27b24d20f25e656667a122d7a341f51611
Reviewed-on: https://gerrit.libreoffice.org/14246
Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
2015-01-30 03:03:46 +00:00
Luboš Luňák
df290c6345 make it possible to easily have variants of glsl programs
Now it's possible to add a preamble to the compiled program, so there can
be just one program with #ifdef's inside and the small variants can be
selected using #define in the preamble instead of having several almost
identical programs.

Change-Id: I6c5112313b91b6269ebdecdfc896e0f96209ea2b
2015-01-27 18:42:48 +01:00
Caolán McNamara
09f38e21c1 coverity#1266483 String not null terminated
Change-Id: I4d22e5a621d36fa2e914891e82ce7e8e06f60b4c
2015-01-25 14:36:14 +00:00
Chris Sherlock
fa4327421e vcl: OpenGLHelper::isVCLOpenGLEnabled() returns false when console only
Change-Id: I7bcda46c73b958637073f8ec95d093385a81df3f
2015-01-24 14:27:37 +11:00
Noel Grandin
7f8f277b94 fdo#84938: convert STREAM_ #defines to 'enum class'
Change-Id: Ibbf14c7e9a5c1883c1311d4c86f948f74f8e473e
2015-01-07 11:20:44 +02:00
Noel Grandin
54942f0d09 spelling: attachement -> attachment
Change-Id: I1bb1ad04adec864b594d96711f85b8fcdc1d1ef2
2015-01-05 12:57:18 +02:00
Markus Mohrhard
ae177f5b99 ifix the OpenGL UI config part
Change-Id: I931a4b618f35188e4e0cca07305ff15bbbacc20a
2014-12-18 10:20:12 +01:00
Markus Mohrhard
2a7571d00f make use of the new ForceOpenGL config variable
Change-Id: Ifdfcbd9d3d62d2a55e3e050d4723700f8436e57a
2014-12-17 22:31:16 +01:00
Markus Mohrhard
1fd34cd93f introduce SAL_FORCEGL and document the variables
SAL_FORCEGL can force OpenGL even if the driver is blacklisted.

Change-Id: Idc763d81fef6dbdf915154995205fbf2b1f060b4
2014-12-01 01:30:00 +01:00
Markus Mohrhard
b7d07ffcad request also a stencil size
Change-Id: Ib3b8b70aa50dd1a42108e3e9091350bf1d315b03
2014-11-30 00:47:32 +01:00
Markus Mohrhard
40ad9eea88 implement windows OpenGL blacklist, first step
Change-Id: I408b76855693c64473dba3bb3fa94374fff01fae
2014-11-27 21:18:29 +01:00
Markus Mohrhard
a55f740045 include the unx part for getting OpenGL driver & device information
desktop/unx/source/glxtest.cxx is taken directly from the Mozilla
project.

THe whole concept is taken from Mozilla and is based on starting an
early process that creates an OpenGL context. This prevents crashing
drivers to crash Libreoffice.

We read the information from the pipe as soon as we create the first vcl
Window. In that place we then decide if the device/driver combination is
blacklisted.

Change-Id: I2624d4ce06d503281a4459cf3174f57cf1f7b733
2014-11-20 13:50:51 +01:00
Michael Meeks
8f1b58b5ac vcl: fix un-initialized log length & clean copy/paste bits.
Change-Id: I39cd9ef32fafa2894ffde961d87adc6aac9d4a4f
2014-11-18 21:26:31 +00:00
Jan Holesovsky
3852d46941 opengl: Do not check for OpenGL errors in a loop.
Can lead to an infinite loop.

Change-Id: I09863959719115aec23534ac72a9a9690af3aeb9
2014-11-18 00:51:04 +01:00
Michael Meeks
8ecfdf9c23 vcl: disable OpenGL usage during build.
Change-Id: I3a534578df727f2aaab6e36839f0e62e6fc8f208
2014-11-16 17:00:57 +01:00
Jan Holesovsky
1d2c5224b2 opengl: Add many more CHECK_GL_ERROR()'s before returning from functions.
Change-Id: I63c147acf9a4013008b0f6d76867186f04ee57d5
2014-11-15 13:51:53 +01:00
Louis-Francis Ratté-Boulianne
f433825259 vcl: Use single-buffer rendering and only flush when necessary
Change-Id: I832dd6f3647fbb423975fa928a5ec32447225e85
2014-11-13 07:54:14 +01:00
Markus Mohrhard
4cbd2c0b41 add quick way to enable OpenGL backend through env var
Change-Id: I274c76178500c231c1339ac5f0cb7fc084cd1e4b
2014-11-12 06:02:48 +01:00
Michael Meeks
45c6cb5f08 vcl: cleanup the opengl selection API.
Change-Id: Icebf3c7d2911b27e29d2259b780a04048b293b3c
2014-11-10 16:51:12 +00:00
Louis-Francis Ratté-Boulianne
4007df6cc8 vcl: Initial work to have native widgets rendered with OpenGL
Change-Id: I8b244a5bdd12a64a65ca1bab14dfe6917a175ccf
2014-11-10 07:59:40 +01:00
Michael Meeks
2ad3552308 Make it easy to disable OpenGL in the environment.
Change-Id: I9ea0c9f7345e0cbad9ebb51ab724dada7ce77106
2014-11-10 07:59:22 +01:00
Markus Mohrhard
658e76cf95 improve log message when shader compilation fails
Change-Id: Ic437302e79d7a192f31f60a674fcfdb38f981d35
2014-11-10 07:59:16 +01:00
Louis-Francis Ratté-Boulianne
42dbcedc73 vcl: Get visual info for window from GLX when needed
Change-Id: Id8cea87391835694e20aa703b7fdb3f13434d47b
2014-11-10 07:59:03 +01:00
Markus Mohrhard
5606d14c3e add possibility to check if system can run OpenGL VCL backend
Change-Id: If3475c6b2c76e4634f16053928b43a94c83be6ee
2014-11-10 07:58:40 +01:00
Zolnai Tamás
079c861f08 fdo#81237: 2D OpenGL charts was upside-down
The problem is that LO drawinglayer uses a coordinate system
with an origin at the top-left corner of the screen, while
OpenGL uses a complete coordinate system (with all four
quarters, e.g.: allows negative values). The points in
LO are always positive values which means they are drawn
in the first quarter of the OpenGL coordinate system which
also means that the origin is at the bottom-left corner
of the scene. This difference causes the flipped scene.

* To solve that problem scale the projection matrix with -1.0f
along the y axis.
* glDisable(GL_CULL_FACE) is necessary to avoid dropping primitives
after scaling with -1.0.
* Since projection matrix mirrors also the textures we don't need to
do that inside the ConvertBitmapExToRGBATextureBuffer() method.

Change-Id: Ieba642f3e665778a12368fe50a20865ec8f73514
2014-09-17 09:59:50 +02:00
Markus Mohrhard
5a7ab9f1f4 add invalid framebuffer operation to OpenGL error messages
Change-Id: I359ec166e9bf0585842fb436a1edd20720b89a9b
2014-09-02 01:08:49 +02:00