Skip to contentSkip to conversation

modesetting: add tile property support

PATCH In review Michel Dänzer 2 participants 2 messages Mar 14, 2019 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 modesetting: add tile property support

From: Dave Airlie <[email protected]>

This adds tiling support to the driver, it retrieves the tile info from the kernel and translates it into the server format and exposes the property.

(Ported from xserver commits 8fb8bbb3062f1a06621ab7030a9e89d5e8367b35
and 6abdb54a11dac4e8854ff94ecdcb90a14321ab31)
(Ported from amdgpu commit 6ee857726166f495abcd68e4ff60e3a09593d079)

---
 src/drmmode_display.c | 54 +++++++++++++++++++++++++++++++++++++++++--
 src/drmmode_display.h |  3 +++
 2 files changed, 55 insertions(+), 2 deletions(-)
src/drmmode_display.c +52 -2
index 002513f1a..0e9e24749 100644
@@ -1576,6 +1576,51 @@ drmmode_output_mode_valid(xf86OutputPtr output, DisplayModePtr pModes)
 	return MODE_OK;
 }
 
+static void
+drmmode_output_attach_tile(xf86OutputPtr output)
+{
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1, 17, 99, 901, 0)
+	drmmode_output_private_ptr drmmode_output = output->driver_private;
+	drmModeConnectorPtr koutput = drmmode_output->mode_output;
+	RADEONEntPtr pRADEONEnt = RADEONEntPriv(output->scrn);
+	struct xf86CrtcTileInfo tile_info, *set = NULL;
+	int i;
+
+	if (!koutput) {
+		xf86OutputSetTile(output, NULL);
+		return;
+	}
+
+	/* look for a TILE property */
+	for (i = 0; i < koutput->count_props; i++) {
+		drmModePropertyPtr props;
+		props = drmModeGetProperty(pRADEONEnt->fd, koutput->props[i]);
+		if (!props)
+			continue;
+
+		if (!(props->flags & DRM_MODE_PROP_BLOB)) {
+			drmModeFreeProperty(props);
+			continue;
+		}
+
+		if (!strcmp(props->name, "TILE")) {
+			drmModeFreePropertyBlob(drmmode_output->tile_blob);
+			drmmode_output->tile_blob =
+				drmModeGetPropertyBlob(pRADEONEnt->fd,
+						       koutput->prop_values[i]);
+		}
+		drmModeFreeProperty(props);
+	}
+	if (drmmode_output->tile_blob) {
+		if (xf86OutputParseKMSTile(drmmode_output->tile_blob->data,
+					   drmmode_output->tile_blob->length,
+					   &tile_info) == TRUE)
+			set = &tile_info;
+	}
+	xf86OutputSetTile(output, set);
+#endif
+}
+
 static int
 koutput_get_prop_idx(int fd, drmModeConnectorPtr koutput,
         int type, const char *name)
@@ -1648,6 +1693,8 @@ drmmode_output_get_modes(xf86OutputPtr output)
 	}
 	xf86OutputSetEDID(output, mon);
 
+	drmmode_output_attach_tile(output);
+
 	/* modes should already be available */
 	for (i = 0; i < koutput->count_modes; i++) {
 		Mode = xnfalloc(sizeof(DisplayModeRec));
@@ -1665,8 +1712,11 @@ drmmode_output_destroy(xf86OutputPtr output)
 	drmmode_output_private_ptr drmmode_output = output->driver_private;
 	int i;
 
-	if (drmmode_output->edid_blob)
-		drmModeFreePropertyBlob(drmmode_output->edid_blob);
+	drmModeFreePropertyBlob(drmmode_output->edid_blob);
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1, 17, 99, 901, 0)
+	drmModeFreePropertyBlob(drmmode_output->tile_blob);
+#endif
+
 	for (i = 0; i < drmmode_output->num_props; i++) {
 		drmModeFreeProperty(drmmode_output->props[i].mode_prop);
 		free(drmmode_output->props[i].atoms);
src/drmmode_display.h +3 -0
index 2c2c3d57f..96eaef0aa 100644
@@ -142,6 +142,9 @@ typedef struct {
     drmModeConnectorPtr mode_output;
     drmModeEncoderPtr *mode_encoders;
     drmModePropertyBlobPtr edid_blob;
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1, 17, 99, 901, 0)
+    drmModePropertyBlobPtr tile_blob;
+#endif
     int dpms_enum_id;
     int num_props;
     drmmode_prop_ptr props;
Signature · 6 lines
2.20.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20190314101948.4496-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org

Reviewed-by
#2 lore raw

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Michel Dänzer <[email protected]>
Sent: Thursday, March 14, 2019 6:19 AM
To: [email protected]
Subject: [PATCH xf86-video-ati] modesetting: add tile property support

From: Dave Airlie <[email protected]>

This adds tiling support to the driver, it retrieves the tile info from the kernel and translates it into the server format and exposes the property.

(Ported from xserver commits 8fb8bbb3062f1a06621ab7030a9e89d5e8367b35
and 6abdb54a11dac4e8854ff94ecdcb90a14321ab31)
(Ported from amdgpu commit 6ee857726166f495abcd68e4ff60e3a09593d079)

---
 src/drmmode_display.c | 54 +++++++++++++++++++++++++++++++++++++++++--
 src/drmmode_display.h |  3 +++
 2 files changed, 55 insertions(+), 2 deletions(-)
src/drmmode_display.c +52 -2
index 002513f1a..0e9e24749 100644
@@ -1576,6 +1576,51 @@ drmmode_output_mode_valid(xf86OutputPtr output, DisplayModePtr pModes)
         return MODE_OK;
 }
 
