libweston: Add transform to weston_head

Like physical size, subpixel arrangement, etc, transform advises of a
physical transform of a head, if present.

This commit adds the transform member and setter to weston_head, however
it is currently unused.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
[daniels: Extracted from one of Lucas's patches.]
Signed-off-by: Daniel Stone <daniels@collabora.com>
dev
Lucas Stach 5 years ago committed by Daniel Stone
parent aaf35586f4
commit a69cb711cc
  1. 7
      include/libweston/libweston.h
  2. 4
      libweston/backend.h
  3. 40
      libweston/compositor.c

@ -207,6 +207,10 @@ struct weston_head {
int32_t mm_width; /**< physical image width in mm */ int32_t mm_width; /**< physical image width in mm */
int32_t mm_height; /**< physical image height in mm */ int32_t mm_height; /**< physical image height in mm */
/** WL_OUTPUT_TRANSFORM enum to apply to match native orientation */
uint32_t transform;
char *make; /**< monitor manufacturer (PNP ID) */ char *make; /**< monitor manufacturer (PNP ID) */
char *model; /**< monitor model */ char *model; /**< monitor model */
char *serial_number; /**< monitor serial */ char *serial_number; /**< monitor serial */
@ -1954,6 +1958,9 @@ weston_head_get_name(struct weston_head *head);
struct weston_output * struct weston_output *
weston_head_get_output(struct weston_head *head); weston_head_get_output(struct weston_head *head);
uint32_t
weston_head_get_transform(struct weston_head *head);
void void
weston_head_detach(struct weston_head *head); weston_head_detach(struct weston_head *head);

@ -138,6 +138,10 @@ weston_head_set_physical_size(struct weston_head *head,
void void
weston_head_set_subpixel(struct weston_head *head, weston_head_set_subpixel(struct weston_head *head,
enum wl_output_subpixel sp); enum wl_output_subpixel sp);
void
weston_head_set_transform(struct weston_head *head, uint32_t transform);
/* weston_output */ /* weston_output */
void void

@ -5422,6 +5422,28 @@ weston_head_set_non_desktop(struct weston_head *head, bool non_desktop)
weston_head_set_device_changed(head); weston_head_set_device_changed(head);
} }
/** Store display transformation
*
* \param head The head to modify.
* \param transform The transformation to apply for this head
*
* This may set the device_changed flag.
*
* \ingroup head
* \internal
*/
WL_EXPORT void
weston_head_set_transform(struct weston_head *head, uint32_t transform)
{
if (head->transform == transform)
return;
head->transform = transform;
weston_head_set_device_changed(head);
}
/** Store physical image size /** Store physical image size
* *
* \param head The head to modify. * \param head The head to modify.
@ -5683,6 +5705,24 @@ weston_head_get_output(struct weston_head *head)
return head->output; return head->output;
} }
/** Get the head's native transformation
*
* \param head The head to query.
* \return The head's native transform, as a WL_OUTPUT_TRANSFORM_* value
*
* A weston_head may have a 'native' transform provided by the backend.
* Examples include panels which are physically rotated, where the rotation
* is recorded and described as part of the system configuration. This call
* will return any known native transform for the head.
*
* \ingroup head
*/
WL_EXPORT uint32_t
weston_head_get_transform(struct weston_head *head)
{
return head->transform;
}
/** Add destroy callback for a head /** Add destroy callback for a head
* *
* \param head The head to watch for. * \param head The head to watch for.

Loading…
Cancel
Save