<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Reviewed-by: Alex Deucher <alexander.deucher@amd.com><br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Michel Dänzer <michel@daenzer.net><br>
<b>Sent:</b> Thursday, March 14, 2019 6:19 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Subject:</b> [PATCH xf86-video-ati] modesetting: add tile property support</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">From: Dave Airlie <airlied@redhat.com><br>
<br>
This adds tiling support to the driver, it retrieves the tile info from<br>
the kernel and translates it into the server format and exposes the<br>
property.<br>
<br>
(Ported from xserver commits 8fb8bbb3062f1a06621ab7030a9e89d5e8367b35<br>
 and 6abdb54a11dac4e8854ff94ecdcb90a14321ab31)<br>
(Ported from amdgpu commit 6ee857726166f495abcd68e4ff60e3a09593d079)<br>
<br>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com><br>
---<br>
 src/drmmode_display.c | 54 +++++++++++++++++++++++++++++++++++++++++--<br>
 src/drmmode_display.h |  3 +++<br>
 2 files changed, 55 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/drmmode_display.c b/src/drmmode_display.c<br>
index 002513f1a..0e9e24749 100644<br>
--- a/src/drmmode_display.c<br>
+++ b/src/drmmode_display.c<br>
@@ -1576,6 +1576,51 @@ drmmode_output_mode_valid(xf86OutputPtr output, DisplayModePtr pModes)<br>
         return MODE_OK;<br>
 }<br>
 <br>
+static void<br>
+drmmode_output_attach_tile(xf86OutputPtr output)<br>
+{<br>
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1, 17, 99, 901, 0)<br>
+       drmmode_output_private_ptr drmmode_output = output->driver_private;<br>
+       drmModeConnectorPtr koutput = drmmode_output->mode_output;<br>
+       RADEONEntPtr pRADEONEnt = RADEONEntPriv(output->scrn);<br>
+       struct xf86CrtcTileInfo tile_info, *set = NULL;<br>
+       int i;<br>
+<br>
+       if (!koutput) {<br>
+               xf86OutputSetTile(output, NULL);<br>
+               return;<br>
+       }<br>
+<br>
+       /* look for a TILE property */<br>
+       for (i = 0; i < koutput->count_props; i++) {<br>
+               drmModePropertyPtr props;<br>
+               props = drmModeGetProperty(pRADEONEnt->fd, koutput->props[i]);<br>
+               if (!props)<br>
+                       continue;<br>
+<br>
+               if (!(props->flags & DRM_MODE_PROP_BLOB)) {<br>
+                       drmModeFreeProperty(props);<br>
+                       continue;<br>
+               }<br>
+<br>
+               if (!strcmp(props->name, "TILE")) {<br>
+                       drmModeFreePropertyBlob(drmmode_output->tile_blob);<br>
+                       drmmode_output->tile_blob =<br>
+                               drmModeGetPropertyBlob(pRADEONEnt->fd,<br>
+                                                      koutput->prop_values[i]);<br>
+               }<br>
+               drmModeFreeProperty(props);<br>
+       }<br>
+       if (drmmode_output->tile_blob) {<br>
+               if (xf86OutputParseKMSTile(drmmode_output->tile_blob->data,<br>
+                                          drmmode_output->tile_blob->length,<br>
+                                          &tile_info) == TRUE)<br>
+                       set = &tile_info;<br>
+       }<br>
+       xf86OutputSetTile(output, set);<br>
+#endif<br>
+}<br>
+<br>
 static int<br>
 koutput_get_prop_idx(int fd, drmModeConnectorPtr koutput,<br>
         int type, const char *name)<br>
@@ -1648,6 +1693,8 @@ drmmode_output_get_modes(xf86OutputPtr output)<br>
         }<br>
         xf86OutputSetEDID(output, mon);<br>
 <br>
+       drmmode_output_attach_tile(output);<br>
+<br>
         /* modes should already be available */<br>
         for (i = 0; i < koutput->count_modes; i++) {<br>
                 Mode = xnfalloc(sizeof(DisplayModeRec));<br>
@@ -1665,8 +1712,11 @@ drmmode_output_destroy(xf86OutputPtr output)<br>
         drmmode_output_private_ptr drmmode_output = output->driver_private;<br>
         int i;<br>
 <br>
-       if (drmmode_output->edid_blob)<br>
-               drmModeFreePropertyBlob(drmmode_output->edid_blob);<br>
+       drmModeFreePropertyBlob(drmmode_output->edid_blob);<br>
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1, 17, 99, 901, 0)<br>
+       drmModeFreePropertyBlob(drmmode_output->tile_blob);<br>
+#endif<br>
+<br>
         for (i = 0; i < drmmode_output->num_props; i++) {<br>
                 drmModeFreeProperty(drmmode_output->props[i].mode_prop);<br>
                 free(drmmode_output->props[i].atoms);<br>
diff --git a/src/drmmode_display.h b/src/drmmode_display.h<br>
index 2c2c3d57f..96eaef0aa 100644<br>
--- a/src/drmmode_display.h<br>
+++ b/src/drmmode_display.h<br>
@@ -142,6 +142,9 @@ typedef struct {<br>
     drmModeConnectorPtr mode_output;<br>
     drmModeEncoderPtr *mode_encoders;<br>
     drmModePropertyBlobPtr edid_blob;<br>
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1, 17, 99, 901, 0)<br>
+    drmModePropertyBlobPtr tile_blob;<br>
+#endif<br>
     int dpms_enum_id;<br>
     int num_props;<br>
     drmmode_prop_ptr props;<br>
-- <br>
2.20.1<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a></div>
</span></font></div>
</body>
</html>