libweston: Add transform to weston_head
authorLucas Stach <l.stach@pengutronix.de>
Mon, 25 Nov 2019 23:29:31 +0000 (23:29 +0000)
committerDaniel Stone <daniels@collabora.com>
Fri, 6 Mar 2020 21:50:38 +0000 (21:50 +0000)
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>
include/libweston/libweston.h
libweston/backend.h
libweston/compositor.c

index 1439775ef997a5d0ae41448c36a27ae4805ca00a..d036c5bba49fbe262a3519184a97d49a8e722e8a 100644 (file)
@@ -207,6 +207,10 @@ struct weston_head {
 
        int32_t mm_width;               /**< physical image width 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 *model;                    /**< monitor model */
        char *serial_number;            /**< monitor serial */
@@ -1954,6 +1958,9 @@ weston_head_get_name(struct weston_head *head);
 struct weston_output *
 weston_head_get_output(struct weston_head *head);
 
+uint32_t
+weston_head_get_transform(struct weston_head *head);
+
 void
 weston_head_detach(struct weston_head *head);
 
index ff10b3631284d72e6211c837075ca91179365cb0..8e91746b492e3ecc53935a415232993c8b483869 100644 (file)
@@ -138,6 +138,10 @@ weston_head_set_physical_size(struct weston_head *head,
 void
 weston_head_set_subpixel(struct weston_head *head,
                         enum wl_output_subpixel sp);
+
+void
+weston_head_set_transform(struct weston_head *head, uint32_t transform);
+
 /* weston_output */
 
 void
index 29c0ab18ab75720c9440aec83b4498dcd4efed81..35da1e658a02bd7340badd4338948c78a7c3963c 100644 (file)
@@ -5422,6 +5422,28 @@ weston_head_set_non_desktop(struct weston_head *head, bool non_desktop)
        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
  *
  * \param head The head to modify.
@@ -5683,6 +5705,24 @@ weston_head_get_output(struct weston_head *head)
        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
  *
  * \param head The head to watch for.