diff --git a/plugins/platforms/drm/drm_backend.cpp b/plugins/platforms/drm/drm_backend.cpp
index 59e247533..e9c08df03 100644
--- a/plugins/platforms/drm/drm_backend.cpp
+++ b/plugins/platforms/drm/drm_backend.cpp
@@ -57,6 +57,59 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include <xf86drmMode.h>
 #include <libdrm/drm_mode.h>
 
+// HDR definitions copied from linux/include/uapi/drm/drm_mode.h
+
+// Copied from include/drm/drm_color_mgmt.h
+enum drm_color_encoding {
+  DRM_COLOR_YCBCR_BT601,
+  DRM_COLOR_YCBCR_BT709,
+  DRM_COLOR_YCBCR_BT2020,
+};
+enum drm_color_range
+{
+  DRM_COLOR_YCBCR_LIMITED_RANGE,
+  DRM_COLOR_YCBCR_FULL_RANGE,
+};
+
+
+enum hdmi_metadata_type
+{
+  HDMI_STATIC_METADATA_TYPE1 = 1,
+};
+
+enum hdmi_eotf
+{
+  HDMI_EOTF_TRADITIONAL_GAMMA_SDR,
+  HDMI_EOTF_TRADITIONAL_GAMMA_HDR,
+  HDMI_EOTF_SMPTE_ST2084,
+  HDMI_EOTF_BT_2100_HLG,
+};
+
+struct hdr_metadata_infoframe
+{
+  uint8_t eotf;
+  uint8_t metadata_type;
+  struct
+  {
+    uint16_t x, y;
+  } display_primaries[3];
+  struct
+  {
+    uint16_t x, y;
+  } white_point;
+  uint16_t max_display_mastering_luminance;
+  uint16_t min_display_mastering_luminance;
+  uint16_t max_cll;
+  uint16_t max_fall;
+};
+struct hdr_output_metadata
+{
+  uint32_t metadata_type;
+  union {
+    struct hdr_metadata_infoframe hdmi_metadata_type1;
+  };
+};
+
 #ifndef DRM_CAP_CURSOR_WIDTH
 #define DRM_CAP_CURSOR_WIDTH 0x8
 #endif
@@ -513,6 +566,10 @@ drmModeModeInfo getInitialMode(drmModeCrtcPtr crtc, drmModeConnectorPtr connecto
     return connector->modes[0];
 }
 
+constexpr uint16_t scale(double x) {
+	return uint16_t(x * 50000);
+}
+
 void DrmBackend::updateOutputs()
 {
     if (m_fd < 0) {
@@ -600,6 +657,33 @@ void DrmBackend::updateOutputs()
                 crtc->setOutput(output);
                 output->m_crtc = crtc;
 
+                qCDebug(KWIN_DRM) << "Setting HDR metadata fro connector " << con->id();
+                struct hdr_output_metadata hdr_metadata = {
+                    .metadata_type = HDMI_STATIC_METADATA_TYPE1,
+                    .hdmi_metadata_type1 = {
+                        .eotf = HDMI_EOTF_TRADITIONAL_GAMMA_HDR,
+			// This won't work, probably due to eotf_supported() failing in the kernel
+			// .eotf = HDMI_EOTF_BT_2100_HLG,
+                        .metadata_type = HDMI_STATIC_METADATA_TYPE1,
+                        // From Rec. 2100
+                        .display_primaries = {
+                            { .x = scale(0.708), .y = scale(0.292) },
+                            { .x = scale(0.170), .y = scale(0.797) },
+                            { .x = scale(0.131), .y = scale(0.046) },
+                        },
+                        .white_point = { .x = scale(0.3127), .y = scale(0.390) },
+                        .max_display_mastering_luminance = 0xFFFF,
+                        .min_display_mastering_luminance = 0,
+                        // .max_cll = ???
+                        // .max_fall = ???
+                    }
+                };
+                uint32_t hdr_blob_id = 0;
+                drmModeCreatePropertyBlob(fd(), &hdr_metadata, sizeof(hdr_metadata), &hdr_blob_id);
+                con->setValue(int(DrmConnector::PropertyIndex::HdrOutputMetadataId), hdr_blob_id);
+                con->setValue(int(DrmConnector::PropertyIndex::MaxBpcId), 10);
+                // TODO: drmModeDestroyPropertyBlob(fd(), hdr_blob_id);
+
                 output->m_mode = getInitialMode(modeCrtc.get(), connector.get());
                 qCDebug(KWIN_DRM) << "For new output use mode " << output->m_mode.name;
 
diff --git a/plugins/platforms/drm/drm_object_connector.cpp b/plugins/platforms/drm/drm_object_connector.cpp
index 146770fc5..f129cfb77 100644
--- a/plugins/platforms/drm/drm_object_connector.cpp
+++ b/plugins/platforms/drm/drm_object_connector.cpp
@@ -52,6 +52,8 @@ bool DrmConnector::initProps()
 {
     setPropertyNames( {
         QByteArrayLiteral("CRTC_ID"),
+        QByteArrayLiteral("max bpc"),
+        QByteArrayLiteral("HDR_OUTPUT_METADATA"),
     });
 
     DrmScopedPointer<drmModeObjectProperties> properties(
diff --git a/plugins/platforms/drm/drm_object_connector.h b/plugins/platforms/drm/drm_object_connector.h
index d52c5cb47..105827350 100644
--- a/plugins/platforms/drm/drm_object_connector.h
+++ b/plugins/platforms/drm/drm_object_connector.h
@@ -36,13 +36,15 @@ public:
 
     enum class PropertyIndex {
         CrtcId = 0,
+        MaxBpcId = 1,
+        HdrOutputMetadataId = 2,
         Count
     };
 
     QVector<uint32_t> encoders() {
         return m_encoders;
     }
-    
+
     bool initProps() override;
     bool isConnected();
 
