int ret;
struct rockchip_gem_object *rk_obj = to_rockchip_obj(obj);
+ /* default is wc. */
+ if (rk_obj->flags & ROCKCHIP_BO_CACHABLE)
+ vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
+
/*
* We allocated a struct page table for rk_obj, so clear
* VM_PFNMAP flag that was set by drm_gem_mmap_obj()/drm_gem_mmap().
static struct rockchip_gem_object *
rockchip_gem_create_with_handle(struct drm_file *file_priv,
struct drm_device *drm, unsigned int size,
- unsigned int *handle)
+ unsigned int *handle, unsigned int flags)
{
struct rockchip_gem_object *rk_obj;
struct drm_gem_object *obj;
if (ret)
goto err_handle_create;
+ rk_obj->flags = flags;
+
/* drop reference from allocate - handle holds it now. */
drm_gem_object_unreference_unlocked(obj);
args->size = args->pitch * args->height;
rk_obj = rockchip_gem_create_with_handle(file_priv, dev, args->size,
- &args->handle);
+ &args->handle, args->flags);
return PTR_ERR_OR_ZERO(rk_obj);
}
struct rockchip_gem_object *rk_obj;
rk_obj = rockchip_gem_create_with_handle(file_priv, dev, args->size,
- &args->handle);
+ &args->handle, args->flags);
return PTR_ERR_OR_ZERO(rk_obj);
}
#include <drm/drm.h>
+/* memory type definitions. */
+enum drm_rockchip_gem_mem_type {
+ /* Physically Continuous memory and used as default. */
+ ROCKCHIP_BO_CONTIG = 0 << 0,
+ /* Physically Non-Continuous memory. */
+ ROCKCHIP_BO_NONCONTIG = 1 << 0,
+ /* non-cachable mapping and used as default. */
+ ROCKCHIP_BO_NONCACHABLE = 0 << 1,
+ /* cachable mapping. */
+ ROCKCHIP_BO_CACHABLE = 1 << 1,
+ /* write-combine mapping. */
+ ROCKCHIP_BO_WC = 1 << 2,
+ ROCKCHIP_BO_MASK = ROCKCHIP_BO_NONCONTIG | ROCKCHIP_BO_CACHABLE |
+ ROCKCHIP_BO_WC
+};
+
/**
* User-desired buffer creation information structure.
*