Commit graph

30 commits

Author SHA1 Message Date
Solomon Peachy
658026e626 [4/4] Remove HAVE_LCD_BITMAP, as it's now the only choice.
Note:  I left behind lcd_bitmap in features.txt, because removing it
would require considerable work in the manual and the translations.

Change-Id: Ia8ca7761f610d9332a0d22a7d189775fb15ec88a
2020-07-24 21:20:13 +00:00
Solomon Peachy
0c4f89370d [2/4] get rid of HAVE_LCD_CHARCELLS
HAVE_LCD_BITMAP is now redundant.

lcd_bitmap is always-on in features.txt so manual and lang strings
don't have to change

Change-Id: I08eeb20de48099ffc2dc23782711af368c2ec794
2020-07-24 21:20:13 +00:00
Thomas Jarosch
c55be3b83a maemo port: Fix startup crash exposed by audio thread refactoring
The refactoring of the audio thread in this commit
-----------------------------------------------
commit 5857c44017
Author: Michael Sevakis <jethead71@rockbox.org>
Date:   Fri May 31 02:41:02 2013 -0400

    Refactor audio thread to run both recording and playback.
-----------------------------------------------

moved pcm_init() next to dsp_init() in apps/main.c:init().
Before that pcm_init() was called by audio_init().

Unfortunately the maemo init code didn't properly
wait until the maemo thread was fully initialized,
leading to dangling pointers when the code called
by pcm_init() tried to access maemo's variables.

Fix it by refactoring the "very fast shutdown" semaphore
to wait until maemo is initialized in any case.

This should also fix very rare rockbox crashes
on startup that I got once a year or so.
The new code has been tested by a script that
starts and kills rockbox after one second.

Change-Id: I464efce5f2b71ca869c72a5bc578555b8022e459
2014-12-20 02:23:15 +01:00
Michael Sevakis
7d1a47cf13 Rewrite filesystem code (WIP)
This patch redoes the filesystem code from the FAT driver up to the
clipboard code in onplay.c.

Not every aspect of this is finished therefore it is still "WIP". I
don't wish to do too much at once (haha!). What is left to do is get
dircache back in the sim and find an implementation for the dircache
indicies in the tagcache and playlist code or do something else that
has the same benefit. Leaving these out for now does not make anything
unusable. All the basics are done.

Phone app code should probably get vetted (and app path handling
just plain rewritten as environment expansions); the SDL app and
Android run well.

Main things addressed:
1) Thread safety: There is none right now in the trunk code. Most of
what currently works is luck when multiple threads are involved or
multiple descriptors to the same file are open.

2) POSIX compliance: Many of the functions behave nothing like their
counterparts on a host system. This leads to inconsistent code or very
different behavior from native to hosted. One huge offender was
rename(). Going point by point would fill a book.

3) Actual running RAM usage: Many targets will use less RAM and less
stack space (some more RAM because I upped the number of cache buffers
for large memory). There's very little memory lying fallow in rarely-used
areas (see 'Key core changes' below). Also, all targets may open the same
number of directory streams whereas before those with less than 8MB RAM
were limited to 8, not 12 implying those targets will save slightly
less.

4) Performance: The test_disk plugin shows markedly improved performance,
particularly in the area of (uncached) directory scanning, due partly to
more optimal directory reading and to a better sector cache algorithm.
Uncached times tend to be better while there is a bit of a slowdown in
dircache due to it being a bit heavier of an implementation. It's not
noticeable by a human as far as I can say.

Key core changes:
1) Files and directories share core code and data structures.

2) The filesystem code knows which descriptors refer to same file.
This ensures that changes from one stream are appropriately reflected
in every open descriptor for that file (fileobj_mgr.c).

3) File and directory cache buffers are borrowed from the main sector
cache. This means that when they are not in use by a file, they are not
wasted, but used for the cache. Most of the time, only a few of them
are needed. It also means that adding more file and directory handles
is less expensive. All one must do in ensure a large enough cache to
borrow from.

