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:
parent
ce30391748
commit
bc47e98159
11 changed files with 65 additions and 67 deletions
|
|
@ -22,7 +22,7 @@
|
||||||
#include <sync/sync.h>
|
#include <sync/sync.h>
|
||||||
#include <system/graphics.h>
|
#include <system/graphics.h>
|
||||||
|
|
||||||
#define ALIGN(A, B) (((A) + (B) - 1) / (B) * (B))
|
#define ALIGN(A, B) (((A) + (B)-1) / (B) * (B))
|
||||||
#define ARRAY_SIZE(A) (sizeof(A) / sizeof(*(A)))
|
#define ARRAY_SIZE(A) (sizeof(A) / sizeof(*(A)))
|
||||||
|
|
||||||
#define CHECK(cond) \
|
#define CHECK(cond) \
|
||||||
|
|
|
||||||
2
i915.c
2
i915.c
|
|
@ -559,7 +559,7 @@ static size_t i915_num_planes_from_modifier(struct driver *drv, uint32_t format,
|
||||||
32 - __builtin_clz(x)) \
|
32 - __builtin_clz(x)) \
|
||||||
: 0)
|
: 0)
|
||||||
|
|
||||||
#define roundup_power_of_two(x) ((x) != 0 ? 1ULL << gbm_fls((x) - 1) : 0)
|
#define roundup_power_of_two(x) ((x) != 0 ? 1ULL << gbm_fls((x)-1) : 0)
|
||||||
|
|
||||||
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)
|
||||||
|
|
|
||||||
|
|
@ -7,25 +7,18 @@
|
||||||
#define ARRAY_SIZE(A) (sizeof(A) / sizeof(*(A)))
|
#define ARRAY_SIZE(A) (sizeof(A) / sizeof(*(A)))
|
||||||
|
|
||||||
static const uint32_t scanout_render_formats[] = {
|
static const uint32_t scanout_render_formats[] = {
|
||||||
DRM_FORMAT_ABGR2101010,
|
DRM_FORMAT_ABGR2101010, DRM_FORMAT_ABGR8888, DRM_FORMAT_ARGB2101010,
|
||||||
DRM_FORMAT_ABGR8888,
|
DRM_FORMAT_ARGB8888, DRM_FORMAT_RGB565, DRM_FORMAT_XBGR2101010,
|
||||||
DRM_FORMAT_ARGB2101010,
|
DRM_FORMAT_XBGR8888, DRM_FORMAT_XRGB2101010, DRM_FORMAT_XRGB8888,
|
||||||
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[] = {
|
static const uint32_t texture_only_formats[] = {
|
||||||
DRM_FORMAT_R8,
|
DRM_FORMAT_R8, DRM_FORMAT_NV12, DRM_FORMAT_P010,
|
||||||
DRM_FORMAT_NV12,
|
DRM_FORMAT_YVU420, DRM_FORMAT_YVU420_ANDROID,
|
||||||
DRM_FORMAT_P010,
|
|
||||||
DRM_FORMAT_YVU420,
|
|
||||||
DRM_FORMAT_YVU420_ANDROID,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint32_t image_storage_formats[] = {
|
static const uint32_t image_storage_formats[] = {
|
||||||
|
|
@ -65,17 +58,23 @@ const uint16_t gen12_ids[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint16_t adlp_ids[] = {
|
const uint16_t adlp_ids[] = {
|
||||||
0x46A0, 0x46A1, 0x46A2, 0x46A3, 0x46A6, 0x46A8, 0x46AA, 0x462A, 0x4626, 0x4628,
|
0x46A0, 0x46A1, 0x46A2, 0x46A3, 0x46A6, 0x46A8, 0x46AA, 0x462A,
|
||||||
0x46B0, 0x46B1, 0x46B2, 0x46B3, 0x46C0, 0x46C1, 0x46C2, 0x46C3, 0x46D0, 0x46D1,
|
0x4626, 0x4628, 0x46B0, 0x46B1, 0x46B2, 0x46B3, 0x46C0, 0x46C1,
|
||||||
0x46D2, 0x46D3, 0x46D4,
|
0x46C2, 0x46C3, 0x46D0, 0x46D1, 0x46D2, 0x46D3, 0x46D4,
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint16_t rplp_ids[] = {
|
const uint16_t rplp_ids[] = {
|
||||||
0xA720, 0xA721, 0xA7A0, 0xA7A1, 0xA7A8, 0xA7A9, 0xA7AA, 0xA7AB, 0xA7AC, 0xA7AD,
|
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 };
|
const uint16_t ptl_ids[] = { 0xB080, 0xB081, 0xB082, 0xB083, 0xB08F, 0xB090, 0xB0A0, 0xB0B0 };
|
||||||
|
|
|
||||||
13
presubmit.sh
13
presubmit.sh
|
|
@ -2,9 +2,10 @@
|
||||||
# Copyright 2017 The Chromium OS Authors. All rights reserved.
|
# Copyright 2017 The Chromium OS Authors. All rights reserved.
|
||||||
# Use of this source code is governed by a BSD-style license that can be
|
# Use of this source code is governed by a BSD-style license that can be
|
||||||
# found in the LICENSE file.
|
# found in the LICENSE file.
|
||||||
find \
|
cros format \
|
||||||
'(' -name '*.[ch]' -or -name '*.cc' ')' \
|
--exclude 'external/*' \
|
||||||
-not -name 'virtgpu_drm.h' -not -name 'i915_drm.h' \
|
--exclude 'gbm.h' \
|
||||||
-not -name 'gbm.h' -not -name 'virgl_hw.h' \
|
--include '*.[ch]' \
|
||||||
-not -name 'virgl_protocol.h' \
|
--include '*.cc' \
|
||||||
-exec clang-format -style=file -i {} +
|
--include '*.cpp' \
|
||||||
|
.
|
||||||
|
|
|
||||||
6
util.h
6
util.h
|
|
@ -10,11 +10,11 @@
|
||||||
#define MAX(A, B) ((A) > (B) ? (A) : (B))
|
#define MAX(A, B) ((A) > (B) ? (A) : (B))
|
||||||
#define ARRAY_SIZE(A) (sizeof(A) / sizeof(*(A)))
|
#define ARRAY_SIZE(A) (sizeof(A) / sizeof(*(A)))
|
||||||
#define PUBLIC __attribute__((visibility("default")))
|
#define PUBLIC __attribute__((visibility("default")))
|
||||||
#define ALIGN(A, B) (((A) + (B) - 1) & ~((B) - 1))
|
#define ALIGN(A, B) (((A) + (B)-1) & ~((B)-1))
|
||||||
#define IS_ALIGNED(A, B) (ALIGN((A), (B)) == (A))
|
#define IS_ALIGNED(A, B) (ALIGN((A), (B)) == (A))
|
||||||
#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
|
#define DIV_ROUND_UP(n, d) (((n) + (d)-1) / (d))
|
||||||
#define STRINGIZE_NO_EXPANSION(x) #x
|
#define STRINGIZE_NO_EXPANSION(x) #x
|
||||||
#define STRINGIZE(x) STRINGIZE_NO_EXPANSION(x)
|
#define STRINGIZE(x) STRINGIZE_NO_EXPANSION(x)
|
||||||
#define BITFIELD_BIT(b) (1u<<(b))
|
#define BITFIELD_BIT(b) (1u << (b))
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -53,10 +53,9 @@ static const uint32_t texture_source_formats[] = {
|
||||||
DRM_FORMAT_ABGR2101010, DRM_FORMAT_ABGR16161616F
|
DRM_FORMAT_ABGR2101010, DRM_FORMAT_ABGR16161616F
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint32_t depth_stencil_formats[] = {
|
static const uint32_t depth_stencil_formats[] = { DRM_FORMAT_DEPTH16, DRM_FORMAT_DEPTH24,
|
||||||
DRM_FORMAT_DEPTH16, DRM_FORMAT_DEPTH24, DRM_FORMAT_DEPTH24_STENCIL8,
|
DRM_FORMAT_DEPTH24_STENCIL8, DRM_FORMAT_DEPTH32,
|
||||||
DRM_FORMAT_DEPTH32, DRM_FORMAT_DEPTH32_STENCIL8
|
DRM_FORMAT_DEPTH32_STENCIL8 };
|
||||||
};
|
|
||||||
|
|
||||||
extern struct virtgpu_param params[];
|
extern struct virtgpu_param params[];
|
||||||
|
|
||||||
|
|
|
||||||
33
xe.c
33
xe.c
|
|
@ -19,8 +19,8 @@
|
||||||
#include "drv_priv.h"
|
#include "drv_priv.h"
|
||||||
|
|
||||||
#include "external/xe_drm.h"
|
#include "external/xe_drm.h"
|
||||||
#include "util.h"
|
|
||||||
#include "intel_defines.h"
|
#include "intel_defines.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
struct modifier_support_t {
|
struct modifier_support_t {
|
||||||
const uint64_t *order;
|
const uint64_t *order;
|
||||||
|
|
@ -307,19 +307,18 @@ static bool xe_query_config(struct driver *drv, struct xe_device *xe)
|
||||||
struct drm_xe_device_query query = {
|
struct drm_xe_device_query query = {
|
||||||
.query = DRM_XE_DEVICE_QUERY_CONFIG,
|
.query = DRM_XE_DEVICE_QUERY_CONFIG,
|
||||||
};
|
};
|
||||||
if(drmIoctl(drv->fd, DRM_IOCTL_XE_DEVICE_QUERY, &query))
|
if (drmIoctl(drv->fd, DRM_IOCTL_XE_DEVICE_QUERY, &query))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
struct drm_xe_query_config *config = calloc(1, query.size);
|
struct drm_xe_query_config *config = calloc(1, query.size);
|
||||||
if(!config)
|
if (!config)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
query.data = (uintptr_t)config;
|
query.data = (uintptr_t)config;
|
||||||
if(drmIoctl(drv->fd, DRM_IOCTL_XE_DEVICE_QUERY, &query))
|
if (drmIoctl(drv->fd, DRM_IOCTL_XE_DEVICE_QUERY, &query))
|
||||||
goto data_query_failed;
|
goto data_query_failed;
|
||||||
|
|
||||||
|
if (config->info[DRM_XE_QUERY_CONFIG_FLAGS] & DRM_XE_QUERY_CONFIG_FLAG_HAS_VRAM)
|
||||||
if(config->info[DRM_XE_QUERY_CONFIG_FLAGS] & DRM_XE_QUERY_CONFIG_FLAG_HAS_VRAM)
|
|
||||||
xe->has_local_mem = true;
|
xe->has_local_mem = true;
|
||||||
else
|
else
|
||||||
xe->has_local_mem = false;
|
xe->has_local_mem = false;
|
||||||
|
|
@ -347,20 +346,21 @@ static bool xe_device_probe(struct driver *drv, struct xe_device *xe)
|
||||||
.data = 0,
|
.data = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
if(drmIoctl(drv->fd, DRM_IOCTL_XE_DEVICE_QUERY, &query))
|
if (drmIoctl(drv->fd, DRM_IOCTL_XE_DEVICE_QUERY, &query))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
struct drm_xe_query_config *config = calloc(1, query.size);
|
struct drm_xe_query_config *config = calloc(1, query.size);
|
||||||
if(!config)
|
if (!config)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
query.data = (uintptr_t)config;
|
query.data = (uintptr_t)config;
|
||||||
if(drmIoctl(drv->fd, DRM_IOCTL_XE_DEVICE_QUERY, &query)){
|
if (drmIoctl(drv->fd, DRM_IOCTL_XE_DEVICE_QUERY, &query)) {
|
||||||
free(config);
|
free(config);
|
||||||
return false;
|
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;
|
xe->revision = (config->info[DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID] >> 16) & 0xFFFF;
|
||||||
|
|
||||||
free(config);
|
free(config);
|
||||||
|
|
@ -375,7 +375,7 @@ static int xe_init(struct driver *drv)
|
||||||
if (!xe)
|
if (!xe)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
if(!xe_device_probe(drv, xe)){
|
if (!xe_device_probe(drv, xe)) {
|
||||||
drv_loge("Failed to query device id using DRM_IOCTL_XE_DEVICE_QUERY");
|
drv_loge("Failed to query device id using DRM_IOCTL_XE_DEVICE_QUERY");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
@ -391,14 +391,14 @@ static int xe_init(struct driver *drv)
|
||||||
if (xe->graphics_version >= 12)
|
if (xe->graphics_version >= 12)
|
||||||
xe->has_hw_protection = 0;
|
xe->has_hw_protection = 0;
|
||||||
else if (xe->graphics_version < 12) {
|
else if (xe->graphics_version < 12) {
|
||||||
drv_loge("Xe driver is not supported on your platform: 0x%x\n",xe->device_id);
|
drv_loge("Xe driver is not supported on your platform: 0x%x\n", xe->device_id);
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
drv->priv = xe;
|
drv->priv = xe;
|
||||||
|
|
||||||
return xe_add_combinations(drv);
|
return xe_add_combinations(drv);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -406,8 +406,7 @@ return 0;
|
||||||
* to the largest coded unit (LCU) assuming that it will be used for video. This
|
* to the largest coded unit (LCU) assuming that it will be used for video. This
|
||||||
* is based on gmmlib's GmmIsYUVFormatLCUAligned().
|
* is based on gmmlib's GmmIsYUVFormatLCUAligned().
|
||||||
*/
|
*/
|
||||||
static bool xe_format_needs_LCU_alignment(uint32_t format, size_t plane,
|
static bool xe_format_needs_LCU_alignment(uint32_t format, size_t plane, const struct xe_device *xe)
|
||||||
const struct xe_device *xe)
|
|
||||||
{
|
{
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case DRM_FORMAT_NV12:
|
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 */
|
/* Get the fake offset back */
|
||||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_XE_GEM_MMAP_OFFSET, &gem_map);
|
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_XE_GEM_MMAP_OFFSET, &gem_map);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
addr = mmap(0, bo->meta.total_size, PROT_READ | PROT_WRITE,
|
addr = mmap(0, bo->meta.total_size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->drv->fd,
|
||||||
MAP_SHARED, bo->drv->fd, gem_map.offset);
|
gem_map.offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addr == MAP_FAILED) {
|
if (addr == MAP_FAILED) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue