summaryrefslogtreecommitdiff
path: root/mediatek.c
diff options
context:
space:
mode:
authorGurchetan Singh <gurchetansingh@chromium.org>2017-03-10 16:25:23 -0800
committerchrome-bot <chrome-bot@chromium.org>2017-03-31 10:40:27 -0700
commit1b1d56ae4018eaed1da9d6e7032554156b7be020 (patch)
tree232c64a658abf621ad44b9e69ff97b9b98ac1e1e /mediatek.c
parent4c3aa42a5220d08b9bc06fa15a494b9d25e83507 (diff)
minigbm: add clang-format and presubmit hooks
Running the presubmit.sh script will apply our rules to every file in the repo. Exclude gbm.h from the formatting requirements since this file was taken from other open-source projects, and diffing will be easier without our formatting rules. In addition, special case drivers where the order of includes matters. BUG=none TEST=Verified the following commands succeed: emerge-cyan minigbm/arc-cros-gralloc emerge-oak minigbm/arc-cros-gralloc emerge-veyron_minnie-cheets minigbm/arc-cros-gralloc emerge-peach_pi minigbm emerge-nyan_big minigbm emerge-jadeite minigbm Change-Id: I6ce93fb1930da254d13d5017766c17341870ccc9 Reviewed-on: https://chromium-review.googlesource.com/447319 Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Diffstat (limited to 'mediatek.c')
-rw-r--r--mediatek.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/mediatek.c b/mediatek.c
index ab59e9a..e018b36 100644
--- a/mediatek.c
+++ b/mediatek.c
@@ -6,30 +6,30 @@
#ifdef DRV_MEDIATEK
+// clang-format off
#include <stdio.h>
#include <string.h>
#include <sys/mman.h>
#include <xf86drm.h>
#include <mediatek_drm.h>
+// clang-format on
#include "drv_priv.h"
#include "helpers.h"
#include "util.h"
-static const uint32_t supported_formats[] = {
- DRM_FORMAT_ABGR8888, DRM_FORMAT_ARGB8888, DRM_FORMAT_RGB565,
- DRM_FORMAT_XBGR8888, DRM_FORMAT_XRGB8888, DRM_FORMAT_YVU420,
- DRM_FORMAT_YVU420_ANDROID
-};
+static const uint32_t supported_formats[] = { DRM_FORMAT_ABGR8888, DRM_FORMAT_ARGB8888,
+ DRM_FORMAT_RGB565, DRM_FORMAT_XBGR8888,
+ DRM_FORMAT_XRGB8888, DRM_FORMAT_YVU420,
+ DRM_FORMAT_YVU420_ANDROID };
static int mediatek_init(struct driver *drv)
{
- return drv_add_linear_combinations(drv, supported_formats,
- ARRAY_SIZE(supported_formats));
+ return drv_add_linear_combinations(drv, supported_formats, ARRAY_SIZE(supported_formats));
}
-static int mediatek_bo_create(struct bo *bo, uint32_t width, uint32_t height,
- uint32_t format, uint32_t flags)
+static int mediatek_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint32_t format,
+ uint32_t flags)
{
int ret;
size_t plane;
@@ -50,7 +50,8 @@ static int mediatek_bo_create(struct bo *bo, uint32_t width, uint32_t height,
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_MTK_GEM_CREATE, &gem_create);
if (ret) {
fprintf(stderr, "drv: DRM_IOCTL_MTK_GEM_CREATE failed "
- "(size=%llu)\n", gem_create.size);
+ "(size=%llu)\n",
+ gem_create.size);
return ret;
}
@@ -70,14 +71,14 @@ static void *mediatek_bo_map(struct bo *bo, struct map_info *data, size_t plane)
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_MTK_GEM_MAP_OFFSET, &gem_map);
if (ret) {
- fprintf(stderr,"drv: DRM_IOCTL_MTK_GEM_MAP_OFFSET failed\n");
+ fprintf(stderr, "drv: DRM_IOCTL_MTK_GEM_MAP_OFFSET failed\n");
return MAP_FAILED;
}
data->length = bo->total_size;
- return mmap(0, bo->total_size, PROT_READ | PROT_WRITE, MAP_SHARED,
- bo->drv->fd, gem_map.offset);
+ return mmap(0, bo->total_size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->drv->fd,
+ gem_map.offset);
}
static uint32_t mediatek_resolve_format(uint32_t format)
@@ -93,8 +94,7 @@ static uint32_t mediatek_resolve_format(uint32_t format)
}
}
-struct backend backend_mediatek =
-{
+struct backend backend_mediatek = {
.name = "mediatek",
.init = mediatek_init,
.bo_create = mediatek_bo_create,