From: Ilija Hadzic Subject: Re: vblank problem (and proposed fix) on crtc > 1 Date: Thu, 10 Mar 2011 07:32:49 -0600 (CST) Message-ID: References: <1299251679.14068.83.camel@thor.local> <1299760304.5726.94.camel@thor.local> Mime-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="-559023410-758783491-1299763969=:23088" Return-path: Received: from ihemail3.lucent.com (ihemail3.lucent.com [135.245.0.37]) by gabe.freedesktop.org (Postfix) with ESMTP id 1AFDC9E7D7 for ; Thu, 10 Mar 2011 05:43:32 -0800 (PST) In-Reply-To: <1299760304.5726.94.camel@thor.local> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: Michel =?ISO-8859-1?Q?D=E4nzer?= Cc: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---559023410-758783491-1299763969=:23088 Content-Type: TEXT/PLAIN; charset=UTF-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Thu, 10 Mar 2011, Michel [ISO-8859-1] D=E4nzer wrote: > > I'm afraid I don't really like this. Apart from the ugly bogus error > message, the probes could fail for other reasons, e.g. at some point we > might want to return an error when the ioctl is called for a CRTC which > is currently disabled, to avoid the hang you were getting for CRTC 1. > Your example actually speaks in favor of probing. Let's say that the=20 future kernel starts returning an error for disabled CRTC and you don't do= =20 any probing. DDX will start calling vblank waits on disabled CRTC (just=20 like it's doing now) and spam the kernel with errors. With probing, error= =20 will happen only once at screen init time. > Dave's drm-next tree actually has a new DRM_IOCTL_GET_CAP ioctl, which > could be used for detecting this capability. It might even be possible > to handle old kernels transparently in drmWaitVBlank(), but I'm not sure > offhand if that would be better overall than doing it in the driver > code. > This argument is self defeating. The purpose of the probing is to check=20 for the old kernel. If I have DRM_IOCTL_GET_CAP, that means that I have a= =20 new kernel so probing will just work. If I have an old kernel then I don't= =20 have DRM_IOCTL_GET_CAP ioctl, so attemting to use it will result in an=20 error from the kernel anyway. It makes no sense to me to cause an error=20 in one ioctl so that you would prevent an error in other ioctl. >> + if (info->high_crtc_works) { >> + high_crtc =3D (crtc << DRM_VBLANK_HIGH_CRTC_SHIFT) & >> + DRM_VBLANK_HIGH_CRTC_MASK; >> + } else vbl.request.type |=3D DRM_VBLANK_SECONDARY; > > Waiting on a random other CRTC makes no sense. If you know you can't > wait on the given CRTC, don't wait at all. > It's not random CRTC, but it's what today's DDX and DRM call "secondary"=20 CRTC. I intentionally did this for two reasons. First, this is the=20 behavior that is identical to what we see today, and I prefer to preserve= =20 the same behavior if either component is old (DDX or kernel), rather than= =20 have different behavior for different combinations of old/new. The second= =20 reason is pragmatic, if you want to not call wait_vblank at all and make=20 sure you are safe to whatever the code above you is doing and not=20 return an error you have to make up the sequence numbers and timestamps (and probably keep track of them) and that's much more radical=20 modification to the DDX. So I figured this would be conservative. >> + vbl.request.sequence =3D 0; >> + if (drmWaitVBlank(info->dri2.drm_fd, &vbl)) { >> + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Kernel rejects = VBLANK request on CRTC %d\n", c); >> + info->high_crtc_works =3D FALSE; > > Should break out of the for loop at this point. > This was also intentional. I want to see in Xorg log file the full list of= =20 crtcs that rejected the vblank wait request. It comes handy for analyzing= =20 the problems and/or bugs. ---559023410-758783491-1299763969=:23088 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel ---559023410-758783491-1299763969=:23088--