diff --git a/extensions/surface-extension.xml b/extensions/surface-extension.xml
index 096e72ca9f90722a9dd8e6d4905188b07e9dc751..38c6590ce61673903a9c2caf6c87e334b7d31cc8 100644
--- a/extensions/surface-extension.xml
+++ b/extensions/surface-extension.xml
@@ -59,5 +59,21 @@
             <arg name="name" type="string"/>
             <arg name="value" type="array"/>
         </request>
+
+        <enum name="orientation">
+            <entry name="PrimaryOrientation" value="0"/>
+            <entry name="PortraitOrientation" value="1"/>
+            <entry name="LandscapeOrientation" value="2"/>
+            <entry name="InvertedPortraitOrientation" value="4"/>
+            <entry name="InvertedLandscapeOrientation" value="8"/>
+        </enum>
+
+        <request name="set_window_orientation">
+            <arg name="orientation" type="int"/>
+        </request>
+
+        <request name="set_content_orientation">
+            <arg name="orientation" type="int"/>
+        </request>
     </interface>
 </protocol>
diff --git a/src/compositor/compositor_api/waylandsurface.cpp b/src/compositor/compositor_api/waylandsurface.cpp
index c071bd60c15daee0f84e7a98a1fa542233ace1bd..786c1f4b540f0de1f0e4ac6904fbb4a7c6178fdc 100644
--- a/src/compositor/compositor_api/waylandsurface.cpp
+++ b/src/compositor/compositor_api/waylandsurface.cpp
@@ -141,6 +141,18 @@ void WaylandSurface::setSize(const QSize &size)
     d->surface->setSize(size);
 }
 
+Qt::ScreenOrientation WaylandSurface::contentOrientation() const
+{
+    Q_D(const WaylandSurface);
+    return d->surface->contentOrientation();
+}
+
+Qt::ScreenOrientation WaylandSurface::windowOrientation() const
+{
+    Q_D(const WaylandSurface);
+    return d->surface->windowOrientation();
+}
+
 QImage WaylandSurface::image() const
 {
     Q_D(const WaylandSurface);
diff --git a/src/compositor/compositor_api/waylandsurface.h b/src/compositor/compositor_api/waylandsurface.h
index faa1aa6f1faaa2c972867e52a8e1751a8a250e38..debf6fe7c326c14ed43d355ddd86ad9e4c704e9c 100644
--- a/src/compositor/compositor_api/waylandsurface.h
+++ b/src/compositor/compositor_api/waylandsurface.h
@@ -94,6 +94,9 @@ public:
     QSize size() const;
     void setSize(const QSize &size);
 
+    Qt::ScreenOrientation contentOrientation() const;
+    Qt::ScreenOrientation windowOrientation() const;
+
     QImage image() const;
 #ifdef QT_COMPOSITOR_WAYLAND_GL
     GLuint texture(QOpenGLContext *context) const;
diff --git a/src/compositor/wayland_wrapper/wlextendedsurface.cpp b/src/compositor/wayland_wrapper/wlextendedsurface.cpp
index 6278381f9d36398b3d8614d4ddbdad163fef5e5c..5ee1f93d9c3270c4b838405bc5f2eb4e2ec1b122 100644
--- a/src/compositor/wayland_wrapper/wlextendedsurface.cpp
+++ b/src/compositor/wayland_wrapper/wlextendedsurface.cpp
@@ -77,6 +77,8 @@ void SurfaceExtensionGlobal::get_extended_surface(struct wl_client *client,
 
 ExtendedSurface::ExtendedSurface(struct wl_client *client, uint32_t id, Surface *surface)
     : m_surface(surface)
+    , m_windowOrientation(Qt::PrimaryOrientation)
+    , m_contentOrientation(Qt::PrimaryOrientation)
 {
     Q_ASSERT(surface->extendedSurface() == 0);
     surface->setExtendedSurface(this);
@@ -124,8 +126,49 @@ void ExtendedSurface::update_generic_property(wl_client *client, wl_resource *ex
 
 }
 
+static Qt::ScreenOrientation screenOrientationFromWaylandOrientation(int32_t orientation)
+{
+    switch (orientation) {
+    case WL_EXTENDED_SURFACE_ORIENTATION_PORTRAITORIENTATION: return Qt::PortraitOrientation;
+    case WL_EXTENDED_SURFACE_ORIENTATION_INVERTEDPORTRAITORIENTATION: return Qt::InvertedPortraitOrientation;
+    case WL_EXTENDED_SURFACE_ORIENTATION_LANDSCAPEORIENTATION: return Qt::LandscapeOrientation;
+    case WL_EXTENDED_SURFACE_ORIENTATION_INVERTEDLANDSCAPEORIENTATION: return Qt::InvertedLandscapeOrientation;
+    default: return Qt::PrimaryOrientation;
+    }
+}
+
+Qt::ScreenOrientation ExtendedSurface::windowOrientation() const
+{
+    return m_windowOrientation;
+}
+
+Qt::ScreenOrientation ExtendedSurface::contentOrientation() const
+{
+    return m_contentOrientation;
+}
+
+void ExtendedSurface::set_window_orientation(struct wl_client *client,
+                                             struct wl_resource *extended_surface_resource,
+                                             int32_t orientation)
+{
+    Q_UNUSED(client);
+    ExtendedSurface *extended_surface = static_cast<ExtendedSurface *>(extended_surface_resource->data);
+    extended_surface->m_windowOrientation = screenOrientationFromWaylandOrientation(orientation);
+}
+
+void ExtendedSurface::set_content_orientation(struct wl_client *client,
+                                              struct wl_resource *extended_surface_resource,
+                                              int32_t orientation)
+{
+    Q_UNUSED(client);
+    ExtendedSurface *extended_surface = static_cast<ExtendedSurface *>(extended_surface_resource->data);
+    extended_surface->m_contentOrientation = screenOrientationFromWaylandOrientation(orientation);
+}
+
 const struct wl_extended_surface_interface ExtendedSurface::extended_surface_interface = {
-    ExtendedSurface::update_generic_property
+    ExtendedSurface::update_generic_property,
+    ExtendedSurface::set_window_orientation,
+    ExtendedSurface::set_content_orientation
 };
 
 }
diff --git a/src/compositor/wayland_wrapper/wlextendedsurface.h b/src/compositor/wayland_wrapper/wlextendedsurface.h
index 6e145536687637e03bb066b0f2aeaea352de0eaa..2bc1f636094f812137196874a291e5bad466c393 100644
--- a/src/compositor/wayland_wrapper/wlextendedsurface.h
+++ b/src/compositor/wayland_wrapper/wlextendedsurface.h
@@ -87,15 +87,29 @@ public:
     void setParent(ExtendedSurface *parent);
     QLinkedList<WaylandSurface *> subSurfaces() const;
 
+    Qt::ScreenOrientation windowOrientation() const;
+    Qt::ScreenOrientation contentOrientation() const;
+
 private:
     struct wl_resource *m_extended_surface_resource;
     Surface *m_surface;
 
+    Qt::ScreenOrientation m_windowOrientation;
+    Qt::ScreenOrientation m_contentOrientation;
+
     static void update_generic_property(struct wl_client *client,
                                     struct wl_resource *resource,
                                     const char *name,
                                     struct wl_array *value);
 
+    static void set_window_orientation(struct wl_client *client,
+                                       struct wl_resource *resource,
+                                       int32_t orientation);
+
+    static void set_content_orientation(struct wl_client *client,
+                                        struct wl_resource *resource,
+                                        int32_t orientation);
+
     static const struct wl_extended_surface_interface extended_surface_interface;
 };
 
diff --git a/src/compositor/wayland_wrapper/wlsurface.cpp b/src/compositor/wayland_wrapper/wlsurface.cpp
index b85a54004b6978eee6bb493df877d17d1bf2fd3f..107a726c968cd203a6e931f66a3f7ce7cb1770b2 100644
--- a/src/compositor/wayland_wrapper/wlsurface.cpp
+++ b/src/compositor/wayland_wrapper/wlsurface.cpp
@@ -612,6 +612,18 @@ void Surface::setWindowProperty(const QString &name, const QVariant &value, bool
     }
 }
 
+Qt::ScreenOrientation Surface::windowOrientation() const
+{
+    Q_D(const Surface);
+    return d->extendedSurface ? d->extendedSurface->windowOrientation() : Qt::PrimaryOrientation;
+}
+
+Qt::ScreenOrientation Surface::contentOrientation() const
+{
+    Q_D(const Surface);
+    return d->extendedSurface ? d->extendedSurface->contentOrientation() : Qt::PrimaryOrientation;
+}
+
 QPoint Surface::lastMousePos() const
 {
     Q_D(const Surface);
diff --git a/src/compositor/wayland_wrapper/wlsurface.h b/src/compositor/wayland_wrapper/wlsurface.h
index 8bb8132dde66f5cfcdcd29ac9d65d84a39201610..b34d7c8cce7ac2178120ff961cd56bd66e0f9f41 100644
--- a/src/compositor/wayland_wrapper/wlsurface.h
+++ b/src/compositor/wayland_wrapper/wlsurface.h
@@ -114,6 +114,9 @@ public:
     QVariant windowProperty(const QString &propertyName) const;
     void setWindowProperty(const QString &name, const QVariant &value, bool writeUpdateToClient = true);
 
+    Qt::ScreenOrientation contentOrientation() const;
+    Qt::ScreenOrientation windowOrientation() const;
+
     QPoint lastMousePos() const;
 
     void setExtendedSurface(ExtendedSurface *extendedSurface);
diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp b/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp
index 1f7055746d442fb4985b93d5eb059c1373f93036..58dfac4b01b5281bd40126670002b33243611cb9 100644
--- a/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp
+++ b/src/plugins/platforms/wayland/qwaylandextendedsurface.cpp
@@ -97,6 +97,27 @@ void QWaylandExtendedSurface::updateGenericProperty(const QString &name, const Q
     nativeInterface->emitWindowPropertyChanged(m_window,name);
 }
 
+static int32_t waylandRotationFromScreenOrientation(Qt::ScreenOrientation orientation)
+{
+    switch (orientation) {
+    case Qt::PortraitOrientation: return WL_EXTENDED_SURFACE_ORIENTATION_PORTRAITORIENTATION;
+    case Qt::InvertedPortraitOrientation: return WL_EXTENDED_SURFACE_ORIENTATION_INVERTEDPORTRAITORIENTATION;
+    case Qt::LandscapeOrientation: return WL_EXTENDED_SURFACE_ORIENTATION_LANDSCAPEORIENTATION;
+    case Qt::InvertedLandscapeOrientation: return WL_EXTENDED_SURFACE_ORIENTATION_INVERTEDLANDSCAPEORIENTATION;
+    default: return WL_EXTENDED_SURFACE_ORIENTATION_PRIMARYORIENTATION;
+    }
+}
+
+void QWaylandExtendedSurface::setWindowOrientation(Qt::ScreenOrientation orientation)
+{
+    wl_extended_surface_set_window_orientation(m_extended_surface, waylandRotationFromScreenOrientation(orientation));
+}
+
+void QWaylandExtendedSurface::setContentOrientation(Qt::ScreenOrientation orientation)
+{
+    wl_extended_surface_set_content_orientation(m_extended_surface, waylandRotationFromScreenOrientation(orientation));
+}
+
 QVariantMap QWaylandExtendedSurface::properties() const
 {
     return m_properties;
diff --git a/src/plugins/platforms/wayland/qwaylandextendedsurface.h b/src/plugins/platforms/wayland/qwaylandextendedsurface.h
index 88c10b87601acf5a0582a8662264ab389d353440..184fc0d471e0ccbf4b3d9fb3e1e4ed2852856a9c 100644
--- a/src/plugins/platforms/wayland/qwaylandextendedsurface.h
+++ b/src/plugins/platforms/wayland/qwaylandextendedsurface.h
@@ -66,6 +66,9 @@ class QWaylandExtendedSurface
 public:
     QWaylandExtendedSurface(QWaylandWindow *window, struct wl_extended_surface *extended_surface);
 
+    void setWindowOrientation(Qt::ScreenOrientation orientation);
+    void setContentOrientation(Qt::ScreenOrientation orientation);
+
     void updateGenericProperty(const QString &name, const QVariant &value);
     QVariantMap properties() const;
     QVariant property(const QString &name);
diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp
index 97aed6d7d9b4c16702d9e0effaece846a68ae832..2f2b784427a6d9dbf4ac4ee2c42481315878dd94 100644
--- a/src/plugins/platforms/wayland/qwaylandwindow.cpp
+++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp
@@ -205,3 +205,19 @@ QWaylandSubSurface *QWaylandWindow::subSurfaceWindow() const
 {
     return mSubSurfaceWindow;
 }
+
+void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orientation)
+{
+    if (mExtendedWindow)
+        mExtendedWindow->setContentOrientation(orientation);
+}
+
+Qt::ScreenOrientation QWaylandWindow::requestWindowOrientation(Qt::ScreenOrientation orientation)
+{
+    if (mExtendedWindow) {
+        mExtendedWindow->setWindowOrientation(orientation);
+        return orientation;
+    }
+
+    return Qt::PrimaryOrientation;
+}
diff --git a/src/plugins/platforms/wayland/qwaylandwindow.h b/src/plugins/platforms/wayland/qwaylandwindow.h
index 9357738ab27c9995caad596a49158877c5152bd0..d102f4e6ebb0023172d20031433913482a411306 100644
--- a/src/plugins/platforms/wayland/qwaylandwindow.h
+++ b/src/plugins/platforms/wayland/qwaylandwindow.h
@@ -85,6 +85,9 @@ public:
     QWaylandExtendedSurface *extendedWindow() const;
     QWaylandSubSurface *subSurfaceWindow() const;
 
+    void handleContentOrientationChange(Qt::ScreenOrientation orientation);
+    Qt::ScreenOrientation requestWindowOrientation(Qt::ScreenOrientation orientation);
+
 protected:
     QWaylandDisplay *mDisplay;
     struct wl_surface *mSurface;