Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Mar 2015 00:29:39 +0100
From:      Hans Petter Selasky <hps@selasky.org>
To:        "Sam Fourman Jr." <sfourman@gmail.com>,  Alexander Kabaev <kabaev@gmail.com>
Cc:        Konstantin Belousov <kib@FreeBSD.org>, freebsd-x11 <freebsd-x11@freebsd.org>, FreeBSD Current <freebsd-current@freebsd.org>, Ed Maste <emaste@freebsd.org>, =?windows-1252?Q?Jean-S=E9bastien_P=E9dron?= <dumbbell@FreeBSD.org>
Subject:   Re: [Call for testers] DRM device-independent code update to Linux 3.8 (take #2)
Message-ID:  <5510A1E3.9040603@selasky.org>
In-Reply-To: <CAOFF%2BZ3ZDjt4nTcyV%2B9_GZvexsbFBYz84q-J79tcUue9jx6NEQ@mail.gmail.com>
References:  <54F636B3.90701@FreeBSD.org>	<20150307111305.10d7678d@kan> <CAOFF%2BZ3ZDjt4nTcyV%2B9_GZvexsbFBYz84q-J79tcUue9jx6NEQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------020405040306080001000506
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

Without the attached kernel patch(es), Xorg starts consuming alot of CPU 
and becomes very unresponsive and unusable.

Using ktrace reveals that X-org is issuing DRM_IOCTL_MODE_GETCONNECTOR 
over and over again with no apparent reason. It doesn't happen when 
using a simple window manager like blackbox. I was not able to use XFCE4 
(9-stable userland) with 11-current kernel at all, after the latest DRM2 
kernel updates. It worked fine before the update.

I'm not sure what is causing it. Going through the new DRM2 code 
revealed that a mode sorting function did not take all parameters like 
interlaced or not into account, causing the mode list to be reshuffelled 
every time a new mode scan was done. Not sure if Xorg cares about this 
though.

I can test patches if you have other suggestions.

--HPS


--------------020405040306080001000506
Content-Type: text/x-diff;
 name="drm_patches.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="drm_patches.diff"

diff --git a/sys/dev/drm2/drm_crtc.c b/sys/dev/drm2/drm_crtc.c
index 318a764..d368e83 100644
--- a/sys/dev/drm2/drm_crtc.c
+++ b/sys/dev/drm2/drm_crtc.c
@@ -1499,15 +1499,18 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
 		}
 	}
 
-	if (out_resp->count_modes == 0) {
+	list_for_each_entry(mode, &connector->modes, head)
+		mode_count++;
+
+	if (mode_count == 0) {
 		connector->funcs->fill_modes(connector,
 					     dev->mode_config.max_width,
 					     dev->mode_config.max_height);
-	}
 
-	/* delayed so we get modes regardless of pre-fill_modes state */
-	list_for_each_entry(mode, &connector->modes, head)
-		mode_count++;
+		/* delayed so we get modes regardless of pre-fill_modes state */
+		list_for_each_entry(mode, &connector->modes, head)
+			mode_count++;
+	}
 
 	out_resp->connector_id = connector->base.id;
 	out_resp->connector_type = connector->connector_type;
diff --git a/sys/dev/drm2/drm_modes.c b/sys/dev/drm2/drm_modes.c
index 4df8cb1..db06176 100644
--- a/sys/dev/drm2/drm_modes.c
+++ b/sys/dev/drm2/drm_modes.c
@@ -928,6 +928,10 @@ static int drm_mode_compare(void *priv, struct list_head *lh_a, struct list_head
 	if (diff)
 		return diff;
 	diff = b->clock - a->clock;
+	if (diff)
+		return diff;
+	diff = ((b->flags & DRM_MODE_FLAG_INTERLACE) != 0) -
+		((a->flags & DRM_MODE_FLAG_INTERLACE) != 0);
 	return diff;
 }
 

--------------020405040306080001000506--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5510A1E3.9040603>