forked from KolibriOS/kolibrios
i915: trace memory allocation/deallocation
git-svn-id: svn://kolibrios.org@3290 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
ba61873d0c
commit
7d0513e9f6
@ -217,6 +217,7 @@ drm_gem_handle_delete(struct drm_file *filp, u32 handle)
|
|||||||
* we may want to use ida for number allocation and a hash table
|
* we may want to use ida for number allocation and a hash table
|
||||||
* for the pointers, anyway.
|
* for the pointers, anyway.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
spin_lock(&filp->table_lock);
|
spin_lock(&filp->table_lock);
|
||||||
|
|
||||||
/* Check if we currently have a reference on the object */
|
/* Check if we currently have a reference on the object */
|
||||||
@ -227,6 +228,8 @@ drm_gem_handle_delete(struct drm_file *filp, u32 handle)
|
|||||||
}
|
}
|
||||||
dev = obj->dev;
|
dev = obj->dev;
|
||||||
|
|
||||||
|
printf("%s handle %d obj %p\n", __FUNCTION__, handle, obj);
|
||||||
|
|
||||||
/* Release reference and decrement refcount. */
|
/* Release reference and decrement refcount. */
|
||||||
idr_remove(&filp->object_idr, handle);
|
idr_remove(&filp->object_idr, handle);
|
||||||
spin_unlock(&filp->table_lock);
|
spin_unlock(&filp->table_lock);
|
||||||
|
@ -237,6 +237,8 @@ i915_gem_create(struct drm_file *file,
|
|||||||
int ret;
|
int ret;
|
||||||
u32 handle;
|
u32 handle;
|
||||||
|
|
||||||
|
ENTER();
|
||||||
|
|
||||||
size = roundup(size, PAGE_SIZE);
|
size = roundup(size, PAGE_SIZE);
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -259,6 +261,9 @@ i915_gem_create(struct drm_file *file,
|
|||||||
trace_i915_gem_object_create(obj);
|
trace_i915_gem_object_create(obj);
|
||||||
|
|
||||||
*handle_p = handle;
|
*handle_p = handle;
|
||||||
|
|
||||||
|
printf("%s obj %p handle %d\n", __FUNCTION__, obj, handle);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1491,11 +1496,11 @@ i915_gem_object_put_pages_gtt(struct drm_i915_gem_object *obj)
|
|||||||
for_each_sg(obj->pages->sgl, sg, page_count, i) {
|
for_each_sg(obj->pages->sgl, sg, page_count, i) {
|
||||||
struct page *page = sg_page(sg);
|
struct page *page = sg_page(sg);
|
||||||
|
|
||||||
|
page_cache_release(page);
|
||||||
|
|
||||||
// page_cache_release(page);
|
|
||||||
}
|
}
|
||||||
//DRM_DEBUG_KMS("%s release %d pages\n", __FUNCTION__, page_count);
|
//DRM_DEBUG_KMS("%s release %d pages\n", __FUNCTION__, page_count);
|
||||||
|
printf("%s release %d pages\n", __FUNCTION__, page_count);
|
||||||
|
|
||||||
obj->dirty = 0;
|
obj->dirty = 0;
|
||||||
|
|
||||||
sg_free_table(obj->pages);
|
sg_free_table(obj->pages);
|
||||||
@ -3506,6 +3511,7 @@ void i915_gem_free_object(struct drm_gem_object *gem_obj)
|
|||||||
|
|
||||||
// if (obj->phys_obj)
|
// if (obj->phys_obj)
|
||||||
// i915_gem_detach_phys_object(dev, obj);
|
// i915_gem_detach_phys_object(dev, obj);
|
||||||
|
printf("%s obj %p\n", __FUNCTION__, obj);
|
||||||
|
|
||||||
obj->pin_count = 0;
|
obj->pin_count = 0;
|
||||||
if (WARN_ON(i915_gem_object_unbind(obj) == -ERESTARTSYS)) {
|
if (WARN_ON(i915_gem_object_unbind(obj) == -ERESTARTSYS)) {
|
||||||
@ -3528,6 +3534,12 @@ void i915_gem_free_object(struct drm_gem_object *gem_obj)
|
|||||||
// if (obj->base.import_attach)
|
// if (obj->base.import_attach)
|
||||||
// drm_prime_gem_destroy(&obj->base, NULL);
|
// drm_prime_gem_destroy(&obj->base, NULL);
|
||||||
|
|
||||||
|
if(obj->base.filp != NULL)
|
||||||
|
{
|
||||||
|
printf("filp %p\n", obj->base.filp);
|
||||||
|
shmem_file_delete(obj->base.filp);
|
||||||
|
}
|
||||||
|
|
||||||
drm_gem_object_release(&obj->base);
|
drm_gem_object_release(&obj->base);
|
||||||
i915_gem_info_remove_obj(dev_priv, obj->base.size);
|
i915_gem_info_remove_obj(dev_priv, obj->base.size);
|
||||||
|
|
||||||
|
@ -652,6 +652,8 @@ typedef struct
|
|||||||
|
|
||||||
struct drm_i915_mask {
|
struct drm_i915_mask {
|
||||||
__u32 handle;
|
__u32 handle;
|
||||||
|
__u32 width;
|
||||||
|
__u32 height;
|
||||||
__u32 bo_size;
|
__u32 bo_size;
|
||||||
__u32 bo_pitch;
|
__u32 bo_pitch;
|
||||||
__u32 bo_map;
|
__u32 bo_map;
|
||||||
@ -693,6 +695,10 @@ int i915_mask_update(struct drm_device *dev, void *data,
|
|||||||
{
|
{
|
||||||
static warn_count;
|
static warn_count;
|
||||||
|
|
||||||
|
mask->width = winrc.right - winrc.left + 1;
|
||||||
|
mask->height = winrc.bottom - winrc.top + 1;
|
||||||
|
mask->bo_pitch = (mask->width+15) & ~15;
|
||||||
|
|
||||||
if(warn_count < 1)
|
if(warn_count < 1)
|
||||||
{
|
{
|
||||||
printf("left %d top %d right %d bottom %d\n",
|
printf("left %d top %d right %d bottom %d\n",
|
||||||
@ -702,6 +708,7 @@ int i915_mask_update(struct drm_device *dev, void *data,
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
slot = *((u8*)CURRENT_TASK);
|
slot = *((u8*)CURRENT_TASK);
|
||||||
|
|
||||||
if( mask_seqno[slot] != os_display->mask_seqno)
|
if( mask_seqno[slot] != os_display->mask_seqno)
|
||||||
@ -730,7 +737,7 @@ int i915_mask_update(struct drm_device *dev, void *data,
|
|||||||
src_offset+= get_display_map();
|
src_offset+= get_display_map();
|
||||||
dst_offset = (u8*)mask->bo_map;
|
dst_offset = (u8*)mask->bo_map;
|
||||||
|
|
||||||
u32_t tmp_h = winrc.bottom - winrc.top;
|
u32_t tmp_h = mask->height;
|
||||||
|
|
||||||
ifl = safe_cli();
|
ifl = safe_cli();
|
||||||
{
|
{
|
||||||
@ -755,12 +762,6 @@ int i915_mask_update(struct drm_device *dev, void *data,
|
|||||||
src_offset+= os_display->width;
|
src_offset+= os_display->width;
|
||||||
dst_offset+= mask->bo_pitch;
|
dst_offset+= mask->bo_pitch;
|
||||||
|
|
||||||
// while( tmp_w--)
|
|
||||||
// {
|
|
||||||
// *(tmp_src) = (*tmp_dst==slot)?0x1:0x00;
|
|
||||||
// tmp_src++;
|
|
||||||
// tmp_dst++;
|
|
||||||
// };
|
|
||||||
while(tmp_w >= 64)
|
while(tmp_w >= 64)
|
||||||
{
|
{
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
|
@ -125,6 +125,7 @@ u32_t drvEntry(int action, char *cmdline)
|
|||||||
#define SRV_BLIT_TEXTURE 16
|
#define SRV_BLIT_TEXTURE 16
|
||||||
#define SRV_BLIT_VIDEO 17
|
#define SRV_BLIT_VIDEO 17
|
||||||
|
|
||||||
|
|
||||||
#define SRV_GET_PCI_INFO 20
|
#define SRV_GET_PCI_INFO 20
|
||||||
#define SRV_GET_PARAM 21
|
#define SRV_GET_PARAM 21
|
||||||
#define SRV_I915_GEM_CREATE 22
|
#define SRV_I915_GEM_CREATE 22
|
||||||
@ -140,6 +141,7 @@ u32_t drvEntry(int action, char *cmdline)
|
|||||||
#define SRV_I915_GEM_THROTTLE 32
|
#define SRV_I915_GEM_THROTTLE 32
|
||||||
#define SRV_FBINFO 33
|
#define SRV_FBINFO 33
|
||||||
#define SRV_I915_GEM_EXECBUFFER2 34
|
#define SRV_I915_GEM_EXECBUFFER2 34
|
||||||
|
#define SRV_MASK_UPDATE 35
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -272,6 +274,10 @@ int _stdcall display_handler(ioctl_t *io)
|
|||||||
retval = i915_gem_execbuffer2(main_device, inp, file);
|
retval = i915_gem_execbuffer2(main_device, inp, file);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SRV_MASK_UPDATE:
|
||||||
|
retval = i915_mask_update(main_device, inp, file);
|
||||||
|
break;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -29,8 +29,8 @@ struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags
|
|||||||
filep->allocated = 0;
|
filep->allocated = 0;
|
||||||
filep->vma = NULL;
|
filep->vma = NULL;
|
||||||
|
|
||||||
// dbgprintf("%s file %p pages %p count %d\n",
|
printf("%s file %p pages %p count %d\n",
|
||||||
// __FUNCTION__,filep, filep->pages, filep->pages);
|
__FUNCTION__,filep, filep->pages, count);
|
||||||
|
|
||||||
return filep;
|
return filep;
|
||||||
}
|
}
|
||||||
@ -94,4 +94,11 @@ err:
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void shmem_file_delete(struct file *filep)
|
||||||
|
{
|
||||||
|
printf("%s file %p pages %p count %d\n",
|
||||||
|
__FUNCTION__, filep, filep->pages, filep->count);
|
||||||
|
|
||||||
|
if(filep->pages)
|
||||||
|
kfree(filep->pages);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user