minigbm: remove buffer sizes when importing
CL:662919 started using lseek() and the buffer offsets when importing,
so let's remove buffer sizes here.
BUG=b:65566935
TEST=emerge-eve {minigbm, arc-cros-gralloc}
Change-Id: I43fda28bfe530139e8e0d68c6b9c213489077b4c
Reviewed-on: https://chromium-review.googlesource.com/691421
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
This commit is contained in:
parent
2426d03731
commit
bc24bd757b
7 changed files with 19 additions and 28 deletions
|
|
@ -124,7 +124,6 @@ int32_t cros_gralloc_driver::allocate(const struct cros_gralloc_buffer_descripto
|
|||
hnd->fds[plane] = drv_bo_get_plane_fd(bo, plane);
|
||||
hnd->strides[plane] = drv_bo_get_plane_stride(bo, plane);
|
||||
hnd->offsets[plane] = drv_bo_get_plane_offset(bo, plane);
|
||||
hnd->sizes[plane] = drv_bo_get_plane_size(bo, plane);
|
||||
|
||||
mod = drv_bo_get_plane_format_modifier(bo, plane);
|
||||
hnd->format_modifiers[2 * plane] = static_cast<uint32_t>(mod >> 32);
|
||||
|
|
@ -189,7 +188,6 @@ int32_t cros_gralloc_driver::retain(buffer_handle_t handle)
|
|||
memcpy(data.fds, hnd->fds, sizeof(data.fds));
|
||||
memcpy(data.strides, hnd->strides, sizeof(data.strides));
|
||||
memcpy(data.offsets, hnd->offsets, sizeof(data.offsets));
|
||||
memcpy(data.sizes, hnd->sizes, sizeof(data.sizes));
|
||||
for (uint32_t plane = 0; plane < DRV_MAX_PLANES; plane++) {
|
||||
data.format_modifiers[plane] =
|
||||
static_cast<uint64_t>(hnd->format_modifiers[2 * plane]) << 32;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ struct cros_gralloc_handle {
|
|||
int32_t fds[DRV_MAX_PLANES];
|
||||
uint32_t strides[DRV_MAX_PLANES];
|
||||
uint32_t offsets[DRV_MAX_PLANES];
|
||||
uint32_t sizes[DRV_MAX_PLANES];
|
||||
uint32_t format_modifiers[2 * DRV_MAX_PLANES];
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
|
|
|
|||
18
drv.c
18
drv.c
|
|
@ -580,24 +580,6 @@ size_t drv_num_planes_from_format(uint32_t format)
|
|||
return 0;
|
||||
}
|
||||
|
||||
uint32_t drv_size_from_format(uint32_t format, uint32_t stride, uint32_t height, size_t plane)
|
||||
{
|
||||
assert(plane < drv_num_planes_from_format(format));
|
||||
uint32_t vertical_subsampling;
|
||||
|
||||
switch (format) {
|
||||
case DRM_FORMAT_NV12:
|
||||
case DRM_FORMAT_YVU420:
|
||||
case DRM_FORMAT_YVU420_ANDROID:
|
||||
vertical_subsampling = (plane == 0) ? 1 : 2;
|
||||
break;
|
||||
default:
|
||||
vertical_subsampling = 1;
|
||||
}
|
||||
|
||||
return stride * DIV_ROUND_UP(height, vertical_subsampling);
|
||||
}
|
||||
|
||||
uint32_t drv_num_buffers_per_bo(struct bo *bo)
|
||||
{
|
||||
uint32_t count = 0;
|
||||
|
|
|
|||
3
drv.h
3
drv.h
|
|
@ -71,7 +71,6 @@ struct drv_import_fd_data {
|
|||
int fds[DRV_MAX_PLANES];
|
||||
uint32_t strides[DRV_MAX_PLANES];
|
||||
uint32_t offsets[DRV_MAX_PLANES];
|
||||
uint32_t sizes[DRV_MAX_PLANES];
|
||||
uint64_t format_modifiers[DRV_MAX_PLANES];
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
|
|
@ -145,8 +144,6 @@ uint32_t drv_resolve_format(struct driver *drv, uint32_t format, uint64_t usage)
|
|||
|
||||
size_t drv_num_planes_from_format(uint32_t format);
|
||||
|
||||
uint32_t drv_size_from_format(uint32_t format, uint32_t stride, uint32_t height, size_t plane);
|
||||
|
||||
uint32_t drv_num_buffers_per_bo(struct bo *bo);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
4
gbm.c
4
gbm.c
|
|
@ -179,7 +179,6 @@ PUBLIC struct gbm_bo *gbm_bo_import(struct gbm_device *gbm, uint32_t type, void
|
|||
drv_data.format = fd_data->format;
|
||||
drv_data.fds[0] = fd_data->fd;
|
||||
drv_data.strides[0] = fd_data->stride;
|
||||
drv_data.sizes[0] = fd_data->height * fd_data->stride;
|
||||
break;
|
||||
case GBM_BO_IMPORT_FD_PLANAR:
|
||||
gbm_format = fd_planar_data->format;
|
||||
|
|
@ -195,9 +194,6 @@ PUBLIC struct gbm_bo *gbm_bo_import(struct gbm_device *gbm, uint32_t type, void
|
|||
drv_data.offsets[i] = fd_planar_data->offsets[i];
|
||||
drv_data.strides[i] = fd_planar_data->strides[i];
|
||||
drv_data.format_modifiers[i] = fd_planar_data->format_modifiers[i];
|
||||
|
||||
drv_data.sizes[i] = drv_size_from_format(
|
||||
drv_data.format, drv_data.strides[i], drv_data.height, i);
|
||||
}
|
||||
|
||||
for (i = num_planes; i < GBM_MAX_PLANES; i++)
|
||||
|
|
|
|||
18
helpers.c
18
helpers.c
|
|
@ -127,6 +127,24 @@ uint32_t drv_stride_from_format(uint32_t format, uint32_t width, size_t plane)
|
|||
return stride;
|
||||
}
|
||||
|
||||
uint32_t drv_size_from_format(uint32_t format, uint32_t stride, uint32_t height, size_t plane)
|
||||
{
|
||||
assert(plane < drv_num_planes_from_format(format));
|
||||
uint32_t vertical_subsampling;
|
||||
|
||||
switch (format) {
|
||||
case DRM_FORMAT_NV12:
|
||||
case DRM_FORMAT_YVU420:
|
||||
case DRM_FORMAT_YVU420_ANDROID:
|
||||
vertical_subsampling = (plane == 0) ? 1 : 2;
|
||||
break;
|
||||
default:
|
||||
vertical_subsampling = 1;
|
||||
}
|
||||
|
||||
return stride * DIV_ROUND_UP(height, vertical_subsampling);
|
||||
}
|
||||
|
||||
/*
|
||||
* This function fills in the buffer object given the driver aligned stride of
|
||||
* the first plane, height and a format. This function assumes there is just
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include "drv.h"
|
||||
|
||||
uint32_t drv_stride_from_format(uint32_t format, uint32_t width, size_t plane);
|
||||
uint32_t drv_size_from_format(uint32_t format, uint32_t stride, uint32_t height, size_t plane);
|
||||
int drv_bo_from_format(struct bo *bo, uint32_t stride, uint32_t aligned_height, uint32_t format);
|
||||
int drv_dumb_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint32_t format,
|
||||
uint32_t flags);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue