Rev 3033 | Rev 3039 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3033 | Rev 3037 | ||
---|---|---|---|
Line 14... | Line 14... | ||
14 | 14 | ||
Line 15... | Line 15... | ||
15 | extern struct drm_device *main_device; |
15 | extern struct drm_device *main_device; |
Line 16... | Line -... | ||
16 | - | ||
17 | 16 | ||
18 | 17 | ||
19 | void __attribute__((regparm(1))) destroy_bitmap(bitmap_t *bitmap) |
18 | void __attribute__((regparm(1))) destroy_bitmap(bitmap_t *bitmap) |
20 | { |
19 | { |
Line 21... | Line -... | ||
21 | dma_addr_t *pages = bitmap->obj->allocated_pages;; |
- | |
22 | int i; |
20 | dma_addr_t *pages = bitmap->obj->allocated_pages; |
23 | 21 | int i; |
|
24 | printf("destroy bitmap %d\n", bitmap->handle); |
22 | |
25 | free_handle(&bm_mm, bitmap->handle); |
23 | free_handle(&bm_mm, bitmap->handle); |
Line 26... | Line 24... | ||
26 | bitmap->handle = 0; |
24 | bitmap->handle = 0; |
- | 25 | bitmap->obj->base.read_domains = I915_GEM_DOMAIN_GTT; |
|
27 | bitmap->obj->base.read_domains = I915_GEM_DOMAIN_GTT; |
26 | bitmap->obj->base.write_domain = I915_GEM_DOMAIN_CPU; |
28 | bitmap->obj->base.write_domain = I915_GEM_DOMAIN_CPU; |
27 | |
Line 29... | Line 28... | ||
29 | 28 | mutex_lock(&main_device->struct_mutex); |
|
30 | mutex_lock(&main_device->struct_mutex); |
29 | |
31 | drm_gem_object_unreference(&bitmap->obj->base); |
30 | drm_gem_object_unreference(&bitmap->obj->base); |
32 | mutex_unlock(&main_device->struct_mutex); |
31 | mutex_unlock(&main_device->struct_mutex); |
Line -... | Line 32... | ||
- | 32 | ||
- | 33 | if(pages != NULL) |
|
33 | 34 | { |
|
34 | if(pages != NULL) |
35 | for (i = 0; i < bitmap->page_count; i++) |
35 | { |
36 | FreePage(pages[i]); |
36 | for (i = 0; i < bitmap->page_count; i++) |
37 | |
37 | FreePage(pages[i]); |
38 | DRM_DEBUG("%s freec %d pages\n", __FUNCTION__, bitmap->page_count); |
Line 210... | Line 211... | ||
210 | bitmap->page_count = page_count; |
211 | bitmap->page_count = page_count; |
211 | bitmap->max_count = max_count; |
212 | bitmap->max_count = max_count; |
212 | }; |
213 | }; |
213 | 214 | ||
Line -... | Line 215... | ||
- | 215 | DRM_DEBUG("%s alloc %d pages\n", __FUNCTION__, page_count); |
|
- | 216 | ||
214 | obj = i915_gem_alloc_object(dev, size); |
217 | obj = i915_gem_alloc_object(dev, size); |
215 | if (obj == NULL) |
218 | if (obj == NULL) |
216 | goto err4; |
219 | goto err4; |
Line 217... | Line 220... | ||
217 | 220 | ||
Line 241... | Line 244... | ||
241 | pbitmap->data = uaddr; |
244 | pbitmap->data = uaddr; |
242 | pbitmap->pitch = pitch; |
245 | pbitmap->pitch = pitch; |
243 | 246 | ||
Line 244... | Line 247... | ||
244 | 247 | ||
245 | printf("%s handle: %d pitch: %d gpu_addr: %x user_addr: %x\n", |
248 | DRM_DEBUG("%s handle: %d pitch: %d gpu_addr: %x user_addr: %x\n", |
Line 246... | Line 249... | ||
246 | __FUNCTION__, handle, pitch, obj->gtt_offset, uaddr); |
249 | __FUNCTION__, handle, pitch, obj->gtt_offset, uaddr); |
Line 247... | Line 250... | ||
247 | 250 | ||
Line 280... | Line 283... | ||
280 | 283 | ||
Line 281... | Line 284... | ||
281 | if(unlikely(bitmap==NULL)) |
284 | if(unlikely(bitmap==NULL)) |
282 | return -1; |
285 | return -1; |
Line -... | Line 286... | ||
- | 286 | ||
283 | 287 | mutex_lock(&main_device->struct_mutex); |
|
- | 288 | ret = i915_gem_object_set_to_cpu_domain(bitmap->obj, true); |
|
Line 284... | Line 289... | ||
284 | ret = i915_gem_object_set_to_cpu_domain(bitmap->obj, true); |
289 | mutex_unlock(&main_device->struct_mutex); |
285 | 290 | ||
286 | if(ret != 0 ) |
291 | if(ret != 0 ) |
287 | { |
292 | { |
Line 336... | Line 341... | ||
336 | 341 | ||
Line 337... | Line 342... | ||
337 | 342 | ||
338 | void __attribute__((regparm(1))) destroy_context(struct context *context) |
343 | void __attribute__((regparm(1))) destroy_context(struct context *context) |
339 | { |
344 | { |
Line 340... | Line 345... | ||
340 | printf("destroy context %x\n", context); |
345 | DRM_DEBUG("destroy context %x\n", context); |
Line 341... | Line 346... | ||
341 | 346 | ||
342 | context_map[context->slot] = NULL; |
347 | context_map[context->slot] = NULL; |
Line 363... | Line 368... | ||
363 | if( context != NULL) |
368 | if( context != NULL) |
364 | return context; |
369 | return context; |
Line 365... | Line 370... | ||
365 | 370 | ||
366 | context = CreateObject(GetPid(), sizeof(*context)); |
- | |
- | 371 | context = CreateObject(GetPid(), sizeof(*context)); |
|
367 | printf("context %x\n", context); |
372 | |
368 | if( context != NULL) |
373 | if( context != NULL) |
369 | { |
374 | { |
370 | drm_i915_private_t *dev_priv = dev->dev_private; |
375 | drm_i915_private_t *dev_priv = dev->dev_private; |