[PATCH V4 0/7] Add weston randr protocol

Quanxian Wang quanxian.wang at intel.com
Thu Apr 24 00:50:04 PDT 2014


It should be the final feature updates. Next I will focus on
the comment from developers and send the updates.
If more features are needed, it will be better to be implemented in next release.

Sorry for thousands of code. Before submit, I have done strictly grammar check, coding style check
and testing and try to let code to be readable. Wish this could let reviewer spend less effort on review.

Changes in V4:
a) Configure file is supported. Thanks Bryce's commment.
   configure file parser is provided.
b) Output movement algorithm is done to support movements including rightof, leftof, above, below
auto, and primary.
c) Clone and output disable/enable are also added into algorithm but it needs support from compositor.
   It will be easy to enable if compositor is ready.
d) Some bug fixes and previous V3 code review from Hardening.

Thanks for your great support.

Regards

Quanxian Wang

GENERAL SUMMARY:

Important Notes:
This protocol is not exposed to public. It is only for
QA testing and Admin configuration at the moment.

Objective:
The idea is from xrandr provided by xserver. *Dynamic* output mode
setting is the main objective of this protocol. Remember,
it is one shot operation. For example, if setting the mode,
just call one request weston_randr_set_mode and commit them.
Result will be returned in done event.

With this protocol, weston-wrandr application is developed to help 
implement randr protocol in command line just like xrandr command 
in xserver.

FEATURES:
1) Scaling
   Scale the output to be more than 1.
2) Transform
   Rotate output to be 8 type of angles.
   0, 90, 180, 270, flip-0, flip-90, flip-180, flip-270
3) Mode Set
   Fuzzy set: First matched, first active.
      For example: weston-wrandr --output HDMI3 --mode 1280x1024
         This will select the first matched mode with
         width=1280 and height=1024.
   Exact set:
      a) Exact Timing set
         For example:
         weston-wrandr --output HDMI3 --timing='40000,800,840,968,1056,0,600,601,605,628,0,+hsync'
      b) Exact mode number set (select the nth mode from mode list)
         For example:
         weston-wrandr --output HDMI3 --mode 2
4) New a mode of output
   a) newmode for RDP (RDP developers should add additional newmode backend interface for that.)
      Example:
      weston-wrandr --output HDMI3 --newmode='1280x1024 at 50000'
   b) newtiming for drm backend
      Example:
      weston-wrandr --output HDMI3 --newtiming='40000,800,840,968,1056,0,600,601,605,628,0,+hsync'

   NOTICE: This action is bound with output.
5) Delete a mode of output
   All matched, all deleted.
   Fuzzy and exact match are supported as described above.

6) Re-position of output
   Primary, auto, leftof, rightof, above, below are supported.
   Primary: let output to the top left most output (x=0, y=0).
   Auto: re-organize all outputs to be horizontal with extended mode.
   leftof: left of relative output. So rightof, above, and below.
   Example: weston-wrandr --output HDMI3 --leftof VGA1

7) Support configure file
   Client can put all configure request in one file with
   defined format and submit it from randr interface.
   This option will be more flexible for future extension.
   Thanks for Bryce's idea for that.

   For example:
   weston-wrandr --configure /home/tizen/monitor.txt

   The content of configure file will be like that:
   ====
   [compositor]
   auto=1
   [HDMI3]
   mode=1
   scale=2
   [VGA1]
   mode=1024x768
   transform=0
   scale=2
8) Provide a set of actions above in one commit 
   Requests can be combined together in one commit.
   like configure file.
   For example:
   weston-randr --output HDMI3 --transform 3 --scale 2 --mode 2 -leftof VGA1
9) Support multiple outputs operations with one commit.
   Just like configure file example. There are two outputs are processed.

OTHERS IMPORTANT:
a) Movement algorithm has included horizontal movement, vertical movement
   and clone operation. This algorithm is specailly designed for weston
   compositor as a common module. The algorithm detailed introduction has
   been included in the header file(module/wrandr/randr_layout_algorithm.h). 
   In weston compositor, it can be included if moving output.
   Generally it can be used in weston.ini which contains layout configure or
   other interfaces which want to move/initialize outputs if weston.ini support layout.
   By the way, movement algorithm is designed to support any number of outputs.

b) Clone, disable/enable output method are left for future development.
   Depends on the compositor process. Once compositor supports them, it
   will be enabled in randr interface.

PATCH DEPENDENCY:
1) [PATCH 0/3] Add wl_output name event
2) [PATCH] desktop-shell: Bug fix client apps because of output change

