Commit graph

12 commits

Author SHA1 Message Date
Tao Bao
b549243b27 Use O_CLOEXEC at a few places.
Found these FDs unintentionally propagated into forked processes (e.g.
updater) during my local debugging. Use O_CLOEXEC to avoid that.

Test: Dump open FDs in updater process.
Test: Sideload a package on taimen (which uses framebuffer).
Test: Run graphics test on taimen.
Change-Id: I1fb65dd4a103c47d28b15973def9e9359c251ca3
2019-03-01 14:24:41 -08:00
Tao Bao
dd78982d58 minui: GRSurface::Create() computes data_size on its own.
GRSurface::Create() doesn't need to rely on caller specifying the buffer
size, as it can compute that info based on the given args.

This CL also uses `size_t` for all the parameters in
GRSurface::Create().

Test: Run recovery_unit_test on marlin.
Test: Build and boot into blueline recovery. `Run graphics test`.
Test: Build and boot into blueline charger mode.
Change-Id: Idec9381079196abf13553a475006fefcfca10950
2018-11-26 22:46:19 -08:00
Tao Bao
f65d48bb5a minui: Use android::base::unique_fd in MinuiBackendFbdev.
Test: mmma -j bootable/recovery
Test: `Run graphics test` on taimen.
Change-Id: I5b25cafbd0107943606a87f0619242cf950174ac
2018-11-02 09:35:08 -07:00
Tao Bao
4a22b28bea minui: Refactor GRSurfaceFbdev.
- Adds Create() that returns a GRSurfaceFbdev instance.
- Moves away from using the copy ctor (precisely assignment operator) of
  GRSurfaceFbdev.
- Moves the GRSurfaceFbdev deallocation code into GRSurfaceFbdev's dtor.
- Manages MinuiBackendFbdev::gr_framebuffer with std::unique_ptr.

Test: mmma -j bootable/recovery
Test: `Run graphics test` on taimen.
Change-Id: I8e67cda7bc3a2feec0790124d035caa36fb58a89
2018-10-31 20:28:29 -07:00
Tao Bao
92bdb5a389 minui: Move GRSurface into a class.
This CL adds GRSurface::Create() and dtor for managing the allocated
memory in GRSurface class. It also adds GRSurface::data() that hides the
underlying implementation, with both of const and non-const overloads.
This allows `const GRSurface&` to be more useful - previously it only
ensured a const member variable of `data`, instead of a read-only buffer
it points to.

It also marks the parameters in gr_texticon() and gr_blit() as const, as
they're incoming source that shouldn't be altered. It corrects the type
of gr_draw, which is the sink to be painted on (an earlier attempt was
made in [1], but didn't get the full picture correctly).

[1] https://android-review.googlesource.com/c/platform/bootable/recovery/+/704757/

Test: mmma -j bootable/recovery
Test: recovery_unit_test on marlin
Test: Run graphics test on marlin (fbdev).
Test: Run graphics test on blueline (drm).
Change-Id: I7904df084cd6c08fa04a9da97d01b4b1a6e3a20c
2018-10-22 18:18:02 -07:00
Tao Bao
557fa1f45e minui: Move graphics_{adf,drm,fbdev} into classes.
This CL defines minui_backend as an interface, and expresses the three
backends (adf, drm and fbdev) as subclasses to the interface.

Test: 'Run graphics test' on N9, Pixel C and N5X.
Change-Id: I0e23951c7b2e2ff918957a8d9fc8b0085b6e5952
2017-02-10 17:05:15 -08:00
Tao Bao
acf4dd157a minui: Clean up graphics_fbdev.cpp.
Remove unneeded header includes. Otherwise mostly cosmetic changes like
reformatting.

Test: 'Run graphics test' on bullhead (which uses fbdev).

Change-Id: I9b92c96128fa332ac940f73764f9c5fc93ff6c8c
2017-02-07 14:46:31 -08:00
Tao Bao
0ecbd76b22 minui: Export minui/minui.h.
For libminui static and shared libraries.

Test: build
Change-Id: Ib30dc5e2ef4a3c8b3ca3a0cec68cb65e229a0c16
2017-01-16 21:28:18 -08:00
Rahul Chaudhry
b29f23f7e7 Use static_cast to cast pointers returned by malloc/calloc/realloc/mmap.
static_cast is preferable to reinterpret_cast when casting from void*
pointers returned by malloc/calloc/realloc/mmap calls.

Discovered while looking at compiler warnings (b/26936282).

Test: WITH_TIDY=1 WITH_STATIC_ANALYZER=1 mma
Change-Id: Iaffd537784aa857108f6981fdfd82d0496eb5592
Merged-In: I151642d5a60c94f312d0611576ad0143c249ba3d
2016-11-15 23:24:54 -08:00
Andriy Naborskyy
a5d5082222 Revert "Byte swap to support BGRA in recovery mode"
This reverts commit e5879c3639.

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 fd778e3e40

Bug: 26243152
Change-Id: I313ee41bee2c143b4e5412515285a65ac394ec77
2016-01-08 10:15:57 -08:00
Elliott Hughes
0a5cb0c7cd Don't use typedefs that hide *s.
gr_surface was causing confusion for no good reason.

Change-Id: If7120187f9a00dd16297877fc49352185a4d4ea6
2015-04-15 10:58:56 -07:00
Elliott Hughes
07cfb8fe79 Switch minui over to C++.
Change-Id: I59e08a304ae514a3fdb6fab58721f11670bc1b01
2015-04-10 13:42:55 -07:00
Renamed from minui/graphics_fbdev.c (Browse further)