a10disp v0.6

a10disp is a utility to change the output mode of screen 0 or 1 for A1x and A20
devices running Linux, especially tablets, but should also work on other boards.

It has support for:
	- Showing info about the current display mode.
	- Switching the output from LCD to a particular HDMI mode and pixel
	  depth.
	- Switching the output from HDMI to LCD.
	- Changing the HDMI mode and pixel depth.

Pixel depths can be 32 (RGBA8888) or 16 (RGB565). VGA or TV output is currently
not supported.

When setting a HDMI mode, it optionally enables SCALER mode for 32bpp modes
larger than 1280x1024 (primarily 1920x1080) for enhanced stability. When
enabling a HDMI mode, it also does a check of the framebuffer size to prevent
framebuffer overflow which could otherwise cause a hard crash.

Run a10disp without arguments for usage information. It must be run as root
to actually do anything. 

a10disp must be run in the console. Exit any X server sessions before running
a10disp (for example, running Debian with lightdm, run
'sudo /etc/init.d/lightdm stop'). a10disp automatically adjusts the console
framebuffer size to the new resolution. To be able to change the size of the
font used in the console, install the package console-setup and run setupcon.
When you restart X, the new framebuffer dimensions will be used.

Because it is theoretically possible that setting a mode will result in a hard
crash, or losing the ability to see what you type, it is advisable to run
a10disp on an idle system, and to run "sudo sync" just before running a10disp
(for example: "sudo sync; sudo a10disp changehdmimode 5"). Be prepared to
blindly type something like "sudo reboot" if something goes wrong and you can
no longer see what you type.

Remember that since framebuffer bandwidth for screen refresh increases as the
mode dimensions increase, the memory bandwidth available for applications
also decreases. This means the device runs slower when a higher resolution 
mode is set. Setting the pixel depth to 16bpp can also measurably improve
performance because it halves the bandwidth needed for screen refresh.

To compile, you need to copy the file sunxi_disp_ioctl.h from to the
kernel being used to the source directory for a10disp. In the kernel sources,
this file is located in include/video.

For convenience a pre-compiled binary is provided in the bin/ directory.

The program requires sunxi display driver version 1.0 or higher. It was tested
on sunxi kernel version 3.4.43, 3.4.61 and 3.4.67. It may not work on earlier
versions of the 3.4 tree with a display driver older than version 1.0. It may
also work on the 3.0 tree if the sunxi display driver version is 1.0 or higher.

There is a definition at the top of a10disp.c that can be changed. It defines
the number of framebuffers (double-buffering) assumed when checking
whether the selected mode fits into the framebuffer. If you don't need double
buffering (which is used by Mali and probably by motion video acceleration),
you can set this to 1 to be able to set larger modes with a smaller framebuffer.
This can also be enabled with the --nodoublebuffer option. You can change the
default size of the framebuffer allocated by the kernel by setting the kernel
command line option sunxi_fb_mem_reserve=n where n is the total framebuffer
size in MB.

To install, run

	sudo make install

Running a10disp requires that the "fbset" utility is present in the path. It
is available in Debian based distributions in the package "fbset".

Changes:
v0.6	- Fix issue with changing console resolution on second screen
	- Add enablehdmi, rescale and disablescale commands
v0.5	- Fix potential issue with changepixeldepth command when HDMI EDID
          is enabled.
	- Show current HDMI mode when using the info command.
v0.4.1	- Add --noscaler option.
v0.4	- Rework command line processing.
	- Add --screen option so that screen 1 can also be changed. This has
          not been tested.
	- Add --nodoublebuffer option.
v0.3.2	- Experimental suport for changing the pixel depth to and from 24bpp
	  mode (only with changepixeldepth).
v0.3.1	- Fix lcdon when framebuffer was in 16bpp mode.
	- Fix bug when changing from a 16bpp mode to a 32bpp mode.
v0.3	- Fix bugs when changing from a 16bpp mode to a 32bpp mode using
	  changehdmimode or switchtohdmimode.
	- Elimate scaler warning message when changing from 1920x1024x32bpp
	  to a 16bpp mode.
	- Fix switching to LCD mode from a 16bpp mode.
	- Add displayoff and lcdon commands.

