[RFC weston 13/16] compositor: Add a function to test if images transformed by a matrix should be bilinearly filtered
derekf at osg.samsung.com
Tue Sep 30 12:35:24 PDT 2014
Thanks for taking a look!
On 26/09/14 05:48 PM, Bill Spitzak wrote:
> 90 degree rotation about x or y will require filtering.
Yup, you're right.
> You test y scale twice, must be a typo. I think you intended to test z,
> but in fact z scale is not relevant so you should not test it at all.
Argh - thanks. Why isn't Z scale relevant? I'm worried about making
assumptions about the transformations these matrices represent and
having those assumptions violated in the future... For Z not to matter
are we assuming projection will always be orthographic?
> Translation by non-integer will also require filtering.
> I recommend instead of checking the rotation to instead look for zeros
> in the correct locations in the matrix. Matrix must be of the form:
> |sx 0 0 tx|
> |0 sy 0 ty|
> |? ? ? ?|
> |0 0 0 1|
> |0 sx 0 tx|
> |sy 0 0 ty|
> |? ? ? ?|
> |0 0 0 1|
> sx and sy must be ±1, and tx and ty must be integers. The ? can be any
That could save us the very expensive matrix decomposition. I'll try
this out. Thanks.
I think this may be better than decomposition for deciding to use video
planes in compositor-drm as well.
(In fact, you've got me wondering if we ever need to split a matrix into
basic transformations at all...)
> Also pixman is already doing equivalent tests and short-circuiting to
> nearest filter, so you might not need to check this anyway.
This is also used for the gl renderer, so I don't think I can count on
that short circuit there... Though bilinear vs nearest doesn't have
anywhere near the same performance impact there.
Are you suggesting pixman always be set to use bilinear, and it'll just
pick nearest automatically when the image transform doesn't require it?
> On 09/26/2014 02:10 PM, Derek Foreman wrote:
>> +WL_EXPORT int
>> +weston_matrix_needs_filtering(struct weston_matrix *matrix)
>> + if (!rot_is_90(weston_matrix_get_rotation_x(matrix))
>> + || !rot_is_90(weston_matrix_get_rotation_y(matrix))
>> + || !rot_is_90(weston_matrix_get_rotation_z(matrix))
>> + || (fabs(weston_matrix_get_scale_x(matrix) - 1.0) > 0.0001)
>> + || (fabs(weston_matrix_get_scale_y(matrix) - 1.0) > 0.0001)
>> + || (fabs(weston_matrix_get_scale_y(matrix) - 1.0) > 0.0001))
>> + return 1;
>> + return 0;
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
More information about the wayland-devel