summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChangyeon Lee <cyeon.lee@samsung.com>2020-12-03 19:03:42 +0900
committerChangyeon Lee <cyeon.lee@samsung.com>2020-12-07 16:19:53 +0900
commitcfa166e7d0ccdcaf69198f9a0dde662f15f82f61 (patch)
tree1363ef93d277971e1aea68e8b97ce1185f8018bd
parente3788c4ee8bfad7217dbca3cb027736cc04edfbb (diff)
downloadlibtbm-vc4-cfa166e7d0ccdcaf69198f9a0dde662f15f82f61.tar.gz
libtbm-vc4-cfa166e7d0ccdcaf69198f9a0dde662f15f82f61.tar.bz2
libtbm-vc4-cfa166e7d0ccdcaf69198f9a0dde662f15f82f61.zip
apply align 16 to height at YCbCr format
Change-Id: I1d45e44e194c16b39f8abd153e3073ba96b02021
-rw-r--r--src/tbm_bufmgr_vc4.c53
1 files changed, 36 insertions, 17 deletions
diff --git a/src/tbm_bufmgr_vc4.c b/src/tbm_bufmgr_vc4.c
index ae30452..5f6caef 100644
--- a/src/tbm_bufmgr_vc4.c
+++ b/src/tbm_bufmgr_vc4.c
@@ -73,6 +73,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define TBM_SURFACE_ALIGNMENT_PLANE_NV12 (4096)
#define TBM_SURFACE_ALIGNMENT_PITCH_YUV (16)
+#define TBM_SURFACE_ALIGNMENT_HEIGHT_YUV (16)
//#define VC4_TILED_FORMAT 1
@@ -1082,6 +1083,7 @@ tbm_vc4_bufmgr_get_plane_data(tbm_backend_bufmgr_data *bufmgr_data,
int _pitch = 0;
int _size = 0;
int _bo_idx = 0;
+ int _align_height = 0;
TBM_RETURN_VAL_IF_FAIL(bufmgr_vc4 != NULL, TBM_ERROR_INVALID_PARAMETER);
@@ -1155,7 +1157,8 @@ tbm_vc4_bufmgr_get_plane_data(tbm_backend_bufmgr_data *bufmgr_data,
bpp = 32;
_offset = 0;
_pitch = SIZE_ALIGN((width * bpp) >> 3, TBM_SURFACE_ALIGNMENT_PITCH_YUV);
- _size = SIZE_ALIGN(_pitch * height, TBM_SURFACE_ALIGNMENT_PLANE);
+ _align_height = SIZE_ALIGN(height, TBM_SURFACE_ALIGNMENT_HEIGHT_YUV);
+ _size = SIZE_ALIGN(_pitch * _align_height, TBM_SURFACE_ALIGNMENT_PLANE);
_bo_idx = 0;
break;
@@ -1173,7 +1176,8 @@ tbm_vc4_bufmgr_get_plane_data(tbm_backend_bufmgr_data *bufmgr_data,
{
_offset = 0;
_pitch = SIZE_ALIGN(width, TBM_SURFACE_ALIGNMENT_PITCH_YUV);
- _size = SIZE_ALIGN(_pitch * height, TBM_SURFACE_ALIGNMENT_PLANE);
+ _align_height = SIZE_ALIGN(height, TBM_SURFACE_ALIGNMENT_HEIGHT_YUV);
+ _size = SIZE_ALIGN(_pitch * _align_height, TBM_SURFACE_ALIGNMENT_PLANE);
_bo_idx = 0;
if (plane_idx == 0)
break;
@@ -1182,7 +1186,8 @@ tbm_vc4_bufmgr_get_plane_data(tbm_backend_bufmgr_data *bufmgr_data,
{
_offset += _size;
_pitch = SIZE_ALIGN(width, TBM_SURFACE_ALIGNMENT_PITCH_YUV);
- _size = SIZE_ALIGN(_pitch * (height / 2), TBM_SURFACE_ALIGNMENT_PLANE);
+ _align_height = SIZE_ALIGN(height / 2, TBM_SURFACE_ALIGNMENT_HEIGHT_YUV);
+ _size = SIZE_ALIGN(_pitch * _align_height, TBM_SURFACE_ALIGNMENT_PLANE);
_bo_idx = 0;
}
break;
@@ -1193,7 +1198,8 @@ tbm_vc4_bufmgr_get_plane_data(tbm_backend_bufmgr_data *bufmgr_data,
{
_offset = 0;
_pitch = SIZE_ALIGN(width, TBM_SURFACE_ALIGNMENT_PITCH_YUV);
- _size = SIZE_ALIGN(_pitch * height, TBM_SURFACE_ALIGNMENT_PLANE);
+ _align_height = SIZE_ALIGN(height, TBM_SURFACE_ALIGNMENT_HEIGHT_YUV);
+ _size = SIZE_ALIGN(_pitch * _align_height, TBM_SURFACE_ALIGNMENT_PLANE);
_bo_idx = 0;
if (plane_idx == 0)
break;
@@ -1202,7 +1208,8 @@ tbm_vc4_bufmgr_get_plane_data(tbm_backend_bufmgr_data *bufmgr_data,
{
_offset += _size;
_pitch = SIZE_ALIGN(width, TBM_SURFACE_ALIGNMENT_PITCH_YUV);
- _size = SIZE_ALIGN(_pitch * height, TBM_SURFACE_ALIGNMENT_PLANE);
+ _align_height = SIZE_ALIGN(height, TBM_SURFACE_ALIGNMENT_HEIGHT_YUV);
+ _size = SIZE_ALIGN(_pitch * _align_height, TBM_SURFACE_ALIGNMENT_PLANE);
_bo_idx = 0;
}
break;
@@ -1228,7 +1235,8 @@ tbm_vc4_bufmgr_get_plane_data(tbm_backend_bufmgr_data *bufmgr_data,
{
_offset = 0;
_pitch = SIZE_ALIGN(width, TBM_SURFACE_ALIGNMENT_PITCH_YUV);
- _size = SIZE_ALIGN(_pitch * height, TBM_SURFACE_ALIGNMENT_PLANE);
+ _align_height = SIZE_ALIGN(height, TBM_SURFACE_ALIGNMENT_HEIGHT_YUV);
+ _size = SIZE_ALIGN(_pitch * _align_height, TBM_SURFACE_ALIGNMENT_PLANE);
_bo_idx = 0;
if (plane_idx == 0)
break;
@@ -1237,7 +1245,8 @@ tbm_vc4_bufmgr_get_plane_data(tbm_backend_bufmgr_data *bufmgr_data,
{
_offset += _size;
_pitch = SIZE_ALIGN(width / 4, TBM_SURFACE_ALIGNMENT_PITCH_YUV / 4);
- _size = SIZE_ALIGN(_pitch * (height / 4), TBM_SURFACE_ALIGNMENT_PLANE);
+ _align_height = SIZE_ALIGN(height / 4, TBM_SURFACE_ALIGNMENT_HEIGHT_YUV);
+ _size = SIZE_ALIGN(_pitch * _align_height, TBM_SURFACE_ALIGNMENT_PLANE);
_bo_idx = 0;
if (plane_idx == 1)
break;
@@ -1246,7 +1255,8 @@ tbm_vc4_bufmgr_get_plane_data(tbm_backend_bufmgr_data *bufmgr_data,
{
_offset += _size;
_pitch = SIZE_ALIGN(width / 4, TBM_SURFACE_ALIGNMENT_PITCH_YUV / 4);
- _size = SIZE_ALIGN(_pitch * (height / 4), TBM_SURFACE_ALIGNMENT_PLANE);
+ _align_height = SIZE_ALIGN(height / 4, TBM_SURFACE_ALIGNMENT_HEIGHT_YUV);
+ _size = SIZE_ALIGN(_pitch * _align_height, TBM_SURFACE_ALIGNMENT_PLANE);
_bo_idx = 0;
}
break;
@@ -1259,7 +1269,8 @@ tbm_vc4_bufmgr_get_plane_data(tbm_backend_bufmgr_data *bufmgr_data,
{
_offset = 0;
_pitch = SIZE_ALIGN(width, TBM_SURFACE_ALIGNMENT_PITCH_YUV);
- _size = SIZE_ALIGN(_pitch * height, TBM_SURFACE_ALIGNMENT_PLANE);
+ _align_height = SIZE_ALIGN(height, TBM_SURFACE_ALIGNMENT_HEIGHT_YUV);
+ _size = SIZE_ALIGN(_pitch * _align_height, TBM_SURFACE_ALIGNMENT_PLANE);
_bo_idx = 0;
if (plane_idx == 0)
break;
@@ -1268,7 +1279,8 @@ tbm_vc4_bufmgr_get_plane_data(tbm_backend_bufmgr_data *bufmgr_data,
{
_offset += _size;
_pitch = SIZE_ALIGN(width / 2, TBM_SURFACE_ALIGNMENT_PITCH_YUV / 2);
- _size = SIZE_ALIGN(_pitch * (height / 2), TBM_SURFACE_ALIGNMENT_PLANE);
+ _align_height = SIZE_ALIGN(height / 2, TBM_SURFACE_ALIGNMENT_HEIGHT_YUV / 2);
+ _size = SIZE_ALIGN(_pitch * _align_height, TBM_SURFACE_ALIGNMENT_PLANE);
_bo_idx = 0;
if (plane_idx == 1)
break;
@@ -1277,7 +1289,8 @@ tbm_vc4_bufmgr_get_plane_data(tbm_backend_bufmgr_data *bufmgr_data,
{
_offset += _size;
_pitch = SIZE_ALIGN(width / 2, TBM_SURFACE_ALIGNMENT_PITCH_YUV / 2);
- _size = SIZE_ALIGN(_pitch * (height / 2), TBM_SURFACE_ALIGNMENT_PLANE);
+ _align_height = SIZE_ALIGN(height / 2, TBM_SURFACE_ALIGNMENT_HEIGHT_YUV / 2);
+ _size = SIZE_ALIGN(_pitch * _align_height, TBM_SURFACE_ALIGNMENT_PLANE);
_bo_idx = 0;
}
break;
@@ -1288,7 +1301,8 @@ tbm_vc4_bufmgr_get_plane_data(tbm_backend_bufmgr_data *bufmgr_data,
{
_offset = 0;
_pitch = SIZE_ALIGN(width, TBM_SURFACE_ALIGNMENT_PITCH_YUV);
- _size = SIZE_ALIGN(_pitch * height, TBM_SURFACE_ALIGNMENT_PLANE);
+ _align_height = SIZE_ALIGN(height, TBM_SURFACE_ALIGNMENT_HEIGHT_YUV);
+ _size = SIZE_ALIGN(_pitch * _align_height, TBM_SURFACE_ALIGNMENT_PLANE);
_bo_idx = 0;
if (plane_idx == 0)
break;
@@ -1297,7 +1311,8 @@ tbm_vc4_bufmgr_get_plane_data(tbm_backend_bufmgr_data *bufmgr_data,
{
_offset += _size;
_pitch = SIZE_ALIGN(width / 2, TBM_SURFACE_ALIGNMENT_PITCH_YUV / 2);
- _size = SIZE_ALIGN(_pitch * (height), TBM_SURFACE_ALIGNMENT_PLANE);
+ _align_height = SIZE_ALIGN(height, TBM_SURFACE_ALIGNMENT_HEIGHT_YUV);
+ _size = SIZE_ALIGN(_pitch * _align_height, TBM_SURFACE_ALIGNMENT_PLANE);
_bo_idx = 0;
if (plane_idx == 1)
break;
@@ -1306,7 +1321,8 @@ tbm_vc4_bufmgr_get_plane_data(tbm_backend_bufmgr_data *bufmgr_data,
{
_offset += _size;
_pitch = SIZE_ALIGN(width / 2, TBM_SURFACE_ALIGNMENT_PITCH_YUV / 2);
- _size = SIZE_ALIGN(_pitch * (height), TBM_SURFACE_ALIGNMENT_PLANE);
+ _align_height = SIZE_ALIGN(height, TBM_SURFACE_ALIGNMENT_HEIGHT_YUV);
+ _size = SIZE_ALIGN(_pitch * _align_height, TBM_SURFACE_ALIGNMENT_PLANE);
_bo_idx = 0;
}
break;
@@ -1317,7 +1333,8 @@ tbm_vc4_bufmgr_get_plane_data(tbm_backend_bufmgr_data *bufmgr_data,
{
_offset = 0;
_pitch = SIZE_ALIGN(width, TBM_SURFACE_ALIGNMENT_PITCH_YUV);
- _size = SIZE_ALIGN(_pitch * height, TBM_SURFACE_ALIGNMENT_PLANE);
+ _align_height = SIZE_ALIGN(height, TBM_SURFACE_ALIGNMENT_HEIGHT_YUV);
+ _size = SIZE_ALIGN(_pitch * _align_height, TBM_SURFACE_ALIGNMENT_PLANE);
_bo_idx = 0;
if (plane_idx == 0)
break;
@@ -1326,7 +1343,8 @@ tbm_vc4_bufmgr_get_plane_data(tbm_backend_bufmgr_data *bufmgr_data,
{
_offset += _size;
_pitch = SIZE_ALIGN(width, TBM_SURFACE_ALIGNMENT_PITCH_YUV);
- _size = SIZE_ALIGN(_pitch * height, TBM_SURFACE_ALIGNMENT_PLANE);
+ _align_height = SIZE_ALIGN(height, TBM_SURFACE_ALIGNMENT_HEIGHT_YUV);
+ _size = SIZE_ALIGN(_pitch * _align_height, TBM_SURFACE_ALIGNMENT_PLANE);
_bo_idx = 0;
if (plane_idx == 1)
break;
@@ -1335,7 +1353,8 @@ tbm_vc4_bufmgr_get_plane_data(tbm_backend_bufmgr_data *bufmgr_data,
{
_offset += _size;
_pitch = SIZE_ALIGN(width, TBM_SURFACE_ALIGNMENT_PITCH_YUV);
- _size = SIZE_ALIGN(_pitch * height, TBM_SURFACE_ALIGNMENT_PLANE);
+ _align_height = SIZE_ALIGN(height, TBM_SURFACE_ALIGNMENT_HEIGHT_YUV);
+ _size = SIZE_ALIGN(_pitch * _align_height, TBM_SURFACE_ALIGNMENT_PLANE);
_bo_idx = 0;
}
break;