Commit Graph

122 Commits

Author SHA1 Message Date
bigbiff bigbiff ac6cc08941 truetype: convert to STL map for handling fonts
In Android 10, libcutils is deprecating the hash functions. This
patchset moves to use the STL map to handle storing related
truetype objects.

This patchset moves the truetype functions to it's own static
class and moves the declarations to a header file. I also removed
statistics functions that were not called from anywhere.

Change-Id: I1679df4c7e844c01e3a2cbdaf5117bb09df2a5f3
2020-03-24 12:01:16 -04:00
bigbiff d58ba18272 AOSP10 TWRP Merge: fix conflicts and update libraries needed
This allows flame to boot TWRP. Still will need to work on
super partition for vendor and system access.

The plan will be to cherry-pick any updates to android-9.0
through gerrit.twrp.me to this branch as a WIP.
2020-03-23 11:18:29 -04:00
Ethan Yonker abf1fb0086 Switch between dependencies and modules
Use LOCAL_REQUIRED_MODULES for Pie and up and
LOCAL_ADDITIONAL_DEPENDENCIES for Oreo and down.

Change-Id: I5365e782f98f3bbf4bf246be22c8f573824b65ee
2019-05-24 22:39:12 +02:00
Dees Troy 9a4d7403d9 Fix build in 5.1 tree
Change-Id: I15f888d58c01de00920dc5c56148d363f4dd79b8
2019-04-03 05:23:34 +02:00
Ethan Yonker e03158ebdd Fix gr_clip
gr_clip was not calculating the correct values after the rotation
patch. Since gr_clip width and height instead of taking a second
pair of x,y coordinates, we cannot depend as much on the
ROTATION_X_DISP and ROTATION_Y_DISP macros. The simplest solution
was to call scissor with direct values in most cases.

Change-Id: I25f9d575ec6ddc430fca4555f29c8334441fc95d
2019-03-19 11:40:28 -05:00
Vladimir Oltean d32b7ebf20 TW_ROTATION: add flag to handle hardware-rotated display panels
* 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-03-18 11:39:38 -05:00
bigbiff bigbiff 3ed778ad63 Vibration: allow BoardConfig to disable vibration for a device.
Change-Id: Ibd2f67391ce6d7774498839829e0de9391508781
2019-03-17 22:39:00 -05:00
Andreas Schneider df7c39dfcd minuitwrp: Remove unused variables
Change-Id: Ia5cfb747f300557ebd719538244655c8b792c407
2019-01-18 09:09:00 +01:00
Ethan Yonker 2f685279fd libminuitwrp updates for Pixel 3 devices
Fix rules for adf graphics to detect their presence when ninja
make files are used.
Change pixelflinger graphics mode so that colors display properly
on the Pixel 3

Change-Id: Ie7181be6c5e1e9a007b58fd798b2cef787ce4a01
2019-01-16 10:11:28 -06:00
lambdadroid d842fe1ae0 minuitwrp: Fix detection of libdrm on Pie
external/libdrm was fully converted to Android.bp on Pie, causing
the wildcard to match nothing, even though libdrm is present in
the build tree. Change it to cover both build files.

Change-Id: I4b092b29ac021cc1aa3bcf7346b225b79fd99f4b
2019-01-16 16:43:49 +08:00
Simon Shi fcfc634ea6 twrp: Fix unsigned compare compile warning.
Change-Id: I7e847e76932a6ceea3e669e8b8b9ec35e5ef9d9d
2019-01-16 16:43:46 +08:00
notsyncing c7c78d2fea minuitwrp: Support haptics drivers registered with LED class framework
This type of vibrator is found on newer kernel versions (4.9+) and
registers with LED class framework (located at /sys/class/leds/vibrator).

Change-Id: I85e93fdac17b3f4b6f2ae689bbbd490806b5c29b
2019-01-16 16:43:42 +08:00
notsyncing 8e4e8ec2f9 minuitwrp: Respect TARGET_RECOVERY_PIXEL_FORMAT config.
Respect TARGET_RECOVERY_PIXEL_FORMAT config in screenshot, graphics.
This fixes other wrong theme color in minuitwrp on Xiaomi MIX 2S.

Change-Id: Ieb8480c411e2f0c72cc50ffca66943ab025e2b7e
2019-01-16 16:43:30 +08:00
Ethan Yonker 58f2132bc3 Merge AOSP android-9.0.0_r3
Fix conflicts and make it build in 5.1, 6.0, 7.1, 8.1, and 9.0

Change-Id: Ida0a64c29ff27d339b7f42a18d820930964ac6e4
2018-08-24 11:17:39 -05:00
Simon Shi 25b850d652 Revert "minuitwrp: drm: wait for last page flip to complete"
See https://github.com/omnirom/android_bootable_recovery/issues/219

This reverts commit 34ad728823.

Change-Id: Ia659b49af8206ba74b098aa721099a180762bab5
2018-06-05 14:55:04 +02:00
Simon Shields 34ad728823 minuitwrp: drm: wait for last page flip to complete
if we try and flip pages too quickly, the kernel returns -EBUSY.
Use drmHandleEvent to wait for any previous flip to complete
before attempting a new one.

Change-Id: If3def889c0c89d7cfb8b7f13c4dae6d4b12760f9
2018-05-25 15:12:29 +02:00
Simon Shields 16d831bee5 minuitwrp: use a separate draw buffer for DRM as well
draw performance is significantly slower when drawing directly to the
mmaped buffer. Instead, draw to a userspace buffer and memcpy()
to the mmaped buffer on page flip.

Change-Id: Ibf2cd4be4f5437b445e68c572ff76ad72d506b15
2018-05-25 15:12:09 +02:00
Simon Shields 1021c5ae50 minuitwrp: drm: fix RECOVERY_BGRA pixel format
GGL_PIXEL_FORMAT_RGBA8888 seems to work in this instance.

Change-Id: I88fb3e53332f47952036ef6e617b3ea7d0b639a9
2018-05-25 15:08:59 +02:00
Ethan Yonker 3eb70edb4a Use libdrm_platform for minuitwrp in 8.x trees
Change-Id: I58d7aa61cdb5c954e0726644fdc25c58eed8e544
2018-01-04 16:00:15 +01:00
Ethan Yonker 8373cfe28c Update to AOSP 8.0 base
Change-Id: I29fe722b4eb9718765327902779046840a01433e
2017-09-08 07:14:59 -05:00
Matt Mower 9b4d8dd8f3 Use LOGI/LOGE for non-EVENT_LOGGING events
Change-Id: Iaebc613a25a727a91205d2f361e9d7719036d88d
2017-02-23 20:14:10 +01:00
Ethan Yonker b386f71078 ifdef overlay graphics
Change-Id: If3173ddbfaccb95cc48636240ee3a918dac1e23f
2017-01-21 08:23:09 -06:00
Ethan Yonker 4a71d4f6c7 Add build flag for forcing single buffer mode
RECOVERY_GRAPHICS_FORCE_SINGLE_BUFFER := true

Change-Id: Id5144ea772c3b7ae382b064c41c23acdd0decb84
2016-08-19 17:19:38 +02:00
Ethan Yonker 64dbd0df84 Make input whitelist and blacklist work for mouse devices too
Includes some minor code clean up. Also we are now outputting the
name of the first mouse device that we encounter to make it easier
to identify which device(s) may need to be blacklisted.

Change-Id: I515baf92967390edd224728f3a7092239138e6b8
2016-08-11 02:34:15 +02:00
Muhammad Fahad Baig 0ac2293a9e Black screen patch for some HiSilicon devices (FBIOPAN_DISPLAY)
Change-Id: Ib114dcc7b48219142602a2fbc256e2a0258b26e0
2016-06-09 22:25:19 +02:00
Aaron Kling b9e547e6ac Move force_rgb_565 up.
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-05-26 14:49:33 -05:00
¨Paul 80bd165150 Restore TW_SCREEN_BLANK_ON_BOOT functionality.
This is required for a number of devices, particularly now that custom
graphics support is deprecated.

This change is required to officially support TWRP on the Huawei Plank
(aka the Honor 7).

Change-Id: Ie16ec557c75654c9c9e7a2877aee3339fc214d05
2016-04-28 17:02:53 +01:00
that b9d8f62c26 minuitwrp: retry opening fb0 if it failed
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-29 17:10:00 +01:00
that 506fc803bf minuitwrp: fix and hopefully speed up fbdev screen flipping
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-19 04:03:01 +01:00
AdrianDC 2948b6f393 twrp: Add support for TW_SECONDARY_BRIGHTNESS_PATH
* Required for devices like Sony Huashan (dual backlighting paths)

Change-Id: I0f84623431aec91fafee6617c1d4c542e4566caf
2016-02-19 04:01:57 +01:00
Greg Wallace ace7623306 Flag to enable jpg support
Builder using a custom theme may have need for this.  Add a flag to
easily enable jpg support.

Change-Id: Ica74f8cb1312d3193105f2201a5cf8073e2edc82
2016-02-03 05:15:10 +01:00
Ethan Yonker 31f855b5ad Change some graphics build flags
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-03 03:57:53 +01:00
Ethan Yonker 871b07f7b4 graphics: reintroduce flipped screens for fbdev
Change-Id: Ide3510d2efc1c1b39c756691776938e42424b61d
2016-02-01 10:31:59 -06:00
xadro 7509bc53ca Bring back option to flip screen for overlay devices
The driver already has the capability to do so.
It needs only to be flagged, if required.

Change-Id: I1d81b00a7499e493d1dbba0a440b45fc1202f7c1
2016-02-01 17:03:23 +01:00
Greg Wallace 62c188ca3d Fix minuitwrp include mistake
Change-Id: Iebb5763277eec83fd6db4fdca8b7ecfd3c78dc6b
2016-01-29 17:56:35 +01:00
Ziyan 4fea38a1d4 twrp: default to GGL_PIXEL_FORMAT_BGRA_8888 if vi.red.offset == 16
Change-Id: I436bab6ef679168d3625d8e1837917077cf89908
2016-01-29 03:02:47 +01:00
Ethan Yonker e95c4868b9 ifdef and comment out libjpeg
Chances are there are not many themes in widespread use that are
using jpeg images, but this will be easy to revert back or even
just temporarily modify if we need jpeg support in a pinch.

Change-Id: If17b05ce3ebccce724fd74b26ed8ea91b287c3cf
2016-01-27 10:58:02 -06:00
Ethan Yonker fbb4353a24 Update minuitwrp graphics in line with latest minui
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-27 10:53:13 -06:00
Ethan Yonker 2c80efa0c8 Update rules for libpixelfinger_twrp
Change-Id: I40131f330e902afab033e810761bf98c07bbd03d
2015-11-07 07:57:36 -06:00
Ethan Yonker b7a54a3016 Allow text to scale to fit
Change-Id: Iacd4bb78f551b51d092ecde09521b5541e7dadcd
2015-10-16 22:57:35 +02:00
Ethan Yonker 88037f476f Remove support for non-TTF fonts
This patch set removes support in TWRP for the old .dat file
format as well as support for the AOSP style fonts in header
files. We need TTF for scaling.

Note that the old AOSP style header font is still supported in
minui which is not used by TWRP.

Change-Id: I6124a3333d479f1fc668138f7e32c4be9b519552
2015-10-15 09:23:39 -05:00
Kra1o5 7756859abe Add support for RGBA_8888 pixel format
Change-Id: Ia15d49e51cad5bc8a3291975e1ff515a2b1c419c
2015-10-14 13:32:03 -05:00
Ethan Yonker c798c9cd24 Merge up to AOSP marshmallow-release
In order to maintain compatibility with older trees, we now have
minadbd.old and minui.old. I had to use a TARGET_GLOBAL_CFLAG to
handle ifdef issues in minui/minui.d because healthd includes
minui/minui.h and there was no other alternative to make minui.h
compatible with older trees without having to modify healthd rules
which is outside of TWRP.

Note that the new minui does not currently have support for qcom
overlay graphics. Support for this graphics mode will likely be
added in a later patch set. If you are building in a 6.0 tree and
have a device that needs qcom overlay graphics, be warned, as off
mode charging may not work properly. A dead battery in this case
could potentially brick your device if it is unable to charge as
healthd handles charging duties.

Update rules for building toolbox and add rules for making toybox

Use permissive.sh in init.rc which will follow symlinks so we do
not have to worry about what binary is supplying the setenforce
functionality (toolbox, toybox, or busybox).

Fix a few warnings in the main recovery binary source code.

Fix a few includes that were missing that prevented compiling in
6.0

Change-Id: Ia67aa2107d260883da5e365475a19bea538e8b97
2015-10-09 11:15:29 -05:00
Ethan Yonker d6821a11bb Add TW_IGNORE_ABS_MT_TRACKING_ID
Fixes touch on Oppo R7 Plus

Oppo R7 Plus, when recovery is flashed and booted from the actual
recovery partition, the digitizer sends some extra touch data for
up to 10 different touch slots even if no actual touch is present
for those slots (ABS_MT_SLOT). This patch allows TWRP to handle
touch data properly for this device and maybe others.

Change-Id: I8f9171b605566788b674b3d4d96bd9f2f65736c2
2015-08-26 22:36:34 +02:00
Kra1o5 c9556ccb5e Add flag to disable double buffering
Some devices don't support double buffering, so add
the flag TW_DISABLE_DOUBLE_BUFFERING to disable it

Change-Id: Ia9c233fa229ae9c221a6c6f219b216d1753052f4
2015-06-29 19:42:40 +02:00
jenkins 796991360d framebuffer: s6 edge takes a little lomger to initialize fb0
Change-Id: I48a5b25a227afb8637fcce7e4a1e2fc6bcc56b03
2015-06-17 23:39:37 +02:00
xiaolu 26ffa869d0 minuitwrp: fix crash when taking a screenshot.
when "gr_mem_surface.format = GGL_PIXEL_FORMAT_RGBA_8888", "gl->recti" will be crash.
this is a simple fix.

Change-Id: I39da7298286f34cdf7eae98f6b082c36695b222e
2015-06-17 23:26:24 +02:00
Xuefer 0eb2aab058 avoid possible dead loop for invalid utf8
Change-Id: Ida48b7ff119030312836aa109072ac4de7c5b9d6
2015-06-04 18:44:34 +02:00
ramsudharsan 8335324d2a minuitwrp: remove unused variable
Change-Id: I0beb3b349efd4f08491c92bb51c12caf3653cb73
Signed-off-by: ramsudharsan <ramsudharsanm@gmail.com>
2015-05-29 17:32:02 +02:00
Kra1o5 de50c5f552 Add option to use new heap_id_mask instead of old heap_mask
Use TW_NEW_ION_HEAP := true to use it

Change-Id: I2ad105fa6d122b460ed4b5dc78563077b7904567
2015-04-23 21:49:57 +02:00