The current gralloc allocates buffer memory for render targets that will typically have NPOT dimensions. Assuming that the vendor driver supports converting the resulting NPOT android_native_buffer_t to a NPOT EGLImage, SurfaceFlinger calls glEGLImageTargetTexture2DOES(), and uses glGetError() to test whether the GL can support creating an EGL target texture with the specified NPOT EGLImage. If it is supported, the DIRECT_TEXTURE flag remains set, otherwise it is cleared.
Tangentially, if the driver advertises the GL_ARB_texture_non_power_of_two extension, the NPOT_EXTENSION flag is set, otherwise it is cleared.
If the driver supported creating an EGL target texture from a NPOT source EGLImage, it implicitly creates a NPOT texture. This does not need any glScalef() texture coordinate correction in LayerBase::drawWithOpenGL(). However, the same driver may not advertise the GL_ARB_texture_non_power_of_two extension nor generally support NPOT textures that were not derived from EGLImages. So SurfaceFlinger may flag only DIRECT_TEXTURE, not NPOT_EXTENSION.
Therefore, the test in LayerBase::drawWithOpenGL() should only perform the glScalef() if neither NPOT_EXTENSION or DIRECT_TEXTURE are flagged. Otherwise scaling is applied to NPOT EGL target textures when none is required.
Merge commit '1521cd6e657ba4efa9382ab73d3cbba3bdf50ead'
* commit '1521cd6e657ba4efa9382ab73d3cbba3bdf50ead':
Reset the mDpiX and mDpiY values when qemu.sf.lcd_density is defined.
doesn't happen because the visibility never changes. With this change
the overlay parameter and position will be committed when either the visibility
of the window changes, or on the first call to visibility resolved, if it
hasn't already been done.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Merge commit '58ebdcc06eca06741460a7db2be4b79e3865eb88'
* commit '58ebdcc06eca06741460a7db2be4b79e3865eb88':
fix [1947273] the DimLayer causes the whole screen to update during transactions
we can't use a texture of 1/4th of the screen for the dim layer, because the mdp internal input resultion is alwyas integers and for very small blits of a couple pixels the scale factor can get way out of range, for instance for a 7 pixels source, the scale factor would be either 7 (7/1) or 3.5 (7/2) instead of 4 (7/1.75). This caused the mdp to fail in some cases and revert to software. we now always use a texture of the actual screen size, so the problem will never happen. This burns 300KB of pmem instead of 21KB. On devices with a larger screen we might want to use a smaller texture and tile it by hand.
Merge commit 'b1cdb64877ebd3b8c5182913ff02edd8b54a6982'
* commit 'b1cdb64877ebd3b8c5182913ff02edd8b54a6982':
Allow the qemu.sf.lcd_density property to override the value of ro.sf.lcd_density
ro.sf.lcd_density is usually defined in the build.prop file which is parsed by init
before anything else. Since its name begins with "ro.", this property is write-once
and cannot later be modified, e.g. in /system/etc/init.goldfish.sh.
In other words, you cannot use "emulator -prop ro.sf.lcd_density=<value>", since
it is impossible to override the value defined in build.prop
This patch modifies the system to recognize "qemu.sf.lcd_density" as an override
value, which can be set with "emulator -prop qemu.sf.lcd_density=<value>", forcing
a specific density.
A later patch will allow the emulator to automatically set this property depending
on AVD hardware configuration settings.