<div dir="ltr"><p dir="ltr"><br>
On Oct 2, 2014 12:37 AM, "Pekka Paalanen" <<a href="mailto:ppaalanen@gmail.com" target="_blank">ppaalanen@gmail.com</a>> wrote:<br>
><br>
> On Wed, 1 Oct 2014 18:09:32 -0700<br>
> Jason Ekstrand <<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>> wrote:<br>
><br>
> > Allow me to chip in here. Sorry that I haven't had a chance to really look<br>
> > over things carefully. I have been reading this thread, just haven't had a<br>
> > chance to respond.<br>
> ><br>
> > On Wed, Oct 1, 2014 at 12:41 AM, Pekka Paalanen <<a href="mailto:ppaalanen@gmail.com" target="_blank">ppaalanen@gmail.com</a>> wrote:<br>
> ><br>
> > > On Tue, 30 Sep 2014 14:35:24 -0500<br>
> > > Derek Foreman <<a href="mailto:derekf@osg.samsung.com" target="_blank">derekf@osg.samsung.com</a>> wrote:<br>
> > ><br>
> > > > Thanks for taking a look!<br>
> > > ><br>
> > > > On 26/09/14 05:48 PM, Bill Spitzak wrote:<br>
> > > > > 90 degree rotation about x or y will require filtering.<br>
> > > ><br>
> > > > Yup, you're right.<br>
> > > ><br>
> > > > > You test y scale twice, must be a typo. I think you intended to test z,<br>
> > > > > but in fact z scale is not relevant so you should not test it at all.<br>
> > > ><br>
> > > > Argh - thanks. Why isn't Z scale relevant? I'm worried about making<br>
> > > > assumptions about the transformations these matrices represent and<br>
> > > > having those assumptions violated in the future... For Z not to matter<br>
> > > > are we assuming projection will always be orthographic?<br>
> > ><br>
> > > Weston never uses the final Z coordinate for anything, so in that sense<br>
> > > it is always orthographic. Essentially, we could just do with 3x3<br>
> > > matrices perfectly fine. 3x3 supports 2D-projective which is enough to<br>
> > > implement fake-3D effects like<br>
> > > <a href="http://people.collabora.com/~pq/rotate3d-fun.webm" target="_blank">http://people.collabora.com/~pq/rotate3d-fun.webm</a><br>
> > > (The gl-renderer does not route the W element at all, I had to patch<br>
> > > that. Pixman-renderer OTOH just worked.)<br>
> > ><br>
> > > Weston also hardcodes the input Z coordinate always to 0, no matter<br>
> > > which way you are going between buffer and output spaces.<br>
> > ><br>
> > > I suppose the 4x4 matrix was originally chosen to fit the OpenGL API.<br>
> > > And maybe with some speculation about a desktop cube implementation or<br>
> > > something, but I don't really see the cube or such coming, not as a<br>
> > > generic thing anyway as only the gl-renderer could support it with<br>
> > > true 3D space.<br>
> > ><br>
> > > > > Translation by non-integer will also require filtering.<br>
> > > ><br>
> > > > Good point.<br>
> > > ><br>
> > > > > I recommend instead of checking the rotation to instead look for zeros<br>
> > > > > in the correct locations in the matrix. Matrix must be of the form:<br>
> > > > ><br>
> > > > > |sx 0 0 tx|<br>
> > > > > |0 sy 0 ty|<br>
> > > > > |? ? ? ?|<br>
> > > > > |0 0 0 1|<br>
> > > > ><br>
> > > > > or<br>
> > > > ><br>
> > > > > |0 sx 0 tx|<br>
> > > > > |sy 0 0 ty|<br>
> > > > > |? ? ? ?|<br>
> > > > > |0 0 0 1|<br>
> > > > ><br>
> > > > > sx and sy must be ±1, and tx and ty must be integers. The ? can be any<br>
> > > > > value.<br>
> > > ><br>
> > > > That could save us the very expensive matrix decomposition. I'll try<br>
> > > > this out. Thanks.<br>
> > > ><br>
> > > > I think this may be better than decomposition for deciding to use video<br>
> > > > planes in compositor-drm as well.<br>
> > > ><br>
> > > > (In fact, you've got me wondering if we ever need to split a matrix into<br>
> > > > basic transformations at all...)<br>
> > ><br>
> > > I'd be wondering about that, too. My intuition would say there is no<br>
> > > need to really decompose. Just checking the elements should suffice,<br>
> > > and when the matrix is supportable for whatever, then you pick the<br>
> > > right elements (which is a bit like decomposition, but no need to be<br>
> > > generic at all).<br>
> > ><br>
> ><br>
> > Yeah, I'm not convinced we need to be able to do a full decomposition<br>
> > either. My original intention was something like this:<br>
> ><br>
> > bool<br>
> > weston_matrix_to_integer_transform(const weston_matrix *mat, enum<br>
> > wl_output_transform& transform, int *scale, int *x, int *y)<br>
><br>
> Why would there be 'transform' parameter? That implies that the matrix<br>
> is not really the total transformation, which I find odd here.<br>
><br>
> (Total transformation is between buffer pixel coords and output/scanout<br>
> pixel coords, i.e. buffer-to-output.)</p>
<p dir="ltr">I'm sorry I mistyped but I meant the transform to be an output parameter. That way you know of the matrix is a 90-degree rotation or flip. Not sure if this is needed but for figuring out GL_LINEAR vs GL_NEAREST we don't want to fail if there is a 90-degree rotation.</p>
<p dir="ltr">><br>
> > (do we use "bool" in weston? Maybe just return int). We may need both x<br>
> > and y scales and it may be useful to get those as floats. I'm not sure on<br>
> > that. Pekka, what would the RPi backend use?<br>
><br>
> The rpi-renderer uses pretty much the same as what DRM planes/overlays<br>
> offer wrt. coordinates, IIRC: integer position and size on the output,<br>
> and 16.16 fixed point position and size on input (buffer).<br>
><br>
> Whether scaling factor is integer or not is irrelevant there. I do not<br>
> recall there being an option for sampling (nearest/linear/...) in<br>
> either DispmanX nor DRM.<br>
><br>
> > Basically, we want to be<br>
> > able to do 2 things: First, detect if it's an entirely integer transform<br>
> > and use GL_NEAREST instead of GL_LINEAR and second, know how to flip the<br>
> > surface around in cases when we can do some simple transformations but<br>
> > can't do an arbitrary matrix transformation. One example here is DRM<br>
> > planes. We can only use a plane when there's no scale and the<br>
> > buffer-to-output transform has no rotation. We need to check for that<br>
> > condition and then pull the needed data out.<br>
><br>
> I think DRM planes do handle at least limited scaling, as do DispmanX<br>
> (IIRC something like if scaling to less than 1/8 you take an<br>
> additional performance hit, or other funny effects) also.<br>
><br>
> We may not know all the limitations of a DRM plane in advance, so we<br>
> only need to make sure it can fit through the KMS API, and then the<br>
> kernel will reject it if it violates some hw-specific restrictions.<br>
> (Fallback will be implemented in Weston when atomic/nuclear support<br>
> arrives.)</p><p>Yes, but we probably want to use the above function and then check that transform == WL_OUTPUT_TRANSFORM_NORMAL. In any case, having some idea of the rotation is probably needed. (I don't know that much about KMS).<br></p><p dir="ltr"><br>
><br>
> > Point is, we don't need a full matrix decomposition. Also, it's worth<br>
> > throwing out there that the caching probably doesn't help us at all because<br>
> > we're going to usually be calling this on freshly computed matrices such as<br>
> > the above mentioned buffer-to-output transform.<br>
> ><br>
> > Does that make sense?<br>
><br>
> Yes, to me at least.<br>
><br>
> Futhermore, if you wanted to cache the buffer-to-output matrix, you<br>
> would end up with number_of_views * number_of_outputs matrices to be<br>
> cached. The buffer-to-global per-view matrix might not change too<br>
> often, but we tend to paint outputs in turns, which means doing just<br>
> per-view cached total matrix is a waste.<br>
><br>
> So you might have buffer-to-surface matrix in weston_surface, then<br>
> buffer-to-global matrix cached in weston_view. I'm not sure it makes<br>
> sense to cache buffer-to-output anywhere.<br>
><br>
><br>
> Thanks,<br>
> pq</p>
</div>