BUIDLING and INSTALLING:
When you build weston, add option --enable-wrandr to enable building of this module.
     ./autogen.sh --enable-wrandr ...
When you run weston,
     weston --tty=1 --enable-wrandr

USER CASES:

1. Query mode info

Command: weston-wrandr --output HDMI3 -q
1)1440x900 at 59887(current)
2)1920x1200 at 59950
3)1680x1050 at 59883
...

2. weston-randr --output HDMI3 --mode 2 # which will set mode as 1920x1200
or weston-randr --output HDMI3 --mode 1920x1200 at 59950
or weston-randr --output HDMI3 --mode 1920x1200
or weston-randton-wrandr --output HDMI3 --timing='40000,800,840,968,1056,0,600,601,605,628,0,+hsync'

3. weston-randr --output HDMI3 --delmode 1 # Delete mode
or weston-randr --output HDMI3 --delmode 1920x1200 at 59950
or weston-randr --output HDMI3 --delmode 1920x1200

4. weston-randr --output HDMI3 --transform 1 # rotate HDMI3 output 90 degree

5. weston-randr --output HDMI3 --leftof VGA1 # put HDMI3 output leftof VGA1

6. weston-randr --output HDMI3 --scale 2 # scale the output HDMI3

7. weston-wrandr --output HDMI3 --newmode='1000x1900 at 1034'
   weston-randton-wrandr --output HDMI3 --newtiming='40000,800,840,968,1056,0,600,601,605,628,0,+hsync'

8. weston-wrandr --configure=/home/tizen/monitor.txt
Output Results for client:
======
*** OUTPUT: VGA1 ***
MODE:SUCCESS!
SCALE:SUCCESS!
TRANSFORM:SUCCESS!
*** OUTPUT: HDMI3 ***
MODE:SUCCESS!
TRANSFORM:SUCCESS!
MOVE RIGHT:SUCCESS!

*** Compositor ***
Analyze Configure File:SUCCESS!
=====

Group operations example:
1. weston-randr --output HDMI3 --transform 3 --scale 2 --mode 2 -leftof VGA1
2. weston-wrandr --output HDMI3 --transform 1 --scale 2 --mode 2 --rightof VGA1

Command:
weston-randton-wrandr --output HDMI3 --transform 1 --scale 2 --rightof VGA1

Output Result:
*** output:HDMI3 ***
SCALE:SUCCESS!
TRANSFORM:SUCCESS!
MOVE RIGHT:SUCCESS!

Quanxian Wang (7):
  weston: Add weston randr protocol
  weston: Add the weston randr support in compositor.h
  weston: Add enable-wrandr option and export common functions
  Add new mode function in drm backend
  weston:Add the weston randr protocol implementation
  weston: Add configure to support wrandr.
  Apps: Add weston-randr application

 Makefile.am                            |    5 +
 clients/Makefile.am                    |    9 +
 clients/wrandr.c                       | 1313 ++++++++++++++++++++++
 configure.ac                           |    8 +
 module/Makefile.am                     |    3 +
 module/wrandr/Makefile.am              |   37 +
 module/wrandr/monitors.txt             |   19 +
 module/wrandr/randr_layout_algorithm.c |  693 ++++++++++++
 module/wrandr/randr_layout_algorithm.h |  217 ++++
 module/wrandr/randr_parser.c           |  169 +++
 module/wrandr/randr_parser.h           |   57 +
 module/wrandr/wrandr.c                 | 1915 ++++++++++++++++++++++++++++++++
 module/wrandr/wrandr.h                 |  133 +++
 protocol/Makefile.am                   |    1 +
 protocol/randr.xml                     |  316 ++++++
 src/compositor-drm.c                   |   92 ++
 src/compositor.c                       |   35 +-
 src/compositor.h                       |   53 +
 18 files changed, 5073 insertions(+), 2 deletions(-)
 create mode 100644 clients/wrandr.c
 create mode 100644 module/Makefile.am
 create mode 100644 module/wrandr/Makefile.am
 create mode 100644 module/wrandr/monitors.txt
 create mode 100644 module/wrandr/randr_layout_algorithm.c
 create mode 100644 module/wrandr/randr_layout_algorithm.h
 create mode 100644 module/wrandr/randr_parser.c
 create mode 100644 module/wrandr/randr_parser.h
 create mode 100644 module/wrandr/wrandr.c
 create mode 100644 module/wrandr/wrandr.h
 create mode 100644 protocol/randr.xml

-- 
1.8.1.2



More information about the wayland-devel mailing list