[PATCH V3 0/7] Add weston randr protocol

Quanxian Wang quanxian.wang at intel.com
Mon Apr 7 22:03:14 PDT 2014

Important Changes compared with V2:

1) Provide 2 methods to mode match for mode setting and mode delete.
   a) Exact mode number match
   Client selects the mode number according to query information.

   b) Fuzzy match for width, height and refresh
   Set: First matches, first takes effect.
   Delete: All matched, all deleted.

2) Support multiple outputs operations in one commit.
   With discussion, request structure is adjusted to support multiple outputs.
   One request will contain several output requests. Done event will be sent
   with output parameter (Null means for total, not null means for output).

3) Enhance new timing flags support
   Currently +hsync, -hsync, -vsync, +vsync, csync, +csync, -csync are supported.

4) Add Randr data type interface
   This interface will store all the data type used by other weston randr interfaces.
   The main reason is that the name of type is too long. I have to find a better way to use a
   human-readable type with short name.

5) Add above and below move action of output.
   Currently it is the empty because compositor's related functions are not ready.

6) Newmode request is provided for RDP backend, but it should be implemented in backend by RDP developer.
   Provide newmode option in apps(widthxheight or widthxheight at refresh)
   Provide newmode request in randr protocol to create a simple mode without detail timing information.

7) With suggestion from Bryce, provide a configure method to submit configure file
   But it is a empty function, parser is not ready for configure file.

8) Delete randr_start request and request id. 

9) The implemented code is ready for review.

TODO List:
1) Configure request is added to randr protocol. But the parser is not ready and needs more work.
2) Move above and below are not ready. But it depends on compositor development for that.

This patches series has been tested. Until now it works fine.
If you want to have a try, you need two patches I send before.
1) [PATCH 0/3] Add wl_output name event
2) [PATCH] desktop-shell: Bug fix client apps because of output change
When you build weston, add option --enable-wrandr to enable building of weston randr module.
Like that: ./autogen.sh --enable-wrandr ...



Quanxian Wang

General Information:

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

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.

Weston randr protocol will provide interfaces to
1) Mode set of output (scale, transform, mode setting)
   For mode setting, three match methods are provided.

2) Position of output (currently support leftof, rightof)
   More need to be done, above, below and any positoion of output with (x,y).

3) New a custom mode
   This action should be bound with output.
   It acts like combination of newmode and addmode in xrandr.
   The reason is compositor does not have the mechanism to store all modes.

4) Delete mode

5) Provide a set of actions above in one commit 
   1-4 actions could be combined together in one commit.

6) Support multiple outputs operations with one commit.
   The result event will be sent with output parameter one by one.


1. Query all 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

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-randton-wrandr --output HDMI3 --newmode='1000x1900 at 1034'
   weston-randton-wrandr --output HDMI3 --newtiming='1000,300,100,120,150,400,350,370,399,0,+hsync,-vsync'

Group operations example:
8. weston-randr --output HDMI3 --transform 3 --scale 2 --mode 2 -leftof VGA1
9. weston-randton-wrandr --output HDMI3 --transform 1 --scale 2 --mode 2 --rightof VGA1 --newtiming='1000,300,100,120,150,400,350,370,399,0,+hsync,-vsync'

The result format will be like that:
Command: weston-randton-wrandr --output HDMI3 --transform 1 --scale 2 --mode 2 --rightof VGA1 --newtiming='1000,300,100,120,150,400,350,370,399,+hsync,-vsync'
*** output:HDMI3 ***

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          | 1213 +++++++++++++++++++++++++++++++++++++++++++
 configure.ac              |    8 +
 module/Makefile.am        |    3 +
 module/wrandr/Makefile.am |   32 ++
 module/wrandr/wrandr.c    | 1262 +++++++++++++++++++++++++++++++++++++++++++++
 protocol/Makefile.am      |    1 +
 protocol/randr.xml        |  260 ++++++++++
 src/compositor-drm.c      |   76 +++
 src/compositor.c          |   14 +-
 src/compositor.h          |   43 ++
 12 files changed, 2924 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/wrandr.c
 create mode 100644 protocol/randr.xml


More information about the wayland-devel mailing list