minigbm: Remove plane in bo_map
Remove the parameter to align with upstream gbm. For some places that use the number of planes. The number is 1. The multi-planar formats are being allocated into a single plane, and minigbm exynos backend is dropped. So we can just set the plane index to 0 if needed. Fixed the format in i915.c. Bug=b:266776512 TEST=camera works after deploying the change #strongbad TEST=camera works after deploying the change #corsola Change-Id: I0880917754c01b9d0f27d21f3c42d87f00a09f50 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/4249501 Commit-Queue: Dawn Han <dawnhan@google.com> Tested-by: Dawn Han <dawnhan@google.com> Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Reviewed-by: Chia-I Wu <olv@google.com>
This commit is contained in:
parent
46a3cfa5a8
commit
ecbc89179e
12 changed files with 23 additions and 24 deletions
6
amdgpu.c
6
amdgpu.c
|
|
@ -663,19 +663,19 @@ static int amdgpu_destroy_bo(struct bo *bo)
|
|||
return drv_gem_bo_destroy(bo);
|
||||
}
|
||||
|
||||
static void *amdgpu_map_bo(struct bo *bo, struct vma *vma, size_t plane, uint32_t map_flags)
|
||||
static void *amdgpu_map_bo(struct bo *bo, struct vma *vma, uint32_t map_flags)
|
||||
{
|
||||
void *addr = MAP_FAILED;
|
||||
int ret;
|
||||
union drm_amdgpu_gem_mmap gem_map = { { 0 } };
|
||||
struct drm_amdgpu_gem_create_in bo_info = { 0 };
|
||||
struct drm_amdgpu_gem_op gem_op = { 0 };
|
||||
uint32_t handle = bo->handles[plane].u32;
|
||||
uint32_t handle = bo->handles[0].u32;
|
||||
struct amdgpu_linear_vma_priv *priv = NULL;
|
||||
struct amdgpu_priv *drv_priv;
|
||||
|
||||
if (bo->priv)
|
||||
return dri_bo_map(bo, vma, plane, map_flags);
|
||||
return dri_bo_map(bo, vma, 0, map_flags);
|
||||
|
||||
drv_priv = bo->drv->priv;
|
||||
gem_op.handle = handle;
|
||||
|
|
|
|||
2
drv.c
2
drv.c
|
|
@ -523,7 +523,7 @@ void *drv_bo_map(struct bo *bo, const struct rectangle *rect, uint32_t map_flags
|
|||
}
|
||||
|
||||
memcpy(mapping.vma->map_strides, bo->meta.strides, sizeof(mapping.vma->map_strides));
|
||||
addr = drv->backend->bo_map(bo, mapping.vma, plane, map_flags);
|
||||
addr = drv->backend->bo_map(bo, mapping.vma, map_flags);
|
||||
if (addr == MAP_FAILED) {
|
||||
*map_data = NULL;
|
||||
free(mapping.vma);
|
||||
|
|
|
|||
|
|
@ -459,14 +459,14 @@ int drv_prime_bo_import(struct bo *bo, struct drv_import_fd_data *data)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void *drv_dumb_bo_map(struct bo *bo, struct vma *vma, size_t plane, uint32_t map_flags)
|
||||
void *drv_dumb_bo_map(struct bo *bo, struct vma *vma, uint32_t map_flags)
|
||||
{
|
||||
int ret;
|
||||
size_t i;
|
||||
struct drm_mode_map_dumb map_dumb;
|
||||
|
||||
memset(&map_dumb, 0, sizeof(map_dumb));
|
||||
map_dumb.handle = bo->handles[plane].u32;
|
||||
map_dumb.handle = bo->handles[0].u32;
|
||||
|
||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_MODE_MAP_DUMB, &map_dumb);
|
||||
if (ret) {
|
||||
|
|
@ -475,8 +475,7 @@ void *drv_dumb_bo_map(struct bo *bo, struct vma *vma, size_t plane, uint32_t map
|
|||
}
|
||||
|
||||
for (i = 0; i < bo->meta.num_planes; i++)
|
||||
if (bo->handles[i].u32 == bo->handles[plane].u32)
|
||||
vma->length += bo->meta.sizes[i];
|
||||
vma->length += bo->meta.sizes[i];
|
||||
|
||||
return mmap(0, vma->length, drv_get_prot(map_flags), MAP_SHARED, bo->drv->fd,
|
||||
map_dumb.offset);
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ int drv_dumb_bo_create_ex(struct bo *bo, uint32_t width, uint32_t height, uint32
|
|||
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 vma *vma, size_t plane, uint32_t map_flags);
|
||||
void *drv_dumb_bo_map(struct bo *bo, struct vma *vma, uint32_t map_flags);
|
||||
int drv_bo_munmap(struct bo *bo, struct vma *vma);
|
||||
int drv_get_prot(uint32_t map_flags);
|
||||
void drv_add_combination(struct driver *drv, uint32_t format, struct format_metadata *metadata,
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ struct backend {
|
|||
/* Called on free if this bo is the last object referencing the contained GEM BOs */
|
||||
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 vma *vma, size_t plane, uint32_t map_flags);
|
||||
void *(*bo_map)(struct bo *bo, struct vma *vma, uint32_t map_flags);
|
||||
int (*bo_unmap)(struct bo *bo, struct vma *vma);
|
||||
int (*bo_invalidate)(struct bo *bo, struct mapping *mapping);
|
||||
int (*bo_flush)(struct bo *bo, struct mapping *mapping);
|
||||
|
|
|
|||
10
i915.c
10
i915.c
|
|
@ -813,7 +813,7 @@ static int i915_bo_import(struct bo *bo, struct drv_import_fd_data *data)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void *i915_bo_map(struct bo *bo, struct vma *vma, size_t plane, uint32_t map_flags)
|
||||
static void *i915_bo_map(struct bo *bo, struct vma *vma, uint32_t map_flags)
|
||||
{
|
||||
int ret;
|
||||
void *addr = MAP_FAILED;
|
||||
|
|
@ -833,8 +833,8 @@ static void *i915_bo_map(struct bo *bo, struct vma *vma, size_t plane, uint32_t
|
|||
/* Get the fake offset back */
|
||||
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_I915_GEM_MMAP_OFFSET, &gem_map);
|
||||
if (ret == 0)
|
||||
addr = mmap(0, bo->meta.total_size, drv_get_prot(map_flags), MAP_SHARED,
|
||||
bo->drv->fd, gem_map.offset);
|
||||
addr = mmap(0, bo->meta.total_size, drv_get_prot(map_flags),
|
||||
MAP_SHARED, bo->drv->fd, gem_map.offset);
|
||||
} else {
|
||||
struct drm_i915_gem_mmap gem_map = { 0 };
|
||||
/* TODO(b/118799155): We don't seem to have a good way to
|
||||
|
|
@ -846,8 +846,8 @@ static void *i915_bo_map(struct bo *bo, struct vma *vma, size_t plane, uint32_t
|
|||
* Renderscript and camera use cases, as they're
|
||||
* performance-sensitive. */
|
||||
if ((bo->meta.use_flags & BO_USE_SCANOUT) &&
|
||||
!(bo->meta.use_flags &
|
||||
(BO_USE_RENDERSCRIPT | BO_USE_CAMERA_READ | BO_USE_CAMERA_WRITE)))
|
||||
!(bo->meta.use_flags &
|
||||
(BO_USE_RENDERSCRIPT | BO_USE_CAMERA_READ | BO_USE_CAMERA_WRITE)))
|
||||
gem_map.flags = I915_MMAP_WC;
|
||||
|
||||
gem_map.handle = bo->handles[0].u32;
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ static int mediatek_bo_create(struct bo *bo, uint32_t width, uint32_t height, ui
|
|||
ARRAY_SIZE(modifiers));
|
||||
}
|
||||
|
||||
static void *mediatek_bo_map(struct bo *bo, struct vma *vma, size_t plane, uint32_t map_flags)
|
||||
static void *mediatek_bo_map(struct bo *bo, struct vma *vma, uint32_t map_flags)
|
||||
{
|
||||
int ret, prime_fd;
|
||||
struct drm_mtk_gem_map_off gem_map = { 0 };
|
||||
|
|
|
|||
2
msm.c
2
msm.c
|
|
@ -352,7 +352,7 @@ static int msm_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint32_
|
|||
return msm_bo_create_for_modifier(bo, width, height, format, combo->metadata.modifier);
|
||||
}
|
||||
|
||||
static void *msm_bo_map(struct bo *bo, struct vma *vma, size_t plane, uint32_t map_flags)
|
||||
static void *msm_bo_map(struct bo *bo, struct vma *vma, uint32_t map_flags)
|
||||
{
|
||||
int ret;
|
||||
struct drm_msm_gem_info req = { 0 };
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ static int rockchip_bo_create(struct bo *bo, uint32_t width, uint32_t height, ui
|
|||
ARRAY_SIZE(modifiers));
|
||||
}
|
||||
|
||||
static void *rockchip_bo_map(struct bo *bo, struct vma *vma, size_t plane, uint32_t map_flags)
|
||||
static void *rockchip_bo_map(struct bo *bo, struct vma *vma, uint32_t map_flags)
|
||||
{
|
||||
int ret;
|
||||
struct rockchip_private_map_data *priv;
|
||||
|
|
|
|||
2
vc4.c
2
vc4.c
|
|
@ -105,7 +105,7 @@ static int vc4_bo_create_with_modifiers(struct bo *bo, uint32_t width, uint32_t
|
|||
return vc4_bo_create_for_modifier(bo, width, height, format, modifier);
|
||||
}
|
||||
|
||||
static void *vc4_bo_map(struct bo *bo, struct vma *vma, size_t plane, uint32_t map_flags)
|
||||
static void *vc4_bo_map(struct bo *bo, struct vma *vma, uint32_t map_flags)
|
||||
{
|
||||
int ret;
|
||||
struct drm_vc4_mmap_bo bo_map = { 0 };
|
||||
|
|
|
|||
|
|
@ -410,7 +410,7 @@ static int cross_domain_bo_create(struct bo *bo, uint32_t width, uint32_t height
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void *cross_domain_bo_map(struct bo *bo, struct vma *vma, size_t plane, uint32_t map_flags)
|
||||
static void *cross_domain_bo_map(struct bo *bo, struct vma *vma, uint32_t map_flags)
|
||||
{
|
||||
int ret;
|
||||
struct drm_virtgpu_map gem_map = { 0 };
|
||||
|
|
|
|||
|
|
@ -504,7 +504,7 @@ static int virgl_3d_bo_create(struct bo *bo, uint32_t width, uint32_t height, ui
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void *virgl_3d_bo_map(struct bo *bo, struct vma *vma, size_t plane, uint32_t map_flags)
|
||||
static void *virgl_3d_bo_map(struct bo *bo, struct vma *vma, uint32_t map_flags)
|
||||
{
|
||||
int ret;
|
||||
struct drm_virtgpu_map gem_map = { 0 };
|
||||
|
|
@ -796,12 +796,12 @@ static int virgl_bo_destroy(struct bo *bo)
|
|||
return drv_dumb_bo_destroy(bo);
|
||||
}
|
||||
|
||||
static void *virgl_bo_map(struct bo *bo, struct vma *vma, size_t plane, uint32_t map_flags)
|
||||
static void *virgl_bo_map(struct bo *bo, struct vma *vma, uint32_t map_flags)
|
||||
{
|
||||
if (params[param_3d].value)
|
||||
return virgl_3d_bo_map(bo, vma, plane, map_flags);
|
||||
return virgl_3d_bo_map(bo, vma, map_flags);
|
||||
else
|
||||
return drv_dumb_bo_map(bo, vma, plane, map_flags);
|
||||
return drv_dumb_bo_map(bo, vma, map_flags);
|
||||
}
|
||||
|
||||
static bool is_arc_screen_capture_bo(struct bo *bo)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue