From d532c7e54d8022a13a10cf2d337b75688a011b6d Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Thu, 19 Dec 2019 19:47:31 +0900 Subject: [PATCH] fix pitch, offset of NV format Change-Id: I79f30da720e5765686bd6e19a34f1f7916f95259 --- src/tbm_bufmgr_dumb.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/tbm_bufmgr_dumb.c b/src/tbm_bufmgr_dumb.c index 0bf073f..a962f26 100644 --- a/src/tbm_bufmgr_dumb.c +++ b/src/tbm_bufmgr_dumb.c @@ -491,19 +491,23 @@ tbm_dumb_bufmgr_get_plane_data(tbm_backend_bufmgr_data *bufmgr_data, case TBM_FORMAT_NV12: case TBM_FORMAT_NV21: bpp = 12; - if (plane_idx == 0) { + //if (plane_idx == 0) + { _offset = 0; - _pitch = SIZE_ALIGN(width , TBM_SURFACE_ALIGNMENT_PITCH_YUV); + _pitch = SIZE_ALIGN(width, TBM_SURFACE_ALIGNMENT_PITCH_YUV); _size = SIZE_ALIGN(_pitch * height, TBM_SURFACE_ALIGNMENT_PLANE); _bo_idx = 0; - } else if (plane_idx == 1) { - _offset = width*height; - _pitch = SIZE_ALIGN(width , TBM_SURFACE_ALIGNMENT_PITCH_YUV/2); + if (plane_idx == 0) + break; + } + //else if (plane_idx == 1) + { + _offset += _size; + _pitch = SIZE_ALIGN(width, TBM_SURFACE_ALIGNMENT_PITCH_YUV); _size = SIZE_ALIGN(_pitch * (height / 2), TBM_SURFACE_ALIGNMENT_PLANE); _bo_idx = 0; } break; - case TBM_FORMAT_NV16: case TBM_FORMAT_NV61: bpp = 16; @@ -519,7 +523,7 @@ tbm_dumb_bufmgr_get_plane_data(tbm_backend_bufmgr_data *bufmgr_data, //else if (plane_idx == 1) { _offset += _size; - _pitch = SIZE_ALIGN(width, TBM_SURFACE_ALIGNMENT_PITCH_YUV/2); + _pitch = SIZE_ALIGN(width, TBM_SURFACE_ALIGNMENT_PITCH_YUV); _size = SIZE_ALIGN(_pitch * height, TBM_SURFACE_ALIGNMENT_PLANE); _bo_idx = 0; } -- 2.34.1