[PATCH 1/6] Add weston randr protocol

Wang, Quanxian quanxian.wang at intel.com
Wed Mar 5 19:01:11 PST 2014


Except the comment below. I mention some points.

1) My idea:
My original idea is from xrandr of xserver. I just want to let xrandr could be implemented in wayland. If no protocol is used, that is fine. But no way to implement some function for example transform, scale, mode set output. I have to create a protocol to communicate with compositor and let compositor do that.

This protocol basically live with compositor. It also provides the interface for library above to provide the randr function. For example efl, gtk, or ...
If you think it is to build the standard protocol, that is fine. Anyway, my idea is that.

2) About mode setting requirement:
Most of case, it is for configuration of output as a whole. Generally it should be in setting panel for screen size, rotation, ...option setting. The user cases I mentioned are related with that setting. Of course you may prefer another way to implement. 

3) Security Issue:
I found Pq, Jason, Japsper, ... don't want to expose the interface because of "at will, arbitrary or disaster or any client". Actually it is security issue. That is fine.
Yes, it really exists. We must be careful for that. Firstly I take it as a module, let owner to determine if he really need randr function. Secondly at the same time, it will be convenient for us to update randr when new wayland security control policy is ready.

4) Here I can share an security idea for such protocol. I just want to show, if wayland provides such kind security checking, it will be easily adopted by randr interface. Previous interface could be default defined as general, other special could be identified as video or root. Please do not focus on the role definition and I just take an example. 

My security idea:
Add two attributes separately to wl_client, wl_randr interface.
wl_client has the user id and group id, wl_randr interface has an access attribute (general user, video user, root/admin).
if you are afraid it is hacked, when you wl_closure_send, you can dynamically generate user id and group id.

In client:
wl_randr_set_mode(wl_wrandr_interface, ...)
In compositor:
Uid = get_uid(client)
Gid = get_gid(client)
If (It_video_user(uid, gid,..) || !is_root_user(uid,gid..))
Wl_randr_send_permission("No permission to do that!\n");

Continue...


5) At last I answer the questions raised by Pq for me.

- Would you be happy with something that works for your specific use
  case only?
[Wang Quanxian]not happy, really not happy. I like what I do is helpful for everyone.

- Do you want to establish a universal standard, i.e. get this into
  Wayland core? If so, why?
[Wang Quanxian] No, it lives with compositor. Without compositor, randr could do nothing.

- Do you want a sample implementation and the protocol be included in
  Weston specifically? If so, why?
[Wang Quanxian] weston or other compositor, any compositor which wants that. I just provide a tool or protocol to implement randr function.

The foremost, what is the use case?
[Wang Quanxian] still, more cases are listed. In window, in linux(gnome, KDE), there is always some setting contains ration, leftof, rightof, primary, slave, scale, transform, mode set. Is it not use case? If not, why they are there? You know what I mean. Currently tablet, TV, automotive have not such option, it is not user don't want it. It is because no one provides that. Also it maybe some other reason, some apps don't like that flexible mode setting because it make it crashed or mess up.

