Lines Matching refs:pobj
28 int psb_gem_pin(struct psb_gem_object *pobj) in psb_gem_pin() argument
30 struct drm_gem_object *obj = &pobj->base; in psb_gem_pin()
42 if (pobj->in_gart || pobj->stolen) in psb_gem_pin()
55 psb_gtt_insert_pages(dev_priv, &pobj->resource, pages); in psb_gem_pin()
57 (gpu_base + pobj->offset), npages, 0, 0, in psb_gem_pin()
60 pobj->pages = pages; in psb_gem_pin()
63 ++pobj->in_gart; in psb_gem_pin()
73 void psb_gem_unpin(struct psb_gem_object *pobj) in psb_gem_unpin() argument
75 struct drm_gem_object *obj = &pobj->base; in psb_gem_unpin()
86 WARN_ON(!pobj->in_gart); in psb_gem_unpin()
88 --pobj->in_gart; in psb_gem_unpin()
90 if (pobj->in_gart || pobj->stolen) in psb_gem_unpin()
96 (gpu_base + pobj->offset), npages, 0, 0); in psb_gem_unpin()
97 psb_gtt_remove_pages(dev_priv, &pobj->resource); in psb_gem_unpin()
100 set_pages_array_wb(pobj->pages, npages); in psb_gem_unpin()
102 drm_gem_put_pages(obj, pobj->pages, true, false); in psb_gem_unpin()
103 pobj->pages = NULL; in psb_gem_unpin()
113 struct psb_gem_object *pobj = to_psb_gem_object(obj); in psb_gem_free_object() local
116 if (pobj->mmapping) in psb_gem_free_object()
117 psb_gem_unpin(pobj); in psb_gem_free_object()
121 WARN_ON(pobj->in_gart && !pobj->stolen); in psb_gem_free_object()
123 release_resource(&pobj->resource); in psb_gem_free_object()
124 kfree(pobj); in psb_gem_free_object()
142 struct psb_gem_object *pobj; in psb_gem_create() local
148 pobj = kzalloc(sizeof(*pobj), GFP_KERNEL); in psb_gem_create()
149 if (!pobj) in psb_gem_create()
151 obj = &pobj->base; in psb_gem_create()
155 ret = psb_gtt_allocate_resource(dev_priv, &pobj->resource, name, size, align, stolen, in psb_gem_create()
156 &pobj->offset); in psb_gem_create()
161 pobj->stolen = true; in psb_gem_create()
162 pobj->in_gart = 1; in psb_gem_create()
180 return pobj; in psb_gem_create()
183 release_resource(&pobj->resource); in psb_gem_create()
185 kfree(pobj); in psb_gem_create()
203 struct psb_gem_object *pobj; in psb_gem_dumb_create() local
216 pobj = psb_gem_create(dev, size, "gem", false, PAGE_SIZE); in psb_gem_dumb_create()
217 if (IS_ERR(pobj)) in psb_gem_dumb_create()
218 return PTR_ERR(pobj); in psb_gem_dumb_create()
219 obj = &pobj->base; in psb_gem_dumb_create()
258 struct psb_gem_object *pobj; in psb_gem_fault() local
270 pobj = to_psb_gem_object(obj); in psb_gem_fault()
278 if (pobj->mmapping == 0) { in psb_gem_fault()
279 err = psb_gem_pin(pobj); in psb_gem_fault()
285 pobj->mmapping = 1; in psb_gem_fault()
293 if (pobj->stolen) in psb_gem_fault()
294 pfn = (dev_priv->stolen_base + pobj->offset) >> PAGE_SHIFT; in psb_gem_fault()
296 pfn = page_to_pfn(pobj->pages[page_offset]); in psb_gem_fault()
384 struct psb_gem_object *pobj; in psb_gem_mm_populate_resources() local
392 pobj = container_of(r, struct psb_gem_object, resource); in psb_gem_mm_populate_resources()
393 if (pobj->pages) { in psb_gem_mm_populate_resources()
394 psb_gtt_insert_pages(pdev, &pobj->resource, pobj->pages); in psb_gem_mm_populate_resources()
395 size += resource_size(&pobj->resource); in psb_gem_mm_populate_resources()