1 /* 2 // Copyright(c)2014 IntelCorporation 3 // 4 // LicensedundertheApacheLicense,Version2.0(the"License"); 5 // youmaynotusethisfileexceptincompliancewiththeLicense. 6 // YoumayobtainacopyoftheLicenseat 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unlessrequiredbyapplicablelaworagreedtoinwriting,software 11 // distributedundertheLicenseisdistributedonan"ASIS"BASIS, 12 // WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied. 13 // SeetheLicenseforthespecificlanguagegoverningpermissionsand 14 // limitationsundertheLicense. 15 */ 16 #include <hal_public.h> 17 #include <HwcTrace.h> 18 #include <common/PixelFormat.h> 19 20 namespace android { 21 namespace intel { 22 23 bool PixelFormat::convertFormat(uint32_t grallocFormat, uint32_t& spriteFormat, int& bpp) 24 { 25 switch (grallocFormat) { 26 case HAL_PIXEL_FORMAT_RGBA_8888: 27 spriteFormat = PLANE_PIXEL_FORMAT_RGBA8888; 28 bpp = 4; 29 break; 30 case HAL_PIXEL_FORMAT_RGBX_8888: 31 spriteFormat = PLANE_PIXEL_FORMAT_RGBX8888; 32 bpp = 4; 33 break; 34 case HAL_PIXEL_FORMAT_BGRX_8888: 35 spriteFormat = PLANE_PIXEL_FORMAT_BGRX8888; 36 bpp = 4; 37 break; 38 case HAL_PIXEL_FORMAT_BGRA_8888: 39 spriteFormat = PLANE_PIXEL_FORMAT_BGRA8888; 40 bpp = 4; 41 break; 42 case HAL_PIXEL_FORMAT_RGB_565: 43 spriteFormat = PLANE_PIXEL_FORMAT_BGRX565; 44 bpp = 2; 45 break; 46 default: 47 return false; 48 } 49 50 return true; 51 } 52 53 54 } // namespace intel 55 } // namespace android 56