From patchwork Fri Mar 7 13:13:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 3791271 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 187659F35F for ; Fri, 7 Mar 2014 13:13:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 44D6720295 for ; Fri, 7 Mar 2014 13:13:49 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 7488120163 for ; Fri, 7 Mar 2014 13:13:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3DE4DFB3B0; Fri, 7 Mar 2014 05:13:47 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by gabe.freedesktop.org (Postfix) with ESMTP id 7C01FFB3B0 for ; Fri, 7 Mar 2014 05:13:42 -0800 (PST) Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s27DDffC023582 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 7 Mar 2014 08:13:42 -0500 Received: from shalem.localdomain.com (vpn1-5-248.ams2.redhat.com [10.36.5.248]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s27DDdkF029081; Fri, 7 Mar 2014 08:13:40 -0500 From: Hans de Goede To: intel-gfx@lists.freedesktop.org Date: Fri, 7 Mar 2014 14:13:38 +0100 Message-Id: <1394198018-19616-2-git-send-email-hdegoede@redhat.com> In-Reply-To: <1394198018-19616-1-git-send-email-hdegoede@redhat.com> References: <1394198018-19616-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 Cc: peter.hutterer@redhat.com Subject: [Intel-gfx] [PATCH] intel: Add support for server managed fds X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 (fd == -1) goto err_path; @@ -298,7 +291,7 @@ int intel_open_device(int entity_num, dev->fd = fd; dev->open_count = 0; - dev->master_count = 0; + dev->master_count = init_master_count; dev->master_node = local_path; dev->render_node = find_render_node(fd); if (dev->render_node == NULL) diff --git a/src/intel_module.c b/src/intel_module.c index 51de62a..02062d1 100644 --- a/src/intel_module.c +++ b/src/intel_module.c @@ -419,6 +419,10 @@ static Bool intel_driver_func(ScrnInfoPtr pScrn, #endif return TRUE; +#if XORG_VERSION_CURRENT > XORG_VERSION_NUMERIC(1,15,99,0,0) + case SUPPORTS_SERVER_FDS: + return TRUE; +#endif default: /* Unknown or deprecated function */ return FALSE;