cros_gralloc: add support for mt8186

Add build changes for mt8186.
Add ARM metadata types: compression, plane fds and data type.
Add mediatek_drm.h which is not available.

Bug: 388092228
Test: boot corsola with minigbm gralloc/mapper

Change-Id: I1f1e8a57f37e26694320c3ddee01fbad453f854b
This commit is contained in:
Dominik Behr 2025-03-20 17:03:12 -07:00
parent a733122a10
commit a1e715acd8
10 changed files with 322 additions and 7 deletions

62
external/mediatek_drm.h vendored Normal file
View file

@ -0,0 +1,62 @@
/*
* Copyright (c) 2015 MediaTek Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _UAPI_MEDIATEK_DRM_H
#define _UAPI_MEDIATEK_DRM_H
#include "drm.h"
/**
* User-desired buffer creation information structure.
*
* @size: user-desired memory allocation size.
* - this size value would be page-aligned internally.
* @flags: user request for setting memory type or cache attributes.
* @handle: returned a handle to created gem object.
* - this handle will be set by gem module of kernel side.
*/
struct drm_mtk_gem_create {
uint64_t size;
uint32_t flags;
uint32_t handle;
};
/**
* A structure for getting buffer offset.
*
* @handle: a pointer to gem object created.
* @pad: just padding to be 64-bit aligned.
* @offset: relatived offset value of the memory region allocated.
* - this value should be set by user.
*/
struct drm_mtk_gem_map_off {
uint32_t handle;
uint32_t pad;
uint64_t offset;
};
#define DRM_MTK_GEM_CREATE 0x00
#define DRM_MTK_GEM_MAP_OFFSET 0x01
#define DRM_MTK_GEM_CREATE_FLAG_RESTRICTED (1 << 0)
#define DRM_MTK_GEM_CREATE_FLAG_ALLOC_SINGLE_PAGES (1 << 1)
#define DRM_IOCTL_MTK_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \
DRM_MTK_GEM_CREATE, struct drm_mtk_gem_create)
#define DRM_IOCTL_MTK_GEM_MAP_OFFSET DRM_IOWR(DRM_COMMAND_BASE + \
DRM_MTK_GEM_MAP_OFFSET, struct drm_mtk_gem_map_off)
#endif /* _UAPI_MEDIATEK_DRM_H */