X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=helpers.c;h=f1a74c7103bb0107ef248c737cb7d7d17b884636;hb=662a9fd2acd72fd73e72110924ea9f350429195d;hp=17b1765fb53299e0be263a42e58fc347ade8fadf;hpb=34ca34fb1e4cfaa90f1c1f040991870b29508f6c;p=android-x86%2Fexternal-minigbm.git diff --git a/helpers.c b/helpers.c index 17b1765..f1a74c7 100644 --- a/helpers.c +++ b/helpers.c @@ -189,7 +189,8 @@ size_t drv_num_planes_from_modifier(struct driver *drv, uint32_t format, uint64_ if (!planes) return 0; - if (drv->backend->num_planes_from_modifier && modifier != DRM_FORMAT_MOD_INVALID) + if (drv->backend->num_planes_from_modifier && modifier != DRM_FORMAT_MOD_INVALID && + modifier != DRM_FORMAT_MOD_LINEAR) return drv->backend->num_planes_from_modifier(drv, format, modifier); return planes; @@ -312,7 +313,7 @@ int drv_dumb_bo_create_ex(struct bo *bo, uint32_t width, uint32_t height, uint32 int ret; size_t plane; uint32_t aligned_width, aligned_height; - struct drm_mode_create_dumb create_dumb; + struct drm_mode_create_dumb create_dumb = { 0 }; aligned_width = width; aligned_height = height; @@ -345,7 +346,6 @@ int drv_dumb_bo_create_ex(struct bo *bo, uint32_t width, uint32_t height, uint32 break; } - memset(&create_dumb, 0, sizeof(create_dumb)); if (quirks & BO_QUIRK_DUMB32BPP) { aligned_width = DIV_ROUND_UP(aligned_width * layout_from_format(format)->bytes_per_pixel[0], 4); @@ -380,12 +380,10 @@ int drv_dumb_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint32_t int drv_dumb_bo_destroy(struct bo *bo) { - struct drm_mode_destroy_dumb destroy_dumb; int ret; + struct drm_mode_destroy_dumb destroy_dumb = { 0 }; - memset(&destroy_dumb, 0, sizeof(destroy_dumb)); destroy_dumb.handle = bo->handles[0].u32; - ret = drmIoctl(bo->drv->fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_dumb); if (ret) { drv_log("DRM_IOCTL_MODE_DESTROY_DUMB failed (handle=%x)\n", bo->handles[0].u32); @@ -451,6 +449,7 @@ int drv_prime_bo_import(struct bo *bo, struct drv_import_fd_data *data) bo->handles[plane].u32 = prime_handle.handle; } + bo->meta.tiling = data->tiling; return 0; } @@ -602,9 +601,9 @@ int drv_modify_linear_combinations(struct driver *drv) * plane and as a cursor. */ drv_modify_combination(drv, DRM_FORMAT_XRGB8888, &LINEAR_METADATA, - BO_USE_CURSOR | BO_USE_SCANOUT); + BO_USE_CURSOR | BO_USE_SCANOUT | BO_USE_COMPOSER_TARGET); drv_modify_combination(drv, DRM_FORMAT_ARGB8888, &LINEAR_METADATA, - BO_USE_CURSOR | BO_USE_SCANOUT); + BO_USE_CURSOR | BO_USE_SCANOUT | BO_USE_COMPOSER_TARGET); return 0; } @@ -640,3 +639,11 @@ bool drv_has_modifier(const uint64_t *list, uint32_t count, uint64_t modifier) return false; } + +/* + * Map internal fourcc codes back to standard fourcc codes. + */ +uint32_t drv_get_standard_fourcc(uint32_t fourcc_internal) +{ + return (fourcc_internal == DRM_FORMAT_YVU420_ANDROID) ? DRM_FORMAT_YVU420 : fourcc_internal; +}