minigbm: Drop drv_bo_get_stride_in_pixels() helper
Computing "stride in pixels" assumes the pixel size divides the stride, which isn't always the case. This is only used for the cros_gralloc implementation, so lets move the calculation there instead of providing a generic helper for an unhealthy concept. BUG=822346 TEST=test_that graphics_Gbm Change-Id: Iab7a363c5471e4bacef7df7095ef77723adf5e93 Reviewed-on: https://chromium-review.googlesource.com/996645 Commit-Ready: Kristian H. Kristensen <hoegsberg@chromium.org> Tested-by: Kristian H. Kristensen <hoegsberg@chromium.org> Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
This commit is contained in:
parent
292da5365a
commit
222919005b
4 changed files with 4 additions and 10 deletions
|
|
@ -90,6 +90,7 @@ int32_t cros_gralloc_driver::allocate(const struct cros_gralloc_buffer_descripto
|
|||
uint64_t mod;
|
||||
size_t num_planes;
|
||||
uint32_t resolved_format;
|
||||
uint32_t bytes_per_pixel;
|
||||
|
||||
struct bo *bo;
|
||||
struct cros_gralloc_handle *hnd;
|
||||
|
|
@ -135,7 +136,8 @@ int32_t cros_gralloc_driver::allocate(const struct cros_gralloc_buffer_descripto
|
|||
hnd->format = drv_bo_get_format(bo);
|
||||
hnd->use_flags[0] = static_cast<uint32_t>(descriptor->use_flags >> 32);
|
||||
hnd->use_flags[1] = static_cast<uint32_t>(descriptor->use_flags);
|
||||
hnd->pixel_stride = drv_bo_get_stride_in_pixels(bo);
|
||||
bytes_per_pixel = drv_bytes_per_pixel_from_format(hnd->format, 0);
|
||||
hnd->pixel_stride = DIV_ROUND_UP(hnd->strides[0], bytes_per_pixel);
|
||||
hnd->magic = cros_gralloc_magic;
|
||||
hnd->droid_format = descriptor->droid_format;
|
||||
hnd->usage = descriptor->producer_usage;
|
||||
|
|
|
|||
2
drv.h
2
drv.h
|
|
@ -155,7 +155,7 @@ uint64_t drv_bo_get_plane_format_modifier(struct bo *bo, size_t plane);
|
|||
|
||||
uint32_t drv_bo_get_format(struct bo *bo);
|
||||
|
||||
uint32_t drv_bo_get_stride_in_pixels(struct bo *bo);
|
||||
uint32_t drv_bytes_per_pixel_from_format(uint32_t format, size_t plane);
|
||||
|
||||
uint32_t drv_stride_from_format(uint32_t format, uint32_t width, size_t plane);
|
||||
|
||||
|
|
|
|||
|
|
@ -185,12 +185,6 @@ uint32_t drv_bytes_per_pixel_from_format(uint32_t format, size_t plane)
|
|||
return layout->bytes_per_pixel[plane];
|
||||
}
|
||||
|
||||
uint32_t drv_bo_get_stride_in_pixels(struct bo *bo)
|
||||
{
|
||||
uint32_t bytes_per_pixel = drv_bytes_per_pixel_from_format(bo->format, 0);
|
||||
return DIV_ROUND_UP(bo->strides[0], bytes_per_pixel);
|
||||
}
|
||||
|
||||
/*
|
||||
* This function returns the stride for a given format, width and plane.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -10,11 +10,9 @@
|
|||
#include "drv.h"
|
||||
#include "helpers_array.h"
|
||||
|
||||
uint32_t drv_width_from_format(uint32_t format, uint32_t width, size_t plane);
|
||||
uint32_t drv_height_from_format(uint32_t format, uint32_t height, 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);
|
||||
uint32_t drv_bytes_per_pixel_from_format(uint32_t format, size_t plane);
|
||||
int drv_dumb_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint32_t format,
|
||||
uint64_t use_flags);
|
||||
int drv_dumb_bo_destroy(struct bo *bo);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue