UPSTREAM: presubmit: switch to cros format

Rather than use `clang-format` from $PATH (which changes between devs),
use `cros format` which has a pinned version for all people.

Add *.cpp to the include list as not all C++ files use *.cc.

Then run format on the files to fix latent issues.

BUG=None
TEST=./presubmit.sh

Change-Id: I28e167d454a7b089bb79e932b7265fa87e4c331f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/6475964
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Ryan Neph <ryanneph@google.com>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Dominik Behr <dbehr@chromium.org>

Bug: None
Test: lunch brya-trunk_staging-userdebug && m libminigbm_gralloc
Change-Id: I23022dbb536ade53951fe61014c5056e114f4bbc
This commit is contained in:
Mike Frysinger 2025-04-21 09:14:10 -04:00 committed by Ryan Neph
parent ce30391748
commit bc47e98159
11 changed files with 65 additions and 67 deletions

View file

@ -7,25 +7,18 @@
#define ARRAY_SIZE(A) (sizeof(A) / sizeof(*(A)))
static const uint32_t scanout_render_formats[] = {
DRM_FORMAT_ABGR2101010,
DRM_FORMAT_ABGR8888,
DRM_FORMAT_ARGB2101010,
DRM_FORMAT_ARGB8888,
DRM_FORMAT_RGB565,
DRM_FORMAT_XBGR2101010,
DRM_FORMAT_XBGR8888,
DRM_FORMAT_XRGB2101010,
DRM_FORMAT_XRGB8888,
DRM_FORMAT_ABGR2101010, DRM_FORMAT_ABGR8888, DRM_FORMAT_ARGB2101010,
DRM_FORMAT_ARGB8888, DRM_FORMAT_RGB565, DRM_FORMAT_XBGR2101010,
DRM_FORMAT_XBGR8888, DRM_FORMAT_XRGB2101010, DRM_FORMAT_XRGB8888,
};
static const uint32_t render_formats[] = { DRM_FORMAT_ABGR16161616F, };
static const uint32_t render_formats[] = {
DRM_FORMAT_ABGR16161616F,
};
static const uint32_t texture_only_formats[] = {
DRM_FORMAT_R8,
DRM_FORMAT_NV12,
DRM_FORMAT_P010,
DRM_FORMAT_YVU420,
DRM_FORMAT_YVU420_ANDROID,
DRM_FORMAT_R8, DRM_FORMAT_NV12, DRM_FORMAT_P010,
DRM_FORMAT_YVU420, DRM_FORMAT_YVU420_ANDROID,
};
static const uint32_t image_storage_formats[] = {
@ -65,17 +58,23 @@ const uint16_t gen12_ids[] = {
};
const uint16_t adlp_ids[] = {
0x46A0, 0x46A1, 0x46A2, 0x46A3, 0x46A6, 0x46A8, 0x46AA, 0x462A, 0x4626, 0x4628,
0x46B0, 0x46B1, 0x46B2, 0x46B3, 0x46C0, 0x46C1, 0x46C2, 0x46C3, 0x46D0, 0x46D1,
0x46D2, 0x46D3, 0x46D4,
0x46A0, 0x46A1, 0x46A2, 0x46A3, 0x46A6, 0x46A8, 0x46AA, 0x462A,
0x4626, 0x4628, 0x46B0, 0x46B1, 0x46B2, 0x46B3, 0x46C0, 0x46C1,
0x46C2, 0x46C3, 0x46D0, 0x46D1, 0x46D2, 0x46D3, 0x46D4,
};
const uint16_t rplp_ids[] = {
0xA720, 0xA721, 0xA7A0, 0xA7A1, 0xA7A8, 0xA7A9, 0xA7AA, 0xA7AB, 0xA7AC, 0xA7AD,
};
const uint16_t mtl_ids[] = { 0x7D40, 0x7D60, 0x7D45, 0x7D55, 0x7DD5, };
const uint16_t mtl_ids[] = {
0x7D40, 0x7D60, 0x7D45, 0x7D55, 0x7DD5,
};
const uint16_t lnl_ids[] = { 0x6420, 0x64A0, 0x64B0, };
const uint16_t lnl_ids[] = {
0x6420,
0x64A0,
0x64B0,
};
const uint16_t ptl_ids[] = { 0xB080, 0xB081, 0xB082, 0xB083, 0xB08F, 0xB090, 0xB0A0, 0xB0B0 };

View file

@ -2,9 +2,10 @@
# Copyright 2017 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
find \
'(' -name '*.[ch]' -or -name '*.cc' ')' \
-not -name 'virtgpu_drm.h' -not -name 'i915_drm.h' \
-not -name 'gbm.h' -not -name 'virgl_hw.h' \
-not -name 'virgl_protocol.h' \
-exec clang-format -style=file -i {} +
cros format \
--exclude 'external/*' \
--exclude 'gbm.h' \
--include '*.[ch]' \
--include '*.cc' \
--include '*.cpp' \
.

View file

@ -53,10 +53,9 @@ static const uint32_t texture_source_formats[] = {
DRM_FORMAT_ABGR2101010, DRM_FORMAT_ABGR16161616F
};
static const uint32_t depth_stencil_formats[] = {
DRM_FORMAT_DEPTH16, DRM_FORMAT_DEPTH24, DRM_FORMAT_DEPTH24_STENCIL8,
DRM_FORMAT_DEPTH32, DRM_FORMAT_DEPTH32_STENCIL8
};
static const uint32_t depth_stencil_formats[] = { DRM_FORMAT_DEPTH16, DRM_FORMAT_DEPTH24,
DRM_FORMAT_DEPTH24_STENCIL8, DRM_FORMAT_DEPTH32,
DRM_FORMAT_DEPTH32_STENCIL8 };
extern struct virtgpu_param params[];

13
xe.c
View file

@ -19,8 +19,8 @@
#include "drv_priv.h"
#include "external/xe_drm.h"
#include "util.h"
#include "intel_defines.h"
#include "util.h"
struct modifier_support_t {
const uint64_t *order;
@ -318,7 +318,6 @@ static bool xe_query_config(struct driver *drv, struct xe_device *xe)
if (drmIoctl(drv->fd, DRM_IOCTL_XE_DEVICE_QUERY, &query))
goto data_query_failed;
if (config->info[DRM_XE_QUERY_CONFIG_FLAGS] & DRM_XE_QUERY_CONFIG_FLAG_HAS_VRAM)
xe->has_local_mem = true;
else
@ -360,7 +359,8 @@ static bool xe_device_probe(struct driver *drv, struct xe_device *xe)
return false;
}
xe->device_id = ((config->info[DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID] << 16)>>16) & 0xFFFF;
xe->device_id =
((config->info[DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID] << 16) >> 16) & 0xFFFF;
xe->revision = (config->info[DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID] >> 16) & 0xFFFF;
free(config);
@ -406,8 +406,7 @@ return 0;
* to the largest coded unit (LCU) assuming that it will be used for video. This
* is based on gmmlib's GmmIsYUVFormatLCUAligned().
*/
static bool xe_format_needs_LCU_alignment(uint32_t format, size_t plane,
const struct xe_device *xe)
static bool xe_format_needs_LCU_alignment(uint32_t format, size_t plane, const struct xe_device *xe)
{
switch (format) {
case DRM_FORMAT_NV12:
@ -711,8 +710,8 @@ static void *xe_bo_map(struct bo *bo, struct vma *vma, uint32_t map_flags)
/* Get the fake offset back */
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_XE_GEM_MMAP_OFFSET, &gem_map);
if (ret == 0) {
addr = mmap(0, bo->meta.total_size, PROT_READ | PROT_WRITE,
MAP_SHARED, bo->drv->fd, gem_map.offset);
addr = mmap(0, bo->meta.total_size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->drv->fd,
gem_map.offset);
}
if (addr == MAP_FAILED) {