diff options
author | Gurchetan Singh <gurchetansingh@chromium.org> | 2017-09-28 15:21:53 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-09-29 14:35:25 -0700 |
commit | bc24bd757b1c63c778f15a1b3ff36c0e8a08b070 (patch) | |
tree | 1a6c7b797bb6a8edfb4ebb43f29760dfd44d6ceb | |
parent | 2426d0373145f74c7f8809786f7171c688fcddb2 (diff) |
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>
-rw-r--r-- | cros_gralloc/cros_gralloc_driver.cc | 2 | ||||
-rw-r--r-- | cros_gralloc/cros_gralloc_handle.h | 1 | ||||
-rw-r--r-- | drv.c | 18 | ||||
-rw-r--r-- | drv.h | 3 | ||||
-rw-r--r-- | gbm.c | 4 | ||||
-rw-r--r-- | helpers.c | 18 | ||||
-rw-r--r-- | helpers.h | 1 |
7 files changed, 19 insertions, 28 deletions
diff --git a/cros_gralloc/cros_gralloc_driver.cc b/cros_gralloc/cros_gralloc_driver.cc index f6e65b7..805c123 100644 --- a/cros_gralloc/cros_gralloc_driver.cc +++ b/cros_gralloc/cros_gralloc_driver.cc @@ -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; diff --git a/cros_gralloc/cros_gralloc_handle.h b/cros_gralloc/cros_gralloc_handle.h index 4cb554d..bdd3f07 100644 --- a/cros_gralloc/cros_gralloc_handle.h +++ b/cros_gralloc/cros_gralloc_handle.h @@ -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; @@ -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; @@ -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 @@ -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++) @@ -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); |