4) Relative path components are supported and the namespace is unified.
It does not support full relative paths to an implied current directory;
what is does support is use of "." and "..". Adding the former would
not be very difficult. The namespace is unified in the sense that
volumes may be specified several times along with relative parts, e.g.:
"/<0>/foo/../../<1>/bar" :<=> "/<1>/bar".

5) Stack usage is down due to sharing of data, static allocation and
less duplication of strings on the stack. This requires more
serialization than I would like but since the number of threads is
limited to a low number, the tradoff in favor of the stack seems
reasonable.

6) Separates and heirarchicalizes (sic) the SIM and APP filesystem
code. SIM path and volume handling is just like the target. Some
aspects of the APP file code get more straightforward (e.g. no path
hashing is needed).

Dircache:
Deserves its own section. Dircache is new but pays homage to the old.
The old one was not compatible and so it, since it got redone, does
all the stuff it always should have done such as:

1) It may be update and used at any time during the build process.
No longer has one to wait for it to finish building to do basic file
management (create, remove, rename, etc.).

2) It does not need to be either fully scanned or completely disabled;
it can be incomplete (i.e. overfilled, missing paths), still be
of benefit and be correct.

3) Handles mounting and dismounting of individual volumes which means
a full rebuild is not needed just because you pop a new SD card in the
slot. Now, because it reuses its freed entry data, may rebuild only
that volume.

4) Much more fundamental to the file code. When it is built, it is
the keeper of the master file list whether enabled or not ("disabled"
is just a state of the cache). Its must always to ready to be started
and bind all streams opened prior to being enabled.

5) Maintains any short filenames in OEM format which means that it does
not need to be rebuilt when changing the default codepage.

Miscellaneous Compatibility:
1) Update any other code that would otherwise not work such as the
hotswap mounting code in various card drivers.

2) File management: Clipboard needed updating because of the behavioral
changes. Still needs a little more work on some finer points.

3) Remove now-obsolete functionality such as the mutex's "no preempt"
flag (which was only for the prior FAT driver).

4) struct dirinfo uses time_t rather than raw FAT directory entry
time fields. I plan to follow up on genericizing everything there
(i.e. no FAT attributes).

5) unicode.c needed some redoing so that the file code does not try
try to load codepages during a scan, which is actually a problem with
the current code. The default codepage, if any is required, is now
kept in RAM separarately (bufalloced) from codepages specified to
iso_decode() (which must not be bufalloced because the conversion
may be done by playback threads).

Brings with it some additional reusable core code:
1) Revised file functions: Reusable code that does things such as
safe path concatenation and parsing without buffer limitations or
data duplication. Variants that copy or alter the input path may be
based off these.

To do:
1) Put dircache functionality back in the sim. Treating it internally
as a different kind of file system seems the best approach at this
time.

2) Restore use of dircache indexes in the playlist and database or
something effectively the same. Since the cache doesn't have to be
complete in order to be used, not getting a hit on the cache doesn't
unambiguously say if the path exists or not.

Change-Id: Ia30f3082a136253e3a0eae0784e3091d138915c8
Reviewed-on: http://gerrit.rockbox.org/566
Reviewed-by: Michael Sevakis <jethead71@rockbox.org>
Tested: Michael Sevakis <jethead71@rockbox.org>
2014-08-30 03:48:23 +02:00
Thomas Martitz
05999ed86d Fix hostfs_init() return value.
Change-Id: Ic8048e3fa0075de234e8879ba9faad101168bf09
2014-03-03 11:19:56 +01:00
Thomas Martitz
77f19f75eb storage: Add STORAGE_HOSTFS
CONFIG_STORAGE & STORAGE_HOSTFS allows to use parts of the storage_* API to be
compiled for application targets without compiling storage.c or performing
actually raw storage access. This is primarily to enable application targets to
implement HAVE_MULTIVOMULE/HAVE_HOTSWAP (in a later commit).

SIMULATOR uses the same mechanism without explicitely defining STORAGE_HOSTFS
(how to add a bit to an existing preprocessor token?).

Change-Id: Ib3f8ee0d5231e2ed21ff00842d51e32bc4fc7292
2014-02-23 20:23:51 +01:00
Thomas Martitz
3a86352a5d sim/sdlapp: Do not quit immediately on panicf, but wait for quit.
Change-Id: I2f0b4b560f00a43ad4b240911e4c30a162deb6e3
2014-02-02 16:59:29 +01:00
Thomas Martitz
444d2e508a Add missing kernel.h include (hopefully the last one, really), take #4.
Change-Id: I167e988868b53203ea926540699d587e115635e8
2014-01-07 22:41:26 +01:00
Frank Gevaerts
3d0c787a48 Change display_zoom from int to double.
The main reason for this is to be able to downscale the sdl app, which
when used for designing themes for android tends not to fit on laptop
screens these days.

Change-Id: Ib52731dbebcdd03a572be7754c157471165eb2df
2012-06-19 21:27:53 +02:00
Frank Gevaerts
a9217bde27 Remove extraneous "extern int display_zoom" declarations.
One extern declaration of a variable should be enough for everyone!

Change-Id: Idd4f4e05abaa5bb82693134a262d4023e1be6bd6
2012-06-14 22:23:50 +02:00
Jonathan Gordon
287bf71247 sdl: Fix the sdl init so the sim will get a taskbar item
Change-Id: Ib0049f96c54b4471a8185937d92bb6e8a492142a
2012-03-20 21:26:37 +11:00
Thomas Martitz
c1bd9b0361 Rework powermgmt to enable code re-use on appliation and sims.
* Introduce CONFIG_BATTERY_MEASURE define, to allow targets (application)
to break powermgmt.c's assumption about the ability to read battery voltage.
There's now additionally percentage (android) and remaining time measure
(maemo). No measure at all also works (sdl app). If voltage can't be measured,
then battery_level() is king and it'll be used for power_history and runtime
estimation.

* Implement target's API in the simulator, i.e. _battery_voltage(), so it
doesn't need to implement it's own powermgmt.c and other stubs. Now
the sim behaves much more like a native target, although it still
changes the simulated battery voltage quickly,

* Other changes include include renaming battery_adc_voltage() to
_battery_voltage(), for consistency with the new target functions and
making some of the apps code aware that voltage and runtime estimation
is not always available.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31548 a1c6a512-1295-4272-9138-f99709370657
2012-01-03 23:44:38 +00:00
Thomas Jarosch
eec4e9ff6a Fix SDL touch screen handling on the screen edges
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29925 a1c6a512-1295-4272-9138-f99709370657
2011-05-25 20:11:03 +00:00
Thomas Jarosch
acd8bffb95 Expose sys_poweroff() and cancel_shutdown() to RaaA. Hopefully fixes android build
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29485 a1c6a512-1295-4272-9138-f99709370657
2011-03-01 20:31:20 +00:00
Jonathan Gordon
a7fb7366b5 brackets are important! fix the mouse being hidden in sims
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29458 a1c6a512-1295-4272-9138-f99709370657
2011-02-28 10:55:02 +00:00
Thomas Martitz
d8f6c75ab9 Hopefully get shutdown/exit handling on SDL/maemo right.
Make shutdown_hw() not return as it's supposed to, ensure sim_do_exit() is called from main thread and move sim_kernel_shutdown() into it to simplify things.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29455 a1c6a512-1295-4272-9138-f99709370657
2011-02-28 03:24:48 +00:00
Thomas Jarosch
6e9e6a7571 RaaA: Add initial Pandora support
More information: www.openpandora.org

Possible things to implement:
- Special button mappings
- Battery monitoring
- ALSA audio backend
- Automate creation of "pnd" (=binary) file

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29451 a1c6a512-1295-4272-9138-f99709370657
2011-02-27 23:42:37 +00:00
Thomas Martitz
6d85de3419 Implement cooperative threads on hosted platforms using C code.
This replaces SDL threads with real cooperative threads, which are less cpu intensive and allow priority scheduling.
The backend for context switching is dependant on the host (sigaltstack/longjmp on Unix, Fibers on Windows).
configure has options to force or disallow SDL threads.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29327 a1c6a512-1295-4272-9138-f99709370657
2011-02-18 22:46:01 +00:00
Thomas Jarosch
5f037ac015 Initial maemo platform support
Adds Nokia N900, N810 and N800 support.

Features:
- Introduce maemo specific platform defines
- Play audio in silent mode
- Stop playback on incoming calls
- Battery level readout
- Bluetooth headset support
- Save CPU by disabling screen updates if the display
  is off or the app doesn't have input focus
- N900: GStreamer audio backend

Kudos to kugel for the code review.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29248 a1c6a512-1295-4272-9138-f99709370657
2011-02-08 20:05:25 +00:00
Thomas Martitz
3c43503283 Vastly increase speed of SDL screen updates for RGB565.
Flyspray: FS#11834 (with minor changes by me).
Author: Thomas Jarosch

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28914 a1c6a512-1295-4272-9138-f99709370657
2010-12-27 22:08:34 +00:00
Rafaël Carré
1edfe3fd47 SDL enhancements:
- remove infinite loop after exit()
- make sure picture_surface is initialized, and free it
- split gui_message_loop() in 3 functions and change prototype
- some code is only used in simulator

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27366 a1c6a512-1295-4272-9138-f99709370657
2010-07-10 02:46:08 +00:00
Michael Sevakis
6ce5279ff3 Simulator: get rid of SDL_mutex* parameter to sim_do_exit.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26338 a1c6a512-1295-4272-9138-f99709370657
2010-05-27 21:36:04 +00:00
Michael Sevakis
deb1600bbc SDL Simulator: Get thread shutdown and properly handled and fix a minor memory leak that happens when threads exit.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26336 a1c6a512-1295-4272-9138-f99709370657
2010-05-27 18:46:09 +00:00
Michael Sevakis
28a7c5d369 UISimulator: cleaner startup using semaphore only to tell when event_thread is done initializing.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26317 a1c6a512-1295-4272-9138-f99709370657
2010-05-26 21:11:40 +00:00
Thomas Martitz
6cbc701d2a Rename sdl lcd initialization to (remote_)lcd_init_device which enables removing two #ifdef SIMULATOR and makes it happen as on target.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26137 a1c6a512-1295-4272-9138-f99709370657
2010-05-18 12:27:20 +00:00
Thomas Martitz
7b3299d681 A bit further cleanup in system-sdl.c.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26123 a1c6a512-1295-4272-9138-f99709370657
2010-05-17 22:03:51 +00:00
Thomas Martitz
60741f2b0d Fix another warning which strangely only occurs on cygwin.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26121 a1c6a512-1295-4272-9138-f99709370657
2010-05-17 21:51:46 +00:00
Thomas Martitz
86e19dd65d Restore changes of r25809 that got lost in the target tree movement and fix simulator build on cygwin.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26120 a1c6a512-1295-4272-9138-f99709370657
2010-05-17 21:43:06 +00:00
Thomas Martitz
c4c7069a8a Fix FS#11280
SDL docs say SDL_PumpEvent (implicitely called by SDL_Poll/WaitEvent)
may only be called from the thread that initializes the video subsystem,
apparently because Windows requires that.
So create an (or bring it back) SDL thread (with preemtive behavior) to read the
event queue for buttons and initialize the video subsystem.
I'd probably would have done that anyway because it enables an interrupt-like method to read them (no polling).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26113 a1c6a512-1295-4272-9138-f99709370657
2010-05-17 17:19:31 +00:00
Thomas Martitz
3d0cee8abb - Move uisimulator/sdl/*.[ch] into the target tree, under firmware/target/hosted/sdl, uisdl.c is split up across button-sdl.c and system-sdl.c.
- Refactor the program startup. main() is now in main.c like on target, and the implicit application thread will now act as our main thread (previously a separate one was created for this in thread initialization).

This is part of Rockbox as an application and is the first step to make an application port from the uisimulator. In a further step the sim bits from the sdl build will be separated out.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26065 a1c6a512-1295-4272-9138-f99709370657
2010-05-15 21:02:47 +00:00
Renamed from uisimulator/sdl/uisdl.c (Browse further)