aboutsummaryrefslogtreecommitdiffstats
path: root/emulator/opengl/host
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Validate glClear mask"bohu2014-11-061-0/+3
|\
| * Validate glClear maskbohu2014-10-281-0/+3
| | | | | | | | | | | | | | The mask should only be a combination of GL_DEPTH_BUFFER_BIT, GL_COLOR_BUFFER_BIT, and GL_STENCIL_BUFFER_BIT Change-Id: Ic448bd33a9bf0dc50db4298a53e96dd128fd110c
* | Merge "Check and return correct error code"bohu2014-11-061-3/+5
|\ \
| * | Check and return correct error codebohu2014-10-291-3/+5
| |/ | | | | | | | | | | | | check and return proper error codes when negative width, height or size or wrong internal texture format is passed in. Change-Id: Ic4ddea55042d8e21f8729a7ca675a44a232b7c7c
* | Merge changes I8cc8fdb0,I750f95f2,Ibab92ab3,Ib11fd06a,I9abc3f9aDavid 'Digit' Turner2014-10-3137-33/+731
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | * changes: emulator/opengl/emugen: Add new 'flushOnEncode' entry point flag. emulator/opengl: Fix glShaderSource() signature. emulator/opengl: Remove compiler warnings. emulator/opengl/emugen: Small cleanup of autogenerated sources. emulator/opengl: Add emugen test suite.
| * | emulator/opengl/emugen: Add new 'flushOnEncode' entry point flag.David 'Digit' Turner2014-10-3122-2/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a new flag that can be applied to entry points for 'emugen', named 'flushOnEncode'. When used, the generated encoder will call stream->flush() just after adding bytes to the stream. This is needed to match the manual change that was performed in the renderControl encoder in the following patch: https://android-review.googlesource.com/#/c/95864/ Change-Id: I8cc8fdb0d38ef27e8ba646c83d717166400babfd
| * | emulator/opengl: Fix glShaderSource() signature.David 'Digit' Turner2014-10-3110-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The glShaderSource() function really takes a 'const GLchar* const*' parameter, not 'const GLchar**'. This creates issues when compiling the auto-generated encoders created with the latest version of 'emugen' and the GL2 Khronos headers. This patch is used to fix the issue. Note that it requires defining a new type in gl2.types, as well as fixing the signature of misc functions in the translator. Change-Id: I750f95f2e33d83b3b5563642ad7f87e4b8a37f35
| * | emulator/opengl: Remove compiler warnings.David 'Digit' Turner2014-10-303-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch ensures that the auto-generated client_context.h headers do not generate compiler warnings in the setError() function. + Remove tiny warning for NativeLinuxSubWindow.cpp Change-Id: Ibab92ab3332fd284589435732b52c011ae21c15f
| * | emulator/opengl/emugen: Small cleanup of autogenerated sources.David 'Digit' Turner2014-10-307-52/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch ensures the generated sources are cleaned up a little bit, more specifically: - Add proper end-ifdef-guard comments. - Use anonymous C++ namespaces to avoid name conflicts in the encoder. - Remove extra spaces / empty lines / indent. - Use 'const' when defining constant tables. Change-Id: Ib11fd06adb9075d472d1dd2fd6defb0760aaa2c2
| * | emulator/opengl: Add emugen test suite.David 'Digit' Turner2014-10-3022-0/+629
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a small test suite to check the output of the 'emugen' program. This serves two purposes: 1) To more easily check that modifications to 'emugen' do not break stuff liberally. 2) To better document how the changes in the generator actually modify the output. To run it, simply call the 'run-tests.sh' script with 'emugen' in your path, or use --emugen=<program> otherwise. See --help for more details. NOTE: The test suite currently doesn't check that the generated sources compile properly, or that they even work as expected. See the following external/qemu patch to call run-tests.sh during each android-rebuild.sh run: https://android-review.googlesource.com/112541 Change-Id: I9abc3f9ae63b0bb753f0f8e07c1b3f0b11a3252f
* | validate glBufferData's usage parameterbohu2014-10-293-0/+12
|/ | | | | | | Only GL_STREAM_DRAW, GL_STATIC_DRAW and GL_DYNAMIC_DRAW usages are allowed. Change-Id: I2d6a425363c32330d25272d26884d32610d8dd19
* Merge "Handle empty data parameter in glTexSubImage2D"bohu2014-10-211-1/+1
|\
| * Handle empty data parameter in glTexSubImage2Dbohu2014-10-171-1/+1
| | | | | | | | | | | | | | This commit handles empty data parameter in decoder side to avoid crashing emultor. Change-Id: I1605c328506d1fa1506023ca7b261d210b944d12
* | Merge "Handle empty length parameter on decoder side"bohu2014-10-211-0/+1
|\ \
| * | Handle empty length parameter on decoder sidebohu2014-10-171-0/+1
| |/ | | | | | | | | | | | | OpenGL standard allows empty length parameter and we should handle it properly to avoid crashing emulator. Change-Id: I3bd5da19461da0c1f84138a197ae770091458b57
* | Properly reset source code bufferbohu2014-10-171-0/+1
|/ | | | | | | | | This commit clears m_src of ShaderParser in setSrc() method before reading new shader source code so that any previous source code won't be prefixed to new shader source code. Change-Id: Iacc98b32aea380d1e4503c37b86f5db55263e667
* emulator/opengl/emugen: Use local variables for parameters.David 'Digit' Turner2014-09-251-83/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Modify the generated decoder to extract paramters from the stream into local variables, the rules are: - non-pointer parameters are extracted into local variables named "var_<name>", where <name> is the parameter name as it appears in the protocol specification for the entry. - for input pointers, use "inptr_<name>", as well as "size_<name>" for the corresponding size in bytes. - for output pointers, use "outptr_<name>" and "size_<name>" This makes the generated code easier to understand, for example the following: case OP_glBindAttribLocation: { size_t tmpPtr2Size = (size_t)*(uint32_t *)(ptr + 8 + 4 + 4); InputBuffer tmpPtr2(ptr + 8 + 4 + 4 + 4, tmpPtr2Size); DEBUG("gl2(%p): glBindAttribLocation(%u %u %p(%u) )\n", stream,Unpack<GLuint,uint32_t>(ptr + 8), Unpack<GLuint,uint32_t>(ptr + 8 + 4), (const GLchar*)(tmpPtr2.get()), (uint32_t)tmpPtr2Size); this->glBindAttribLocation(Unpack<GLuint,uint32_t>(ptr + 8), Unpack<GLuint,uint32_t>(ptr + 8 + 4), (const GLchar*)(tmpPtr2.get())); SET_LASTCALL("glBindAttribLocation"); break; } becomes: case OP_glBindAttribLocation: { GLuint var_program = Unpack<GLuint,uint32_t>(ptr + 8); GLuint var_index = Unpack<GLuint,uint32_t>(ptr + 8 + 4); uint32_t size_name = Unpack<uint32_t,uint32_t>(ptr + 8 + 4 + 4); InputBuffer inptr_name(ptr + 8 + 4 + 4 + 4, size_name); DEBUG("gl2(%p): glBindAttribLocation(%u %u %p(%u) )\n", stream,var_program, var_index, (const GLchar*)(inptr_name.get()), size_name); this->glBindAttribLocation(var_program, var_index, (const GLchar*)(inptr_name.get())); SET_LASTCALL("glBindAttribLocation"); break; } Change-Id: Ifa8c73eec85b818d6d8b6371587da9fdfa57de8e
* emulator/opengl/emugen: Move pointer increment out of case statements.David 'Digit' Turner2014-09-251-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Minor patch that ensures that the pointer/position increment all happen at one place, instead of being replicated in each case statement. In other words, the generated code used to look like: switch (opcode) { case OP_someOperation1: { ... ptr += *(uint32_t)(ptr + 4); pos += *(uint32_t)(ptr + 4); break; } case OP_someOperation2: { ... ptr += *(uint32_t)(ptr + 4); pos += *(uint32_t)(ptr + 4); break; } ... default: { unknownOpcode = true; } Now it looks like: switch (opcode) { case OP_someOperation1: { ... break; } case OP_someOperation2: { ... break; } ... default: { unknownOpcode = true; } if (!unknownOpcode) { ptr += packetLen; pos += packetLen; } Which is cleaner. Also change the type of |opcode| and |packetLen| to uint32_t and size_t respectively. + Minor formatting changes to indentation. Change-Id: If0002fe18a24b9ce6691e3e3cd3e102d1e00d4c9
* emulator/opengl/emugen: Introduce helper macros.David 'Digit' Turner2014-09-251-8/+17
| | | | | | | | This patch introduces two helper macros in the generated decoder to make its source code slightly more readable (DEBUG and SET_LASCALL). Change-Id: I6659fe69a5533e5194d8db5f1882abaf1a5daee5
* emulator/opengl/emugen: Remove accessor functions.David 'Digit' Turner2014-09-254-79/+66
| | | | | | | | This patch simplifies the generated encoders and decoders by getting rid of the accessor functions (e.g. set_glDrawElementsData) given that all fields are public and can be written to directly. Change-Id: I15f4caac95e4d5f1e24a1a5838622600c6bc3207
* emulator/opengl/emugen: Ensure correct buffer alignment.David 'Digit' Turner2014-09-241-4/+69
| | | | | | | | | | | | | | The decoders generated by emugen pass addresses that come directly from the stream to EGL/GL functions. Sometimes, these addresses are not properly padded with regards to the type of data being transfered and this can crash some implementations (e.g. OSMesa being compiled with -msse by default, and doesn't build without it). This patch introduces two helper classes in ProtocolUtils.h, named InputBuffer and OutputBuffer, which are used to auto-align buffer pointers, then make the generated decoder code use them. Change-Id: I345c7eecc230f62310ced5378b6344f419647e06
* emulator/opengl/emgen: Fix debug output of floating point values.David 'Digit' Turner2014-09-171-7/+2
| | | | | | | | | | | | When calling printf() with a "%f", the value passed must be a double, not a float, which means we can't just pass a 32-bit value in the stack and assume printf() will cast it to a float properly. This results in bogus values printed whenever a GLfloat is used in a function signature, due to invalid stack offsets used by the printf(). Fix the problem by using Unpack<>() template. Change-Id: I282d9c07af68457f32af477435e5dc1999267d39
* emulator/opengl/emugen: Use templates to read values from stream.David 'Digit' Turner2014-09-161-73/+142
| | | | | | | | | | | | | | The decoder didn't properly handle GLsizeiptr and GLintptr values, which are always 32-bit on the wire, but can be 64-bit on the host. I.e. it did something like that to read them from the stream: *(GLsizeiptr*)(ptr + offset) This fixes the issue by using templates to generate host-type-specific functions that properly read data from the stream and convert it to the appropriate host type. Change-Id: I75749bd715456ca143eb1713498f7cf635918801
* emulator/opengl/emugl: Remove ispointer field from types definitions.David 'Digit' Turner2014-09-134-95/+101
| | | | Change-Id: If8f42a739dce6d1ac4d737ee50c7d2d569004153
* emulator/opengl/emugen: Get rid of VarConverter.David 'Digit' Turner2014-09-132-72/+45
| | | | | | | | This patch simplifies VarType.h a bit, since there is no point in having a specialized class like VarConverter to essentially hold what is a size in bytes! Change-Id: Idbba469a8594d1e964bbe79bbbea65934c42c033
* emulator/opengl: Cleanup build files + remove obsolete tests.David 'Digit' Turner2014-08-2710-267/+56
| | | | | | | | | | | | | | | | | | | | | | This patch cleans up the build files for the GPU emulation libraries (i.e. there is no need to test for BUILD_EMULATOR_64BITS anymore, filtering is now handled by the build system directly). + Remove a bunch obsolete tests, which were not unit tests, despite their name beginning with ut_xxxx. Which includes removing dependency on SDL too. + Remove -m64 and -fPIC flags from compilation. These are not necessary anymore (again, the build system now takes charge of placing them when necessary), and generated link-time warning when building Windows executables. + Remove a few declarations related to the now-obsolete platform build (these libraries are only built with the emulator's build system now). Change-Id: I27c28979c42cd51f2fe9e30edd4141136e80ee03
* emulator/opengl: Remove out-of-process handling code.David 'Digit' Turner2014-07-096-134/+12
| | | | | | | | | | | This removes the last pieces of shared/OpenglOsUtils which were never used since the code in render_api.cpp always used thread-based rendering, instead of process-based one. This feature could be re-implemented in the future, if really desirable. Change-Id: I551e0f3d6d5a06ff66cb40b007e2b24c295f1dd8
* emulator/opengl: refactor Thread class.David 'Digit' Turner2014-07-096-14/+12
| | | | | | + Add unit test. Change-Id: I26d84cf590f6bfff3304be3f42dc0196bcc7f6d2
* emulator/opengl: refactor shared library handling.David 'Digit' Turner2014-07-099-21/+23
| | | | | | + Add a unit test. Change-Id: I27c993d1dc819e5bd89fc1e9ae266e11e6ef9a76
* emulator/opengl: Add global lock to libOpenglRender.David 'Digit' Turner2014-07-084-14/+17
| | | | | | | | | | | This patch ensures that all render threads use the same global lock to synchronize calls to the underlying GLES/EGL libraries. Original patch from Thomas Knych (thomaswk@google.com) BUG=9627179 Change-Id: I8ac9a43bc30bba8a9a06f832cf29e72263d946ce
* emulator/opengl: Prepare for 64-bit build changes.David 'Digit' Turner2014-06-118-8/+8
| | | | | | | | | | | This patch slightly modifies the build files for the GPU emulation libraries to prepare for future changes in the emulator-specific build system that will be necessary to support Win64 binaries. The main difference is the introduction of 64-bit versions of the emugl-begin-host-<type> macros, named emugl-begin-host64-<type>. Change-Id: Ib40c030fa407b0ed951755dd9b007fda85778e03
* emulator/opengl: Fix compilation with Mingw64 toolchain.David 'Digit' Turner2014-06-041-2/+2
| | | | | | | | | | When using the newest Mingw64 toolchain, both the forward declaration and the definition of functions need to use GLAPI / GLAPIENTRY or the compiler will complain. BUG=15402623 Change-Id: Ida9e1cb9b177759e7d6688dc1d883dd856abda04
* emulator/opengl: Fix GPU emulation library crash on Windows.David 'Digit' Turner2014-06-041-2/+2
| | | | | | | | | | | | | | | The definitions of two EGL translator functions were missing EGLAPI / EGLAPIENTRY macros. On Windows, these enforces the __stdcall procedure call modifier, which changes the way the stack pointer is modified on function exit. Without this patch, a call to these function will result in a corrupted stack pointer in the caller, quickly followed by a random crash. BUG=15402623 Change-Id: Ia0f7ebef29e1252086fb59ebf2e6f907c2a69487
* opengl: rcOpenColorBuffer must be synchronousJesse Hall2014-05-275-6/+22
| | | | | | | | | | | | | The gralloc register_buffer() function, which calls rcOpenColorBuffer, must actually increment the reference count before returning. Otherwise the buffer allocator may release its reference before the client has obtained one, and the buffer will be freed prematurely. Since rcOpenColorBuffer was just sending a message to the host without waiting for it to be received/processed, this guarantee was not met. Adding a return value makes the call synchronous. Bug: 12988668 Change-Id: I8b2399cfb0f600f99b3387f630343291b59bc9a6
* emulator/opengl: A few debugging, stability improvements to emuglKen Mixter2014-05-213-4/+8
| | | | | | | | | | | | | | | | | | | * Zero output parameters so that errors don't return random data (even if the target code was careful to zero its output parameters.) Spec says that we will not modify values in case of an error, which is not currently possible, but at least this means we return deterministic values. * Similarly, avoid passing uninitialized data if an error occurs during getting the viewport. * Fix a bug where glGetError may be called when NULL is decoded in CHECK_GL_ERROR mode. * Output more information about the stream in DEBUG_PRINTOUT mode to help separate from multiple streams. Change-Id: I31706b92642efe4c7ed38d178b49e72835a9c9a6
* emulator/opengl: Fix GCC 4.8 warnings.David 'Digit' Turner2014-04-283-27/+27
| | | | | | | | This fixes a few compiler warnings when building the GPU emulation libraries with GCC 4.8. Note that GLbyte is defined as khronos_int8_t which is signed! Change-Id: I52027cd2eb20d6162983319f22d4da150ff514ed
* emulator/opengl: Backport fixes from master branch.David 'Digit' Turner2014-04-174-5/+19
| | | | | | | | | | This back-ports several fixes from aosp/master branch into idea133: 145e25 Fix the Google Maps crash issue e33909 Support GL_MAX_TEXTURE_SIZE case to glGetIntegerv API c6dd20 Fix Mac build. Change-Id: I26a05956c3b926dddeb638c6cff979199075ecbb
* Merge "Fix compilation error due to missing getopt with ↵David Turner2014-04-161-3/+0
|\ | | | | | | x86_64-linux-glibc2.11-4.8" into idea133
| * Fix compilation error due to missing getopt with x86_64-linux-glibc2.11-4.8Andrew Hsieh2014-03-181-3/+0
| | | | | | | | | | | | | | | | Unlike its 4.6 counterpart, the new x86_64-linux-glibc2.11-4.8/x86_64-linux/include/c++/4.8/x86_64-linux/bits/gthr-default.h (line #39) no longer unconditionally include unistd.h which provides getopt prototype Change-Id: I53310bb0f27e6ed7b4ee732ef301c4868decccb4
* | emulator/opengl: Fix misc. compiler warnings.David 'Digit' Turner2014-04-018-38/+28
| | | | | | | | | | | | | | These warnings appear when building the sources through the emulator's standalone build system, not the platform one. Change-Id: Ib5d51cf6211f32763be00c7436ae14c06f76b436
* | emulator/opengl: Fix Windows EGL queryConfigs().David 'Digit' Turner2014-04-011-2/+2
| | | | | | | | | | | | | | | | | | | | The function uses DescribePixelFormat() which doesn't return a count, but a maximum index, in a base-1 list of possible formats, so adjust the code accordingly. See http://msdn.microsoft.com/en-us/library/windows/desktop/dd318302(v=vs.85).aspx Change-Id: Id0cc92249348e6c845570adaaf4c280721a194bb
* | emulator/opengl: Fix eglWaitGL implementation.David 'Digit' Turner2014-04-011-1/+3
|/ | | | | | | | | | | The eglWaitEGL implementation didn't restore the previous bound API after calling eglWaitClient. This probably isn't a big concern for emugl correctness, but fixing this removes a compiler warning. See http://www.khronos.org/registry/egl/sdk/docs/man/xhtml/eglWaitGL.html Change-Id: I143ffeeefa01aff502d27d4e1d6f892f0d1efe5b
* emulator/opengl: Fix Windows SDK build.David 'Digit' Turner2014-03-111-0/+27
| | | | | | | | | | | | | | | | | | This patch fixes the Windows SDK build. A previous patch apparently broke it even though I could not reproduce this locally before submitting. What it does is, when using the platform build to generate Windows binaries, use the host Linux binary instead of rebuilding the 'emugen' tool from sources. Note that the emulator's standalone build supports building host Linux binaries even when targetting Windows by default. + Add a missing module import that got lost in translation for some odd reason. Change-Id: I2ccd962d8b3df859b2cba82573225820b69b0d32
* emulator/opengl: Allow standalone build.David 'Digit' Turner2014-03-1114-92/+307
| | | | | | | | This patch improves the build files for the GPU emulation libraries to allow them to be built directly with the emulator's own standalone build system. Change-Id: I205392bdfe4223a5c43fa67e24a2beffcbcbc07a
* emulator/opengl: Remove libcutils/libutils/liblogDavid 'Digit' Turner2014-03-112-4/+4
| | | | | | | | Final patch to completely remove dependencies on libcutils/libutils/liblog from the host-side GPU emulation libraries. Change-Id: I84a058bbd0ca676b18c0b0a094ac8bae692f9c94
* emulator/opengl: Remove Android-specific thread_store.David 'Digit' Turner2014-03-113-35/+73
| | | | | | | | | | | | | | | | | This patch removes the use of the 'thread_store' class from <utils/threads.h> by providing its own implementation instead under shared/emugl/common/thread_store.h, plus appropriate unit tests. Note that unlike the Android version, this properly destroys the thread-local values on thread exit (instead of leaking them). + Provide a LazyInstance class used to perform thread-safe lazy initialization of static variables without the use of C++ constructors. Change-Id: Iabe01fbd713c6872b5fe245d7255c3c03749a88a
* emulator/opengl: Remove android::Mutex.David 'Digit' Turner2014-03-1122-185/+145
| | | | | | | | | | | This patch removes the dependency on android::Mutex from <cutils/threads.h> by providing a custom implementation, which is a simple wrapper around pthread_mutex_t / CriticalSection, under shared/emugl/common/mutex.h + Provide unit tests. Change-Id: I379ef0c480c478ab9ba5f2faaf8274267eff37ba
* emulator/opengl: Remove compiler warningsDavid 'Digit' Turner2014-03-063-7/+1
| | | | | | | This patch removes a few minor compiler warnings related to unused local variables. Change-Id: Icd4b3b478dce0c38cc1dd04419db7350dcbdb8f6
* emulator/opengl: Refactor SmartPtr implementation.David 'Digit' Turner2014-01-2112-186/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | This gets rid of two copies of SmartPtr.h and replaces them with a single implementation under shared/emugl/common/smart_ptr.* Note that this uses a new include path rooted at the shared/ directory for classes that are likely to be built both for the host and the device (in case we back-port this to device/generic/goldfish/opengl/ in the future). + Add a gtest-based set of unittests, after building, just call 'emugl_common_host_unittests' to run it. Note that this probably needs a 64-bit version as well, will come later once I find a way to build GTest for 64-bits without breaking the platform build :-) Also note that this moves the class to the 'emugl' namespace, in order to make the code easier to build out of the platform tree, and embed it in other projects. More classes will be transitioned / refactored in future patches. AOSP_BUG=64806 Change-Id: Ieb326c5f3f002a21537b8a391a82ce2ef9925073
* emulator/opengl: Prepare out-of-platform build with SDL.David 'Digit' Turner2014-01-181-0/+282
| | | | | | | | | | | A small patch to prepare for the out-of-platform-tree build. This ones places SDL-related definitions in a new build file (sdl.mk) and provide a way for the emulator's build system to provide its own SDL compiler and linker flags. + Add missing KHR/khrplatform.h file. Change-Id: I496f1a49730ffbfae80a074e09611bd07777cf1a