summaryrefslogtreecommitdiffstats
path: root/minuitwrp/graphics_fbdev.cpp (unfollow)
Commit message (Collapse)AuthorFilesLines
2019-03-18TW_ROTATION: add flag to handle hardware-rotated display panelsVladimir Oltean1-27/+0
* The existence of TW_ROTATION that implements this feature at the level of calls to libpixelflinger API closely mirrors the existence of ro.sf.hwrotation for surfaceflinger in LineageOS. * A brute-force approach was previously attempted via the BOARD_HAS_FLIPPED_SCREEN makefile flag. That code iterated over the active display surface in a double-buffered setup, and performed a "smart" memcpy from the UI drawing surface (gr_draw) onto the display surface. The problem was that, without heavy loop optimizations, that code could have never scaled for 90 and 270 degree rotation. I tried and you could literally see the for loop with the naked eye while the display surface was updating. * That code is now gone, but support for BOARD_HAS_FLIPPED_SCREEN := true is still there (now means TW_ROTATION := 180). * This patch relies on the assumption that it is impossibly difficult and non-portable to rotate whole framebuffer display surfaces, in a way that is not dependent upon the graphics backend (adf, fbdev, drm, overlay etc). Therefore, it identifies the rendering primitives that the TWRP graphics stack exposes to the GUI application above, and implements hwrotation inside each of those calls instead: - gr_line(), gr_fill() - 2D geometric shapes (lines, rectangles) - gr_blit() - graphical image resources - gr_ttf_textExWH() - font rendering - gr_fb_width(), gr_fb_height() - framebuffer resolution * The gist is to keep the backend and framebuffer (dimensions, row size etc) unchanged (because making changes there is asking for trouble), but present an altogether different reality to the calling API, according to the compile-time constant TW_ROTATION. * All (x, y) API coordinates and shapes are transformed before being actually rendered as (x_disp, y_disp) display coordinates. * With TW_ROTATION := 90 or 270 you can turn a landscape device into a portrait one, because the GUI is fooled by the reversed dimensions reported by gr_fb_width() and gr_fb_height() and renders the UI as for a different device. * For blit and text rendering operations, figuring out the transformed coordinates in display space is not enough, as the surfaces that are to be rendered have to be rotated themselves. This is handled by allocating an intermediary rotated surface on each rendering operation (not ideal), so the code with the intermediary surface is compiled out for the TW_ROTATION := 0 case. * This is still not as bad as rotating the whole framebuffer though, and on a msm8976 device the performance hit is not even noticeable (for software rendering). * Currently there is no attempt to make a connection between the TW_ROTATION and the { RECOVERY_TOUCHSCREEN_SWAP_XY, RECOVERY_TOUCHSCREEN_FLIP_X, RECOVERY_TOUCHSCREEN_FLIP_Y } settings. Change-Id: Ic8966ad5360c8a499649fdb16e242286640fd992 Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
2019-01-16twrp: Fix unsigned compare compile warning.Simon Shi1-4/+2
Change-Id: I7e847e76932a6ceea3e669e8b8b9ec35e5ef9d9d
2016-08-19Add build flag for forcing single buffer modeEthan Yonker1-0/+5
RECOVERY_GRAPHICS_FORCE_SINGLE_BUFFER := true Change-Id: Id5144ea772c3b7ae382b064c41c23acdd0decb84
2016-06-09Black screen patch for some HiSilicon devices (FBIOPAN_DISPLAY)Muhammad Fahad Baig1-0/+6
Change-Id: Ib114dcc7b48219142602a2fbc256e2a0258b26e0
2016-05-26Move force_rgb_565 up.Aaron Kling1-21/+29
Changes to fb_var_screeninfo can cause changes to fb_fix_screeninfo. So, write back the force changes before fi is read. Change-Id: I721a960fa401ac5203ffc90bd3bfa2d7d0cfb292
2016-02-29minuitwrp: retry opening fb0 if it failedthat1-6/+16
On some devices TWRP tries to access the framebuffer before all device nodes have been created. Retry opening instead of crashing later. Change-Id: I189a8fe80a8906b46fb6cece53c0bf83c00c0e09
2016-02-19minuitwrp: fix and hopefully speed up fbdev screen flippingthat1-7/+16
Fix: use row_bytes instead of xres (should help on Shield tablet) Speed: Moving the calculations out of the inner loop Change-Id: Ie43ae5e94ae88822360900c7b4d852b7aab4379b
2016-02-19twrp: Add support for TW_SECONDARY_BRIGHTNESS_PATHAdrianDC1-0/+10
* Required for devices like Sony Huashan (dual backlighting paths) Change-Id: I0f84623431aec91fafee6617c1d4c542e4566caf
2016-02-03Change some graphics build flagsEthan Yonker1-2/+3
While not all of these old build flags are active or implemented yet (and they may not ever be implemeted until we find a device that needs them), we need to make sure that the old build flags are only applied when actually needed. Since there are a lot of device trees that probably won't get updated due to lack of device maintainers, we will rename the build flags and fix up devices on a case by case basis. Also added some pixel format related build flags to the make file from AOSP so that AOSP devices should work in TWRP without additional build flags. Change-Id: I11ab475297d02b6aeffe89404fe50b4799a36be3
2016-02-01graphics: reintroduce flipped screens for fbdevEthan Yonker1-11/+29
Change-Id: Ide3510d2efc1c1b39c756691776938e42424b61d
2016-01-29twrp: default to GGL_PIXEL_FORMAT_BGRA_8888 if vi.red.offset == 16Ziyan1-1/+1
Change-Id: I436bab6ef679168d3625d8e1837917077cf89908
2016-01-27Update minuitwrp graphics in line with latest minuiEthan Yonker1-22/+76
Note: events.cpp is still old code renamed to cpp to make it easier to call functions like gr_fb_width(). I had to modify AOSP fbdev code to provide a separate memory surface for drawing to as drawing directly to the framebuffer resulted in rendering taking about 5 times longer. I also modified AOSP adf code to provide a separate memory surface for drawing for the same performance reasons. The Nexus 9 supports adf graphics. Overlay graphics work on at least one device. Overlay provides a separate memory buffer already so performance is good. I do not have a drm device yet that I know of. I made some attempt to update the drm code to determine the correct pixel format based on the drm graphics format, but what is available in pixel flinger and what is available in drm do not line up all that well. Reports are that the Pixel C is using drm graphics, but performance is slow, likely due to the use of a mmap instead of a memory buffyer. Change-Id: Ibd45bccca6ac2cb826037aa9b2aa5065cf683eed
2016-01-08Revert "Byte swap to support BGRA in recovery mode"Andriy Naborskyy1-12/+0
This reverts commit e5879c3639789d61803605c12371a4f291e0b3cc. The swap in page flip code is not needed any more. New changes take care of ABGR and BGRA formats swapping bytes in png and drawing routines See commit fd778e3e406a7e83536ea66776996f032f24af64 Bug: 26243152 Change-Id: I313ee41bee2c143b4e5412515285a65ac394ec77
2015-04-15Don't use typedefs that hide *s.Elliott Hughes1-4/+4
gr_surface was causing confusion for no good reason. Change-Id: If7120187f9a00dd16297877fc49352185a4d4ea6
2015-04-10Switch minui over to C++.Elliott Hughes1-10/+6
Change-Id: I59e08a304ae514a3fdb6fab58721f11670bc1b01
2015-02-12Fix Droid and animation color in recovery modeTony Kuo1-13/+0
[Problem] Droid and animation color in recovery mode are incorrect [Modify] - Add support for flipping (zero copy) with RECOVERY_ABGR. - Decodes PNG files to BGRA directly, and other fills, text and alpha blending are also done directly in BGRA (i.e. blits can still bypass conversion) - Remove the BGRA workaround added previous for single buffer mode (f766396) Bug:19216535 Change-Id: Ie864419fc6da776ff58b2d02e130f203c194500f Signed-off-by: Tony Kuo <tony.kuo@mediatek.com>
2015-01-30Add missing includes.Elliott Hughes1-0/+1
Change-Id: I06ea08400efa511e627be37a4fd70fbdfadea2e6
2014-11-14Byte swap to support BGRA in recovery modeHeather Lee Wilson1-0/+12
Fixes color palate of recovery mode when double buffer enabled. Bug: 18169447 Change-Id: Ia50b0fb9afd8001dfd740c09ce109fa421e691f7
2014-11-06Revert to old libminui and fix upEthan Yonker1-217/+0
We will wait for CAF to give us a new libminui that supports qualcomm overlay before moving up to the new format if possible. Attempt to fix up old libminui to work with new libpng. Change-Id: I494b7287b347f4730aa8f9d27d4cc17b6e93919a
2014-06-12minui: avoid random screen frame at startupJoey Pan1-0/+2
Clear framebuffer at init. [toddpoynor@google.com: forward port] Change-Id: Ie98c7724cd974dcacef3e3559a6fe492864a5e72
2014-05-14Support BGRA framebufferDaniel Leung1-0/+13
The re-designed recovery graphics code only supports RGB{_,X,A} framebuffer, and this patch adds support for BGRA framebuffer. Change-Id: I3780c8288088f497fa248f3492c54f43834a8598 Signed-off-by: Daniel Leung <daniel.leung@intel.com> Reviewed-by: Jovanovic, Radivoje <radivoje.jovanovic@intel.com> Reviewed-by: Parkinson, TimothyX L <timothyx.l.parkinson@intel.com> Tested-by: Parkinson, TimothyX L <timothyx.l.parkinson@intel.com> Reviewed-by: Boie, Andrew P <andrew.p.boie@intel.com> Reviewed-by: Gumbel, Matthew K <matthew.k.gumbel@intel.com>
2014-03-14Recovery 64-bit compile issuesMark Salyzyn1-3/+4
Change-Id: I92d5abd1a628feab3b0246924fab7f97ba3b9d34
2014-03-11separate fbdev-specific code out from minuiDoug Zongker1-0/+201
Isolate the code that interacts with fbdev, in preparation for adding a new backend. Change-Id: I19105e9da1ca6408cebc110f7e2bb5abfb481ee9
2014-03-11separate fbdev-specific code out from minuiDoug Zongker1-0/+201
Isolate the code that interacts with fbdev, in preparation for adding a new backend. Change-Id: I19105e9da1ca6408cebc110f7e2bb5abfb481ee9