Commit 279c01f6 authored by Roger He's avatar Roger He Committed by Alex Deucher

drm/ttm: use an operation ctx for ttm_mem_global_alloc

forward the operation context to ttm_mem_global_alloc as well, and the
ultimate goal is swapout enablement for reserved BOs
Reviewed-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarRoger He <Hongbo.He@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent a6c26af8
...@@ -1135,7 +1135,7 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev, ...@@ -1135,7 +1135,7 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
struct ttm_mem_global *mem_glob = bdev->glob->mem_glob; struct ttm_mem_global *mem_glob = bdev->glob->mem_glob;
bool locked; 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) { if (ret) {
pr_err("Out of kernel memory\n"); pr_err("Out of kernel memory\n");
if (destroy) if (destroy)
......
...@@ -508,7 +508,7 @@ static int ttm_mem_global_reserve(struct ttm_mem_global *glob, ...@@ -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, static int ttm_mem_global_alloc_zone(struct ttm_mem_global *glob,
struct ttm_mem_zone *single_zone, struct ttm_mem_zone *single_zone,
uint64_t memory, uint64_t memory,
bool no_wait, bool interruptible) struct ttm_operation_ctx *ctx)
{ {
int count = TTM_MEMORY_ALLOC_RETRIES; int count = TTM_MEMORY_ALLOC_RETRIES;
...@@ -516,7 +516,7 @@ static int ttm_mem_global_alloc_zone(struct ttm_mem_global *glob, ...@@ -516,7 +516,7 @@ static int ttm_mem_global_alloc_zone(struct ttm_mem_global *glob,
single_zone, single_zone,
memory, true) memory, true)
!= 0)) { != 0)) {
if (no_wait) if (ctx->no_wait_gpu)
return -ENOMEM; return -ENOMEM;
if (unlikely(count-- == 0)) if (unlikely(count-- == 0))
return -ENOMEM; return -ENOMEM;
...@@ -527,15 +527,14 @@ static int ttm_mem_global_alloc_zone(struct ttm_mem_global *glob, ...@@ -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, 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 * Normal allocations of kernel memory are registered in
* all zones. * all zones.
*/ */
return ttm_mem_global_alloc_zone(glob, NULL, memory, no_wait, return ttm_mem_global_alloc_zone(glob, NULL, memory, ctx);
interruptible);
} }
EXPORT_SYMBOL(ttm_mem_global_alloc); EXPORT_SYMBOL(ttm_mem_global_alloc);
...@@ -544,6 +543,10 @@ int ttm_mem_global_alloc_page(struct ttm_mem_global *glob, ...@@ -544,6 +543,10 @@ int ttm_mem_global_alloc_page(struct ttm_mem_global *glob,
{ {
struct ttm_mem_zone *zone = NULL; 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 * Page allocations may be registed in a single zone
...@@ -557,7 +560,7 @@ int ttm_mem_global_alloc_page(struct ttm_mem_global *glob, ...@@ -557,7 +560,7 @@ int ttm_mem_global_alloc_page(struct ttm_mem_global *glob,
if (glob->zone_dma32 && page_to_pfn(page) > 0x00100000UL) if (glob->zone_dma32 && page_to_pfn(page) > 0x00100000UL)
zone = glob->zone_kernel; zone = glob->zone_kernel;
#endif #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, void ttm_mem_global_free_page(struct ttm_mem_global *glob, struct page *page,
......
...@@ -325,6 +325,10 @@ int ttm_ref_object_add(struct ttm_object_file *tfile, ...@@ -325,6 +325,10 @@ int ttm_ref_object_add(struct ttm_object_file *tfile,
struct ttm_ref_object *ref; struct ttm_ref_object *ref;
struct drm_hash_item *hash; struct drm_hash_item *hash;
struct ttm_mem_global *mem_glob = tfile->tdev->mem_glob; struct ttm_mem_global *mem_glob = tfile->tdev->mem_glob;
struct ttm_operation_ctx ctx = {
.interruptible = false,
.no_wait_gpu = false
};
int ret = -EINVAL; int ret = -EINVAL;
if (base->tfile != tfile && !base->shareable) if (base->tfile != tfile && !base->shareable)
...@@ -350,7 +354,7 @@ int ttm_ref_object_add(struct ttm_object_file *tfile, ...@@ -350,7 +354,7 @@ int ttm_ref_object_add(struct ttm_object_file *tfile,
return -EPERM; return -EPERM;
ret = ttm_mem_global_alloc(mem_glob, sizeof(*ref), ret = ttm_mem_global_alloc(mem_glob, sizeof(*ref),
false, false); &ctx);
if (unlikely(ret != 0)) if (unlikely(ret != 0))
return ret; return ret;
ref = kmalloc(sizeof(*ref), GFP_KERNEL); ref = kmalloc(sizeof(*ref), GFP_KERNEL);
...@@ -686,7 +690,10 @@ int ttm_prime_handle_to_fd(struct ttm_object_file *tfile, ...@@ -686,7 +690,10 @@ int ttm_prime_handle_to_fd(struct ttm_object_file *tfile,
dma_buf = prime->dma_buf; dma_buf = prime->dma_buf;
if (!dma_buf || !get_dma_buf_unless_doomed(dma_buf)) { if (!dma_buf || !get_dma_buf_unless_doomed(dma_buf)) {
DEFINE_DMA_BUF_EXPORT_INFO(exp_info); 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.ops = &tdev->ops;
exp_info.size = prime->size; exp_info.size = prime->size;
exp_info.flags = flags; exp_info.flags = flags;
...@@ -696,7 +703,7 @@ int ttm_prime_handle_to_fd(struct ttm_object_file *tfile, ...@@ -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. * Need to create a new dma_buf, with memory accounting.
*/ */
ret = ttm_mem_global_alloc(tdev->mem_glob, tdev->dma_buf_size, ret = ttm_mem_global_alloc(tdev->mem_glob, tdev->dma_buf_size,
false, true); &ctx);
if (unlikely(ret != 0)) { if (unlikely(ret != 0)) {
mutex_unlock(&prime->mutex); mutex_unlock(&prime->mutex);
goto out_unref; goto out_unref;
......
...@@ -1202,10 +1202,14 @@ struct vmw_ctx_binding_state * ...@@ -1202,10 +1202,14 @@ struct vmw_ctx_binding_state *
vmw_binding_state_alloc(struct vmw_private *dev_priv) vmw_binding_state_alloc(struct vmw_private *dev_priv)
{ {
struct vmw_ctx_binding_state *cbs; struct vmw_ctx_binding_state *cbs;
struct ttm_operation_ctx ctx = {
.interruptible = false,
.no_wait_gpu = false
};
int ret; int ret;
ret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv), sizeof(*cbs), ret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv), sizeof(*cbs),
false, false); &ctx);
if (ret) if (ret)
return ERR_PTR(ret); return ERR_PTR(ret);
......
...@@ -394,6 +394,10 @@ static int vmw_ttm_map_dma(struct vmw_ttm_tt *vmw_tt) ...@@ -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 vmw_private *dev_priv = vmw_tt->dev_priv;
struct ttm_mem_global *glob = vmw_mem_glob(dev_priv); struct ttm_mem_global *glob = vmw_mem_glob(dev_priv);
struct vmw_sg_table *vsgt = &vmw_tt->vsgt; struct vmw_sg_table *vsgt = &vmw_tt->vsgt;
struct ttm_operation_ctx ctx = {
.interruptible = true,
.no_wait_gpu = false
};
struct vmw_piter iter; struct vmw_piter iter;
dma_addr_t old; dma_addr_t old;
int ret = 0; int ret = 0;
...@@ -417,8 +421,7 @@ static int vmw_ttm_map_dma(struct vmw_ttm_tt *vmw_tt) ...@@ -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)); sgt_size = ttm_round_pot(sizeof(struct sg_table));
} }
vmw_tt->sg_alloc_size = sgt_size + sgl_size * vsgt->num_pages; vmw_tt->sg_alloc_size = sgt_size + sgl_size * vsgt->num_pages;
ret = ttm_mem_global_alloc(glob, vmw_tt->sg_alloc_size, false, ret = ttm_mem_global_alloc(glob, vmw_tt->sg_alloc_size, &ctx);
true);
if (unlikely(ret != 0)) if (unlikely(ret != 0))
return ret; return ret;
...@@ -638,6 +641,10 @@ static int vmw_ttm_populate(struct ttm_tt *ttm) ...@@ -638,6 +641,10 @@ static int vmw_ttm_populate(struct ttm_tt *ttm)
container_of(ttm, struct vmw_ttm_tt, dma_ttm.ttm); container_of(ttm, struct vmw_ttm_tt, dma_ttm.ttm);
struct vmw_private *dev_priv = vmw_tt->dev_priv; struct vmw_private *dev_priv = vmw_tt->dev_priv;
struct ttm_mem_global *glob = vmw_mem_glob(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; int ret;
if (ttm->state != tt_unpopulated) if (ttm->state != tt_unpopulated)
...@@ -646,7 +653,7 @@ static int vmw_ttm_populate(struct ttm_tt *ttm) ...@@ -646,7 +653,7 @@ static int vmw_ttm_populate(struct ttm_tt *ttm)
if (dev_priv->map_mode == vmw_dma_alloc_coherent) { if (dev_priv->map_mode == vmw_dma_alloc_coherent) {
size_t size = size_t size =
ttm_round_pot(ttm->num_pages * sizeof(dma_addr_t)); 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)) if (unlikely(ret != 0))
return ret; return ret;
......
...@@ -746,6 +746,10 @@ static int vmw_context_define(struct drm_device *dev, void *data, ...@@ -746,6 +746,10 @@ static int vmw_context_define(struct drm_device *dev, void *data,
struct vmw_resource *tmp; struct vmw_resource *tmp;
struct drm_vmw_context_arg *arg = (struct drm_vmw_context_arg *)data; struct drm_vmw_context_arg *arg = (struct drm_vmw_context_arg *)data;
struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile; 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; int ret;
if (!dev_priv->has_dx && dx) { if (!dev_priv->has_dx && dx) {
...@@ -768,7 +772,7 @@ static int vmw_context_define(struct drm_device *dev, void *data, ...@@ -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), ret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv),
vmw_user_context_size, vmw_user_context_size,
false, true); &ttm_opt_ctx);
if (unlikely(ret != 0)) { if (unlikely(ret != 0)) {
if (ret != -ERESTARTSYS) if (ret != -ERESTARTSYS)
DRM_ERROR("Out of graphics memory for context" DRM_ERROR("Out of graphics memory for context"
......
...@@ -573,6 +573,10 @@ struct vmw_resource *vmw_cotable_alloc(struct vmw_private *dev_priv, ...@@ -573,6 +573,10 @@ struct vmw_resource *vmw_cotable_alloc(struct vmw_private *dev_priv,
u32 type) u32 type)
{ {
struct vmw_cotable *vcotbl; struct vmw_cotable *vcotbl;
struct ttm_operation_ctx ttm_opt_ctx = {
.interruptible = true,
.no_wait_gpu = false
};
int ret; int ret;
u32 num_entries; u32 num_entries;
...@@ -580,7 +584,7 @@ struct vmw_resource *vmw_cotable_alloc(struct vmw_private *dev_priv, ...@@ -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)); cotable_acc_size = ttm_round_pot(sizeof(struct vmw_cotable));
ret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv), ret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv),
cotable_acc_size, false, true); cotable_acc_size, &ttm_opt_ctx);
if (unlikely(ret)) if (unlikely(ret))
return ERR_PTR(ret); return ERR_PTR(ret);
......
...@@ -588,6 +588,10 @@ int vmw_user_fence_create(struct drm_file *file_priv, ...@@ -588,6 +588,10 @@ int vmw_user_fence_create(struct drm_file *file_priv,
struct vmw_user_fence *ufence; struct vmw_user_fence *ufence;
struct vmw_fence_obj *tmp; struct vmw_fence_obj *tmp;
struct ttm_mem_global *mem_glob = vmw_mem_glob(fman->dev_priv); 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; int ret;
/* /*
...@@ -596,7 +600,7 @@ int vmw_user_fence_create(struct drm_file *file_priv, ...@@ -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, ret = ttm_mem_global_alloc(mem_glob, fman->user_fence_size,
false, false); &ctx);
if (unlikely(ret != 0)) if (unlikely(ret != 0))
return ret; return ret;
......
...@@ -607,6 +607,10 @@ int vmw_dx_shader_add(struct vmw_cmdbuf_res_manager *man, ...@@ -607,6 +607,10 @@ int vmw_dx_shader_add(struct vmw_cmdbuf_res_manager *man,
struct vmw_dx_shader *shader; struct vmw_dx_shader *shader;
struct vmw_resource *res; struct vmw_resource *res;
struct vmw_private *dev_priv = ctx->dev_priv; struct vmw_private *dev_priv = ctx->dev_priv;
struct ttm_operation_ctx ttm_opt_ctx = {
.interruptible = true,
.no_wait_gpu = false
};
int ret; int ret;
if (!vmw_shader_dx_size) if (!vmw_shader_dx_size)
...@@ -616,7 +620,7 @@ int vmw_dx_shader_add(struct vmw_cmdbuf_res_manager *man, ...@@ -616,7 +620,7 @@ int vmw_dx_shader_add(struct vmw_cmdbuf_res_manager *man,
return -EINVAL; return -EINVAL;
ret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv), vmw_shader_dx_size, ret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv), vmw_shader_dx_size,
false, true); &ttm_opt_ctx);
if (ret) { if (ret) {
if (ret != -ERESTARTSYS) if (ret != -ERESTARTSYS)
DRM_ERROR("Out of graphics memory for shader " DRM_ERROR("Out of graphics memory for shader "
...@@ -730,6 +734,10 @@ static int vmw_user_shader_alloc(struct vmw_private *dev_priv, ...@@ -730,6 +734,10 @@ static int vmw_user_shader_alloc(struct vmw_private *dev_priv,
{ {
struct vmw_user_shader *ushader; struct vmw_user_shader *ushader;
struct vmw_resource *res, *tmp; struct vmw_resource *res, *tmp;
struct ttm_operation_ctx ctx = {
.interruptible = true,
.no_wait_gpu = false
};
int ret; int ret;
/* /*
...@@ -742,7 +750,7 @@ static int vmw_user_shader_alloc(struct vmw_private *dev_priv, ...@@ -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), ret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv),
vmw_user_shader_size, vmw_user_shader_size,
false, true); &ctx);
if (unlikely(ret != 0)) { if (unlikely(ret != 0)) {
if (ret != -ERESTARTSYS) if (ret != -ERESTARTSYS)
DRM_ERROR("Out of graphics memory for shader " DRM_ERROR("Out of graphics memory for shader "
...@@ -800,6 +808,10 @@ static struct vmw_resource *vmw_shader_alloc(struct vmw_private *dev_priv, ...@@ -800,6 +808,10 @@ static struct vmw_resource *vmw_shader_alloc(struct vmw_private *dev_priv,
{ {
struct vmw_shader *shader; struct vmw_shader *shader;
struct vmw_resource *res; struct vmw_resource *res;
struct ttm_operation_ctx ctx = {
.interruptible = true,
.no_wait_gpu = false
};
int ret; int ret;
/* /*
...@@ -812,7 +824,7 @@ static struct vmw_resource *vmw_shader_alloc(struct vmw_private *dev_priv, ...@@ -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), ret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv),
vmw_shader_size, vmw_shader_size,
false, true); &ctx);
if (unlikely(ret != 0)) { if (unlikely(ret != 0)) {
if (ret != -ERESTARTSYS) if (ret != -ERESTARTSYS)
DRM_ERROR("Out of graphics memory for shader " DRM_ERROR("Out of graphics memory for shader "
......
...@@ -149,6 +149,10 @@ vmw_simple_resource_create_ioctl(struct drm_device *dev, void *data, ...@@ -149,6 +149,10 @@ vmw_simple_resource_create_ioctl(struct drm_device *dev, void *data,
struct vmw_resource *res; struct vmw_resource *res;
struct vmw_resource *tmp; struct vmw_resource *tmp;
struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile; 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 alloc_size;
size_t account_size; size_t account_size;
int ret; int ret;
...@@ -162,7 +166,7 @@ vmw_simple_resource_create_ioctl(struct drm_device *dev, void *data, ...@@ -162,7 +166,7 @@ vmw_simple_resource_create_ioctl(struct drm_device *dev, void *data,
return ret; return ret;
ret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv), account_size, ret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv), account_size,
false, true); &ctx);
ttm_read_unlock(&dev_priv->reservation_sem); ttm_read_unlock(&dev_priv->reservation_sem);
if (ret) { if (ret) {
if (ret != -ERESTARTSYS) if (ret != -ERESTARTSYS)
......
...@@ -329,6 +329,10 @@ int vmw_view_add(struct vmw_cmdbuf_res_manager *man, ...@@ -329,6 +329,10 @@ int vmw_view_add(struct vmw_cmdbuf_res_manager *man,
struct vmw_private *dev_priv = ctx->dev_priv; struct vmw_private *dev_priv = ctx->dev_priv;
struct vmw_resource *res; struct vmw_resource *res;
struct vmw_view *view; struct vmw_view *view;
struct ttm_operation_ctx ttm_opt_ctx = {
.interruptible = true,
.no_wait_gpu = false
};
size_t size; size_t size;
int ret; int ret;
...@@ -345,7 +349,7 @@ int vmw_view_add(struct vmw_cmdbuf_res_manager *man, ...@@ -345,7 +349,7 @@ int vmw_view_add(struct vmw_cmdbuf_res_manager *man,
size = offsetof(struct vmw_view, cmd) + cmd_size; 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) {
if (ret != -ERESTARTSYS) if (ret != -ERESTARTSYS)
DRM_ERROR("Out of graphics memory for view" DRM_ERROR("Out of graphics memory for view"
......
...@@ -700,6 +700,10 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data, ...@@ -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_create_req *req = &arg->req;
struct drm_vmw_surface_arg *rep = &arg->rep; struct drm_vmw_surface_arg *rep = &arg->rep;
struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile; struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
struct ttm_operation_ctx ctx = {
.interruptible = true,
.no_wait_gpu = false
};
int ret; int ret;
int i, j; int i, j;
uint32_t cur_bo_offset; uint32_t cur_bo_offset;
...@@ -741,7 +745,7 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data, ...@@ -741,7 +745,7 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data,
return ret; return ret;
ret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv), ret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv),
size, false, true); size, &ctx);
if (unlikely(ret != 0)) { if (unlikely(ret != 0)) {
if (ret != -ERESTARTSYS) if (ret != -ERESTARTSYS)
DRM_ERROR("Out of graphics memory for surface" DRM_ERROR("Out of graphics memory for surface"
...@@ -1479,6 +1483,10 @@ int vmw_surface_gb_priv_define(struct drm_device *dev, ...@@ -1479,6 +1483,10 @@ int vmw_surface_gb_priv_define(struct drm_device *dev,
{ {
struct vmw_private *dev_priv = vmw_priv(dev); struct vmw_private *dev_priv = vmw_priv(dev);
struct vmw_user_surface *user_srf; struct vmw_user_surface *user_srf;
struct ttm_operation_ctx ctx = {
.interruptible = true,
.no_wait_gpu = false
};
struct vmw_surface *srf; struct vmw_surface *srf;
int ret; int ret;
u32 num_layers; u32 num_layers;
...@@ -1525,7 +1533,7 @@ int vmw_surface_gb_priv_define(struct drm_device *dev, ...@@ -1525,7 +1533,7 @@ int vmw_surface_gb_priv_define(struct drm_device *dev,
return ret; return ret;
ret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv), ret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv),
user_accounting_size, false, true); user_accounting_size, &ctx);
if (unlikely(ret != 0)) { if (unlikely(ret != 0)) {
if (ret != -ERESTARTSYS) if (ret != -ERESTARTSYS)
DRM_ERROR("Out of graphics memory for surface" DRM_ERROR("Out of graphics memory for surface"
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/kobject.h> #include <linux/kobject.h>
#include <linux/mm.h> #include <linux/mm.h>
#include "ttm_bo_api.h"
/** /**
* struct ttm_mem_global - Global memory accounting structure. * struct ttm_mem_global - Global memory accounting structure.
...@@ -79,7 +80,7 @@ struct ttm_mem_global { ...@@ -79,7 +80,7 @@ struct ttm_mem_global {
extern int ttm_mem_global_init(struct ttm_mem_global *glob); extern int ttm_mem_global_init(struct ttm_mem_global *glob);
extern void ttm_mem_global_release(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, 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, extern void ttm_mem_global_free(struct ttm_mem_global *glob,
uint64_t amount); uint64_t amount);
extern int ttm_mem_global_alloc_page(struct ttm_mem_global *glob, extern int ttm_mem_global_alloc_page(struct ttm_mem_global *glob,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment