[Spice-devel] [PATCH 2/5] drm/ttm: Define a single DRM_FILE_PAGE_OFFSET constant

Thomas Hellstrom thellstrom at vmware.com
Thu Feb 7 19:07:42 UTC 2019


On Thu, 2019-02-07 at 09:59 +0100, Thomas Zimmermann wrote:
> Most TTM drivers define the constant DRM_FILE_PAGE_OFFSET of the same
> value. The only exception is vboxvideo, which is being converted to
> the
> new offset by this patch. Unifying the constants in a single place
> simplifies the driver code.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c     | 2 --
>  drivers/gpu/drm/ast/ast_drv.h               | 2 --
>  drivers/gpu/drm/bochs/bochs.h               | 2 --
>  drivers/gpu/drm/cirrus/cirrus_drv.h         | 1 -
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 2 --
>  drivers/gpu/drm/mgag200/mgag200_drv.h       | 1 -
>  drivers/gpu/drm/nouveau/nouveau_drv.h       | 2 --
>  drivers/gpu/drm/qxl/qxl_drv.h               | 3 ---
>  drivers/gpu/drm/radeon/radeon_ttm.c         | 2 --
>  drivers/gpu/drm/virtio/virtgpu_ttm.c        | 2 --
>  drivers/gpu/drm/vmwgfx/vmwgfx_drv.c         | 2 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_drv.h         | 1 -
>  drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c    | 2 +-
>  drivers/staging/vboxvideo/vbox_drv.h        | 2 --
>  include/drm/ttm/ttm_bo_driver.h             | 2 ++
>  15 files changed, 4 insertions(+), 24 deletions(-)
> 
> 

...

> diff --git a/include/drm/ttm/ttm_bo_driver.h
> b/include/drm/ttm/ttm_bo_driver.h
> index cbf3180cb612..c0bed72492f3 100644
> --- a/include/drm/ttm/ttm_bo_driver.h
> +++ b/include/drm/ttm/ttm_bo_driver.h
> @@ -49,6 +49,8 @@
>  #define TTM_MEMTYPE_FLAG_MAPPABLE      (1 << 1)	/* Memory
> mappable */
>  #define TTM_MEMTYPE_FLAG_CMA           (1 << 3)	/* Can't map
> aperture */
>  
> +#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
> +

IMO strictly, the place in the drm file address space where a driver
chooses to insert the TTM bo address space is to be determined by DRM,
(as also the define indicates) rather than TTM. So I think the right
place for this define is a drm header, not a ttm header.

Thanks,
Thomas


>  struct ttm_mem_type_manager;
>  
>  struct ttm_mem_type_manager_func {


More information about the Spice-devel mailing list