>-----Original Message-----
>From: Pekka Paalanen [mailto:ppaalanen at gmail.com]
>Sent: Wednesday, March 05, 2014 6:28 PM
>To: Wang, Quanxian
>Cc: Jasper St. Pierre; Jason Ekstrand; Zhang, Xiong Y; Hardening; Matthias Clasen;
>wayland-devel at lists.freedesktop.org
>Subject: Re: [PATCH 1/6] Add weston randr protocol
>
>On Wed, 5 Mar 2014 09:24:34 +0000
>"Wang, Quanxian" <quanxian.wang at intel.com> wrote:
>
>> Hi, Jasper & Jason
>>
>> In order to understand it more, I provide such cases.
>>
>>
>> 1)       One customer uses handset which OS using wayland. When he
>> open the handset, there is the menu screen which contain icons list.
>> Someone want to see 10 icons, someone wants to see 20 icons. (one
>> requirement, it really happens, at least when use my handset, I like
>> to see everything in one page or more). Surface mode set is one way,
>> output mode set is another way, apps setting is also another way(font
>> size or icon size).
>
>Runtime video mode switching in a phone? Is that even a thing? I mean, does the
>hardware even support anything but a single video mode for the panel?
>
>As for the UI size, that is much better handled at the drawing phase in applications,
>rather than by the scanout hardware doing scaling.
[Wang, Quanxian] Yes, I agree your point, in the drawing phase to do that based on your parent layout(the parent at last point to output/root window). if user open setting panel, and select screen size setting to some mode, what happens on application?
Mess up or disaster? I come across such thing in automotive. When we change another mode to start weston, it works not good, mess up.
we found the size is defined as hard code. For example, width is 180x200, so apps definitely define it as 180x200, if you change 200x200, mess up.
>
>> 2)       Continue, customer click the web page apps, you could see
>> the web contents. He can change the font size by setting web page(see
>> clear or more contents). The same above, surface is one way, web
>> setting another way, mode set for output is also a way.
>
>I would think adjusting what the browser renders is the only sane way.
>You definitely do not want a browser to control the video mode.
>
>> 3)       Ok, You can tell me, surface could do that, that is right.
>
>No, abusing the fullscreen surface semantics for all that would be wrong; the same
>as using video mode setting, in my opinion.
>
>> You change menu screen surface, but at the same time you want to
>> customer change the webpage surface with same action. Why do I say
>> that? according to the custom, someone wants to see small or big, less
>> or more, it will do the same thing in another apps. Generally when
>> user have some sense for one apps to change the size of icon, it has
>> the same feeling on other apps. Surface just update one surface,
>> output will update all surfaces on the output. It is one shot thing.
>> Surface mode set is one choice, why not provide output mode set to
>> user? All done or part done, it is up to user. We just provide the
>> choice.
>
>This is not a thing that should be set via output properties. I believe this should be
>done via the phone environment (cf. desktop
>environment) specific protocols, which already need to handle a lot more than
>that.
>
>Output properties are about the physical output features, like the size of a pixel.
>Those do not change with software usage.
>
>> 4)       Another thinking
>> You use automotive or handset or TV, it is belong to you. There are no
>> existence to let arbitrary mode setting. If someone really do that,
>> that means your machine is attacked or hacked. Automotive, handset, TV
>> is a private thing which should not be public to outside.
>> It is not like server or server-like desktop. Every client should have
>> been  strictly controlled. Even if for desktop, do you want anyone to
>> access you at will?
>>
>> I don't expect wayland will be powerful in server. But it should be a
>> choice for embedded system or netbook or some small device which is
>> belong to private thing. It is under the control by user.
>
>Sorry, what?
[Wang, Quanxian] The owner of private device could have absolutely permission to do what he want to do.
User needs this, just do that if he can control that. If could not, just disable that. It is based on user case.
>
>> 5)       Another thing, Please don't tell me customer doesn't know
>> such functionality. Yes, from developer view, customer doesn't know
>> what mode setting is. But when developer develops an application which
>> use mode setting interface, it could be called another reasonable
>> thing. For example, magnifier or smaller, or bigger, or little, or
>> scaler... You know what I mean. The only thing is when you using your
>> TV, handset, automotive, if you have the requirement to change the
>> view of that.
>>
>> I just show my thought for this idea. Welcome any concern about that.
>> :)
>
>To me it sounds like all the examples you gave are not suited to be implemented
>by video mode setting at all, and even less by a configuration protocol.
>
>Are you seriously going to use "wayland-randr" for these things?
[Wang, Quanxian] I take output as a whole to change the size of the output. Basically the apps on this output should be changed consistently. It is like you change the surface size, the subsurface of this surface should be redraw with new size of parent. 
>
>
>Thanks,
>pq


More information about the wayland-devel mailing list