dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig-5C7GfCeVMHo@public.gmane.org>
To: Sinclair Yeh <syeh-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
Cc: Thomas Hellstrom
	<thellstrom-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>,
	Roger He <Hongbo.He-5C7GfCeVMHo@public.gmane.org>,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 2/7] drm/ttm: use an operation ctx for ttm_mem_global_alloc
Date: Thu, 25 Jan 2018 09:31:54 +0100	[thread overview]
Message-ID: <9716c43f-6bc2-70f0-c166-442121dcf60f@amd.com> (raw)
In-Reply-To: <20180124232346.GA59165-WSU1YMatGzO44ywRPIzf9A@public.gmane.org>

Unfortunately the patches are already comitted (with a better commit 
message IIRC).

But the variable name sounds just like a style nit pick to me we can fix 
in a separate patch as well.

Thanks,
Christian.

Am 25.01.2018 um 00:24 schrieb Sinclair Yeh:
> Hi,
>
> Sorry, I've been on a leave.  Catching up on emails.
>
> In case this is still not yet merged, my comment is
> be consist with the new variable name.  In some cases
> it's "ttm_opt_ctx", in others it's "ctx".
>
> I prefer ttm_opt_ctx because it's more descriptive.
>
> And yes, some description on why this change is necessary in the
> commit message is nice, too.
>
> Sinclair
>
> On Wed, Dec 20, 2017 at 02:33:37PM +0100, Christian König wrote:
>> Commit message needed! Something like:
>>
>> Forward the operation context to ttm_mem_global_alloc as well.
>>
>> Am 20.12.2017 um 11:34 schrieb Roger He:
>>> Change-Id: I5279b5cd3560c4082b00f822219575a5f9c3808a
>>> Signed-off-by: Roger He <Hongbo.He@amd.com>
>> With the commit message fixed, patch is Reviewed-by: Christian König
>> <christian.koenig@amd.com>.
>>
>> I would like to get an rb or ab from Thomas and/or Sinclair as well, since
>> this is touching a lot of vmwgfx code.
>>
>> Regards,
>> Christian.
>>
>>> ---
>>>    drivers/gpu/drm/ttm/ttm_bo.c                    |  2 +-
>>>    drivers/gpu/drm/ttm/ttm_memory.c                | 15 +++++++++------
>>>    drivers/gpu/drm/ttm/ttm_object.c                | 13 ++++++++++---
>>>    drivers/gpu/drm/vmwgfx/vmwgfx_binding.c         |  6 +++++-
>>>    drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c          | 13 ++++++++++---
>>>    drivers/gpu/drm/vmwgfx/vmwgfx_context.c         |  6 +++++-
>>>    drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c         |  6 +++++-
>>>    drivers/gpu/drm/vmwgfx/vmwgfx_fence.c           |  6 +++++-
>>>    drivers/gpu/drm/vmwgfx/vmwgfx_shader.c          | 18 +++++++++++++++---
>>>    drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c |  6 +++++-
>>>    drivers/gpu/drm/vmwgfx/vmwgfx_so.c              |  6 +++++-
>>>    drivers/gpu/drm/vmwgfx/vmwgfx_surface.c         | 12 ++++++++++--
>>>    include/drm/ttm/ttm_memory.h                    |  3 ++-
>>>    13 files changed, 87 insertions(+), 25 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
>>> index fa57aa8..c59f572 100644
>>> --- a/drivers/gpu/drm/ttm/ttm_bo.c
>>> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
>>> @@ -1133,7 +1133,7 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
>>>    	struct ttm_mem_global *mem_glob = bdev->glob->mem_glob;
>>>    	bool locked;
>>> -	ret = ttm_mem_global_alloc(mem_glob, acc_size, false, false);
>>> +	ret = ttm_mem_global_alloc(mem_glob, acc_size, ctx);
>>>    	if (ret) {
>>>    		pr_err("Out of kernel memory\n");
>>>    		if (destroy)
>>> diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_memory.c
>>> index 9130bdf..525d3b6 100644
>>> --- a/drivers/gpu/drm/ttm/ttm_memory.c
>>> +++ b/drivers/gpu/drm/ttm/ttm_memory.c
>>> @@ -508,7 +508,7 @@ static int ttm_mem_global_reserve(struct ttm_mem_global *glob,
>>>    static int ttm_mem_global_alloc_zone(struct ttm_mem_global *glob,
>>>    				     struct ttm_mem_zone *single_zone,
>>>    				     uint64_t memory,
>>> -				     bool no_wait, bool interruptible)
>>> +				     struct ttm_operation_ctx *ctx)
>>>    {
>>>    	int count = TTM_MEMORY_ALLOC_RETRIES;
>>> @@ -516,7 +516,7 @@ static int ttm_mem_global_alloc_zone(struct ttm_mem_global *glob,
>>>    					       single_zone,
>>>    					       memory, true)
>>>    			!= 0)) {
>>> -		if (no_wait)
>>> +		if (ctx->no_wait_gpu)
>>>    			return -ENOMEM;
>>>    		if (unlikely(count-- == 0))
>>>    			return -ENOMEM;
>>> @@ -527,15 +527,14 @@ static int ttm_mem_global_alloc_zone(struct ttm_mem_global *glob,
>>>    }
>>>    int ttm_mem_global_alloc(struct ttm_mem_global *glob, uint64_t memory,
>>> -			 bool no_wait, bool interruptible)
>>> +			 struct ttm_operation_ctx *ctx)
>>>    {
>>>    	/**
>>>    	 * Normal allocations of kernel memory are registered in
>>>    	 * all zones.
>>>    	 */
>>> -	return ttm_mem_global_alloc_zone(glob, NULL, memory, no_wait,
>>> -					 interruptible);
>>> +	return ttm_mem_global_alloc_zone(glob, NULL, memory, ctx);
>>>    }
>>>    EXPORT_SYMBOL(ttm_mem_global_alloc);
>>> @@ -544,6 +543,10 @@ int ttm_mem_global_alloc_page(struct ttm_mem_global *glob,
>>>    {
>>>    	struct ttm_mem_zone *zone = NULL;
>>> +	struct ttm_operation_ctx ctx = {
>>> +		.interruptible = false,
>>> +		.no_wait_gpu = false
>>> +	};
>>>    	/**
>>>    	 * Page allocations may be registed in a single zone
>>> @@ -557,7 +560,7 @@ int ttm_mem_global_alloc_page(struct ttm_mem_global *glob,
>>>    	if (glob->zone_dma32 && page_to_pfn(page) > 0x00100000UL)
>>>    		zone = glob->zone_kernel;
>>>    #endif
>>> -	return ttm_mem_global_alloc_zone(glob, zone, size, false, false);
>>> +	return ttm_mem_global_alloc_zone(glob, zone, size, &ctx);
>>>    }
>>>    void ttm_mem_global_free_page(struct ttm_mem_global *glob, struct page *page,
>>> diff --git a/drivers/gpu/drm/ttm/ttm_object.c b/drivers/gpu/drm/ttm/ttm_object.c
>>> index 26a7ad0..1aa2baa 100644
>>> --- a/drivers/gpu/drm/ttm/ttm_object.c
>>> +++ b/drivers/gpu/drm/ttm/ttm_object.c
>>> @@ -325,6 +325,10 @@ int ttm_ref_object_add(struct ttm_object_file *tfile,
>>>    	struct ttm_ref_object *ref;
>>>    	struct drm_hash_item *hash;
>>>    	struct ttm_mem_global *mem_glob = tfile->tdev->mem_glob;
>>> +	struct ttm_operation_ctx ctx = {
>>> +		.interruptible = false,
>>> +		.no_wait_gpu = false
>>> +	};
>>>    	int ret = -EINVAL;
>>>    	if (base->tfile != tfile && !base->shareable)
>>> @@ -350,7 +354,7 @@ int ttm_ref_object_add(struct ttm_object_file *tfile,
>>>    			return -EPERM;
>>>    		ret = ttm_mem_global_alloc(mem_glob, sizeof(*ref),
>>> -					   false, false);
>>> +					   &ctx);
>>>    		if (unlikely(ret != 0))
>>>    			return ret;
>>>    		ref = kmalloc(sizeof(*ref), GFP_KERNEL);
>>> @@ -686,7 +690,10 @@ int ttm_prime_handle_to_fd(struct ttm_object_file *tfile,
>>>    	dma_buf = prime->dma_buf;
>>>    	if (!dma_buf || !get_dma_buf_unless_doomed(dma_buf)) {
>>>    		DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
>>> -
>>> +		struct ttm_operation_ctx ctx = {
>>> +			.interruptible = true,
>>> +			.no_wait_gpu = false
>>> +		};
>>>    		exp_info.ops = &tdev->ops;
>>>    		exp_info.size = prime->size;
>>>    		exp_info.flags = flags;
>>> @@ -696,7 +703,7 @@ int ttm_prime_handle_to_fd(struct ttm_object_file *tfile,
>>>    		 * Need to create a new dma_buf, with memory accounting.
>>>    		 */
>>>    		ret = ttm_mem_global_alloc(tdev->mem_glob, tdev->dma_buf_size,
>>> -					   false, true);
>>> +					   &ctx);
>>>    		if (unlikely(ret != 0)) {
>>>    			mutex_unlock(&prime->mutex);
>>>    			goto out_unref;
>>> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_binding.c b/drivers/gpu/drm/vmwgfx/vmwgfx_binding.c
>>> index 9c42e96..55d32ae 100644
>>> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_binding.c
>>> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_binding.c
>>> @@ -1202,10 +1202,14 @@ struct vmw_ctx_binding_state *
>>>    vmw_binding_state_alloc(struct vmw_private *dev_priv)
>>>    {
>>>    	struct vmw_ctx_binding_state *cbs;
>>> +	struct ttm_operation_ctx ctx = {
>>> +		.interruptible = false,
>>> +		.no_wait_gpu = false
>>> +	};
>>>    	int ret;
>>>    	ret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv), sizeof(*cbs),
>>> -				   false, false);
>>> +				&ctx);
>>>    	if (ret)
>>>    		return ERR_PTR(ret);
>>> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c b/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c
>>> index c705632..ef97542 100644
>>> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c
>>> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c
>>> @@ -394,6 +394,10 @@ static int vmw_ttm_map_dma(struct vmw_ttm_tt *vmw_tt)
>>>    	struct vmw_private *dev_priv = vmw_tt->dev_priv;
>>>    	struct ttm_mem_global *glob = vmw_mem_glob(dev_priv);
>>>    	struct vmw_sg_table *vsgt = &vmw_tt->vsgt;
>>> +	struct ttm_operation_ctx ctx = {
>>> +		.interruptible = true,
>>> +		.no_wait_gpu = false
>>> +	};
>>>    	struct vmw_piter iter;
>>>    	dma_addr_t old;
>>>    	int ret = 0;
>>> @@ -417,8 +421,7 @@ static int vmw_ttm_map_dma(struct vmw_ttm_tt *vmw_tt)
>>>    			sgt_size = ttm_round_pot(sizeof(struct sg_table));
>>>    		}
>>>    		vmw_tt->sg_alloc_size = sgt_size + sgl_size * vsgt->num_pages;
>>> -		ret = ttm_mem_global_alloc(glob, vmw_tt->sg_alloc_size, false,
>>> -					   true);
>>> +		ret = ttm_mem_global_alloc(glob, vmw_tt->sg_alloc_size, &ctx);
>>>    		if (unlikely(ret != 0))
>>>    			return ret;
>>> @@ -638,6 +641,10 @@ static int vmw_ttm_populate(struct ttm_tt *ttm)
>>>    		container_of(ttm, struct vmw_ttm_tt, dma_ttm.ttm);
>>>    	struct vmw_private *dev_priv = vmw_tt->dev_priv;
>>>    	struct ttm_mem_global *glob = vmw_mem_glob(dev_priv);
>>> +	struct ttm_operation_ctx ctx = {
>>> +		.interruptible = true,
>>> +		.no_wait_gpu = false
>>> +	};
>>>    	int ret;
>>>    	if (ttm->state != tt_unpopulated)
>>> @@ -646,7 +653,7 @@ static int vmw_ttm_populate(struct ttm_tt *ttm)
>>>    	if (dev_priv->map_mode == vmw_dma_alloc_coherent) {
>>>    		size_t size =
>>>    			ttm_round_pot(ttm->num_pages * sizeof(dma_addr_t));
>>> -		ret = ttm_mem_global_alloc(glob, size, false, true);
>>> +		ret = ttm_mem_global_alloc(glob, size, &ctx);
>>>    		if (unlikely(ret != 0))
>>>    			return ret;
>>> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
>>> index 4212b3e..3767ac3 100644
>>> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
>>> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
>>> @@ -746,6 +746,10 @@ static int vmw_context_define(struct drm_device *dev, void *data,
>>>    	struct vmw_resource *tmp;
>>>    	struct drm_vmw_context_arg *arg = (struct drm_vmw_context_arg *)data;
>>>    	struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
>>> +	struct ttm_operation_ctx ttm_opt_ctx = {
>>> +		.interruptible = true,
>>> +		.no_wait_gpu = false
>>> +	};
>>>    	int ret;
>>>    	if (!dev_priv->has_dx && dx) {
>>> @@ -768,7 +772,7 @@ static int vmw_context_define(struct drm_device *dev, void *data,
>>>    	ret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv),
>>>    				   vmw_user_context_size,
>>> -				   false, true);
>>> +				   &ttm_opt_ctx);
>>>    	if (unlikely(ret != 0)) {
>>>    		if (ret != -ERESTARTSYS)
>>>    			DRM_ERROR("Out of graphics memory for context"
>>> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c b/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
>>> index 92df0b0..cbf54ea 100644
>>> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
>>> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
>>> @@ -573,6 +573,10 @@ struct vmw_resource *vmw_cotable_alloc(struct vmw_private *dev_priv,
>>>    				       u32 type)
>>>    {
>>>    	struct vmw_cotable *vcotbl;
>>> +	struct ttm_operation_ctx ttm_opt_ctx = {
>>> +		.interruptible = true,
>>> +		.no_wait_gpu = false
>>> +	};
>>>    	int ret;
>>>    	u32 num_entries;
>>> @@ -580,7 +584,7 @@ struct vmw_resource *vmw_cotable_alloc(struct vmw_private *dev_priv,
>>>    		cotable_acc_size = ttm_round_pot(sizeof(struct vmw_cotable));
>>>    	ret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv),
>>> -				   cotable_acc_size, false, true);
>>> +				   cotable_acc_size, &ttm_opt_ctx);
>>>    	if (unlikely(ret))
>>>    		return ERR_PTR(ret);
>>> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
>>> index d6b1c50..6c5c75c 100644
>>> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
>>> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
>>> @@ -588,6 +588,10 @@ int vmw_user_fence_create(struct drm_file *file_priv,
>>>    	struct vmw_user_fence *ufence;
>>>    	struct vmw_fence_obj *tmp;
>>>    	struct ttm_mem_global *mem_glob = vmw_mem_glob(fman->dev_priv);
>>> +	struct ttm_operation_ctx ctx = {
>>> +		.interruptible = false,
>>> +		.no_wait_gpu = false
>>> +	};
>>>    	int ret;
>>>    	/*
>>> @@ -596,7 +600,7 @@ int vmw_user_fence_create(struct drm_file *file_priv,
>>>    	 */
>>>    	ret = ttm_mem_global_alloc(mem_glob, fman->user_fence_size,
>>> -				   false, false);
>>> +				   &ctx);
>>>    	if (unlikely(ret != 0))
>>>    		return ret;
>>> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
>>> index 004e18b..73b8e9a 100644
>>> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
>>> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
>>> @@ -607,6 +607,10 @@ int vmw_dx_shader_add(struct vmw_cmdbuf_res_manager *man,
>>>    	struct vmw_dx_shader *shader;
>>>    	struct vmw_resource *res;
>>>    	struct vmw_private *dev_priv = ctx->dev_priv;
>>> +	struct ttm_operation_ctx ttm_opt_ctx = {
>>> +		.interruptible = true,
>>> +		.no_wait_gpu = false
>>> +	};
>>>    	int ret;
>>>    	if (!vmw_shader_dx_size)
>>> @@ -616,7 +620,7 @@ int vmw_dx_shader_add(struct vmw_cmdbuf_res_manager *man,
>>>    		return -EINVAL;
>>>    	ret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv), vmw_shader_dx_size,
>>> -				   false, true);
>>> +				   &ttm_opt_ctx);
>>>    	if (ret) {
>>>    		if (ret != -ERESTARTSYS)
>>>    			DRM_ERROR("Out of graphics memory for shader "
>>> @@ -730,6 +734,10 @@ static int vmw_user_shader_alloc(struct vmw_private *dev_priv,
>>>    {
>>>    	struct vmw_user_shader *ushader;
>>>    	struct vmw_resource *res, *tmp;
>>> +	struct ttm_operation_ctx ctx = {
>>> +		.interruptible = true,
>>> +		.no_wait_gpu = false
>>> +	};
>>>    	int ret;
>>>    	/*
>>> @@ -742,7 +750,7 @@ static int vmw_user_shader_alloc(struct vmw_private *dev_priv,
>>>    	ret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv),
>>>    				   vmw_user_shader_size,
>>> -				   false, true);
>>> +				   &ctx);
>>>    	if (unlikely(ret != 0)) {
>>>    		if (ret != -ERESTARTSYS)
>>>    			DRM_ERROR("Out of graphics memory for shader "
>>> @@ -800,6 +808,10 @@ static struct vmw_resource *vmw_shader_alloc(struct vmw_private *dev_priv,
>>>    {
>>>    	struct vmw_shader *shader;
>>>    	struct vmw_resource *res;
>>> +	struct ttm_operation_ctx ctx = {
>>> +		.interruptible = true,
>>> +		.no_wait_gpu = false
>>> +	};
>>>    	int ret;
>>>    	/*
>>> @@ -812,7 +824,7 @@ static struct vmw_resource *vmw_shader_alloc(struct vmw_private *dev_priv,
>>>    	ret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv),
>>>    				   vmw_shader_size,
>>> -				   false, true);
>>> +				   &ctx);
>>>    	if (unlikely(ret != 0)) {
>>>    		if (ret != -ERESTARTSYS)
>>>    			DRM_ERROR("Out of graphics memory for shader "
>>> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c
>>> index 051d3b3..a0cb310 100644
>>> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c
>>> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c
>>> @@ -149,6 +149,10 @@ vmw_simple_resource_create_ioctl(struct drm_device *dev, void *data,
>>>    	struct vmw_resource *res;
>>>    	struct vmw_resource *tmp;
>>>    	struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
>>> +	struct ttm_operation_ctx ctx = {
>>> +		.interruptible = true,
>>> +		.no_wait_gpu = false
>>> +	};
>>>    	size_t alloc_size;
>>>    	size_t account_size;
>>>    	int ret;
>>> @@ -162,7 +166,7 @@ vmw_simple_resource_create_ioctl(struct drm_device *dev, void *data,
>>>    		return ret;
>>>    	ret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv), account_size,
>>> -				   false, true);
>>> +				   &ctx);
>>>    	ttm_read_unlock(&dev_priv->reservation_sem);
>>>    	if (ret) {
>>>    		if (ret != -ERESTARTSYS)
>>> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_so.c b/drivers/gpu/drm/vmwgfx/vmwgfx_so.c
>>> index 5a73eeb..d3573c3 100644
>>> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_so.c
>>> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_so.c
>>> @@ -329,6 +329,10 @@ int vmw_view_add(struct vmw_cmdbuf_res_manager *man,
>>>    	struct vmw_private *dev_priv = ctx->dev_priv;
>>>    	struct vmw_resource *res;
>>>    	struct vmw_view *view;
>>> +	struct ttm_operation_ctx ttm_opt_ctx = {
>>> +		.interruptible = true,
>>> +		.no_wait_gpu = false
>>> +	};
>>>    	size_t size;
>>>    	int ret;
>>> @@ -345,7 +349,7 @@ int vmw_view_add(struct vmw_cmdbuf_res_manager *man,
>>>    	size = offsetof(struct vmw_view, cmd) + cmd_size;
>>> -	ret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv), size, false, true);
>>> +	ret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv), size, &ttm_opt_ctx);
>>>    	if (ret) {
>>>    		if (ret != -ERESTARTSYS)
>>>    			DRM_ERROR("Out of graphics memory for view"
>>> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
>>> index 6ac094e..db1bb16 100644
>>> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
>>> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
>>> @@ -700,6 +700,10 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data,
>>>    	struct drm_vmw_surface_create_req *req = &arg->req;
>>>    	struct drm_vmw_surface_arg *rep = &arg->rep;
>>>    	struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
>>> +	struct ttm_operation_ctx ctx = {
>>> +		.interruptible = true,
>>> +		.no_wait_gpu = false
>>> +	};
>>>    	int ret;
>>>    	int i, j;
>>>    	uint32_t cur_bo_offset;
>>> @@ -741,7 +745,7 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data,
>>>    		return ret;
>>>    	ret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv),
>>> -				   size, false, true);
>>> +				   size, &ctx);
>>>    	if (unlikely(ret != 0)) {
>>>    		if (ret != -ERESTARTSYS)
>>>    			DRM_ERROR("Out of graphics memory for surface"
>>> @@ -1479,6 +1483,10 @@ int vmw_surface_gb_priv_define(struct drm_device *dev,
>>>    {
>>>    	struct vmw_private *dev_priv = vmw_priv(dev);
>>>    	struct vmw_user_surface *user_srf;
>>> +	struct ttm_operation_ctx ctx = {
>>> +		.interruptible = true,
>>> +		.no_wait_gpu = false
>>> +	};
>>>    	struct vmw_surface *srf;
>>>    	int ret;
>>>    	u32 num_layers;
>>> @@ -1525,7 +1533,7 @@ int vmw_surface_gb_priv_define(struct drm_device *dev,
>>>    		return ret;
>>>    	ret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv),
>>> -				   user_accounting_size, false, true);
>>> +				   user_accounting_size, &ctx);
>>>    	if (unlikely(ret != 0)) {
>>>    		if (ret != -ERESTARTSYS)
>>>    			DRM_ERROR("Out of graphics memory for surface"
>>> diff --git a/include/drm/ttm/ttm_memory.h b/include/drm/ttm/ttm_memory.h
>>> index 85f3ad6..755c107 100644
>>> --- a/include/drm/ttm/ttm_memory.h
>>> +++ b/include/drm/ttm/ttm_memory.h
>>> @@ -35,6 +35,7 @@
>>>    #include <linux/errno.h>
>>>    #include <linux/kobject.h>
>>>    #include <linux/mm.h>
>>> +#include "ttm_bo_api.h"
>>>    /**
>>>     * struct ttm_mem_global - Global memory accounting structure.
>>> @@ -79,7 +80,7 @@ struct ttm_mem_global {
>>>    extern int ttm_mem_global_init(struct ttm_mem_global *glob);
>>>    extern void ttm_mem_global_release(struct ttm_mem_global *glob);
>>>    extern int ttm_mem_global_alloc(struct ttm_mem_global *glob, uint64_t memory,
>>> -				bool no_wait, bool interruptible);
>>> +				struct ttm_operation_ctx *ctx);
>>>    extern void ttm_mem_global_free(struct ttm_mem_global *glob,
>>>    				uint64_t amount);
>>>    extern int ttm_mem_global_alloc_page(struct ttm_mem_global *glob,

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2018-01-25  8:31 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-20 10:34 [PATCH 1/7] drm/ttm: call ttm_bo_swapout directly when ttm shrink Roger He
2017-12-20 10:34 ` [PATCH 3/7] drm/ttm: use an operation ctx for ttm_mem_global_alloc_page Roger He
     [not found]   ` <1513766101-15993-3-git-send-email-Hongbo.He-5C7GfCeVMHo@public.gmane.org>
2017-12-20 13:35     ` Christian König
     [not found]       ` <edd81ee9-bb23-84c4-4065-2b424c95724e-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-12-21  6:05         ` He, Roger
     [not found]           ` <BN6PR1201MB0114CD1510459BE13D0BF292FD0D0-6iU6OBHu2P8MH+E/uqw63WrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2017-12-21  8:15             ` Thomas Hellstrom
2017-12-20 10:35 ` [PATCH 6/7] drm/ttm: add ttm_bo_evict_swapout_allowable to check bo is allowable to evict or swapout Roger He
2017-12-21  7:50   ` Thomas Hellstrom
2017-12-25  3:10     ` He, Roger
     [not found] ` <1513766101-15993-1-git-send-email-Hongbo.He-5C7GfCeVMHo@public.gmane.org>
2017-12-20 10:34   ` [PATCH 2/7] drm/ttm: use an operation ctx for ttm_mem_global_alloc Roger He
     [not found]     ` <1513766101-15993-2-git-send-email-Hongbo.He-5C7GfCeVMHo@public.gmane.org>
2017-12-20 13:33       ` Christian König
     [not found]         ` <15e3b956-8777-8fb1-2709-5409a756f0be-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-01-24 23:24           ` Sinclair Yeh
     [not found]             ` <20180124232346.GA59165-WSU1YMatGzO44ywRPIzf9A@public.gmane.org>
2018-01-25  8:31               ` Christian König [this message]
2017-12-21  8:07     ` Thomas Hellstrom
2017-12-20 10:34   ` [PATCH 4/7] drm/ttm: use an operation ctx for ttm_tt_populate in ttm_bo_driver Roger He
2017-12-20 14:20     ` Christian König
2017-12-20 10:34   ` [PATCH 5/7] drm/ttm: use an operation ctx for ttm_tt_bind Roger He
2017-12-20 10:35   ` [PATCH 7/7] drm/ttm: enable swapout of per VM BOs during allocation and allows reaping of deleted BOs Roger He
     [not found]     ` <1513766101-15993-7-git-send-email-Hongbo.He-5C7GfCeVMHo@public.gmane.org>
2017-12-21  7:58       ` Thomas Hellstrom
2017-12-21  8:18         ` Christian König
2017-12-20 13:29   ` [PATCH 1/7] drm/ttm: call ttm_bo_swapout directly when ttm shrink Christian König
2017-12-21  7:34   ` Thomas Hellstrom
     [not found]     ` <b0f51ff0-950e-bbe0-0032-e0e714d94350-4+hqylr40dJg9hUCZPvPmw@public.gmane.org>
2017-12-21  9:17       ` He, Roger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9716c43f-6bc2-70f0-c166-442121dcf60f@amd.com \
    --to=christian.koenig-5c7gfcevmho@public.gmane.org \
    --cc=Hongbo.He-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=syeh-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org \
    --cc=thellstrom-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox