1 /*
2 // Copyright (c) 2014 Intel Corporation 
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //      http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 */
16 
17 #include <HwcTrace.h>
18 #include <DisplayPlane.h>
19 #include <hal_public.h>
20 #include <OMX_IVCommon.h>
21 #include <OMX_IntelVideoExt.h>
22 #include <DisplayQuery.h>
23 
24 
25 namespace android {
26 namespace intel {
27 
isVideoFormat(uint32_t format)28 bool DisplayQuery::isVideoFormat(uint32_t format)
29 {
30     switch (format) {
31     case OMX_INTEL_COLOR_FormatYUV420PackedSemiPlanar:
32     case OMX_INTEL_COLOR_FormatYUV420PackedSemiPlanar_Tiled:
33     // Expand format to support the case: Software decoder + HW rendering
34     // Only VP9 use this foramt now
35     case HAL_PIXEL_FORMAT_YV12:
36         return true;
37     default:
38         return false;
39     }
40 }
41 
getOverlayLumaStrideAlignment(uint32_t format)42 int DisplayQuery::getOverlayLumaStrideAlignment(uint32_t format)
43 {
44     // both luma and chroma stride need to be 64-byte aligned for overlay
45     switch (format) {
46     case HAL_PIXEL_FORMAT_YV12:
47     case HAL_PIXEL_FORMAT_I420:
48         // for these two formats, chroma stride is calculated as half of luma stride
49         // so luma stride needs to be 128-byte aligned.
50         return 128;
51     default:
52         return 64;
53     }
54 }
55 
queryNV12Format()56 uint32_t DisplayQuery::queryNV12Format()
57 {
58     return HAL_PIXEL_FORMAT_NV12;
59 }
60 
61 } // namespace intel
62 } // namespace android
63 
64