{
available = gcvFALSE;
}
-#if !gcdDVFS
- available = gcvFALSE;
-#endif
break;
case gcvFEATURE_ACE:
0x0010C,
&data));
-#if gcdDVFS
/* Disable internal DFS. */
- data = ((((gctUINT32) (data)) & ~(((gctUINT32) (((gctUINT32) ((((1 ?
+ data =
+#if gcdDVFS
+ ((((gctUINT32) (data)) & ~(((gctUINT32) (((gctUINT32) ((((1 ?
18:18) - (0 ? 18:18) + 1) == 32) ? ~0U : (~(~0U << ((1 ? 18:18) - (0 ?
18:18) + 1))))))) << (0 ? 18:18))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ?
18:18) - (0 ? 18:18) + 1) == 32) ? ~0U : (~(~0U << ((1 ? 18:18) - (0 ?
- 18:18) + 1))))))) << (0 ? 18:18)));
-
-#else
- /* Disable externl DVFS and auto-gating*/
- data &= ~0x50000;
- data |= 0x20000;
+ 18:18) + 1))))))) << (0 ? 18:18))) |
#endif
+ ((((gctUINT32) (data)) & ~(((gctUINT32) (((gctUINT32) ((((1 ?
+ 16:16) - (0 ? 16:16) + 1) == 32) ? ~0U : (~(~0U << ((1 ? 16:16) - (0 ?
+ 16:16) + 1))))))) << (0 ? 16:16))) | (((gctUINT32) ((gctUINT32) (0) & ((gctUINT32) ((((1 ?
+ 16:16) - (0 ? 16:16) + 1) == 32) ? ~0U : (~(~0U << ((1 ? 16:16) - (0 ?
+ 16:16) + 1))))))) << (0 ? 16:16))) |
+ ((((gctUINT32) (data)) & ~(((gctUINT32) (((gctUINT32) ((((1 ?
+ 17:17) - (0 ? 17:17) + 1) == 32) ? ~0U : (~(~0U << ((1 ? 17:17) - (0 ?
+ 17:17) + 1))))))) << (0 ? 17:17))) | (((gctUINT32) ((gctUINT32) (1) & ((gctUINT32) ((((1 ?
+ 17:17) - (0 ? 17:17) + 1) == 32) ? ~0U : (~(~0U << ((1 ? 17:17) - (0 ?
+ 17:17) + 1))))))) << (0 ? 17:17)));
+
gcmkONERROR(gckOS_WriteRegisterEx(Hardware->os,
Hardware->core,
0x0010C,
case gcvHAL_WRAP_USER_MEMORY:
gcmkONERROR(gckVIDMEM_NODE_WrapUserMemory(Kernel,
&Interface->u.WrapUserMemory.desc,
- &Interface->u.WrapUserMemory.node));
+ &Interface->u.WrapUserMemory.node,
+ &Interface->u.WrapUserMemory.bytes));
gcmkONERROR(
gckKERNEL_AddProcessDB(Kernel,
gckVIDMEM_NODE_WrapUserMemory(
IN gckKERNEL Kernel,
IN gcsUSER_MEMORY_DESC_PTR Desc,
- OUT gctUINT32 * Handle
+ OUT gctUINT32 * Handle,
+ OUT gctUINT64 * Bytes
);
gceSTATUS
gckVIDMEM_NODE_WrapUserMemory(
IN gckKERNEL Kernel,
IN gcsUSER_MEMORY_DESC_PTR Desc,
- OUT gctUINT32 * Handle
+ OUT gctUINT32 * Handle,
+ OUT gctUINT64 * Bytes
)
{
gceSTATUS status = gcvSTATUS_OK;
gcmkVERIFY_OBJECT(Kernel, gcvOBJ_KERNEL);
gcmkVERIFY_ARGUMENT(Desc);
gcmkVERIFY_ARGUMENT(Handle);
+ gcmkVERIFY_ARGUMENT(Bytes);
#if defined(CONFIG_DMA_SHARED_BUFFER)
if (Desc->flag & gcvALLOC_FLAG_DMABUF)
/* Allocate a handle for current process. */
gcmkERR_BREAK(gckVIDMEM_HANDLE_Allocate(Kernel, nodeObject, Handle));
found = gcvTRUE;
+
+ *Bytes = (gctUINT64)dmabuf->size;
}
while (gcvFALSE);
gcvPOOL_VIRTUAL,
Handle
));
+
+ *Bytes = (gctUINT64)node->Virtual.bytes;
}
while (gcvFALSE);
/* Output video mmory node. */
OUT gctUINT32 node;
+ /* size of the node in bytes */
+ OUT gctUINT64 bytes;
}
WrapUserMemory;
*
*****************************************************************************/
+#ifndef __VIVNATE_DRM_H__
+#define __VIVNATE_DRM_H__
-#ifndef __GC_HAL_DRM_H__
-#define __GC_HAL_DRM_H__
+#if !defined(__KERNEL__)
+#include <drm.h>
+#endif
#if defined(__cplusplus)
extern "C" {
#endif
/* creation flag bits. */
-#define DRM_VIV_GEM_CONTIGUOUS 0x01
-#define DRM_VIV_GEM_CACHED 0x02
-#define DRM_VIV_GEM_SECURE 0x04
+#define DRM_VIV_GEM_CONTIGUOUS (1u << 0)
+#define DRM_VIV_GEM_CACHED (1u << 1)
+#define DRM_VIV_GEM_SECURE (1u << 2)
+#define DRM_VIV_GEM_CMA_LIMIT (1u << 3)
struct drm_viv_gem_create {
__u64 size;
}
#endif
-#endif /* __GC_HAL_DRM_H__ */
+#endif /* __VIVNATE_DRM_H__ */
{
flags |= gcvALLOC_FLAG_SECURITY;
}
+ if (args->flags & DRM_VIV_GEM_CMA_LIMIT)
+ {
+ flags |= gcvALLOC_FLAG_CMA_LIMIT;
+ }
gckOS_ZeroMemory(&iface, sizeof(iface));
iface.command = gcvHAL_ALLOCATE_LINEAR_VIDEO_MEMORY;
# include "gc_hal_kernel_sync.h"
#endif
+#if defined(CONFIG_DMA_SHARED_BUFFER)
+#include <linux/dma-buf.h>
+#endif
+
#if defined(CONFIG_ARM) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
#include <dma.h>
#endif
#endif
{
/* remove LSB. */
- phys &= ~(4096ul - 1);
+ phys &= ~(4096ull - 1);
#if gcdENABLE_VG
if (Core == gcvCORE_VG)
gceSTATUS status = gcvSTATUS_OUT_OF_MEMORY;
gckALLOCATOR allocator;
gcsATTACH_DESC desc;
+ gctSIZE_T bytes = 0;
gcmkHEADER_ARG("Os=0x%X ", Os);
if (Desc->flag & gcvALLOC_FLAG_DMABUF)
{
desc.dmaBuf.dmabuf = gcmUINT64_TO_PTR(Desc->dmabuf);
+
+#if defined(CONFIG_DMA_SHARED_BUFFER)
+ {
+ struct dma_buf *dmabuf = (struct dma_buf*)desc.dmaBuf.dmabuf;
+ bytes = dmabuf->size;
+ }
+#endif
}
else if (Desc->flag & gcvALLOC_FLAG_USERMEMORY)
{
desc.userMem.memory = gcmUINT64_TO_PTR(Desc->logical);
desc.userMem.physical = Desc->physical;
desc.userMem.size = Desc->size;
+ bytes = Desc->size;
}
else if (Desc->flag & gcvALLOC_FLAG_EXTERNAL_MEMORY)
{
mdl->dmaHandle = 0;
mdl->addr = 0;
- *Bytes = mdl->numPages * PAGE_SIZE;
+ *Bytes = bytes ? bytes : mdl->numPages * PAGE_SIZE;
/* Return physical address. */
*Physical = (gctPHYS_ADDR) mdl;
/* Private data used by allocator. */
void * priv;
- /* exported dma_buf */
- void * dmabuf;
-
uint gid;
struct list_head link;