From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hans de Goede Subject: Re: [PATCH] intel: Add support for server managed fds Date: Fri, 07 Mar 2014 19:18:29 +0100 Message-ID: <531A0D75.2050807@redhat.com> References: <1394198018-19616-1-git-send-email-hdegoede@redhat.com> <1394198018-19616-2-git-send-email-hdegoede@redhat.com> <20140307131804.GA20302@nuc-i3427.alporthouse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by gabe.freedesktop.org (Postfix) with ESMTP id 1A1F1FB5AF for ; Fri, 7 Mar 2014 10:18:34 -0800 (PST) In-Reply-To: <20140307131804.GA20302@nuc-i3427.alporthouse.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org To: Chris Wilson , intel-gfx@lists.freedesktop.org, peter.hutterer@redhat.com List-Id: intel-gfx@lists.freedesktop.org Hi, On 03/07/2014 02:18 PM, Chris Wilson wrote: > On Fri, Mar 07, 2014 at 02:13:38PM +0100, Hans de Goede wrote: >> Signed-off-by: Hans de Goede >> --- >> src/intel_device.c | 19 ++++++------------- >> src/intel_module.c | 4 ++++ >> 2 files changed, 10 insertions(+), 13 deletions(-) >> >> diff --git a/src/intel_device.c b/src/intel_device.c >> index d0c8092..b19884c 100644 >> --- a/src/intel_device.c >> +++ b/src/intel_device.c >> @@ -240,19 +240,10 @@ static char *get_path(struct xf86_platform_device *dev) >> #endif >> >> >> -#if defined(ODEV_ATTRIB_FD) && 0 >> +#if defined(ODEV_ATTRIB_FD) >> static int get_fd(struct xf86_platform_device *dev) >> { >> - const char *str; >> - >> - if (dev == NULL) >> - return -1; >> - >> - str = xf86_get_platform_device_attrib(dev, ODEV_ATTRIB_FD); >> - if (str == NULL) >> - return -1; >> - >> - return atoi(str); >> + return xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_FD, -1); >> } >> >> #else >> @@ -270,7 +261,7 @@ int intel_open_device(int entity_num, >> { >> struct intel_device *dev; >> char *local_path; >> - int fd; >> + int fd, init_master_count = 0; >> >> if (intel_device_key == -1) >> intel_device_key = xf86AllocateEntityPrivateIndex(); >> @@ -286,6 +277,8 @@ int intel_open_device(int entity_num, >> fd = get_fd(platform); >> if (fd == -1) >> fd = __intel_open_device(pci, &local_path); >> + else >> + init_master_count = 1; /* Server fd is already master */ > > If we set master_count to non-zero, we won't ever call drmDropMaster > (since our get/put will be unbalanced). Does the server manage > DRM_MASTER across VT switches for this fd? Yes (*), so the never calling drmDropMaster is the intention. Regards, Hans *) Well actually this is done by systemd-logind since it requires root rights, but from the driver POV the server takes care of it. If we IE get server managed fds on one of the BSD-s, it will no longer be done by systemd-logind of course, but all that driver really needs to know is that the server takes care of this one way or the other.