+static void
+drmmode_output_attach_tile(xf86OutputPtr output)
+{
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1, 17, 99, 901, 0)
+       drmmode_output_private_ptr drmmode_output = output->driver_private;
+       drmModeConnectorPtr koutput = drmmode_output->mode_output;
+       RADEONEntPtr pRADEONEnt = RADEONEntPriv(output->scrn);
+       struct xf86CrtcTileInfo tile_info, *set = NULL;
+       int i;
+
+       if (!koutput) {
+               xf86OutputSetTile(output, NULL);
+               return;
+       }
+
+       /* look for a TILE property */
+       for (i = 0; i < koutput->count_props; i++) {
+               drmModePropertyPtr props;
+               props = drmModeGetProperty(pRADEONEnt->fd, koutput->props[i]);
+               if (!props)
+                       continue;
+
+               if (!(props->flags & DRM_MODE_PROP_BLOB)) {
+                       drmModeFreeProperty(props);
+                       continue;
+               }
+
+               if (!strcmp(props->name, "TILE")) {
+                       drmModeFreePropertyBlob(drmmode_output->tile_blob);
+                       drmmode_output->tile_blob =
+                               drmModeGetPropertyBlob(pRADEONEnt->fd,
+                                                      koutput->prop_values[i]);
+               }
+               drmModeFreeProperty(props);
+       }
+       if (drmmode_output->tile_blob) {
+               if (xf86OutputParseKMSTile(drmmode_output->tile_blob->data,
+                                          drmmode_output->tile_blob->length,
+                                          &tile_info) == TRUE)
+                       set = &tile_info;
+       }
+       xf86OutputSetTile(output, set);
+#endif
+}
+
 static int
 koutput_get_prop_idx(int fd, drmModeConnectorPtr koutput,
         int type, const char *name)
@@ -1648,6 +1693,8 @@ drmmode_output_get_modes(xf86OutputPtr output)
         }
         xf86OutputSetEDID(output, mon);
 
+       drmmode_output_attach_tile(output);
+
         /* modes should already be available */
         for (i = 0; i < koutput->count_modes; i++) {
                 Mode = xnfalloc(sizeof(DisplayModeRec));
@@ -1665,8 +1712,11 @@ drmmode_output_destroy(xf86OutputPtr output)
         drmmode_output_private_ptr drmmode_output = output->driver_private;
         int i;
 
-       if (drmmode_output->edid_blob)
-               drmModeFreePropertyBlob(drmmode_output->edid_blob);
+       drmModeFreePropertyBlob(drmmode_output->edid_blob);
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1, 17, 99, 901, 0)
+       drmModeFreePropertyBlob(drmmode_output->tile_blob);
+#endif
+
         for (i = 0; i < drmmode_output->num_props; i++) {
                 drmModeFreeProperty(drmmode_output->props[i].mode_prop);
                 free(drmmode_output->props[i].atoms);
src/drmmode_display.h +3 -0
index 2c2c3d57f..96eaef0aa 100644
@@ -142,6 +142,9 @@ typedef struct {
     drmModeConnectorPtr mode_output;
     drmModeEncoderPtr *mode_encoders;
     drmModePropertyBlobPtr edid_blob;
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1, 17, 99, 901, 0)
+    drmModePropertyBlobPtr tile_blob;
+#endif
     int dpms_enum_id;
     int num_props;
     drmmode_prop_ptr props;

--
2.20.1

_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx