summaryrefslogtreecommitdiff
path: root/gralloc
diff options
context:
space:
mode:
authorRebecca Schultz Zavin <rebecca@android.com>2012-08-15 17:03:47 -0700
committerRebecca Schultz Zavin <rebecca@android.com>2012-08-16 11:58:15 -0700
commitda3d871233c291dd2c472c4a7f6bfe35e7c06fc9 (patch)
tree5c236728cd133b45fc4ca082a27829bd8ce6ef36 /gralloc
parent70212e566f17b06d5ce613ab5ef1204334f03b86 (diff)
downloadexynos5-da3d871233c291dd2c472c4a7f6bfe35e7c06fc9.tar.gz
gralloc: Store the usage flags in the gralloc handles
Change-Id: I2e81eb98eb8d09e61ba53776cb35de0ad6e9e74a Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Diffstat (limited to 'gralloc')
-rw-r--r--gralloc/gralloc.cpp35
1 files changed, 20 insertions, 15 deletions
diff --git a/gralloc/gralloc.cpp b/gralloc/gralloc.cpp
index 85774b5..c43ce41 100644
--- a/gralloc/gralloc.cpp
+++ b/gralloc/gralloc.cpp
@@ -111,8 +111,8 @@ framebuffer: 0,
#define ALIGN(x, a) (((x) + (a - 1)) & ~(a - 1))
-static int gralloc_alloc_rgb(int ionfd, int w, int h, int format, int flags,
- private_handle_t **hnd, int *stride)
+static int gralloc_alloc_rgb(int ionfd, int w, int h, int format, int usage,
+ unsigned int ion_flags, private_handle_t **hnd, int *stride)
{
size_t size, bpr;
int bpp = 0, vstride, fd, err;
@@ -143,14 +143,16 @@ static int gralloc_alloc_rgb(int ionfd, int w, int h, int format, int flags,
*stride = bpr / bpp;
size = ALIGN(size, PAGE_SIZE);
- err = ion_alloc_fd(ionfd, size, 0, 1 << ION_HEAP_TYPE_SYSTEM, flags, &fd);
- *hnd = new private_handle_t(fd, size, 0, w, h, format, *stride, vstride);
+ err = ion_alloc_fd(ionfd, size, 0, 1 << ION_HEAP_TYPE_SYSTEM, ion_flags,
+ &fd);
+ *hnd = new private_handle_t(fd, size, usage, w, h, format, *stride,
+ vstride);
return err;
}
-static int gralloc_alloc_yuv(int ionfd, int w, int h, int format, int flags,
- private_handle_t **hnd, int *stride)
+static int gralloc_alloc_yuv(int ionfd, int w, int h, int format, int usage,
+ unsigned int ion_flags, private_handle_t **hnd, int *stride)
{
size_t luma_size, chroma_size;
int err, planes, fd, fd1, fd2 = 0;
@@ -183,22 +185,23 @@ static int gralloc_alloc_yuv(int ionfd, int w, int h, int format, int flags,
return -EINVAL;
}
- err = ion_alloc_fd(ionfd, luma_size, 0, 1 << ION_HEAP_TYPE_SYSTEM, flags,
- &fd);
+ err = ion_alloc_fd(ionfd, luma_size, 0, 1 << ION_HEAP_TYPE_SYSTEM,
+ ion_flags, &fd);
if (err)
return err;
- err = ion_alloc_fd(ionfd, chroma_size, 0, 1 << ION_HEAP_TYPE_SYSTEM, flags,
+ err = ion_alloc_fd(ionfd, chroma_size, 0, 1 << ION_HEAP_TYPE_SYSTEM,
+ ion_flags,
&fd1);
if (err)
goto err1;
if (planes == 3) {
err = ion_alloc_fd(ionfd, chroma_size, 0, 1 << ION_HEAP_TYPE_SYSTEM,
- flags, &fd2);
+ ion_flags, &fd2);
if (err)
goto err2;
}
- *hnd = new private_handle_t(fd, fd1, fd2, luma_size, 0, w, h, format,
+ *hnd = new private_handle_t(fd, fd1, fd2, luma_size, usage, w, h, format,
*stride, luma_vstride);
return err;
@@ -215,23 +218,25 @@ static int gralloc_alloc(alloc_device_t* dev,
{
int stride;
int err;
- int flags = 0;
+ unsigned int ion_flags = 0;
private_handle_t *hnd;
if (!pHandle || !pStride)
return -EINVAL;
if( (usage & GRALLOC_USAGE_SW_READ_MASK) == GRALLOC_USAGE_SW_READ_OFTEN )
- flags = ION_FLAG_CACHED;
+ ion_flags = ION_FLAG_CACHED;
private_module_t* m = reinterpret_cast<private_module_t*>
(dev->common.module);
gralloc_module_t* module = reinterpret_cast<gralloc_module_t*>
(dev->common.module);
- err = gralloc_alloc_rgb(m->ionfd, w, h, format, flags, &hnd, &stride);
+ err = gralloc_alloc_rgb(m->ionfd, w, h, format, usage, ion_flags, &hnd,
+ &stride);
if (err)
- err = gralloc_alloc_yuv(m->ionfd, w, h, format, flags, &hnd, &stride);
+ err = gralloc_alloc_yuv(m->ionfd, w, h, format, usage, ion_flags,
+ &hnd, &stride);
if (err)
return err;