Skip to contentSkip to conversation

modesetting: Record non-desktop kernel property at PreInit time

PATCH In review Michel Dänzer 3 participants 9 messages Jul 9, 2018 – Jul 16, 2018 5 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 modesetting: Record non-desktop kernel property at PreInit time

From: Keith Packard <[email protected]>

Save any value of the kernel non-desktop property in the xf86Output structure to avoid non-desktop outputs in the default configuration.

[Also bump randrproto requirement to a version that defines RR_PROPERTY_NON_DESKTOP - ajax]

(Ported from xserver commit b91c787c4cd2d20685db69426c539938c556128a)

---
 configure.ac          |  2 +-
 src/drmmode_display.c | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)
configure.ac +1 -1
index 2593f52ca..a475f3713 100644
@@ -64,7 +64,7 @@ AC_ARG_WITH(xorg-module-dir,
             [moduledir="$libdir/xorg/modules"])
 
 # Store the list of server defined optional extensions in REQUIRED_MODULES
-XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
+XORG_DRIVER_CHECK_EXT(RANDR, [randrproto >= 1.6.0])
 XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
 XORG_DRIVER_CHECK_EXT(XV, videoproto)
 XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
src/drmmode_display.c +16 -0
index 9364a885a..ca8a61785 100644
@@ -2595,6 +2595,9 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_r
 	drmModeEncoderPtr *kencoders = NULL;
 	drmmode_output_private_ptr drmmode_output;
 	drmModePropertyBlobPtr path_blob = NULL;
+#if XF86_CRTC_VERSION >= 8
+	Bool nonDesktop = FALSE;
+#endif
 	char name[32];
 	int i;
 	const char *s;
@@ -2607,6 +2610,13 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_r
 
 	path_blob = koutput_get_prop_blob(pAMDGPUEnt->fd, koutput, "PATH");
 
+#if XF86_CRTC_VERSION >= 8
+	i = koutput_get_prop_idx(pAMDGPUEnt->fd, koutput, DRM_MODE_PROP_RANGE,
+				 RR_PROPERTY_NON_DESKTOP);
+	if (i >= 0)
+        	nonDesktop = koutput->prop_values[i] != 0;
+#endif
+
 	kencoders = calloc(sizeof(drmModeEncoderPtr), koutput->count_encoders);
 	if (!kencoders) {
 		goto out_free_encoders;
@@ -2638,6 +2648,9 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_r
 			drmmode_output = output->driver_private;
 			drmmode_output->output_id = mode_res->connectors[num];
 			drmmode_output->mode_output = koutput;
+#if XF86_CRTC_VERSION >= 8
+			output->non_desktop = nonDesktop;
+#endif
 			for (i = 0; i < koutput->count_encoders; i++) {
 				drmModeFreeEncoder(kencoders[i]);
 			}
@@ -2681,6 +2694,9 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_r
 	output->interlaceAllowed = TRUE;
 	output->doubleScanAllowed = TRUE;
 	output->driver_private = drmmode_output;
+#if XF86_CRTC_VERSION >= 8
+	output->non_desktop = nonDesktop;
+#endif
 
 	output->possible_crtcs = 0xffffffff;
 	for (i = 0; i < koutput->count_encoders; i++) {
Signature · 6 lines
2.18.0

_______________________________________________
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): 20180709072652.9727-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org

#2 lore raw

PATCH 2/3 modesetting: Create CONNECTOR_ID properties for outputs [v2]

From: Keith Packard <[email protected]>

This lets a DRM client map between X outputs and kernel connectors.

v2:
Change CONNECTOR_ID to enum -- Adam Jackson <[email protected]>

(Ported from xserver commit 023d4aba8d45e9e3630b944ecfb650c081799b96)

---
 src/drmmode_display.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
src/drmmode_display.c +22 -0
index ca8a61785..031d826af 100644
@@ -2192,6 +2192,28 @@ static void drmmode_output_create_resources(xf86OutputPtr output)
 	AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(output->scrn);
 	drmModePropertyPtr drmmode_prop, tearfree_prop;
 	int i, j, err;
+	Atom name;
+
+	/* Create CONNECTOR_ID property */
+	name = MakeAtom("CONNECTOR_ID", 12, TRUE);
+	if (name != BAD_RESOURCE) {
+		INT32 value = mode_output->connector_id;
+
+		err = RRConfigureOutputProperty(output->randr_output, name,
+						FALSE, FALSE, TRUE, 1, &value);
+		if (err != Success) {
+			xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
+				   "RRConfigureOutputProperty error, %d\n", err);
+		}
+
+		err = RRChangeOutputProperty(output->randr_output, name,
+					     XA_INTEGER, 32, PropModeReplace, 1,
+					     &value, FALSE, FALSE);
+		if (err != Success) {
+			xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
+				   "RRChangeOutputProperty error, %d\n", err);
+		}
+	}
 
 	drmmode_output->props =
 		calloc(mode_output->count_props + 1, sizeof(drmmode_prop_rec));
