[PATCH 0/3] drm/vmwgfx: Clean- and fix up DMA mode selection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Thomas Hellstrom (VMware) <thomas_os@xxxxxxxxxxxx>

Clean up and fix dma mode selection. We remove an unused mode, a largely
unused module option and finally add a check to enable dma coherent memory
in those cases streaming dma mappings are undesired or won't work.

Note that this series is intended to be applied on top of
git://people.freedesktop.org/~thomash/linux branch vmwgfx-next

meaning that the vmw_dma_select mode function would, after applying the patches
look like

static int vmw_dma_select_mode(struct vmw_private *dev_priv)
{
	static const char *names[vmw_dma_map_max] = {
		[vmw_dma_alloc_coherent] = "Using coherent TTM pages.",
		[vmw_dma_map_populate] = "Caching DMA mappings.",
		[vmw_dma_map_bind] = "Giving up DMA mappings early."};

	/*
	 * dma_max_mapping_size() != SIZE_MAX means something is going
	 * on in the dma layer that the dma_map_bind or dma_map_populate modes
	 * are not working well with, or haven't been tested with.
	 * This typically happens when the SWIOTLB is active. Fall back to
	 * coherent memory in those cases.
	 */
	if (dma_max_mapping_size(dev_priv->dev->dev) != SIZE_MAX ||
	    vmw_force_coherent)
		dev_priv->map_mode = vmw_dma_alloc_coherent;
	else if (vmw_restrict_iommu)
		dev_priv->map_mode = vmw_dma_map_bind;
	else
		dev_priv->map_mode = vmw_dma_map_populate;

        if (!IS_ENABLED(CONFIG_DRM_TTM_DMA_PAGE_POOL) &&
	    (dev_priv->map_mode == vmw_dma_alloc_coherent))
		return -EINVAL;

	DRM_INFO("DMA map mode: %s\n", names[dev_priv->map_mode]);
	return 0;
}

Cc: Christoph Hellwig <hch@xxxxxxxxxxxxx>
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux