From owner-freebsd-x11@FreeBSD.ORG Mon Sep 17 12:19:13 2012 Return-Path: Delivered-To: freebsd-x11@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E1E5A1065674; Mon, 17 Sep 2012 12:19:13 +0000 (UTC) (envelope-from meowthink@gmail.com) Received: from tethys.ringofsaturn.com (tethys.ringofsaturn.com [71.252.219.43]) by mx1.freebsd.org (Postfix) with ESMTP id 9499A8FC15; Mon, 17 Sep 2012 12:19:13 +0000 (UTC) Received: from ASSP.nospam (localhost [127.0.0.1]) by tethys.ringofsaturn.com (8.14.5/8.14.5) with ESMTP id q8HCJDwS071215; Mon, 17 Sep 2012 07:19:13 -0500 (CDT) (envelope-from meowthink@gmail.com) X-Assp-Version: 1.9.3.7(1.0.01) on ASSP.nospam X-Assp-Delay: rnejdl@ringofsaturn.com was delayed for 7m 35s; 18 Aug 2012 20:51:48 -0500 X-Assp-Envelope-From: owner-freebsd-emulation@freebsd.org To: X-Assp-ID: ASSP.nospam m-34534-25599 X-Assp-Original-Subject: Re: [CFT]Patch for dri / drm interoperability i386 world / amd64kernel X-Assp-Spam-Reason: rejected by personal blacklist: '*,freebsd-emulation-request@freebsd.org' Received: from mx2.freebsd.org ([69.147.83.53] helo=mx2.freebsd.org) by ASSP.nospam with ESMTP (ASSP 1.9); 18 Aug 2012 20:51:47 -0500 Received: from hub.freebsd.org (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 9D23414F28E; Sun, 19 Aug 2012 01:43:47 +0000 (UTC) Received: from hub.freebsd.org (localhost [127.0.0.1]) by hub.freebsd.org (Postfix) with ESMTP id A835F1065695; Sun, 19 Aug 2012 01:43:46 +0000 (UTC) (envelope-from owner-freebsd-emulation@freebsd.org) Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B434106566B; Sun, 19 Aug 2012 01:43:34 +0000 (UTC) (envelope-from meowthink@gmail.com) Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id E64E18FC0A; Sun, 19 Aug 2012 01:43:33 +0000 (UTC) Received: by obbun3 with SMTP id un3so10175055obb.13 for ; Sat, 18 Aug 2012 18:43:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=kppnjCb3ISk/qNzMbwcdcjj2mD1BKjRT+5GBNMjYCUk=; b=aTeYSDOlEdqe2HfQhI5F6mP3bHiRkfd7s7NNpOUoGuLuPdIW44rBtwuwGWfYacIylh lzBNkGnZBpynMyGj9CG1OzRW7C639JQHx2vHNKInhiyhpOEAeqPSJcPKjVUMUpHnaiwf IjkXA7mnHRLFAPgQhB+GvLZDU6koMIAl8NpOjQelKrd1egsMuk122j98Zs5HW20GrkJi 1lnYXvf5XEW1tpcvGeuG34xpnclzRxftheEalSIh8J5p5L2cplsRZ/mEZlr9nn6g7sQ4 xvDKeLSk6IGuW7/vgg1pjTPJnJFRQuc7SR8012IosWfenn0Q1kM0f8V/AfxQX+v4ET+0 qNpw== MIME-Version: 1.0 Received: by 10.50.56.236 with SMTP id d12mr5962913igq.66.1345340612633; Sat, 18 Aug 2012 18:43:32 -0700 (PDT) Received: by 10.64.51.200 with HTTP; Sat, 18 Aug 2012 18:43:32 -0700 (PDT) In-Reply-To: <20120818190225.GF33100@deviant.kiev.zoral.com.ua> References: <20120818190225.GF33100@deviant.kiev.zoral.com.ua> Message-ID: From: Meowthink Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Sender: owner-freebsd-emulation@freebsd.org Errors-To: owner-freebsd-emulation@freebsd.org Cc: freebsd-x11@freebsd.org, freebsd-emulation@freebsd.org Subject: Re: [CFT]Patch for dri / drm interoperability i386 world / amd64 kernel X-BeenThere: freebsd-x11@freebsd.org List-Id: X11 on FreeBSD -- maintaining and support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Mon, 17 Sep 2012 12:19:14 -0000 X-Original-Date: Sun, 19 Aug 2012 09:43:32 +0800 X-List-Received-Date: Mon, 17 Sep 2012 12:19:14 -0000 On Sun, Aug 19, 2012 at 3:02 AM, Konstantin Belousov wrote: > On Sat, Aug 11, 2012 at 09:25:09AM +0800, Meowthink wrote: >> Hello all, >> >> So long FreeBSD's DRI implementation lacks of i386/amd64 >> interoperability, as discussed [0] [1]. This breaks wine, linuxulator >> etc. drawing using DRI-based OpenGL. >> Paul Mackerras et al. actually did that part for Linux implementation, >> so I simply translated their work to FreeBSD. Due to my poor >> programming skills, there's some limitations: >> 0. I tried to split compatible codes into separate files, like under >> Linux. But as a result of the difference between FreeBSD and Linux, >> the code is integrated in a "#include ...ioc32.c" form which is not >> so elegant. >> 1. For same reason, struct drm_driver_info has to be changed. > I fixed 0 and 1 to my liking and committed the patch. > > Thank you. > >> 2. There should be some assertions if a 64-bit pointer failed to fit >> in a 32-bit space. Linux implementation didn't do this either, but >> they're guaranteed by user-space ioctl structures. This may result >> unstable under heavy load. > I am not sure what do you mean exactly. Can you elaborate, please ? Excuse me for my poor expression. What I mean is, for example, line 177-180 in sys/dev/drm2/drm_ioc32.c reads: handle = map.handle; m32->mtrr = map.mtrr; m32->handle = (unsigned long)handle; drm_map.handle will be a 64-bit pointer under 64-bit mode, so I wonder this needs verification? But Linux version of drm didn't verify: if (__get_user(m32.offset, &map->offset) || __get_user(m32.size, &map->size) || __get_user(m32.type, &map->type) || __get_user(m32.flags, &map->flags) || __get_user(handle, &map->handle) || __get_user(m32.mtrr, &map->mtrr)) return -EFAULT; m32.handle = (unsigned long)handle; if (copy_to_user(argp, &m32, sizeof(m32))) return -EFAULT; In this case, drm_addmap(drm_bufs.c) guarantee the handle always a 32-bit integer, with 0s only in high 32 bits on amd64. But I'm not very sure that all kinds of this pointer operations, esp. those buffer-related address ops can guarantee a 32-bit pointer in all cases. Thanks for your review. Meowthink _______________________________________________ freebsd-emulation@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-emulation To unsubscribe, send any mail to "freebsd-emulation-unsubscribe@freebsd.org"