Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751258AbdFFH7P convert rfc822-to-8bit (ORCPT ); Tue, 6 Jun 2017 03:59:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50040 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750755AbdFFH7O (ORCPT ); Tue, 6 Jun 2017 03:59:14 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DDC848123D Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kraxel@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com DDC848123D Message-ID: <1496735950.15129.5.camel@redhat.com> Subject: Re: [PATCH v6 4/6] vfio: Define vfio based vgpu's dma-buf operations From: Gerd Hoffmann To: Kirti Wankhede , Alex Williamson , "Chen, Xiaoguang" Cc: "chris@chris-wilson.co.uk" , "intel-gfx@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" , "zhenyuw@linux.intel.com" , "Lv, Zhiyuan" , "intel-gvt-dev@lists.freedesktop.org" , "Wang, Zhi A" , "Tian, Kevin" Date: Tue, 06 Jun 2017 09:59:10 +0200 In-Reply-To: <3dd898eb-2d4d-18e1-1f82-5a5dcdeb7c9c@nvidia.com> References: <1495874332-2851-1-git-send-email-xiaoguang.chen@intel.com> <1495874332-2851-5-git-send-email-xiaoguang.chen@intel.com> <1496042420.21582.3.camel@redhat.com> <93758f79-8076-9644-a8a7-6e2ebfd91fee@nvidia.com> <20170601103853.5ead4d39@w520.home> <1496392692.16895.1.camel@redhat.com> <3dd898eb-2d4d-18e1-1f82-5a5dcdeb7c9c@nvidia.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Mime-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 06 Jun 2017 07:59:14 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1736 Lines: 47 On Mon, 2017-06-05 at 13:56 +0530, Kirti Wankhede wrote: > > On 6/2/2017 2:08 PM, Gerd Hoffmann wrote: > > > > > struct vfio_vgpu_surface_info { > > >         __u64 start; > > >         __u32 width; > > >         __u32 height; > > >         __u32 stride; > > >         __u32 size; > > >         __u32 x_pos; > > >         __u32 y_pos; > > >         __u32 padding; > > >         /* Only used when VFIO_VGPU_SURFACE_DMABUF_* flags set */ > > >         __u64 drm_format_mod; > > >         __u32 drm_format; > > > > Why for dmabufs only?  Shouldn't the region specify the format > > too?  > > Even in case you are using a fixed one (say > > DRM_FORMAT_XRGB8888) you > > can explicitly say so in drm_format (and set drm_format_mod to > > zero). > > > > Definitions for PIXMAN formats and DRM formats are different. I think > we need a flag to specify the format of surface that vendor driver is > going to provide, PIXMAN or DRM. No need to put that into the ioctl interface. First, the kernel should not worry about what userspace uses to process the data. Second (most) drm formats can trivially be mapped into pixman formats. For example: PIXMAN_x8r8g8b8 (little endian) == DRM_FORMAT_XRGB8888 > If surface is provided through region in PIXMAN format, existing > functions in QEMU can be used to get format from bpp value, > qemu_default_pixman_format(). Similarly, display surface can be > updated > by QEMU using qemu_create_displaysurface_from() from mmaped region. A thin wrapper which accepts a struct vfio_vgpu_surface_info and translates that into a qemu_create_displaysurface_from() call should be pretty small. cheers, Gerd