Signature · 6 lines
2.18.0

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

PATCH 3/3 Add RandR leases support

In reply to a message not in the archive

From: Keith Packard <[email protected]>

(Ported from xserver commit e4e3447603b5fd3a38a92c3f972396d1f81168ad)

---
 configure.ac          |   2 +-
 src/amdgpu_kms.c      |   1 +
 src/drmmode_display.c | 159 +++++++++++++++++++++++++++++++++++++++++-
 src/drmmode_display.h |   6 ++
 4 files changed, 166 insertions(+), 2 deletions(-)
configure.ac +1 -1
index a475f3713..f4633e370 100644
@@ -70,7 +70,7 @@ XORG_DRIVER_CHECK_EXT(XV, videoproto)
 XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
 
 # Checks for libraries.
-PKG_CHECK_MODULES(LIBDRM, [libdrm >= 2.4.78])
+PKG_CHECK_MODULES(LIBDRM, [libdrm >= 2.4.89])
 PKG_CHECK_MODULES(LIBDRM_AMDGPU, [libdrm_amdgpu >= 2.4.76])
 PKG_CHECK_MODULES(GBM, [gbm])
 
src/amdgpu_kms.c +1 -0
index bedd02037..c357ab6b7 100644
@@ -1703,6 +1703,7 @@ static Bool AMDGPUCloseScreen_KMS(ScreenPtr pScreen)
 	/* Clear mask of assigned crtc's in this generation */
 	pAMDGPUEnt->assigned_crtcs = 0;
 
+	drmmode_terminate_leases(pScrn);
 	drmmode_uevent_fini(pScrn, &info->drmmode);
 	amdgpu_drm_queue_close(pScrn);
 
src/drmmode_display.c +158 -1

178 lines not on this page · raw message

src/drmmode_display.h +6 -0
index 0f0227c71..0646752c2 100644
@@ -157,6 +157,10 @@ typedef struct {
 	int tear_free;
 } drmmode_output_private_rec, *drmmode_output_private_ptr;
 
+typedef struct {
+	uint32_t lessee_id;
+} drmmode_lease_private_rec, *drmmode_lease_private_ptr;
+
 
 enum drmmode_flip_sync {
     FLIP_VSYNC,
@@ -241,6 +245,8 @@ PixmapPtr drmmode_crtc_scanout_create(xf86CrtcPtr crtc,
 extern void drmmode_uevent_init(ScrnInfoPtr scrn, drmmode_ptr drmmode);
 extern void drmmode_uevent_fini(ScrnInfoPtr scrn, drmmode_ptr drmmode);
 
+extern void drmmode_terminate_leases(ScrnInfoPtr scrn);
+
 Bool drmmode_set_mode(xf86CrtcPtr crtc, struct drmmode_fb *fb,
 		      DisplayModePtr mode, int x, int y);
 
Signature · 6 lines
2.18.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by
#4 lore raw
In reply to a message not in the archive
Quoted 11 lines · Michel Dänzer

From: Keith Packard <[email protected]>

Save any value of the kernel non-desktop property in the xf86Output structure to avoid non-desktop outputs in the default configuration.

[Also bump randrproto requirement to a version that defines RR_PROPERTY_NON_DESKTOP - ajax]

(Ported from xserver commit b91c787c4cd2d20685db69426c539938c556128a)

Thanks for porting this and making it compile on older server versions; I notice that you switched from xallocarray to calloc -- seems fine to me as it avoids some extra configure.ac goop.

For the series:

Signature · 1 line
-keith

_______________________________________________
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): [email protected]

#6 lore raw
Quoted 10 lines · Keith Packard
Quoted 8 lines · Michel Dänzer

From: Keith Packard <[email protected]>

Save any value of the kernel non-desktop property in the xf86Output structure to avoid non-desktop outputs in the default configuration.

[Also bump randrproto requirement to a version that defines RR_PROPERTY_NON_DESKTOP - ajax]

Quoted 7 lines
Quoted 3 lines

(Ported from xserver commit b91c787c4cd2d20685db69426c539938c556128a)

Thanks for porting this and making it compile on older server versions; I notice that you switched from xallocarray to calloc -- seems fine to me as it avoids some extra configure.ac goop.

Yep, didn't see the point of that, as ncrtc + noutput needs to be explicitly checked for overflow anyway.

Quoted 2 lines

For the series:

Thanks!

Signature · 2 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer

_______________________________________________
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): af4f8c39-0936-dc48-ad67-96b108463619-otUistvHUpPR7s880joybQ@public.gmane.org

#8 lore raw

Hi Michel,

Could randrproto >= 1.6.0 also be optional? randrproto 1.6 is pretty new so most old xserver doesn't compile with it. When compile latest ddx with various OS we support, it will fail.

Maybe we can define RR_PROPERTY_NON_DESKTOP in ddx if not yet.

Regards,
Qiang

________________________________________
From: amd-gfx <[email protected]> on behalf of Michel Dänzer <[email protected]>
Sent: Tuesday, July 10, 2018 12:20:46 AM
To: Keith Packard
Cc: [email protected]
Subject: Re: [PATCH xf86-video-amdgpu 1/3] modesetting: Record non-desktop kernel property at PreInit time

Quoted 10 lines · Keith Packard
Quoted 8 lines · Michel Dänzer

From: Keith Packard <[email protected]>

Save any value of the kernel non-desktop property in the xf86Output structure to avoid non-desktop outputs in the default configuration.

[Also bump randrproto requirement to a version that defines RR_PROPERTY_NON_DESKTOP - ajax]

Quoted 7 lines
Quoted 3 lines

(Ported from xserver commit b91c787c4cd2d20685db69426c539938c556128a)

Thanks for porting this and making it compile on older server versions; I notice that you switched from xallocarray to calloc -- seems fine to me as it avoids some extra configure.ac goop.

Yep, didn't see the point of that, as ncrtc + noutput needs to be explicitly checked for overflow anyway.

Quoted 2 lines

For the series:

Thanks!

--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer

_______________________________________________
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): CY4PR1201MB0117859F55CBFAFE76E560EF8F580-1iTaO6aE1DAP/tBwSbHU42rFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/[email protected]

#10 lore raw

PATCH 1/1 Hardcode "non-desktop" RandR property name

From: Michel Dänzer <[email protected]>

It's a bit silly to require current randrproto just for this definition, which can't really change anyway.

---
 configure.ac          | 2 +-
 src/drmmode_display.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
configure.ac +1 -1
index f4633e370..1ab5a7ae2 100644
@@ -64,7 +64,7 @@ AC_ARG_WITH(xorg-module-dir,
             [moduledir="$libdir/xorg/modules"])
 
 # Store the list of server defined optional extensions in REQUIRED_MODULES
-XORG_DRIVER_CHECK_EXT(RANDR, [randrproto >= 1.6.0])
+XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
 XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
 XORG_DRIVER_CHECK_EXT(XV, videoproto)
 XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
src/drmmode_display.c +1 -1
index f6cafccdc..ccf333662 100644
@@ -2634,7 +2634,7 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_r
 
 #if XF86_CRTC_VERSION >= 8
 	i = koutput_get_prop_idx(pAMDGPUEnt->fd, koutput, DRM_MODE_PROP_RANGE,
-				 RR_PROPERTY_NON_DESKTOP);
+				 "non-desktop");
 	if (i >= 0)
         	nonDesktop = koutput->prop_values[i] != 0;
 #endif
Signature · 6 lines
2.18.0

_______________________________________________
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): 20180713084151.6200-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org

Reviewed-by Qiang Yu
#12 lore raw

Re: [PATCH xf86-video-amdgpu] Hardcode "non-desktop" RandR property name

Thanks, looks good for me.

Regards,
Qiang

________________________________________
From: amd-gfx <[email protected]> on behalf of Michel Dänzer <[email protected]>
Sent: Friday, July 13, 2018 4:41:51 PM
To: [email protected]
Subject: [PATCH xf86-video-amdgpu] Hardcode "non-desktop" RandR property name

From: Michel Dänzer <[email protected]>

It's a bit silly to require current randrproto just for this definition, which can't really change anyway.

---
 configure.ac          | 2 +-
 src/drmmode_display.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
configure.ac +1 -1
index f4633e370..1ab5a7ae2 100644
@@ -64,7 +64,7 @@ AC_ARG_WITH(xorg-module-dir,
             [moduledir="$libdir/xorg/modules"])
 
 # Store the list of server defined optional extensions in REQUIRED_MODULES
-XORG_DRIVER_CHECK_EXT(RANDR, [randrproto >= 1.6.0])
+XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
 XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
 XORG_DRIVER_CHECK_EXT(XV, videoproto)
 XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
src/drmmode_display.c +1 -1
index f6cafccdc..ccf333662 100644
@@ -2634,7 +2634,7 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_r
 
 #if XF86_CRTC_VERSION >= 8
        i = koutput_get_prop_idx(pAMDGPUEnt->fd, koutput, DRM_MODE_PROP_RANGE,
-                                RR_PROPERTY_NON_DESKTOP);
+                                "non-desktop");
        if (i >= 0)
                nonDesktop = koutput->prop_values[i] != 0;
 #endif

--
2.18.0

_______________________________________________
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

#13 lore raw
In reply to a message not in the archive
Quoted 7 lines · Qiang

Hi Michel,

Could randrproto >= 1.6.0 also be optional? randrproto 1.6 is pretty new so most old xserver doesn't compile with it. When compile latest ddx with various OS we support, it will fail.

Maybe we can define RR_PROPERTY_NON_DESKTOP in ddx if not yet.

Yeah, please review https://patchwork.freedesktop.org/patch/238250/ .

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx