diff options
author | Alan Cox <alan@linux.intel.com> | 2011-07-15 17:33:08 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-07-15 19:05:06 +0200 |
commit | 7d7b7adf6bf934064c8fdc4031e75f1a20aaac92 (patch) | |
tree | efa5f2eeb0ce521a1421766e76f05bcb19ae0180 | |
parent | 7dfe43c52d2cd595964c38281499c5361a0a8e85 (diff) | |
download | op-kernel-dev-7d7b7adf6bf934064c8fdc4031e75f1a20aaac92.zip op-kernel-dev-7d7b7adf6bf934064c8fdc4031e75f1a20aaac92.tar.gz |
gma500: allow the creation of 'stolen' memory objects
For things like cursors and many kinds of framebuffer set up we are actually
best using the stolen memory when possible.
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/staging/gma500/gem.c | 24 | ||||
-rw-r--r-- | drivers/staging/gma500/psb_drm.h | 3 |
2 files changed, 26 insertions, 1 deletions
diff --git a/drivers/staging/gma500/gem.c b/drivers/staging/gma500/gem.c index d7b74b6..65fdd6b 100644 --- a/drivers/staging/gma500/gem.c +++ b/drivers/staging/gma500/gem.c @@ -251,6 +251,21 @@ fail: } } +static int psb_gem_create_stolen(struct drm_file *file, struct drm_device *dev, + int size, u32 *handle) +{ + struct gtt_range *gtt = psb_gtt_alloc_range(dev, size, "gem", 1); + if (gtt == NULL) + return -ENOMEM; + if (drm_gem_private_object_init(dev, >t->gem, size) != 0) + goto free_gtt; + if (drm_gem_handle_create(file, >t->gem, handle) == 0) + return 0; +free_gtt: + psb_gtt_free_range(dev, gtt); + return -ENOMEM; +} + /* * GEM interfaces for our specific client */ @@ -258,6 +273,15 @@ int psb_gem_create_ioctl(struct drm_device *dev, void *data, struct drm_file *file) { struct drm_psb_gem_create *args = data; + int ret; + if (args->flags & PSB_GEM_CREATE_STOLEN) { + ret = psb_gem_create_stolen(file, dev, args->size, + &args->handle); + if (ret == 0) + return 0; + /* Fall throguh */ + args->flags &= ~PSB_GEM_CREATE_STOLEN; + } return psb_gem_create(file, dev, args->size, &args->handle); } diff --git a/drivers/staging/gma500/psb_drm.h b/drivers/staging/gma500/psb_drm.h index 70115a9..0da8468 100644 --- a/drivers/staging/gma500/psb_drm.h +++ b/drivers/staging/gma500/psb_drm.h @@ -189,7 +189,8 @@ struct psb_drm_dpu_rect { struct drm_psb_gem_create { __u64 size; __u32 handle; - __u32 pad; + __u32 flags; +#define PSB_GEM_CREATE_STOLEN 1 /* Stolen memory can be used */ }; #define PSB_2D_OP_BUFLEN 16 |