Upgrade minigbm to 3dd534cca2
This project was upgraded with external_updater. Usage: tools/external_updater/updater.sh update external/minigbm For more info, check https://cs.android.com/android/platform/superproject/main/+/main:tools/external_updater/README.md Bug: 378461707 Test: TreeHugger Change-Id: Ia66fa770f9c0d8a3c7539602eaa324e7341163b8
This commit is contained in:
commit
0c5b7a6dd0
5 changed files with 72 additions and 28 deletions
20
Android.bp
20
Android.bp
|
|
@ -59,8 +59,8 @@ filegroup {
|
||||||
|
|
||||||
srcs: [
|
srcs: [
|
||||||
"cros_gralloc/cros_gralloc_buffer.cc",
|
"cros_gralloc/cros_gralloc_buffer.cc",
|
||||||
"cros_gralloc/cros_gralloc_helpers.cc",
|
|
||||||
"cros_gralloc/cros_gralloc_driver.cc",
|
"cros_gralloc/cros_gralloc_driver.cc",
|
||||||
|
"cros_gralloc/cros_gralloc_helpers.cc",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -77,8 +77,8 @@ intel_cflags = [
|
||||||
meson_cflags = ["-DDRV_MESON"]
|
meson_cflags = ["-DDRV_MESON"]
|
||||||
msm_cflags = [
|
msm_cflags = [
|
||||||
"-DDRV_MSM",
|
"-DDRV_MSM",
|
||||||
"-DQCOM_DISABLE_COMPRESSED_NV12",
|
|
||||||
"-DHAS_DMABUF_SYSTEM_HEAP",
|
"-DHAS_DMABUF_SYSTEM_HEAP",
|
||||||
|
"-DQCOM_DISABLE_COMPRESSED_NV12",
|
||||||
]
|
]
|
||||||
arcvm_cflags = ["-DVIRTIO_GPU_NEXT"]
|
arcvm_cflags = ["-DVIRTIO_GPU_NEXT"]
|
||||||
|
|
||||||
|
|
@ -86,14 +86,14 @@ cc_defaults {
|
||||||
name: "minigbm_defaults",
|
name: "minigbm_defaults",
|
||||||
|
|
||||||
cflags: [
|
cflags: [
|
||||||
"-D_GNU_SOURCE=1",
|
|
||||||
"-D_FILE_OFFSET_BITS=64",
|
"-D_FILE_OFFSET_BITS=64",
|
||||||
|
"-D_GNU_SOURCE=1",
|
||||||
"-Wall",
|
"-Wall",
|
||||||
"-Wsign-compare",
|
|
||||||
"-Wpointer-arith",
|
|
||||||
"-Wcast-qual",
|
|
||||||
"-Wcast-align",
|
"-Wcast-align",
|
||||||
|
"-Wcast-qual",
|
||||||
"-Wno-unused-parameter",
|
"-Wno-unused-parameter",
|
||||||
|
"-Wpointer-arith",
|
||||||
|
"-Wsign-compare",
|
||||||
] + select(soong_config_variable("minigbm", "platform"), {
|
] + select(soong_config_variable("minigbm", "platform"), {
|
||||||
"generic": generic_cflags,
|
"generic": generic_cflags,
|
||||||
"intel": intel_cflags,
|
"intel": intel_cflags,
|
||||||
|
|
@ -138,9 +138,9 @@ cc_defaults {
|
||||||
"libdmabufheap",
|
"libdmabufheap",
|
||||||
"libdrm",
|
"libdrm",
|
||||||
"libgralloctypes",
|
"libgralloctypes",
|
||||||
|
"liblog",
|
||||||
"libnativewindow",
|
"libnativewindow",
|
||||||
"libsync",
|
"libsync",
|
||||||
"liblog",
|
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -195,8 +195,8 @@ cc_library {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
apex_available: [
|
apex_available: [
|
||||||
"//apex_available:platform",
|
|
||||||
"//apex_available:anyapex",
|
"//apex_available:anyapex",
|
||||||
|
"//apex_available:platform",
|
||||||
],
|
],
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
product_available: true,
|
product_available: true,
|
||||||
|
|
@ -211,10 +211,10 @@ rust_bindgen {
|
||||||
wrapper_src: "rust/gbm_wrapper.h",
|
wrapper_src: "rust/gbm_wrapper.h",
|
||||||
source_stem: "bindings",
|
source_stem: "bindings",
|
||||||
bindgen_flags: [
|
bindgen_flags: [
|
||||||
"--blocklist-type=__BINDGEN_TMP_.*",
|
|
||||||
"--allowlist-type=^gbm_.*$",
|
|
||||||
"--allowlist-function=^gbm_.*$",
|
"--allowlist-function=^gbm_.*$",
|
||||||
|
"--allowlist-type=^gbm_.*$",
|
||||||
"--allowlist-var=GBM_.*|gbm_.*$",
|
"--allowlist-var=GBM_.*|gbm_.*$",
|
||||||
|
"--blocklist-type=__BINDGEN_TMP_.*",
|
||||||
"--constified-enum-module=^gbm_.*$",
|
"--constified-enum-module=^gbm_.*$",
|
||||||
],
|
],
|
||||||
shared_libs: ["libgbm"],
|
shared_libs: ["libgbm"],
|
||||||
|
|
|
||||||
10
METADATA
10
METADATA
|
|
@ -1,16 +1,20 @@
|
||||||
|
# This project was upgraded with external_updater.
|
||||||
|
# Usage: tools/external_updater/updater.sh update external/minigbm
|
||||||
|
# For more info, check https://cs.android.com/android/platform/superproject/main/+/main:tools/external_updater/README.md
|
||||||
|
|
||||||
name: "minigbm"
|
name: "minigbm"
|
||||||
description: ""
|
description: ""
|
||||||
third_party {
|
third_party {
|
||||||
license_type: NOTICE
|
license_type: NOTICE
|
||||||
last_upgrade_date {
|
last_upgrade_date {
|
||||||
year: 2024
|
year: 2025
|
||||||
month: 3
|
month: 3
|
||||||
day: 12
|
day: 20
|
||||||
}
|
}
|
||||||
homepage: "https://www.chromium.org/"
|
homepage: "https://www.chromium.org/"
|
||||||
identifier {
|
identifier {
|
||||||
type: "Git"
|
type: "Git"
|
||||||
value: "https://chromium.googlesource.com/chromiumos/platform/minigbm/"
|
value: "https://chromium.googlesource.com/chromiumos/platform/minigbm/"
|
||||||
version: "40b28f098a29589b3f72de1ba6753d46a616c48b"
|
version: "3dd534cca22443d6ed2c7c0e2929a0a47c2a524c"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ uint64_t cros_gralloc_convert_usage(uint64_t usage)
|
||||||
handle_usage(&usage, GRALLOC_USAGE_EXTERNAL_DISP, &use_flags, BO_USE_NONE);
|
handle_usage(&usage, GRALLOC_USAGE_EXTERNAL_DISP, &use_flags, BO_USE_NONE);
|
||||||
/* Map PROTECTED to linear until real HW protection is available on Android. */
|
/* Map PROTECTED to linear until real HW protection is available on Android. */
|
||||||
handle_usage(&usage, GRALLOC_USAGE_PROTECTED, &use_flags, BO_USE_LINEAR);
|
handle_usage(&usage, GRALLOC_USAGE_PROTECTED, &use_flags, BO_USE_LINEAR);
|
||||||
handle_usage(&usage, GRALLOC_USAGE_CURSOR, &use_flags, BO_USE_NONE);
|
handle_usage(&usage, GRALLOC_USAGE_CURSOR, &use_flags, BO_USE_CURSOR);
|
||||||
/* HACK: See b/30054495 for BO_USE_SW_READ_OFTEN. */
|
/* HACK: See b/30054495 for BO_USE_SW_READ_OFTEN. */
|
||||||
handle_usage(&usage, GRALLOC_USAGE_HW_VIDEO_ENCODER, &use_flags,
|
handle_usage(&usage, GRALLOC_USAGE_HW_VIDEO_ENCODER, &use_flags,
|
||||||
BO_USE_HW_VIDEO_ENCODER | BO_USE_SW_READ_OFTEN);
|
BO_USE_HW_VIDEO_ENCODER | BO_USE_SW_READ_OFTEN);
|
||||||
|
|
|
||||||
25
i915.c
25
i915.c
|
|
@ -564,10 +564,9 @@ static size_t i915_num_planes_from_modifier(struct driver *drv, uint32_t format,
|
||||||
static int i915_bo_compute_metadata(struct bo *bo, uint32_t width, uint32_t height, uint32_t format,
|
static int i915_bo_compute_metadata(struct bo *bo, uint32_t width, uint32_t height, uint32_t format,
|
||||||
uint64_t use_flags, const uint64_t *modifiers, uint32_t count)
|
uint64_t use_flags, const uint64_t *modifiers, uint32_t count)
|
||||||
{
|
{
|
||||||
uint64_t modifier;
|
|
||||||
struct i915_device *i915 = bo->drv->priv;
|
struct i915_device *i915 = bo->drv->priv;
|
||||||
bool huge_bo = (i915->graphics_version < 11) && (width > 4096);
|
|
||||||
|
|
||||||
|
uint64_t modifier;
|
||||||
if (modifiers) {
|
if (modifiers) {
|
||||||
modifier =
|
modifier =
|
||||||
drv_pick_modifier(modifiers, count, i915->modifier.order, i915->modifier.count);
|
drv_pick_modifier(modifiers, count, i915->modifier.order, i915->modifier.count);
|
||||||
|
|
@ -578,10 +577,32 @@ static int i915_bo_compute_metadata(struct bo *bo, uint32_t width, uint32_t heig
|
||||||
modifier = combo->metadata.modifier;
|
modifier = combo->metadata.modifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For cursor buffer, add padding as needed to reach a known cursor-plane-supported
|
||||||
|
* buffer size, as reported by the cursor capability properties.
|
||||||
|
*
|
||||||
|
* If the requested dimensions exceed either of the reported capabilities, or if the
|
||||||
|
* capabilities couldn't be read, silently fallback by continuing without additional
|
||||||
|
* padding. The buffer can still be used normally, and be committed to non-cursor
|
||||||
|
* planes.
|
||||||
|
*/
|
||||||
|
if (use_flags & BO_USE_CURSOR) {
|
||||||
|
uint64_t cursor_width = 0;
|
||||||
|
uint64_t cursor_height = 0;
|
||||||
|
bool err = drmGetCap(bo->drv->fd, DRM_CAP_CURSOR_WIDTH, &cursor_width) ||
|
||||||
|
drmGetCap(bo->drv->fd, DRM_CAP_CURSOR_HEIGHT, &cursor_height);
|
||||||
|
|
||||||
|
if (!err && width <= cursor_width && height <= cursor_height) {
|
||||||
|
width = cursor_width;
|
||||||
|
height = cursor_height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* i915 only supports linear/x-tiled above 4096 wide on Gen9/Gen10 GPU.
|
* i915 only supports linear/x-tiled above 4096 wide on Gen9/Gen10 GPU.
|
||||||
* VAAPI decode in NV12 Y tiled format so skip modifier change for NV12/P010 huge bo.
|
* VAAPI decode in NV12 Y tiled format so skip modifier change for NV12/P010 huge bo.
|
||||||
*/
|
*/
|
||||||
|
bool huge_bo = (i915->graphics_version < 11) && (width > 4096);
|
||||||
if (huge_bo && format != DRM_FORMAT_NV12 && format != DRM_FORMAT_P010 &&
|
if (huge_bo && format != DRM_FORMAT_NV12 && format != DRM_FORMAT_P010 &&
|
||||||
modifier != I915_FORMAT_MOD_X_TILED && modifier != DRM_FORMAT_MOD_LINEAR) {
|
modifier != I915_FORMAT_MOD_X_TILED && modifier != DRM_FORMAT_MOD_LINEAR) {
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ struct cross_domain_private {
|
||||||
uint32_t ring_handle;
|
uint32_t ring_handle;
|
||||||
void *ring_addr;
|
void *ring_addr;
|
||||||
struct drv_array *metadata_cache;
|
struct drv_array *metadata_cache;
|
||||||
pthread_mutex_t metadata_cache_lock;
|
pthread_mutex_t bo_create_lock;
|
||||||
bool mt8183_camera_quirk_;
|
bool mt8183_camera_quirk_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -61,7 +61,7 @@ static void cross_domain_release_private(struct driver *drv)
|
||||||
if (priv->metadata_cache)
|
if (priv->metadata_cache)
|
||||||
drv_array_destroy(priv->metadata_cache);
|
drv_array_destroy(priv->metadata_cache);
|
||||||
|
|
||||||
pthread_mutex_destroy(&priv->metadata_cache_lock);
|
pthread_mutex_destroy(&priv->bo_create_lock);
|
||||||
|
|
||||||
free(priv);
|
free(priv);
|
||||||
}
|
}
|
||||||
|
|
@ -155,14 +155,13 @@ static int cross_domain_metadata_query(struct driver *drv, struct bo_metadata *m
|
||||||
uint32_t plane;
|
uint32_t plane;
|
||||||
|
|
||||||
memset(&cmd_get_reqs, 0, sizeof(cmd_get_reqs));
|
memset(&cmd_get_reqs, 0, sizeof(cmd_get_reqs));
|
||||||
pthread_mutex_lock(&priv->metadata_cache_lock);
|
|
||||||
for (uint32_t i = 0; i < drv_array_size(priv->metadata_cache); i++) {
|
for (uint32_t i = 0; i < drv_array_size(priv->metadata_cache); i++) {
|
||||||
cached_data = (struct bo_metadata *)drv_array_at_idx(priv->metadata_cache, i);
|
cached_data = (struct bo_metadata *)drv_array_at_idx(priv->metadata_cache, i);
|
||||||
if (!metadata_equal(metadata, cached_data))
|
if (!metadata_equal(metadata, cached_data))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
memcpy(metadata, cached_data, sizeof(*cached_data));
|
memcpy(metadata, cached_data, sizeof(*cached_data));
|
||||||
goto out_unlock;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_get_reqs.hdr.cmd = CROSS_DOMAIN_CMD_GET_IMAGE_REQUIREMENTS;
|
cmd_get_reqs.hdr.cmd = CROSS_DOMAIN_CMD_GET_IMAGE_REQUIREMENTS;
|
||||||
|
|
@ -192,7 +191,7 @@ static int cross_domain_metadata_query(struct driver *drv, struct bo_metadata *m
|
||||||
ret = cross_domain_submit_cmd(drv, (uint32_t *)&cmd_get_reqs, cmd_get_reqs.hdr.cmd_size,
|
ret = cross_domain_submit_cmd(drv, (uint32_t *)&cmd_get_reqs, cmd_get_reqs.hdr.cmd_size,
|
||||||
true);
|
true);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto out_unlock;
|
return ret;
|
||||||
|
|
||||||
memcpy(&metadata->strides, &addr[0], 4 * sizeof(uint32_t));
|
memcpy(&metadata->strides, &addr[0], 4 * sizeof(uint32_t));
|
||||||
memcpy(&metadata->offsets, &addr[4], 4 * sizeof(uint32_t));
|
memcpy(&metadata->offsets, &addr[4], 4 * sizeof(uint32_t));
|
||||||
|
|
@ -211,10 +210,7 @@ static int cross_domain_metadata_query(struct driver *drv, struct bo_metadata *m
|
||||||
metadata->sizes[plane - 1] = metadata->total_size - metadata->offsets[plane - 1];
|
metadata->sizes[plane - 1] = metadata->total_size - metadata->offsets[plane - 1];
|
||||||
|
|
||||||
drv_array_append(priv->metadata_cache, metadata);
|
drv_array_append(priv->metadata_cache, metadata);
|
||||||
|
return 0;
|
||||||
out_unlock:
|
|
||||||
pthread_mutex_unlock(&priv->metadata_cache_lock);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill out metadata for guest buffers, used only for CPU access: */
|
/* Fill out metadata for guest buffers, used only for CPU access: */
|
||||||
|
|
@ -264,7 +260,7 @@ static int cross_domain_init(struct driver *drv)
|
||||||
if (!priv)
|
if (!priv)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
ret = pthread_mutex_init(&priv->metadata_cache_lock, NULL);
|
ret = pthread_mutex_init(&priv->bo_create_lock, NULL);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
free(priv);
|
free(priv);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
@ -367,8 +363,8 @@ static void cross_domain_close(struct driver *drv)
|
||||||
cross_domain_release_private(drv);
|
cross_domain_release_private(drv);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cross_domain_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint32_t format,
|
static int cross_domain_bo_create_locked(struct bo *bo, uint32_t width, uint32_t height,
|
||||||
uint64_t use_flags)
|
uint32_t format, uint64_t use_flags)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
uint32_t blob_flags = VIRTGPU_BLOB_FLAG_USE_SHAREABLE;
|
uint32_t blob_flags = VIRTGPU_BLOB_FLAG_USE_SHAREABLE;
|
||||||
|
|
@ -418,6 +414,29 @@ static int cross_domain_bo_create(struct bo *bo, uint32_t width, uint32_t height
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int cross_domain_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint32_t format,
|
||||||
|
uint64_t use_flags)
|
||||||
|
{
|
||||||
|
|
||||||
|
int ret = 0;
|
||||||
|
struct cross_domain_private *priv = bo->drv->priv;
|
||||||
|
|
||||||
|
// HACK(b/395748805): Any host GET_IMAGE_REQUIREMENTS request must be immediately followed
|
||||||
|
// by the matching CREATE_BLOB request, as the current implementation in crosvm stashes a
|
||||||
|
// single buffer allocation for the first to be returned by the second. We ensure the two
|
||||||
|
// requests are made back to back by using a mutex lock, where the lock is acquired for the
|
||||||
|
// duration of the allocation requests.
|
||||||
|
//
|
||||||
|
// This forces all guest allocations to be made in serial order, and allows the host buffer
|
||||||
|
// stash to be an optimization.
|
||||||
|
pthread_mutex_lock(&priv->bo_create_lock);
|
||||||
|
|
||||||
|
ret = cross_domain_bo_create_locked(bo, width, height, format, use_flags);
|
||||||
|
|
||||||
|
pthread_mutex_unlock(&priv->bo_create_lock);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static void *cross_domain_bo_map(struct bo *bo, struct vma *vma, uint32_t map_flags)
|
static void *cross_domain_bo_map(struct bo *bo, struct vma *vma, uint32_t map_flags)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue