case OMX_COLOR_FormatYUV420Planar:
case OMX_COLOR_FormatYUV420SemiPlanar:
case OMX_SEC_COLOR_FormatNV12Tiled:
- usage = GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_YUV_ADDR;
+ usage = GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN;
break;
default:
usage = GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN;
vplanes[0].fd = priv_hnd->fd;
vplanes[0].offset = 0;
vplanes[0].addr = vaddr[0];
- vplanes[1].fd = priv_hnd->u_fd;
- vplanes[1].offset = priv_hnd->uoffset;
+ vplanes[1].fd = priv_hnd->fd1;
+ vplanes[1].offset = 0;
vplanes[1].addr = vaddr[1];
- vplanes[2].fd = priv_hnd->v_fd;
- vplanes[2].offset = priv_hnd->voffset;
+ vplanes[2].fd = priv_hnd->fd2;
+ vplanes[2].offset = 0;
vplanes[2].addr = vaddr[2];
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "%s: buffer locked: 0x%x", __func__, *vaddr);
/* NOTE: OMX_IndexParamGetAndroidNativeBuffer returns original 'nUsage' without any
* modifications since currently not defined what the 'nUsage' is for.
*/
- pANBParams->nUsage |= (GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_EXTERNAL_DISP
- | GRALLOC_USAGE_HW_ION | GRALLOC_USAGE_HWC_HWOVERLAY);
+ pANBParams->nUsage |= (GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_EXTERNAL_DISP);
}
break;
/*
- * Copyright (C) 2010-2011 ARM Limited. All rights reserved.
- *
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
#define GRALLOC_PRIV_H_
#include <stdint.h>
+#include <limits.h>
+#include <sys/cdefs.h>
+#include <hardware/gralloc.h>
#include <pthread.h>
#include <errno.h>
-#include <linux/fb.h>
+#include <unistd.h>
-#include <hardware/gralloc.h>
#include <cutils/native_handle.h>
-#include "ump.h"
-
-/* UGH.. HACK */
-enum {
- GRALLOC_USAGE_HW_FIMC1 = 0x01000000,
- GRALLOC_USAGE_HW_ION = 0x02000000,
- GRALLOC_USAGE_YUV_ADDR = 0x04000000,
- /* SEC Private usage , for Overlay path at HWC */
- GRALLOC_USAGE_HWC_HWOVERLAY = 0x20000000,
-
- /* SEC Private usage , for HWC to set HDMI S3D format */
- /* HDMI should display this buffer as S3D SBS LR/RL*/
- GRALLOC_USAGE_PRIVATE_SBS_LR = 0x00400000,
- GRALLOC_USAGE_PRIVATE_SBS_RL = 0x00200000,
- /* HDMI should display this buffer as 3D TB LR/RL*/
- GRALLOC_USAGE_PRIVATE_TB_LR = 0x00100000,
- GRALLOC_USAGE_PRIVATE_TB_RL = 0x00080000
-};
-
-/*
- * HWC_HWOVERLAY is flag for location of glReadPixel().
- * Enable this define if you want that glReadPixel() is in HWComposer.
- * If you disable this define, glReadPixel() is not called in threadloop().
- */
-#define HWC_HWOVERLAY 1
+#include <linux/fb.h>
-#define GRALLOC_ARM_UMP_MODULE 1
+/*****************************************************************************/
+struct private_module_t;
struct private_handle_t;
-struct private_module_t
-{
+struct private_module_t {
gralloc_module_t base;
+ private_handle_t* framebuffer;
+ uint32_t flags;
+ uint32_t numBuffers;
+ uint32_t bufferMask;
pthread_mutex_t lock;
- int ion_client;
+ buffer_handle_t currentBuffer;
+ int ionfd;
int xres;
int yres;
float xdpi;
float ydpi;
float fps;
- int enableVSync;
-
void *queue;
pthread_mutex_t queue_lock;
- enum {
- PRIV_USAGE_LOCKED_FOR_POST = 0x80000000
- };
};
+/*****************************************************************************/
+
#ifdef __cplusplus
-struct private_handle_t : public native_handle
-{
+struct private_handle_t : public native_handle {
#else
-struct private_handle_t
-{
+struct private_handle_t {
struct native_handle nativeHandle;
#endif
PRIV_FLAGS_USES_ION = 0x00000020
};
- enum {
- LOCK_STATE_WRITE = 1<<31,
- LOCK_STATE_MAPPED = 1<<30,
- LOCK_STATE_READ_MASK = 0x3FFFFFFF
- };
-
- // Following member is for ION memory only
+ // file-descriptors
int fd;
- int u_fd;
- int v_fd;
+ int fd1;
+ int fd2;
+ // ints
int magic;
int flags;
int size;
- int base;
- int lockState;
- int writeOwner;
- int pid;
-
- // Following members are for UMP memory only
- ump_secure_id ump_id;
- ump_handle ump_mem_handle;
-
- // Following members is for framebuffer only
int offset;
- int paddr;
int format;
- int usage;
int width;
int height;
- int bpp;
int stride;
- /* Following members are for YUV information */
- unsigned int yaddr;
- unsigned int uoffset;
- unsigned int voffset;
- int ion_client;
+ // FIXME: the attributes below should be out-of-line
+ void *base;
#ifdef __cplusplus
- static const int sNumInts = 21;
static const int sNumFds = 3;
+ static const int sNumInts = 9;
static const int sMagic = 0x3141592;
- private_handle_t(int flags, int size, int base, int lock_state, ump_secure_id secure_id, ump_handle handle):
- fd(0),
- u_fd(0),
- v_fd(0),
- magic(sMagic),
- flags(flags),
- size(size),
- base(base),
- lockState(lock_state),
- writeOwner(0),
- pid(getpid()),
- ump_id(secure_id),
- ump_mem_handle(handle),
- offset(0),
- format(0),
- usage(0),
- width(0),
- height(0),
- bpp(0),
- stride(0),
- yaddr(0),
- uoffset(0),
- voffset(0)
+
+ private_handle_t(int fd, int size, int flags, int w,
+ int h, int format, int stride) :
+ fd(fd), magic(sMagic), flags(flags), size(size),
+ offset(0), format(format), width(w), height(h), stride(stride), base(0)
{
version = sizeof(native_handle);
- numFds = sNumFds;
numInts = sNumInts;
+ numFds = sNumFds;
+ fd1 = 0;
+ fd2 = 0;
}
- private_handle_t(int flags, int size, int base, int lock_state, int fb_file, int fb_offset):
- fd(fb_file),
- u_fd(0),
- v_fd(0),
- magic(sMagic),
- flags(flags),
- size(size),
- base(base),
- lockState(lock_state),
- writeOwner(0),
- pid(getpid()),
- ump_id(UMP_INVALID_SECURE_ID),
- ump_mem_handle(UMP_INVALID_MEMORY_HANDLE),
- offset(fb_offset),
- format(0),
- usage(0),
- width(0),
- height(0),
- bpp(0),
- stride(0),
- yaddr(0),
- uoffset(0),
- voffset(0)
+ private_handle_t(int fd, int fd1, int fd2, int size, int flags, int w,
+ int h, int format, int stride) :
+ fd(fd), fd1(fd1), fd2(fd2), magic(sMagic), flags(flags), size(size),
+ offset(0), format(format), width(w), height(h), stride(stride), base(0)
{
version = sizeof(native_handle);
- numFds = sNumFds;
numInts = sNumInts;
+ numFds = sNumFds;
}
-
- ~private_handle_t()
- {
+ ~private_handle_t() {
magic = 0;
}
- bool usesPhysicallyContiguousMemory()
- {
- return (flags & PRIV_FLAGS_FRAMEBUFFER) ? true : false;
- }
-
- static int validate(const native_handle* h)
- {
+ static int validate(const native_handle* h) {
const private_handle_t* hnd = (const private_handle_t*)h;
-
if (!h || h->version != sizeof(native_handle) ||
- h->numInts != sNumInts ||
- h->numFds != sNumFds ||
- hnd->magic != sMagic)
+ h->numInts != sNumInts || h->numFds != sNumFds ||
+ hnd->magic != sMagic)
+ {
+ ALOGE("invalid gralloc handle (at %p)", reinterpret_cast<void *>(const_cast<native_handle *>(h)));
return -EINVAL;
-
+ }
return 0;
}
return NULL;
}
+
#endif
};
int fd = 0, i, j;
*stream_id = 0;
*format_actual = HAL_PIXEL_FORMAT_YV12;
- *usage = GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_YUV_ADDR;
+ *usage = GRALLOC_USAGE_SW_WRITE_OFTEN;
*max_buffers = 8;
-
+
m_streamThread->SetParameter(*stream_id, width, height, *format_actual, stream_ops, *usage, fd, &(m_camera_info.preview));
return 0;
}
const private_handle_t *priv_handle = reinterpret_cast<const private_handle_t *>(buffers[i]);
v4l2_buf.m.planes[0].m.fd = priv_handle->fd;
- v4l2_buf.m.planes[1].m.fd = priv_handle->u_fd;
- v4l2_buf.m.planes[2].m.fd = priv_handle->v_fd;
+ v4l2_buf.m.planes[1].m.fd = priv_handle->fd1;
+ v4l2_buf.m.planes[2].m.fd = priv_handle->fd2;
// HACK
m_streamThread->m_parameters.grallocVirtAddr[i] = virtAddr[0];
struct v4l2_plane planes[VIDEO_MAX_PLANES];
-
+
v4l2_buf.m.planes = planes;
v4l2_buf.type = m_camera_info.preview.type;
v4l2_buf.memory = m_camera_info.preview.memory;
const private_handle_t *priv_handle = reinterpret_cast<const private_handle_t *>(*buf);
v4l2_buf.m.planes[0].m.fd = priv_handle->fd;
- v4l2_buf.m.planes[1].m.fd = priv_handle->u_fd;
- v4l2_buf.m.planes[2].m.fd = priv_handle->v_fd;
+ v4l2_buf.m.planes[1].m.fd = priv_handle->fd1;
+ v4l2_buf.m.planes[2].m.fd = priv_handle->fd2;
// HACK
v4l2_buf.m.planes[0].length = 1920*1088;
v4l2_buf.m.planes[1].length = 1920*1088/4;
v4l2_buf.m.planes[2].length = 1920*1088/4;
-
+
if (exynos_v4l2_qbuf(m_camera_info.preview.fd, &v4l2_buf) < 0) {
ALOGE("ERR(%s):preview exynos_v4l2_qbuf() fail", __func__);