<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Aug 27, 2014 at 1:52 AM, Giulio Camuffo <span dir="ltr"><<a href="mailto:giuliocamuffo@gmail.com" target="_blank">giuliocamuffo@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">2014-08-27 11:38 GMT+03:00 Pekka Paalanen <<a href="mailto:ppaalanen@gmail.com">ppaalanen@gmail.com</a>>:<br>
<div><div class="h5">> On Wed, 27 Aug 2014 11:03:04 +0300<br>
> Giulio Camuffo <<a href="mailto:giuliocamuffo@gmail.com">giuliocamuffo@gmail.com</a>> wrote:<br>
><br>
>> 2014-08-27 10:32 GMT+03:00 Pekka Paalanen <<a href="mailto:ppaalanen@gmail.com">ppaalanen@gmail.com</a>>:<br>
>> > On Tue, 26 Aug 2014 17:50:47 +0300<br>
>> > Giulio Camuffo <<a href="mailto:giuliocamuffo@gmail.com">giuliocamuffo@gmail.com</a>> wrote:<br>
>> ><br>
>> >> 2014-08-26 17:39 GMT+03:00 Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>>:<br>
>> >> ><br>
>> >> > On Aug 26, 2014 1:01 AM, "Giulio Camuffo" <<a href="mailto:giuliocamuffo@gmail.com">giuliocamuffo@gmail.com</a>> wrote:<br>
>> >> >><br>
>> >> >> 2014-08-26 10:24 GMT+03:00 Pekka Paalanen <<a href="mailto:ppaalanen@gmail.com">ppaalanen@gmail.com</a>>:<br>
>> >> >> > On Mon, 25 Aug 2014 21:51:57 -0700<br>
>> >> >> > Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> wrote:<br>
>> >> >> ><br>
>> ><br>
>> >> >> >> On Aug 22, 2014 1:48 PM, "Jasper St. Pierre" <<a href="mailto:jstpierre@mecheye.net">jstpierre@mecheye.net</a>><br>
>> >> >> >> wrote:<br>
>> >> >> >> ><br>
>> >> >> >> > On Wed, Aug 6, 2014 at 9:39 AM, Pekka Paalanen <<a href="mailto:ppaalanen@gmail.com">ppaalanen@gmail.com</a>><br>
>> >> >> >> wrote:<br>
>> >> >> >> >><br>
>> >> >> >> >> On Thu, 17 Jul 2014 17:57:45 -0400<br>
>> >> >> >> >> "Jasper St. Pierre" <<a href="mailto:jstpierre@mecheye.net">jstpierre@mecheye.net</a>> wrote:<br>
>> >> >> >> >><br>
>> ><br>
>> >> >> >> >> > <entry name="fullscreen" value="2" summary="the surface is<br>
>> >> >> >> fullscreen"><br>
>> >> >> >> >> > The surface is fullscreen. The window geometry specified<br>
>> >> >> >> >> > in<br>
>> >> >> >> the configure<br>
>> >> >> >> >> > event must be obeyed by the client.<br>
>> >> >> >> >><br>
>> >> >> >> >> Really? So, will we rely on wl_viewport for scaling low-res apps to<br>
>> >> >> >> >> fullscreen? No provision for automatic black borders in aspect ratio<br>
>> >> >> >> >> or<br>
>> >> >> >> >> size mismatch, even if the display hardware would be able to<br>
>> >> >> >> >> generate<br>
>> >> >> >> >> those for free while scanning out the client buffer, bypassing<br>
>> >> >> >> >> compositing?<br>
>> >> >> >> ><br>
>> >> >> >> ><br>
>> >> >> >> >> Since we have a big space for these states, I suppose we could do<br>
>> >> >> >> >> those<br>
>> >> >> >> >> mismatch cases in separate and explicit state variants of<br>
>> >> >> >> >> fullscreen,<br>
>> >> >> >> >> could we not?<br>
>> >> >> >> ><br>
>> >> >> >> ><br>
>> >> >> >> > I explicitly removed this feature from the first draft of the patch<br>
>> >> >> >> simply to make my life easier as a compositor writer. We could add<br>
>> >> >> >> additional states for this, or break fullscreen into multiple states:<br>
>> >> >> >> "fullscreen + size_strict" or "fullscreen + size_loose" or something.<br>
>> >> >> >> ><br>
>> >> >> >> > I am not familiar enough with the sixteen different configurations of<br>
>> >> >> >> > the<br>
>> >> >> >> > old fullscreen system to make an informed decision about what most<br>
>> >> >> >> > clients<br>
>> >> >> >> > want. Your help and experience is very appreciated. I'm not keen to<br>
>> >> >> >> > add<br>
>> >> >> >> > back the matrix of configuration options.<br>
>> >> >> >><br>
>> >> >> >> Yeah, not sure what to do here. I like the idea of the compositor<br>
>> >> >> >> doing it<br>
>> >> >> >> for the client. Sure, you could use wl_viewport, subsurfaces, and a<br>
>> >> >> >> couple<br>
>> >> >> >> black surfaces for letterboxing. However that is going to be far more<br>
>> >> >> >> difficult for the compositor to translate into overlays/planes than<br>
>> >> >> >> just<br>
>> >> >> >> the one surface and some scaling instructions.<br>
>> >> >> ><br>
>> >> >> > I don't think it would be that hard for a compositor to use overlays<br>
>> >> >> > even then. Have one surface with a 1x1 wl_buffer, scaled with<br>
>> >> >> > wl_viewport to fill the screen, and then have another surface on top<br>
>> >> >> > with the video wl_buffers being fed in, scaled with wl_viewport to keep<br>
>> >> >> > aspect ratio. A compositor can easily put the video on an overlay, and<br>
>> >> >> > if the CRTC hardware supports, it might even eliminate the black surface<br>
>> >> >> > and replace it with a background color.<br>
>> >> >><br>
>> >> >> What is not clear to me is what advantages does the<br>
>> >> >> wl_subsurface+wl_viewport approach has compared to the compositor just<br>
>> >> >> scaling the surface and putting a black surface behind it.<br>
>> >> >> Is it just to remove the hint in the wl_fullscreen request? This seems<br>
>> >> >> a lazy reason to me, implementing that hint in the compositor is not<br>
>> >> >> hard, and in turn it means increasing the complexity of every client<br>
>> >> >> that would ever want to go fullscreen.<br>
>> >> >> There is also one use case for which the wl_subsurface+wl_viewport<br>
>> >> >> cannot work. Having the same surface fullscreen on two differently<br>
>> >> >> sized outputs (think of presentations), like this:<br>
>> >> >> <a href="http://im9.eu/picture/phx647" target="_blank">http://im9.eu/picture/phx647</a><br>
>> >> >> Sure, the compositor can send the configure event with one output's<br>
>> >> >> size and scale the surface to fit the other one, but then what is the<br>
>> >> >> purpose of wl_viewport again here, if the compositor must scale the<br>
>> >> >> surface anyway?<br>
>> >> ><br>
>> >> > Yeah, I think I still have to go with Guilio here. It really it's probably<br>
>> >> > less work for the compositor to implement fullscreen modes than to implement<br>
>> >> > viewport+subsurface correctly and it's certainly less work for clients.<br>
>> >> ><br>
>> >> >> ><br>
>> >> >> > In my previous reply, I concluded that wl_viewport+wl_subsurface would<br>
>> >> >> > be enough (I suprised myself), and we would not really need yet another<br>
>> >> >> > way from xdg_surface. Obviously, I forgot something, that the IRC<br>
>> >> >> > discussion of last night brought back to my mind.<br>
>> >> >> ><br>
>> >> >> > The wl_shell fullscreening has three different cases for dealing with<br>
>> >> >> > size mismatch between the output and the window:<br>
>> >> >> > - aspect-correct scaling<br>
>> >> >> > - centered, no scaling<br>
>> >> >> > - please, I would really like a mode switch<br>
>> >> >> ><br>
>> >> >> > There is also the fourth, which means the client does not care at all<br>
>> >> >> > what the compositor does. This protocol was designed before<br>
>> >> >> > sub-surfaces or wl_viewport were a thing.<br>
>> >> >> ><br>
>> >> >> > If we do not have that in xdg_shell, but instead rely on<br>
>> >> >> > wl_viewport+wl_subsurface, there are two consequences:<br>
>> >> >> > - scaling vs. centered is no longer a hint, but it is dictated by the<br>
>> >> >> > client<br>
>> >> >> > - the mode switch case is lost<br>
>> >> >> > (- all desktop compositors are required to implement both wl_scaler<br>
>> >> >> > and wl_subcompositor)<br>
>> >> >> ><br>
>> >> >> > The first point is likely not an issue, but the second may very well<br>
>> >> >> > be. If xdg_surface requires fullscreen windows to be the exact output<br>
>> >> >> > size, and clients obey, there is no way to trigger the mode switch.<br>
>> >> >> ><br>
>> >> >> > I suspect there are at least gamers out there, who would not like this.<br>
>> >> >> > In fact, they would be pushed back to the way X11 works right now: if<br>
>> >> >> > you want a mode switch, use a helper app to permanently change the<br>
>> >> >> > output resolution (this screws up your whole desktop layout), then<br>
>> >> >> > launch the game, afterwards do a manual switch back.<br>
>> >> >> ><br>
>> >> >> > No, sorry, that would actually be *worse* than the situation on X11<br>
>> >> >> > right now.<br>
>> >> >> ><br>
>> >> >> > Recalling that, I do think we need something to support the mode switch<br>
>> >> >> > case. A crucial part of a video mode for a gamer is the monitor refresh<br>
>> >> >> > rate, which is why wl_shell_surface.set_fullscreen includes the<br>
>> >> >> > framerate parameter.<br>
>> >> >><br>
>> >> >> I don't think games need the screen to be at a NxM pixels mode,<br>
>> >> >> scaling up the surface would be good and possibly better, since we can<br>
>> >> >> scale better than what LCD screens usually do.<br>
>> >> >> On the other hand, there is the framerate parameter, and games may<br>
>> >> >> care about that... I'm not sure what is the best course of action<br>
>> >> >> here.<br>
>> >> ><br>
>> >> > I'd agree. Even on X, when you do a "mode switch" it frequently isn't a<br>
>> >> > mode switch at all. I know that on the nVidia driver, X will do scaling on<br>
>> >> > the graphics card if it's plugged in via a digital connection (DVI, HDMI,<br>
>> >> > DP, etc.) There really is no "mode switch" involved. This is precicely<br>
>> >> > because of what Guilio mentioned: LCD monitors do crappy scaling.<br>
>> ><br>
>> > Yes, I know that, and the driver scaling has bitten me when that leads<br>
>> > to *down*scaling, but that is completely irrelevant here. :-)<br>
>> ><br>
>> >> > That said, there's a counter example! Look at LCD projectors. Unless you<br>
>> >> > have the projector oriented perfectly so that no keystoning is required<br>
>> >> > (BTW: this never happens in practice), the projector will transform the<br>
>> >> > image you give it to make it more rectangular on the projected screen. In<br>
>> >> > this case, the graphics card stretching it and the projector transforming it<br>
>> >> > will probably look worse than the projector transforming the original image.<br>
>> >> ><br>
>> >> > I think the point here is that the app can't really know whether it wants<br>
>> >> > scaling or a mode switch. Apps shouldn't need to be dealing with all the<br>
>> >> > details of what outputs are connected and how beyond maybe knowing that the<br>
>> >> > presentation goes on the projector. Compositors are much better situated to<br>
>> >> > decide when do a mode-switch vs. putting the fullscreen surface in a plane.<br>
>> ><br>
>> > Well, as I've tried to explain, "mode switch" is not a real mode<br>
>> > switch, it is just a wish. The compositor chooses the best course of<br>
>> > action, also based on the user's preferences.<br>
>> ><br>
>> > Fullscreening is still about going to one wl_output, so you have to<br>
>> > care about outputs. Outputs have a mode list, and apps may or may not<br>
>> > use that list as options to show to the user for fullscreen window<br>
>> > size. The mode list would probably be just a supplement to the app's<br>
>> > own hardcoded list, plus maybe completely freely chosen resolution. The<br>
>> > only thing I see is that it should help the user to pick a good<br>
>> > resolution, if the user really has to go changing it.<br>
>> ><br>
>> >> > I think the bigger issue here is framerate. The reason why games want to<br>
>> >> > run at these odd modes is because your card may not be able to render the<br>
>> >> > game at 1920x1080@60fps (to use an extreme example). So what does the game<br>
>> >> > do? It asks for a lower resolution and maybe a lower framerate. If it can<br>
>> >> > only hit 50fps consistently, then using a 50hz vsync looks better than the<br>
>> >> > jitter you would get on a 60hz vsync. Can we use a heuristic for this?<br>
>> >> > Maybe, maybe not.<br>
>> ><br>
>> > Video playback is another thing. Some people really want the refresh<br>
>> > rate to match the video framerate.<br>
>> ><br>
>> >> >> > Also remember, that the mode switch is not meant to be mandatory if<br>
>> >> >> > requested by a client. It is only a preference, that when this app is<br>
>> >> >> > active (and top-most?), it would really like the video mode to be<br>
>> >> >> > changed to the nearest compatible with the window. The compositor is<br>
>> >> >> > free to switch between the game's mode and the native desktop mode at<br>
>> >> >> > will. Minimize the game? Sure, switch back to the native desktop video<br>
>> >> >> > mode. Bring the game back - switch back to the game mode. Alt+tab?<br>
>> >> >> > Switch only when something else than the game gets activated, maybe.<br>
>> >> ><br>
>> >> > As I mentioned above, I don't think clients should care whether they get a<br>
>> >> > new mode or not beyond a possible FPS change. However, I don't know that I<br>
>> >> > like the word "hint" in the fullscreen spec in wl_shell_surface. The way he<br>
>> >> > spec was written before, the client could ask for centered and get a<br>
>> >> > mode-switch or vice-versa. What was the intent here?<br>
>> ><br>
>> > Clients would not know if they got a new mode in any case.<br>
>> ><br>
>> >> > Perhaps we can do everything we want by saying that fullscreen means "fill<br>
>> >> > the screen without changing aspect-ratio" and add a couple of hints requests<br>
>> >> > that the client calls before calling set_fullscreen:<br>
>> >> ><br>
>> >> > - Preferred framerate: "I don't think I can render any faster than this, so<br>
>> >> > it will look better if you refresh at this rate." This could, in theory,<br>
>> >> > apply to non-fullscreen windows as well. Also, it could be a bogus rate<br>
>> >> > such as 24fps (movies) and the compositor could try to refresh at a multiple<br>
>> >> > of 24 or something.<br>
>> >><br>
>> >> We should also have a special value for "i don't care", maybe 0.<br>
>> ><br>
>> > I think the preferred framerate hint is a very good idea. It is one<br>
>> > part of the essence of this whole thing.<br>
>> ><br>
>> >> > - Preferred fullscreen scaling: "I would like to be as large as possible",<br>
>> >> > "I would like to be pixel-perfect, even if that means smaller and surrounded<br>
>> >> > in black", etc. TBH, I don't know how many clients would actually like the<br>
>> >> > later one. Maybe if they have text they don't want getting blurry?<br>
>> >><br>
>> >> I also don't see much use for the second (centered) mode. Scaling<br>
>> >> should definitely be the default, imho.<br>
>> >><br>
>> >> This is going in the right direction, i think.<br>
>> ><br>
>> > This is the question about whether xdg_surface should require the<br>
>> > window to match exactly the configured size. I interpret your replies<br>
>> > as "at most as big as the configured size", allowing to be smaller in<br>
>> > either or both dimensions. Right?<br>
>> ><br>
>> > Let's do a summary:<br>
>> > - a request to go fullscreen<br>
>> > - preferred framerate hint, including dont-care option<br>
>> > - allow the fullscreen window to be smaller than configured, defaulting<br>
>> > to scaling up as big as possible without losing any image content or<br>
>> > changing aspect ratio<br>
>><br>
>> What about bigger than configured? The compositor could scale them<br>
>> down, i don't see any difference here.<br>
><br>
> I would say that the app is being stupid, no-one wants to have<br>
> downscaling when the window is upposed be shown in its normal way.<br>
><br>
> IIRC we already forbid larger than configured anyway.<br>
<br>
</div></div>Forbid as in protocol error or undefined behavior? I agree that's a<br>
stupid thing to do, but the compositor should be able to deal with<br>
stupideness, and scaling down seems the most sensible thing to do. I'm<br>
fine with leaving it as undefined behavior in the spec, anyway.<br></blockquote><div><br></div><div>There are use-cases where you want the surface scaled down. For instance, 1920x1080 video on a 1600x1200 display. If we want to have the client create a viewport that scales it down to 1600x900, that's probably fine but I don't see how that's needed.<br>
<br></div><div>My big point (that may not have gotten through) is that, as long as we have a sensible default ("shoot the client if it's not the right size" doesn't count), we can add support for additional fine-grained control later and this isn't a blocker for xdg_shell going stable. My recommendation for said default would be "fill the screen without changing aspect ratio", i.e. scale and letter-box. If we want to call bigger-than-configure undefined behavior, I don't care but I don't think it's needed either. For the rest of it (modifiers, etc.), let's start another thread on the list and let the details bike shed there and get xdg_shell stabalized.<br>
<br>As I said to Jasper on IRC, i've got some time on the train tomorrow and I'm going to try and give the latest version of xdg_shell a good read and review. My feeling is that we're probably ready for psudo-stable at this point, but I need to give it a thorough read first.<br>
<br></div><div>--Jason<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
><br>
> I'll leave that to Jasper.<br>
><br>
>> > If a client wants any specific kind of scaling / black bars, it can<br>
>> > still do that with wl_viewport and sub-surfaces. This is kind of an<br>
>> > override for special apps with special needs.<br>
>><br>
>> So you think we should drop the method hint and make the apps use<br>
>> wl_viewport+subsurfaces if they want to not be scaled up, right?<br>
><br>
> Yeah.<br>
><br>
>> > A video player might want to use the preferred framerate hint even<br>
>> > while not fullscreen. (Make it an independent xdg_surface request?)<br>
>><br>
>> That could work. The compositor can then switch to a mode with that<br>
>> framerate if it works fine with other surfaces, and otherwise ignore<br>
>> it until the surface goes fullscreen.<br>
><br>
> Exactly. Up to compositor's policy.<br>
><br>
>> > A game may be using window geometry smaller than configured, and set<br>
>> > the framerate hint. The compositor can choose to change video mode<br>
>> > and/or scale up, or not.<br>
>> ><br>
>> > The compositor's user preferences might favour integer scaling factors<br>
>> > if the user thinks they are better than fractional. In the game<br>
>> > example, the compositor is free to use an integer factor and fill the<br>
>> > rest with black.<br>
>> ><br>
>> > A hardcore gamer using a CRT would set his compositor preferences so,<br>
>> > that the compositor will always switch video mode (perhaps per app) to<br>
>> > the app's fullscreen resolution.<br>
>> ><br>
>> > Would that sound good?<br>
>> > Any other use cases to consider?<br>
>> ><br>
>> > The two key features would be the framerate hint, and allowing smaller<br>
>> > than configured fullscreen windows.<br>
><br>
> Thanks,<br>
> pq<br>
</div></div></blockquote></div><br></div></div>