diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2017-08-01 11:44:21 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2017-08-01 09:49:25 +0000 |
commit | 9a05d0e4db172168e429f30bc8ed62b695006490 (patch) | |
tree | 6a7a6b2f7e3410bb9ddc3ef9a200156f2bf623e1 /chromium/third_party/minigbm | |
parent | 6ec7b8da05d21a3878bd21c691b41e675d74bb1c (diff) | |
download | qtwebengine-chromium-9a05d0e4db172168e429f30bc8ed62b695006490.tar.gz |
BASELINE: Update Chromium to 60.0.3112.78
Change-Id: I58f9d14bddb9104a666b6ef869944111ee7eadb8
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/third_party/minigbm')
29 files changed, 204 insertions, 819 deletions
diff --git a/chromium/third_party/minigbm/src/Makefile b/chromium/third_party/minigbm/src/Makefile index 17584444c41..de4fed18f3f 100644 --- a/chromium/third_party/minigbm/src/Makefile +++ b/chromium/third_party/minigbm/src/Makefile @@ -8,9 +8,9 @@ PC_DEPS = libdrm PC_CFLAGS := $(shell $(PKG_CONFIG) --cflags $(PC_DEPS)) PC_LIBS := $(shell $(PKG_CONFIG) --libs $(PC_DEPS)) -CPPFLAGS += -D_GNU_SOURCE=1 -CFLAGS += -std=c99 -Wall -Wsign-compare -Wpointer-arith -Wcast-qual \ - -Wcast-align -D_GNU_SOURCE=1 -D_FILE_OFFSET_BITS=64 +CPPFLAGS += -std=c99 -D_GNU_SOURCE=1 +CFLAGS += -Wall -Wsign-compare -Wpointer-arith -Wcast-qual -Wcast-align \ + -D_GNU_SOURCE=1 -D_FILE_OFFSET_BITS=64 ifdef DRV_AMDGPU CFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm_amdgpu) @@ -21,7 +21,6 @@ ifdef DRV_EXYNOS endif ifdef DRV_I915 CFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm_intel) - LDLIBS += $(shell $(PKG_CONFIG) --libs libdrm_intel) endif ifdef DRV_ROCKCHIP CFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm_rockchip) diff --git a/chromium/third_party/minigbm/src/amdgpu.c b/chromium/third_party/minigbm/src/amdgpu.c index 5dcfbeb0f9b..38ea8d685d8 100644 --- a/chromium/third_party/minigbm/src/amdgpu.c +++ b/chromium/third_party/minigbm/src/amdgpu.c @@ -1,5 +1,5 @@ /* - * Copyright 2016 The Chromium OS Authors. All rights reserved. + * Copyright (c) 2016 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. */ @@ -8,7 +8,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <sys/mman.h> #include <xf86drm.h> #include <amdgpu_drm.h> #include <amdgpu.h> @@ -40,16 +39,11 @@ enum { }; static struct supported_combination combos[5] = { - {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE, - BO_USE_CURSOR | BO_USE_LINEAR | BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN}, - {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE, - BO_USE_RENDERING | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, - {DRM_FORMAT_XBGR8888, DRM_FORMAT_MOD_NONE, - BO_USE_RENDERING | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, - {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, - BO_USE_LINEAR | BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN}, - {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, - BO_USE_RENDERING | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, + {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE, BO_USE_CURSOR | BO_USE_LINEAR}, + {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE, BO_USE_RENDERING}, + {DRM_FORMAT_XBGR8888, DRM_FORMAT_MOD_NONE, BO_USE_RENDERING}, + {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, BO_USE_LINEAR}, + {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, BO_USE_RENDERING}, }; static int amdgpu_set_metadata(int fd, uint32_t handle, @@ -315,7 +309,6 @@ static int amdgpu_bo_create(struct bo *bo, uint32_t width, uint32_t height, struct amdgpu_bo_metadata metadata = {0}; ADDR_COMPUTE_SURFACE_INFO_OUTPUT addr_out = {0}; uint32_t tiling_flags = 0; - uint32_t gem_create_flags = 0; int ret; if (amdgpu_addrlib_compute(addrlib, width, @@ -329,19 +322,13 @@ static int amdgpu_bo_create(struct bo *bo, uint32_t width, uint32_t height, bo->sizes[0] = addr_out.surfSize; bo->strides[0] = addr_out.pixelPitch * DIV_ROUND_UP(addr_out.pixelBits, 8); - if (usage & (BO_USE_CURSOR | BO_USE_LINEAR | BO_USE_SW_READ_OFTEN | - BO_USE_SW_WRITE_OFTEN | BO_USE_SW_WRITE_RARELY | - BO_USE_SW_READ_RARELY)) - gem_create_flags |= AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED; - else - gem_create_flags |= AMDGPU_GEM_CREATE_NO_CPU_ACCESS; memset(&gem_create, 0, sizeof(gem_create)); gem_create.in.bo_size = bo->sizes[0]; gem_create.in.alignment = addr_out.baseAlign; /* Set the placement. */ gem_create.in.domains = AMDGPU_GEM_DOMAIN_VRAM; - gem_create.in.domain_flags = gem_create_flags; + gem_create.in.domain_flags = usage; /* Allocate the buffer with the preferred heap. */ ret = drmCommandWriteRead(drv_get_fd(bo->drv), DRM_AMDGPU_GEM_CREATE, @@ -360,33 +347,12 @@ static int amdgpu_bo_create(struct bo *bo, uint32_t width, uint32_t height, return ret; } -static void *amdgpu_bo_map(struct bo *bo, struct map_info *data, size_t plane) -{ - int ret; - union drm_amdgpu_gem_mmap gem_map; - - memset(&gem_map, 0, sizeof(gem_map)); - gem_map.in.handle = bo->handles[0].u32; - - ret = drmIoctl(bo->drv->fd, DRM_IOCTL_AMDGPU_GEM_MMAP, &gem_map); - if (ret) { - fprintf(stderr, "drv: DRM_IOCTL_AMDGPU_GEM_MMAP failed\n"); - return MAP_FAILED; - } - data->length = bo->sizes[0]; - - return mmap(0, bo->sizes[0], PROT_READ | PROT_WRITE, MAP_SHARED, - bo->drv->fd, gem_map.out.addr_ptr); -} - struct backend backend_amdgpu = { .name = "amdgpu", .init = amdgpu_init, .close = amdgpu_close, .bo_create = amdgpu_bo_create, .bo_destroy = drv_gem_bo_destroy, - .bo_import = drv_prime_bo_import, - .bo_map = amdgpu_bo_map, }; #endif diff --git a/chromium/third_party/minigbm/src/cirrus.c b/chromium/third_party/minigbm/src/cirrus.c index f614e8ad08c..91466c96c4d 100644 --- a/chromium/third_party/minigbm/src/cirrus.c +++ b/chromium/third_party/minigbm/src/cirrus.c @@ -1,5 +1,5 @@ /* - * Copyright 2014 The Chromium OS Authors. All rights reserved. + * Copyright (c) 2014 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. */ @@ -8,16 +8,12 @@ #include "helpers.h" #include "util.h" -static struct supported_combination combos[3] = { - {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE, - BO_USE_CURSOR | BO_USE_LINEAR | BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | - BO_USE_SW_WRITE_OFTEN | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, - {DRM_FORMAT_RGB888, DRM_FORMAT_MOD_NONE, - BO_USE_LINEAR | BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN | - BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, - {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, - BO_USE_CURSOR | BO_USE_LINEAR | BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | - BO_USE_SW_WRITE_OFTEN | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, +static struct supported_combination combos[5] = { + {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE, BO_USE_CURSOR | BO_USE_LINEAR}, + {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE, BO_USE_RENDERING}, + {DRM_FORMAT_RGB888, DRM_FORMAT_MOD_NONE, BO_USE_RENDERING}, + {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, BO_USE_CURSOR | BO_USE_LINEAR}, + {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, BO_USE_RENDERING}, }; static int cirrus_init(struct driver *drv) @@ -32,6 +28,5 @@ struct backend backend_cirrus = .init = cirrus_init, .bo_create = drv_dumb_bo_create, .bo_destroy = drv_dumb_bo_destroy, - .bo_import = drv_prime_bo_import, .bo_map = drv_dumb_bo_map, }; diff --git a/chromium/third_party/minigbm/src/common.mk b/chromium/third_party/minigbm/src/common.mk index 3d7e7d4674c..21de50c937e 100644 --- a/chromium/third_party/minigbm/src/common.mk +++ b/chromium/third_party/minigbm/src/common.mk @@ -1,4 +1,4 @@ -# Copyright 2012 The Chromium OS Authors. All rights reserved. +# Copyright (c) 2012 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. # diff --git a/chromium/third_party/minigbm/src/cros_gralloc/cros_alloc_device.cc b/chromium/third_party/minigbm/src/cros_gralloc/cros_alloc_device.cc index 97c8186f8c6..540574418a0 100644 --- a/chromium/third_party/minigbm/src/cros_gralloc/cros_alloc_device.cc +++ b/chromium/third_party/minigbm/src/cros_gralloc/cros_alloc_device.cc @@ -29,14 +29,6 @@ static struct cros_gralloc_bo *cros_gralloc_bo_create(struct driver *drv, DRM_FORMAT_MOD_NONE); } - if (!supported && (drv_usage & BO_USE_RENDERING) && - (drv_usage && (BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN))) { - drv_usage &= ~BO_USE_RENDERING; - supported = drv_is_combination_supported(drv, drv_format, - drv_usage, - DRM_FORMAT_MOD_NONE); - } - if (!supported) { cros_gralloc_error("Unsupported combination -- HAL format: %u, " "HAL flags: %u, drv_format: %u, " diff --git a/chromium/third_party/minigbm/src/drv.c b/chromium/third_party/minigbm/src/drv.c index fb79e127e4f..3a9ab4caae6 100644 --- a/chromium/third_party/minigbm/src/drv.c +++ b/chromium/third_party/minigbm/src/drv.c @@ -1,10 +1,9 @@ /* - * Copyright 2016 The Chromium OS Authors. All rights reserved. + * Copyright (c) 2016 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. */ #include <assert.h> -#include <errno.h> #include <fcntl.h> #include <pthread.h> #include <stdint.h> @@ -36,7 +35,6 @@ extern struct backend backend_marvell; #ifdef DRV_MEDIATEK extern struct backend backend_mediatek; #endif -extern struct backend backend_nouveau; #ifdef DRV_ROCKCHIP extern struct backend backend_rockchip; #endif @@ -44,9 +42,6 @@ extern struct backend backend_rockchip; extern struct backend backend_tegra; #endif extern struct backend backend_udl; -#ifdef DRV_VC4 -extern struct backend backend_vc4; -#endif extern struct backend backend_vgem; extern struct backend backend_virtio_gpu; @@ -79,7 +74,6 @@ static struct backend *drv_get_backend(int fd) #ifdef DRV_MEDIATEK &backend_mediatek, #endif - &backend_nouveau, #ifdef DRV_ROCKCHIP &backend_rockchip, #endif @@ -87,9 +81,6 @@ static struct backend *drv_get_backend(int fd) &backend_tegra, #endif &backend_udl, -#ifdef DRV_VC4 - &backend_vc4, -#endif &backend_vgem, &backend_virtio_gpu, }; @@ -256,44 +247,6 @@ struct bo *drv_bo_create(struct driver *drv, uint32_t width, uint32_t height, return bo; } -struct bo *drv_bo_create_with_modifiers(struct driver *drv, - uint32_t width, uint32_t height, - uint32_t format, - const uint64_t *modifiers, uint32_t count) -{ - int ret; - size_t plane; - struct bo *bo; - - if (!drv->backend->bo_create_with_modifiers) { - errno = ENOENT; - return NULL; - } - - bo = drv_bo_new(drv, width, height, format); - - if (!bo) - return NULL; - - ret = drv->backend->bo_create_with_modifiers(bo, width, height, - format, modifiers, count); - - if (ret) { - free(bo); - return NULL; - } - - pthread_mutex_lock(&drv->driver_lock); - - for (plane = 0; plane < bo->num_planes; plane++) - drv_increment_reference_count(drv, bo, plane); - - pthread_mutex_unlock(&drv->driver_lock); - - return bo; -} - - void drv_bo_destroy(struct bo *bo) { size_t plane; @@ -321,24 +274,45 @@ struct bo *drv_bo_import(struct driver *drv, struct drv_import_fd_data *data) int ret; size_t plane; struct bo *bo; + struct drm_prime_handle prime_handle; bo = drv_bo_new(drv, data->width, data->height, data->format); if (!bo) return NULL; - ret = drv->backend->bo_import(bo, data); - if (ret) { - free(bo); - return NULL; - } - for (plane = 0; plane < bo->num_planes; plane++) { + + memset(&prime_handle, 0, sizeof(prime_handle)); + prime_handle.fd = data->fds[plane]; + + ret = drmIoctl(drv->fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, + &prime_handle); + + if (ret) { + fprintf(stderr, "drv: DRM_IOCTL_PRIME_FD_TO_HANDLE failed " + "(fd=%u)\n", prime_handle.fd); + + if (plane > 0) { + bo->num_planes = plane; + drv_bo_destroy(bo); + } else { + free(bo); + } + + return NULL; + } + + bo->handles[plane].u32 = prime_handle.handle; bo->strides[plane] = data->strides[plane]; bo->offsets[plane] = data->offsets[plane]; bo->sizes[plane] = data->sizes[plane]; bo->format_modifiers[plane] = data->format_modifiers[plane]; bo->total_size += data->sizes[plane]; + + pthread_mutex_lock(&drv->driver_lock); + drv_increment_reference_count(drv, bo, plane); + pthread_mutex_unlock(&drv->driver_lock); } return bo; @@ -402,10 +376,7 @@ int drv_bo_unmap(struct bo *bo, void *map_data) pthread_mutex_lock(&bo->drv->driver_lock); if (!--data->refcount) { - if (bo->drv->backend->bo_unmap) - ret = bo->drv->backend->bo_unmap(bo, data); - else - ret = munmap(data->addr, data->length); + ret = munmap(data->addr, data->length); drmHashDelete(bo->drv->map_table, data->handle); free(data); } diff --git a/chromium/third_party/minigbm/src/drv.h b/chromium/third_party/minigbm/src/drv.h index 355ea45f03e..83d3b6a4bf5 100644 --- a/chromium/third_party/minigbm/src/drv.h +++ b/chromium/third_party/minigbm/src/drv.h @@ -1,5 +1,5 @@ /* - * Copyright 2016 The Chromium OS Authors. All rights reserved. + * Copyright (c) 2016 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. */ @@ -92,12 +92,6 @@ struct bo * drv_bo_create(struct driver *drv, uint32_t width, uint32_t height, uint32_t format, uint64_t flags); -struct bo * -drv_bo_create_with_modifiers(struct driver *drv, - uint32_t width, uint32_t height, - uint32_t format, - const uint64_t *modifiers, uint32_t count); - void drv_bo_destroy(struct bo *bo); diff --git a/chromium/third_party/minigbm/src/drv_priv.h b/chromium/third_party/minigbm/src/drv_priv.h index 62492c284cb..837310a70b7 100644 --- a/chromium/third_party/minigbm/src/drv_priv.h +++ b/chromium/third_party/minigbm/src/drv_priv.h @@ -1,5 +1,5 @@ /* - * Copyright 2016 The Chromium OS Authors. All rights reserved. + * Copyright (c) 2016 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. */ @@ -46,7 +46,6 @@ struct map_info { size_t length; uint32_t handle; int32_t refcount; - void *priv; }; struct supported_combination { @@ -67,15 +66,8 @@ struct backend void (*close)(struct driver *drv); int (*bo_create)(struct bo *bo, uint32_t width, uint32_t height, uint32_t format, uint32_t flags); - int (*bo_create_with_modifiers)(struct bo *bo, - uint32_t width, uint32_t height, - uint32_t format, - const uint64_t *modifiers, - uint32_t count); - int (*bo_destroy)(struct bo *bo); - int (*bo_import)(struct bo *bo, struct drv_import_fd_data *data); void* (*bo_map)(struct bo *bo, struct map_info *data, size_t plane); - int (*bo_unmap)(struct bo *bo, struct map_info *data); + int (*bo_destroy)(struct bo *bo); uint32_t (*resolve_format)(uint32_t format); struct list_head combinations; }; diff --git a/chromium/third_party/minigbm/src/evdi.c b/chromium/third_party/minigbm/src/evdi.c index 988797b2f8c..97042d1dc78 100644 --- a/chromium/third_party/minigbm/src/evdi.c +++ b/chromium/third_party/minigbm/src/evdi.c @@ -8,13 +8,11 @@ #include "helpers.h" #include "util.h" -static struct supported_combination combos[2] = { - {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE, - BO_USE_CURSOR | BO_USE_LINEAR | BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | - BO_USE_SW_WRITE_OFTEN | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, - {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, - BO_USE_CURSOR | BO_USE_LINEAR | BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | - BO_USE_SW_WRITE_OFTEN | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, +static struct supported_combination combos[4] = { + {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE, BO_USE_CURSOR | BO_USE_LINEAR}, + {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE, BO_USE_RENDERING}, + {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, BO_USE_CURSOR | BO_USE_LINEAR}, + {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, BO_USE_RENDERING}, }; static int evdi_init(struct driver *drv) @@ -29,7 +27,6 @@ struct backend backend_evdi = .init = evdi_init, .bo_create = drv_dumb_bo_create, .bo_destroy = drv_dumb_bo_destroy, - .bo_import = drv_prime_bo_import, .bo_map = drv_dumb_bo_map, }; diff --git a/chromium/third_party/minigbm/src/exynos.c b/chromium/third_party/minigbm/src/exynos.c index 4dcf6043cc1..d6dc7def46f 100644 --- a/chromium/third_party/minigbm/src/exynos.c +++ b/chromium/third_party/minigbm/src/exynos.c @@ -1,5 +1,5 @@ /* - * Copyright 2014 The Chromium OS Authors. All rights reserved. + * Copyright (c) 2014 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. */ @@ -17,16 +17,12 @@ #include "helpers.h" #include "util.h" -static struct supported_combination combos[3] = { - {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE, - BO_USE_CURSOR | BO_USE_LINEAR | BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | - BO_USE_SW_WRITE_OFTEN | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, - {DRM_FORMAT_NV12, DRM_FORMAT_MOD_NONE, - BO_USE_LINEAR | BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN | - BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, - {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, - BO_USE_CURSOR | BO_USE_LINEAR | BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | - BO_USE_SW_WRITE_OFTEN | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, +static struct supported_combination combos[5] = { + {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE, BO_USE_CURSOR | BO_USE_LINEAR}, + {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE, BO_USE_RENDERING}, + {DRM_FORMAT_NV12, DRM_FORMAT_MOD_NONE, BO_USE_RENDERING}, + {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, BO_USE_CURSOR | BO_USE_LINEAR}, + {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, BO_USE_RENDERING}, }; static int exynos_init(struct driver *drv) @@ -110,7 +106,6 @@ struct backend backend_exynos = .init = exynos_init, .bo_create = exynos_bo_create, .bo_destroy = drv_gem_bo_destroy, - .bo_import = drv_prime_bo_import, .bo_map = drv_dumb_bo_map, }; diff --git a/chromium/third_party/minigbm/src/gbm.c b/chromium/third_party/minigbm/src/gbm.c index 6ad32ce6bbe..7389cd8a1b0 100644 --- a/chromium/third_party/minigbm/src/gbm.c +++ b/chromium/third_party/minigbm/src/gbm.c @@ -1,5 +1,5 @@ /* - * Copyright 2014 The Chromium OS Authors. All rights reserved. + * Copyright (c) 2014 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. */ @@ -137,32 +137,6 @@ PUBLIC struct gbm_bo *gbm_bo_create(struct gbm_device *gbm, uint32_t width, return bo; } -PUBLIC struct gbm_bo *gbm_bo_create_with_modifiers(struct gbm_device *gbm, - uint32_t width, - uint32_t height, - uint32_t format, - const uint64_t *modifiers, - uint32_t count) -{ - struct gbm_bo *bo; - - bo = gbm_bo_new(gbm, format); - - if (!bo) - return NULL; - - bo->bo = drv_bo_create_with_modifiers(gbm->drv, - width, height, format, - modifiers, count); - - if (!bo->bo) { - free(bo); - return NULL; - } - - return bo; -} - PUBLIC void gbm_bo_destroy(struct gbm_bo *bo) { if (bo->destroy_user_data) { diff --git a/chromium/third_party/minigbm/src/gbm.h b/chromium/third_party/minigbm/src/gbm.h index 1fb338f98e3..839e2a51c63 100644 --- a/chromium/third_party/minigbm/src/gbm.h +++ b/chromium/third_party/minigbm/src/gbm.h @@ -35,7 +35,6 @@ extern "C" { #define __GBM__ 1 -#include <stddef.h> #include <stdint.h> /** @@ -262,12 +261,6 @@ gbm_bo_create(struct gbm_device *gbm, uint32_t width, uint32_t height, uint32_t format, uint32_t flags); -struct gbm_bo * -gbm_bo_create_with_modifiers(struct gbm_device *gbm, - uint32_t width, uint32_t height, - uint32_t format, - const uint64_t *modifiers, uint32_t count); - #define GBM_BO_IMPORT_WL_BUFFER 0x5501 #define GBM_BO_IMPORT_EGL_IMAGE 0x5502 #define GBM_BO_IMPORT_FD 0x5503 diff --git a/chromium/third_party/minigbm/src/gbm_helpers.c b/chromium/third_party/minigbm/src/gbm_helpers.c index c60a315b2cc..be18a398e61 100644 --- a/chromium/third_party/minigbm/src/gbm_helpers.c +++ b/chromium/third_party/minigbm/src/gbm_helpers.c @@ -1,5 +1,5 @@ /* - * Copyright 2016 The Chromium OS Authors. All rights reserved. + * Copyright (c) 2016 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. */ diff --git a/chromium/third_party/minigbm/src/gbm_helpers.h b/chromium/third_party/minigbm/src/gbm_helpers.h index 48ff3913736..8e0b8b0fd90 100644 --- a/chromium/third_party/minigbm/src/gbm_helpers.h +++ b/chromium/third_party/minigbm/src/gbm_helpers.h @@ -1,5 +1,5 @@ /* - * Copyright 2016 The Chromium OS Authors. All rights reserved. + * Copyright (c) 2016 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. */ diff --git a/chromium/third_party/minigbm/src/gbm_priv.h b/chromium/third_party/minigbm/src/gbm_priv.h index eb29f1be8a7..379bf01701a 100644 --- a/chromium/third_party/minigbm/src/gbm_priv.h +++ b/chromium/third_party/minigbm/src/gbm_priv.h @@ -1,5 +1,5 @@ /* - * Copyright 2014 The Chromium OS Authors. All rights reserved. + * Copyright (c) 2014 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. */ diff --git a/chromium/third_party/minigbm/src/gma500.c b/chromium/third_party/minigbm/src/gma500.c index d8932fb40da..0f78e8546d4 100644 --- a/chromium/third_party/minigbm/src/gma500.c +++ b/chromium/third_party/minigbm/src/gma500.c @@ -1,5 +1,5 @@ /* - * Copyright 2014 The Chromium OS Authors. All rights reserved. + * Copyright (c) 2014 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. */ @@ -8,10 +8,9 @@ #include "helpers.h" #include "util.h" -static struct supported_combination combos[1] = { - {DRM_FORMAT_RGBX8888, DRM_FORMAT_MOD_NONE, - BO_USE_CURSOR | BO_USE_LINEAR | BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | - BO_USE_SW_WRITE_OFTEN | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, +static struct supported_combination combos[2] = { + {DRM_FORMAT_RGBX8888, DRM_FORMAT_MOD_NONE, BO_USE_CURSOR | BO_USE_LINEAR}, + {DRM_FORMAT_RGBX8888, DRM_FORMAT_MOD_NONE, BO_USE_RENDERING}, }; static int gma500_init(struct driver *drv) @@ -26,6 +25,5 @@ struct backend backend_gma500 = .init = gma500_init, .bo_create = drv_dumb_bo_create, .bo_destroy = drv_dumb_bo_destroy, - .bo_import = drv_prime_bo_import, .bo_map = drv_dumb_bo_map, }; diff --git a/chromium/third_party/minigbm/src/helpers.c b/chromium/third_party/minigbm/src/helpers.c index 87aad9df17b..f6fd0ec7ec0 100644 --- a/chromium/third_party/minigbm/src/helpers.c +++ b/chromium/third_party/minigbm/src/helpers.c @@ -1,5 +1,5 @@ /* - * Copyright 2014 The Chromium OS Authors. All rights reserved. + * Copyright (c) 2014 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. */ @@ -210,46 +210,6 @@ int drv_gem_bo_destroy(struct bo *bo) return error; } -int drv_prime_bo_import(struct bo *bo, struct drv_import_fd_data *data) -{ - int ret; - size_t plane; - struct drm_prime_handle prime_handle; - - for (plane = 0; plane < bo->num_planes; plane++) { - memset(&prime_handle, 0, sizeof(prime_handle)); - prime_handle.fd = data->fds[plane]; - - ret = drmIoctl(bo->drv->fd, DRM_IOCTL_PRIME_FD_TO_HANDLE, - &prime_handle); - - if (ret) { - fprintf(stderr, "drv: DRM_IOCTL_PRIME_FD_TO_HANDLE " - "failed (fd=%u)\n", prime_handle.fd); - - /* - * Need to call GEM close on planes that were opened, - * if any. Adjust the num_planes variable to be the - * plane that failed, so GEM close will be called on - * planes before that plane. - */ - bo->num_planes = plane; - drv_gem_bo_destroy(bo); - return ret; - } - - bo->handles[plane].u32 = prime_handle.handle; - } - - for (plane = 0; plane < bo->num_planes; plane++) { - pthread_mutex_lock(&bo->drv->driver_lock); - drv_increment_reference_count(bo->drv, bo, plane); - pthread_mutex_unlock(&bo->drv->driver_lock); - } - - return 0; -} - void *drv_dumb_bo_map(struct bo *bo, struct map_info *data, size_t plane) { int ret; diff --git a/chromium/third_party/minigbm/src/helpers.h b/chromium/third_party/minigbm/src/helpers.h index 64e8489e391..5b72bacc708 100644 --- a/chromium/third_party/minigbm/src/helpers.h +++ b/chromium/third_party/minigbm/src/helpers.h @@ -1,5 +1,5 @@ /* - * Copyright 2014 The Chromium OS Authors. All rights reserved. + * Copyright (c) 2014 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. */ @@ -16,7 +16,6 @@ int drv_dumb_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint32_t format, uint32_t flags); int drv_dumb_bo_destroy(struct bo *bo); int drv_gem_bo_destroy(struct bo *bo); -int drv_prime_bo_import(struct bo *bo, struct drv_import_fd_data *data); void *drv_dumb_bo_map(struct bo *bo, struct map_info *data, size_t plane); uintptr_t drv_get_reference_count(struct driver *drv, struct bo *bo, size_t plane); diff --git a/chromium/third_party/minigbm/src/i915.c b/chromium/third_party/minigbm/src/i915.c index 2c6645bf2cb..769e6a33c67 100644 --- a/chromium/third_party/minigbm/src/i915.c +++ b/chromium/third_party/minigbm/src/i915.c @@ -1,5 +1,5 @@ /* - * Copyright 2014 The Chromium OS Authors. All rights reserved. + * Copyright (c) 2014 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. */ @@ -7,17 +7,17 @@ #ifdef DRV_I915 #include <errno.h> -#include <i915_drm.h> -#include <intel_bufmgr.h> #include <string.h> +#include <stdio.h> #include <sys/mman.h> #include <xf86drm.h> +#include <i915_drm.h> #include "drv_priv.h" #include "helpers.h" #include "util.h" -static struct supported_combination combos[19] = { +static struct supported_combination combos[18] = { {DRM_FORMAT_ARGB1555, DRM_FORMAT_MOD_NONE, BO_USE_RENDERING | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, {DRM_FORMAT_ABGR8888, DRM_FORMAT_MOD_NONE, @@ -54,20 +54,11 @@ static struct supported_combination combos[19] = { BO_USE_RENDERING | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, {DRM_FORMAT_YVU420, DRM_FORMAT_MOD_NONE, BO_USE_RENDERING | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, - {DRM_FORMAT_YVU420, DRM_FORMAT_MOD_NONE, - BO_USE_LINEAR | BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN}, }; struct i915_device { int gen; - drm_intel_bufmgr *mgr; - uint32_t count; -}; - -struct i915_bo -{ - drm_intel_bo *ibos[DRV_MAX_PLANES]; }; static int get_gen(int device_id) @@ -82,10 +73,45 @@ static int get_gen(int device_id) return 4; } +static int i915_init(struct driver *drv) +{ + struct i915_device *i915_drv; + drm_i915_getparam_t get_param; + int device_id; + int ret; + + i915_drv = (struct i915_device*)malloc(sizeof(*i915_drv)); + if (!i915_drv) + return -1; + + memset(&get_param, 0, sizeof(get_param)); + get_param.param = I915_PARAM_CHIPSET_ID; + get_param.value = &device_id; + ret = drmIoctl(drv->fd, DRM_IOCTL_I915_GETPARAM, &get_param); + if (ret) { + fprintf(stderr, "drv: DRM_IOCTL_I915_GETPARAM failed\n"); + free(i915_drv); + return -1; + } + + i915_drv->gen = get_gen(device_id); + + drv->priv = i915_drv; + + drv_insert_combinations(drv, combos, ARRAY_SIZE(combos)); + return drv_add_kms_flags(drv); +} + +static void i915_close(struct driver *drv) +{ + free(drv->priv); + drv->priv = NULL; +} + static void i915_align_dimensions(struct driver *drv, uint32_t tiling_mode, uint32_t *width, uint32_t *height, int bpp) { - struct i915_device *i915_dev = (struct i915_device *)drv->priv; + struct i915_device *i915_drv = (struct i915_device *)drv->priv; uint32_t width_alignment = 4, height_alignment = 4; switch (tiling_mode) { @@ -100,7 +126,7 @@ static void i915_align_dimensions(struct driver *drv, uint32_t tiling_mode, break; case I915_TILING_Y: - if (i915_dev->gen == 3) { + if (i915_drv->gen == 3) { width_alignment = 512 / bpp; height_alignment = 8; } else { @@ -110,7 +136,7 @@ static void i915_align_dimensions(struct driver *drv, uint32_t tiling_mode, break; } - if (i915_dev->gen > 3) { + if (i915_drv->gen > 3) { *width = ALIGN(*width, width_alignment); *height = ALIGN(*height, height_alignment); } else { @@ -125,69 +151,23 @@ static void i915_align_dimensions(struct driver *drv, uint32_t tiling_mode, static int i915_verify_dimensions(struct driver *drv, uint32_t stride, uint32_t height) { - struct i915_device *i915_dev = (struct i915_device *)drv->priv; - if (i915_dev->gen <= 3 && stride > 8192) + struct i915_device *i915_drv = (struct i915_device *)drv->priv; + if (i915_drv->gen <= 3 && stride > 8192) return 0; return 1; } -static int i915_init(struct driver *drv) -{ - struct i915_device *i915_dev; - drm_i915_getparam_t get_param; - int device_id; - int ret; - - i915_dev = calloc(1, sizeof(*i915_dev)); - if (!i915_dev) - return -1; - - memset(&get_param, 0, sizeof(get_param)); - get_param.param = I915_PARAM_CHIPSET_ID; - get_param.value = &device_id; - ret = drmIoctl(drv->fd, DRM_IOCTL_I915_GETPARAM, &get_param); - if (ret) { - fprintf(stderr, "drv: DRM_IOCTL_I915_GETPARAM failed\n"); - free(i915_dev); - return -EINVAL; - } - - i915_dev->gen = get_gen(device_id); - i915_dev->count = 0; - - i915_dev->mgr = drm_intel_bufmgr_gem_init(drv->fd, 16 * 1024); - if (!i915_dev->mgr) { - fprintf(stderr, "drv: drm_intel_bufmgr_gem_init failed\n"); - free(i915_dev); - return -EINVAL; - } - - drv->priv = i915_dev; - - drv_insert_combinations(drv, combos, ARRAY_SIZE(combos)); - return drv_add_kms_flags(drv); -} - -static void i915_close(struct driver *drv) -{ - struct i915_device *i915_dev = drv->priv; - drm_intel_bufmgr_destroy(i915_dev->mgr); - free(i915_dev); - drv->priv = NULL; -} - static int i915_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint32_t format, uint32_t flags) { - int ret; - size_t plane; - char name[20]; - uint32_t tiling_mode; - struct i915_bo *i915_bo; - + struct driver *drv = bo->drv; int bpp = drv_stride_from_format(format, 1, 0); - struct i915_device *i915_dev = (struct i915_device *)bo->drv->priv; + struct drm_i915_gem_create gem_create; + struct drm_i915_gem_set_tiling gem_set_tiling; + uint32_t tiling_mode = I915_TILING_NONE; + size_t plane; + int ret; if (flags & (BO_USE_CURSOR | BO_USE_LINEAR | BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN)) @@ -197,114 +177,46 @@ static int i915_bo_create(struct bo *bo, uint32_t width, uint32_t height, else tiling_mode = I915_TILING_Y; - i915_align_dimensions(bo->drv, tiling_mode, &width, &height, bpp); - drv_bo_from_format(bo, width, height, format); - - if (!i915_verify_dimensions(bo->drv, bo->strides[0], height)) - return -EINVAL; - - snprintf(name, sizeof(name), "i915-buffer-%u", i915_dev->count); - i915_dev->count++; - - i915_bo = calloc(1, sizeof(*i915_bo)); - if (!i915_bo) - return -ENOMEM; - - bo->priv = i915_bo; + i915_align_dimensions(drv, tiling_mode, &width, &height, bpp); - i915_bo->ibos[0] = drm_intel_bo_alloc(i915_dev->mgr, name, - bo->total_size, 0); - if (!i915_bo->ibos[0]) { - fprintf(stderr, "drv: drm_intel_bo_alloc failed"); - free(i915_bo); - bo->priv = NULL; - return -ENOMEM; - } - - for (plane = 0; plane < bo->num_planes; plane++) { - if (plane > 0) - drm_intel_bo_reference(i915_bo->ibos[0]); - - bo->handles[plane].u32 = i915_bo->ibos[0]->handle; - i915_bo->ibos[plane] = i915_bo->ibos[0]; - } + drv_bo_from_format(bo, width, height, format); - bo->tiling = tiling_mode; + if (!i915_verify_dimensions(drv, bo->strides[0], height)) + return EINVAL; - ret = drm_intel_bo_set_tiling(i915_bo->ibos[0], &bo->tiling, - bo->strides[0]); + memset(&gem_create, 0, sizeof(gem_create)); + gem_create.size = bo->total_size; - if (ret || bo->tiling != tiling_mode) { - fprintf(stderr, "drv: drm_intel_gem_bo_set_tiling failed " - "errno=%x, stride=%x\n", errno, bo->strides[0]); - /* Calls i915 bo destroy. */ - bo->drv->backend->bo_destroy(bo); - return -errno; + ret = drmIoctl(drv->fd, DRM_IOCTL_I915_GEM_CREATE, &gem_create); + if (ret) { + fprintf(stderr, "drv: DRM_IOCTL_I915_GEM_CREATE failed " + "(size=%llu)\n", gem_create.size); + return ret; } - return 0; -} - -static int i915_bo_destroy(struct bo *bo) -{ - size_t plane; - struct i915_bo *i915_bo = bo->priv; - for (plane = 0; plane < bo->num_planes; plane++) - drm_intel_bo_unreference(i915_bo->ibos[plane]); - - free(i915_bo); - bo->priv = NULL; - - return 0; -} - -static int i915_bo_import(struct bo *bo, struct drv_import_fd_data *data) -{ - size_t plane; - uint32_t swizzling; - struct i915_bo *i915_bo; - struct i915_device *i915_dev = bo->drv->priv; - - i915_bo = calloc(1, sizeof(*i915_bo)); - if (!i915_bo) - return -ENOMEM; - - bo->priv = i915_bo; - - /* - * When self-importing, libdrm_intel increments the reference count - * on the drm_intel_bo. It also returns the same drm_intel_bo per GEM - * handle. Thus, we don't need to increase the reference count - * (i.e, drv_increment_reference_count) when importing with this - * backend. - */ - for (plane = 0; plane < bo->num_planes; plane++) { - - i915_bo->ibos[plane] = drm_intel_bo_gem_create_from_prime(i915_dev->mgr, - data->fds[plane], data->sizes[plane]); - - if (!i915_bo->ibos[plane]) { - /* - * Need to call GEM close on planes that were opened, - * if any. Adjust the num_planes variable to be the - * plane that failed, so GEM close will be called on - * planes before that plane. - */ - bo->num_planes = plane; - i915_bo_destroy(bo); - fprintf(stderr, "drv: i915: failed to import failed"); - return -EINVAL; - } - - bo->handles[plane].u32 = i915_bo->ibos[plane]->handle; - } - - if (drm_intel_bo_get_tiling(i915_bo->ibos[0], &bo->tiling, - &swizzling)) { - fprintf(stderr, "drv: drm_intel_bo_get_tiling failed"); - i915_bo_destroy(bo); - return -EINVAL; + bo->handles[plane].u32 = gem_create.handle; + + memset(&gem_set_tiling, 0, sizeof(gem_set_tiling)); + do { + gem_set_tiling.handle = bo->handles[0].u32; + gem_set_tiling.tiling_mode = tiling_mode; + gem_set_tiling.stride = bo->strides[0]; + ret = drmIoctl(drv->fd, DRM_IOCTL_I915_GEM_SET_TILING, + &gem_set_tiling); + } while (ret == -1 && (errno == EINTR || errno == EAGAIN)); + + if (ret == -1) { + struct drm_gem_close gem_close; + gem_close.handle = bo->handles[0].u32; + fprintf(stderr, "drv: DRM_IOCTL_I915_GEM_SET_TILING failed " + "errno=%x (handle=%x, tiling=%x, stride=%x)\n", + errno, + gem_set_tiling.handle, + gem_set_tiling.tiling_mode, + gem_set_tiling.stride); + drmIoctl(drv->fd, DRM_IOCTL_GEM_CLOSE, &gem_close); + return -errno; } return 0; @@ -313,35 +225,21 @@ static int i915_bo_import(struct bo *bo, struct drv_import_fd_data *data) static void *i915_bo_map(struct bo *bo, struct map_info *data, size_t plane) { int ret; - struct i915_bo *i915_bo = bo->priv; + struct drm_i915_gem_mmap_gtt gem_map; - if (bo->tiling == I915_TILING_NONE) - /* TODO(gsingh): use bo_map flags to determine if we should - * enable writing. - */ - ret = drm_intel_bo_map(i915_bo->ibos[0], 1); - else - ret = drm_intel_gem_bo_map_gtt(i915_bo->ibos[0]); + memset(&gem_map, 0, sizeof(gem_map)); + gem_map.handle = bo->handles[0].u32; + ret = drmIoctl(bo->drv->fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &gem_map); if (ret) { - fprintf(stderr, "drv: i915_bo_map failed."); + fprintf(stderr, "drv: DRM_IOCTL_I915_GEM_MMAP_GTT failed\n"); return MAP_FAILED; } - return i915_bo->ibos[0]->virtual; -} - -static int i915_bo_unmap(struct bo *bo, struct map_info *data) -{ - int ret; - struct i915_bo *i915_bo = bo->priv; - - if (bo->tiling == I915_TILING_NONE) - ret = drm_intel_bo_unmap(i915_bo->ibos[0]); - else - ret = drm_intel_gem_bo_unmap_gtt(i915_bo->ibos[0]); + data->length = bo->total_size; - return ret; + return mmap(0, bo->total_size, PROT_READ | PROT_WRITE, MAP_SHARED, + bo->drv->fd, gem_map.offset); } static uint32_t i915_resolve_format(uint32_t format) @@ -363,10 +261,8 @@ struct backend backend_i915 = .init = i915_init, .close = i915_close, .bo_create = i915_bo_create, - .bo_destroy = i915_bo_destroy, - .bo_import = i915_bo_import, + .bo_destroy = drv_gem_bo_destroy, .bo_map = i915_bo_map, - .bo_unmap = i915_bo_unmap, .resolve_format = i915_resolve_format, }; diff --git a/chromium/third_party/minigbm/src/marvell.c b/chromium/third_party/minigbm/src/marvell.c index ae3dc4570dc..e088db6e496 100644 --- a/chromium/third_party/minigbm/src/marvell.c +++ b/chromium/third_party/minigbm/src/marvell.c @@ -10,13 +10,11 @@ #include "helpers.h" #include "util.h" -static struct supported_combination combos[2] = { - {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE, - BO_USE_CURSOR | BO_USE_LINEAR | BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | - BO_USE_SW_WRITE_OFTEN | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, - {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, - BO_USE_CURSOR | BO_USE_LINEAR | BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | - BO_USE_SW_WRITE_OFTEN | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, +static struct supported_combination combos[4] = { + {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE, BO_USE_CURSOR | BO_USE_LINEAR}, + {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE, BO_USE_RENDERING}, + {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, BO_USE_CURSOR | BO_USE_LINEAR}, + {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, BO_USE_RENDERING}, } static int marvell_init(struct driver *drv) @@ -31,7 +29,6 @@ struct backend backend_marvell = .init = marvell_init, .bo_create = drv_dumb_bo_create, .bo_destroy = drv_dumb_bo_destroy, - .bo_import = drv_prime_bo_import, .bo_map = drv_dumb_bo_map, }; diff --git a/chromium/third_party/minigbm/src/mediatek.c b/chromium/third_party/minigbm/src/mediatek.c index 7e85f63409a..d4206be55fb 100644 --- a/chromium/third_party/minigbm/src/mediatek.c +++ b/chromium/third_party/minigbm/src/mediatek.c @@ -16,24 +16,25 @@ #include "helpers.h" #include "util.h" -static struct supported_combination combos[6] = { +static struct supported_combination combos[8] = { {DRM_FORMAT_ABGR8888, DRM_FORMAT_MOD_NONE, - BO_USE_LINEAR | BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN | + BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE, - BO_USE_CURSOR | BO_USE_LINEAR | BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | - BO_USE_SW_WRITE_OFTEN | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, + BO_USE_CURSOR | BO_USE_LINEAR | BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN}, + {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE, + BO_USE_RENDERING | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, {DRM_FORMAT_RGB565, DRM_FORMAT_MOD_NONE, - BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN | - BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, + BO_USE_RENDERING | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, + {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, + BO_USE_CURSOR | BO_USE_LINEAR | BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN}, {DRM_FORMAT_XBGR8888, DRM_FORMAT_MOD_NONE, BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, - BO_USE_CURSOR | BO_USE_LINEAR | BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | - BO_USE_SW_WRITE_OFTEN | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, + BO_USE_RENDERING | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, {DRM_FORMAT_YVU420, DRM_FORMAT_MOD_NONE, - BO_USE_LINEAR | BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN | + BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, }; @@ -107,7 +108,6 @@ struct backend backend_mediatek = .init = mediatek_init, .bo_create = mediatek_bo_create, .bo_destroy = drv_gem_bo_destroy, - .bo_import = drv_prime_bo_import, .bo_map = mediatek_bo_map, .resolve_format = mediatek_resolve_format, }; diff --git a/chromium/third_party/minigbm/src/nouveau.c b/chromium/third_party/minigbm/src/nouveau.c deleted file mode 100644 index e0d5954db72..00000000000 --- a/chromium/third_party/minigbm/src/nouveau.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2016 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. - */ - -#include "drv_priv.h" -#include "helpers.h" -#include "util.h" - -static struct supported_combination combos[2] = { - {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, BO_USE_CURSOR | BO_USE_RENDERING}, - {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE, BO_USE_CURSOR | BO_USE_RENDERING}, -}; - -static int nouveau_init(struct driver *drv) -{ - drv_insert_combinations(drv, combos, ARRAY_SIZE(combos)); - return drv_add_kms_flags(drv); -} - -struct backend backend_nouveau = -{ - .name = "nouveau", - .init = nouveau_init, - .bo_create = drv_dumb_bo_create, - .bo_destroy = drv_dumb_bo_destroy, - .bo_import = drv_prime_bo_import, - .bo_map = drv_dumb_bo_map, -}; diff --git a/chromium/third_party/minigbm/src/rockchip.c b/chromium/third_party/minigbm/src/rockchip.c index a64a42f682f..02a5c473f87 100644 --- a/chromium/third_party/minigbm/src/rockchip.c +++ b/chromium/third_party/minigbm/src/rockchip.c @@ -1,5 +1,5 @@ /* - * Copyright 2014 The Chromium OS Authors. All rights reserved. + * Copyright (c) 2014 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. */ @@ -17,7 +17,7 @@ #include "helpers.h" #include "util.h" -static struct supported_combination combos[12] = { +static struct supported_combination combos[11] = { {DRM_FORMAT_ABGR8888, DRM_FORMAT_MOD_NONE, BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, @@ -42,79 +42,16 @@ static struct supported_combination combos[12] = { BO_USE_RENDERING | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, {DRM_FORMAT_YVU420, DRM_FORMAT_MOD_NONE, BO_USE_RENDERING | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, - {DRM_FORMAT_YVU420, DRM_FORMAT_MOD_NONE, - BO_USE_LINEAR | BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN}, }; -static int afbc_bo_from_format(struct bo *bo, uint32_t width, uint32_t height, - uint32_t format) -{ - /* We've restricted ourselves to four bytes per pixel. */ - const uint32_t pixel_size = 4; - - const uint32_t clump_width = 4; - const uint32_t clump_height = 4; - -#define AFBC_NARROW 1 -#if AFBC_NARROW == 1 - const uint32_t block_width = 4 * clump_width; - const uint32_t block_height = 4 * clump_height; -#else - const uint32_t block_width = 8 * clump_width; - const uint32_t block_height = 2 * clump_height; -#endif - - const uint32_t header_block_size = 16; - const uint32_t body_block_size = block_width * block_height * pixel_size; - const uint32_t width_in_blocks = DIV_ROUND_UP(width, block_width); - const uint32_t height_in_blocks = DIV_ROUND_UP(height, block_height); - const uint32_t total_blocks = width_in_blocks * height_in_blocks; - - const uint32_t header_plane_size = total_blocks * header_block_size; - const uint32_t body_plane_size = total_blocks * body_block_size; - - /* GPU requires 64 bytes, but EGL import code expects 1024 byte - * alignement for the body plane. */ - const uint32_t body_plane_alignment = 1024; - - const uint32_t body_plane_offset = - ALIGN(header_plane_size, body_plane_alignment); - const uint32_t total_size = - body_plane_offset + body_plane_size; - - bo->strides[0] = width_in_blocks * block_width * pixel_size; - bo->sizes[0] = total_size; - bo->offsets[0] = 0; - - bo->total_size = total_size; - - bo->format_modifiers[0] = DRM_FORMAT_MOD_CHROMEOS_ROCKCHIP_AFBC; - - return 0; -} - static int rockchip_init(struct driver *drv) { drv_insert_combinations(drv, combos, ARRAY_SIZE(combos)); return drv_add_kms_flags(drv); } -static bool has_modifier(const uint64_t *list, uint32_t count, uint64_t modifier) -{ - uint32_t i; - - for (i = 0; i < count; i++) - if (list[i] == modifier) - return true; - - return false; -} - -static int rockchip_bo_create_with_modifiers(struct bo *bo, - uint32_t width, uint32_t height, - uint32_t format, - const uint64_t *modifiers, - uint32_t count) +static int rockchip_bo_create(struct bo *bo, uint32_t width, uint32_t height, + uint32_t format, uint32_t flags) { int ret; size_t plane; @@ -130,18 +67,7 @@ static int rockchip_bo_create_with_modifiers(struct bo *bo, drv_bo_from_format(bo, aligned_width, height, format); bo->total_size = bo->strides[0] * aligned_height + w_mbs * h_mbs * 128; - } else if (width <= 2560 && - has_modifier(modifiers, count, - DRM_FORMAT_MOD_CHROMEOS_ROCKCHIP_AFBC)) { - /* If the caller has decided they can use AFBC, always - * pick that */ - afbc_bo_from_format(bo, width, height, format); } else { - if (!has_modifier(modifiers, count, DRM_FORMAT_MOD_NONE)) { - errno = EINVAL; - fprintf(stderr, "no usable modifier found\n"); - return -1; - } drv_bo_from_format(bo, width, height, format); } @@ -163,25 +89,11 @@ static int rockchip_bo_create_with_modifiers(struct bo *bo, return 0; } -static int rockchip_bo_create(struct bo *bo, uint32_t width, uint32_t height, - uint32_t format, uint32_t flags) -{ - uint64_t modifiers[] = { DRM_FORMAT_MOD_NONE }; - - return rockchip_bo_create_with_modifiers(bo, width, height, format, - modifiers, ARRAY_SIZE(modifiers)); -} - static void *rockchip_bo_map(struct bo *bo, struct map_info *data, size_t plane) { int ret; struct drm_rockchip_gem_map_off gem_map; - /* We can only map buffers created with SW access flags, which should - * have no modifiers (ie, not AFBC). */ - if (bo->format_modifiers[0] == DRM_FORMAT_MOD_CHROMEOS_ROCKCHIP_AFBC) - return MAP_FAILED; - memset(&gem_map, 0, sizeof(gem_map)); gem_map.handle = bo->handles[0].u32; @@ -217,9 +129,7 @@ struct backend backend_rockchip = .name = "rockchip", .init = rockchip_init, .bo_create = rockchip_bo_create, - .bo_create_with_modifiers = rockchip_bo_create_with_modifiers, .bo_destroy = drv_gem_bo_destroy, - .bo_import = drv_prime_bo_import, .bo_map = rockchip_bo_map, .resolve_format = rockchip_resolve_format, }; diff --git a/chromium/third_party/minigbm/src/tegra.c b/chromium/third_party/minigbm/src/tegra.c index f48352e615d..49f3c6aeb47 100644 --- a/chromium/third_party/minigbm/src/tegra.c +++ b/chromium/third_party/minigbm/src/tegra.c @@ -1,5 +1,5 @@ /* - * Copyright 2014 The Chromium OS Authors. All rights reserved. + * Copyright (c) 2014 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. */ @@ -33,16 +33,6 @@ enum nv_mem_kind NV_MEM_KIND_GENERIC_16Bx2 = 0xfe, }; -enum tegra_map_type { - TEGRA_READ_TILED_BUFFER = 0, - TEGRA_WRITE_TILED_BUFFER = 1, -}; - -struct tegra_private_map_data { - void *tiled; - void *untiled; -}; - static struct supported_combination combos[4] = { {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE, BO_USE_CURSOR | BO_USE_LINEAR | BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN}, @@ -104,80 +94,10 @@ static void compute_layout_blocklinear(int width, int height, int format, static void compute_layout_linear(int width, int height, int format, uint32_t *stride, uint32_t *size) { - *stride = ALIGN(drv_stride_from_format(format, width, 0), 64); + *stride = drv_stride_from_format(format, width, 0); *size = *stride * height; } -static void transfer_tile(struct bo *bo, uint8_t *tiled, uint8_t *untiled, - enum tegra_map_type type, uint32_t bytes_per_pixel, - uint32_t gob_top, uint32_t gob_left, - uint32_t gob_size_pixels) -{ - uint8_t *tmp; - uint32_t x, y, k; - for (k = 0; k < gob_size_pixels; k++) { - /* - * Given the kth pixel starting from the tile specified by - * gob_top and gob_left, unswizzle to get the standard (x, y) - * representation. - */ - x = gob_left + (((k >> 3) & 8) | ((k >> 1) & 4) | (k & 3)); - y = gob_top + ((k >> 7 << 3) | ((k >> 3) & 6) | ((k >> 2) & 1)); - - tmp = untiled + (y * bo->strides[0]) + (x * bytes_per_pixel); - - if (type == TEGRA_READ_TILED_BUFFER) - memcpy(tmp, tiled, bytes_per_pixel); - else if (type == TEGRA_WRITE_TILED_BUFFER) - memcpy(tiled, tmp, bytes_per_pixel); - - /* Move on to next pixel. */ - tiled += bytes_per_pixel; - } -} - -static void transfer_tiled_memory(struct bo *bo, uint8_t *tiled, - uint8_t *untiled, enum tegra_map_type type) -{ - uint32_t gob_width, gob_height, gob_size_bytes, gob_size_pixels, - gob_count_x, gob_count_y, gob_top, gob_left; - uint32_t i, j, offset; - uint8_t *tmp; - uint32_t bytes_per_pixel = drv_stride_from_format(bo->format, 1, 0); - - /* - * The blocklinear format consists of 8*(2^n) x 64 byte sized tiles, - * where 0 <= n <= 4. - */ - gob_width = DIV_ROUND_UP(NV_BLOCKLINEAR_GOB_WIDTH, bytes_per_pixel); - gob_height = NV_BLOCKLINEAR_GOB_HEIGHT * - (1 << NV_DEFAULT_BLOCK_HEIGHT_LOG2); - /* Calculate the height from maximum possible gob height */ - while (gob_height > NV_BLOCKLINEAR_GOB_HEIGHT - && gob_height >= 2 * bo->height) - gob_height /= 2; - - gob_size_bytes = gob_height * NV_BLOCKLINEAR_GOB_WIDTH; - gob_size_pixels = gob_height * gob_width; - - gob_count_x = DIV_ROUND_UP(bo->strides[0], NV_BLOCKLINEAR_GOB_WIDTH); - gob_count_y = DIV_ROUND_UP(bo->height, gob_height); - - offset = 0; - for (j = 0; j < gob_count_y; j++) { - gob_top = j * gob_height; - for (i = 0; i < gob_count_x; i++) { - tmp = tiled + offset; - gob_left = i * gob_width; - - transfer_tile(bo, tmp, untiled, type, bytes_per_pixel, - gob_top, gob_left, gob_size_pixels); - - offset += gob_size_bytes; - } - } -} - static int tegra_init(struct driver *drv) { drv_insert_combinations(drv, combos, ARRAY_SIZE(combos)); @@ -242,7 +162,6 @@ static void *tegra_bo_map(struct bo *bo, struct map_info *data, size_t plane) { int ret; struct drm_tegra_gem_mmap gem_map; - struct tegra_private_map_data *priv; memset(&gem_map, 0, sizeof(gem_map)); gem_map.handle = bo->handles[0].u32; @@ -254,37 +173,10 @@ static void *tegra_bo_map(struct bo *bo, struct map_info *data, size_t plane) return MAP_FAILED; } - void *addr = mmap(0, bo->total_size, PROT_READ | PROT_WRITE, MAP_SHARED, - bo->drv->fd, gem_map.offset); - data->length = bo->total_size; - if ((bo->tiling & 0xFF) == NV_MEM_KIND_C32_2CRA && addr != MAP_FAILED) { - priv = calloc(1, sizeof(*priv)); - priv->untiled = calloc(1, bo->total_size); - priv->tiled = addr; - data->priv = priv; - transfer_tiled_memory(bo, priv->tiled, priv->untiled, - TEGRA_READ_TILED_BUFFER); - addr = priv->untiled; - } - - return addr; -} - -static int tegra_bo_unmap(struct bo *bo, struct map_info *data) -{ - if (data->priv) { - struct tegra_private_map_data *priv = data->priv; - transfer_tiled_memory(bo, priv->tiled, priv->untiled, - TEGRA_WRITE_TILED_BUFFER); - data->addr = priv->tiled; - free(priv->untiled); - free(priv); - data->priv = NULL; - } - - return munmap(data->addr, data->length); + return mmap(0, bo->total_size, PROT_READ | PROT_WRITE, MAP_SHARED, + bo->drv->fd, gem_map.offset); } struct backend backend_tegra = @@ -293,9 +185,7 @@ struct backend backend_tegra = .init = tegra_init, .bo_create = tegra_bo_create, .bo_destroy = drv_gem_bo_destroy, - .bo_import = drv_prime_bo_import, .bo_map = tegra_bo_map, - .bo_unmap = tegra_bo_unmap, }; #endif diff --git a/chromium/third_party/minigbm/src/udl.c b/chromium/third_party/minigbm/src/udl.c index c607772b736..a4fb07b5b47 100644 --- a/chromium/third_party/minigbm/src/udl.c +++ b/chromium/third_party/minigbm/src/udl.c @@ -1,5 +1,5 @@ /* - * Copyright 2014 The Chromium OS Authors. All rights reserved. + * Copyright (c) 2014 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. */ @@ -8,13 +8,11 @@ #include "helpers.h" #include "util.h" -static struct supported_combination combos[2] = { - {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE, - BO_USE_CURSOR | BO_USE_LINEAR | BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | - BO_USE_SW_WRITE_OFTEN | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, - {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, - BO_USE_CURSOR | BO_USE_LINEAR | BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | - BO_USE_SW_WRITE_OFTEN | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, +static struct supported_combination combos[4] = { + {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE, BO_USE_CURSOR | BO_USE_LINEAR}, + {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE, BO_USE_RENDERING}, + {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, BO_USE_CURSOR | BO_USE_LINEAR}, + {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, BO_USE_RENDERING}, }; static int udl_init(struct driver *drv) @@ -29,6 +27,5 @@ struct backend backend_udl = .init = udl_init, .bo_create = drv_dumb_bo_create, .bo_destroy = drv_dumb_bo_destroy, - .bo_import = drv_prime_bo_import, .bo_map = drv_dumb_bo_map, }; diff --git a/chromium/third_party/minigbm/src/util.h b/chromium/third_party/minigbm/src/util.h index 696b996b9af..9606336fdc4 100644 --- a/chromium/third_party/minigbm/src/util.h +++ b/chromium/third_party/minigbm/src/util.h @@ -1,5 +1,5 @@ /* - * Copyright 2014 The Chromium OS Authors. All rights reserved. + * Copyright (c) 2014 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. */ diff --git a/chromium/third_party/minigbm/src/vc4.c b/chromium/third_party/minigbm/src/vc4.c deleted file mode 100644 index 7e5351f2775..00000000000 --- a/chromium/third_party/minigbm/src/vc4.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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. - */ - -#ifdef DRV_VC4 - -#include <stdio.h> -#include <string.h> -#include <sys/mman.h> -#include <vc4_drm.h> -#include <xf86drm.h> - -#include "drv_priv.h" -#include "helpers.h" -#include "util.h" - -static struct supported_combination combos[3] = { - {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE, - BO_USE_CURSOR | BO_USE_LINEAR | BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | - BO_USE_SW_WRITE_OFTEN | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, - {DRM_FORMAT_RGB565, DRM_FORMAT_MOD_NONE, - BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN | - BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, - {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, - BO_USE_CURSOR | BO_USE_LINEAR | BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | - BO_USE_SW_WRITE_OFTEN | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, -}; - -static int vc4_init(struct driver *drv) -{ - drv_insert_combinations(drv, combos, ARRAY_SIZE(combos)); - return drv_add_kms_flags(drv); -} - -static int vc4_bo_create(struct bo *bo, uint32_t width, uint32_t height, - uint32_t format, uint32_t flags) -{ - int ret; - size_t plane; - struct drm_vc4_create_bo bo_create; - - drv_bo_from_format(bo, width, height, format); - - memset(&bo_create, 0, sizeof(bo_create)); - bo_create.size = bo->total_size; - - ret = drmIoctl(bo->drv->fd, DRM_IOCTL_VC4_CREATE_BO, &bo_create); - if (ret) { - fprintf(stderr, "drv: DRM_IOCTL_VC4_GEM_CREATE failed " - "(size=%zu)\n", bo->total_size); - return ret; - } - - for (plane = 0; plane < bo->num_planes; plane++) - bo->handles[plane].u32 = bo_create.handle; - - return 0; -} - -static void *vc4_bo_map(struct bo *bo, struct map_info *data, size_t plane) -{ - int ret; - struct drm_vc4_mmap_bo bo_map; - - memset(&bo_map, 0, sizeof(bo_map)); - bo_map.handle = bo->handles[0].u32; - - ret = drmCommandWriteRead(bo->drv->fd, DRM_VC4_MMAP_BO, &bo_map, - sizeof(bo_map)); - if (ret) { - fprintf(stderr, "drv: DRM_VC4_MMAP_BO 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, bo_map.offset); -} - -struct backend backend_vc4 = -{ - .name = "vc4", - .init = vc4_init, - .bo_create = vc4_bo_create, - .bo_import = drv_prime_bo_import, - .bo_destroy = drv_gem_bo_destroy, - .bo_map = vc4_bo_map, -}; - -#endif diff --git a/chromium/third_party/minigbm/src/vgem.c b/chromium/third_party/minigbm/src/vgem.c index 0f3d2e3e0e3..815f73c9051 100644 --- a/chromium/third_party/minigbm/src/vgem.c +++ b/chromium/third_party/minigbm/src/vgem.c @@ -13,17 +13,14 @@ static struct supported_combination combos[4] = { {DRM_FORMAT_ABGR8888, DRM_FORMAT_MOD_NONE, - BO_USE_CURSOR | BO_USE_LINEAR | BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | - BO_USE_SW_WRITE_OFTEN | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, + BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN}, {DRM_FORMAT_RGB565, DRM_FORMAT_MOD_NONE, - BO_USE_LINEAR | BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN | - BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, + BO_USE_RENDERING | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, {DRM_FORMAT_XBGR8888, DRM_FORMAT_MOD_NONE, - BO_USE_CURSOR | BO_USE_LINEAR | BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | - BO_USE_SW_WRITE_OFTEN | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, - {DRM_FORMAT_YVU420, DRM_FORMAT_MOD_NONE, - BO_USE_LINEAR | BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN | + BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, + {DRM_FORMAT_YVU420, DRM_FORMAT_MOD_NONE, + BO_USE_RENDERING | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, }; static int vgem_init(struct driver *drv) @@ -63,7 +60,6 @@ struct backend backend_vgem = .init = vgem_init, .bo_create = vgem_bo_create, .bo_destroy = drv_dumb_bo_destroy, - .bo_import = drv_prime_bo_import, .bo_map = drv_dumb_bo_map, .resolve_format = vgem_resolve_format, }; diff --git a/chromium/third_party/minigbm/src/virtio_gpu.c b/chromium/third_party/minigbm/src/virtio_gpu.c index 5ac0e314aa0..f169101be27 100644 --- a/chromium/third_party/minigbm/src/virtio_gpu.c +++ b/chromium/third_party/minigbm/src/virtio_gpu.c @@ -8,13 +8,11 @@ #include "helpers.h" #include "util.h" -static struct supported_combination combos[2] = { - {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE, - BO_USE_CURSOR | BO_USE_LINEAR | BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | - BO_USE_SW_WRITE_OFTEN | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, - {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, - BO_USE_CURSOR | BO_USE_LINEAR | BO_USE_RENDERING | BO_USE_SW_READ_OFTEN | - BO_USE_SW_WRITE_OFTEN | BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY}, +static struct supported_combination combos[4] = { + {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE, BO_USE_CURSOR | BO_USE_LINEAR}, + {DRM_FORMAT_ARGB8888, DRM_FORMAT_MOD_NONE, BO_USE_RENDERING}, + {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, BO_USE_CURSOR | BO_USE_LINEAR}, + {DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, BO_USE_RENDERING}, }; static int virtio_gpu_init(struct driver *drv) @@ -29,7 +27,6 @@ struct backend backend_virtio_gpu = .init = virtio_gpu_init, .bo_create = drv_dumb_bo_create, .bo_destroy = drv_dumb_bo_destroy, - .bo_import = drv_prime_bo_import, .bo_map = drv_dumb_bo_map, }; |