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 <HwcTrace.h> 17 #include <IDisplayDevice.h> 18 #include <Drm.h> 19 #include <DrmConfig.h> 20 21 22 namespace android { 23 namespace intel { 24 25 const char* DrmConfig::getDrmPath() 26 { 27 return "/dev/card0"; 28 } 29 30 uint32_t DrmConfig::getDrmConnector(int device) 31 { 32 if (device == IDisplayDevice::DEVICE_PRIMARY) 33 return DRM_MODE_CONNECTOR_DSI; 34 else if (device == IDisplayDevice::DEVICE_EXTERNAL) 35 return DRM_MODE_CONNECTOR_DVID; 36 return DRM_MODE_CONNECTOR_Unknown; 37 } 38 39 uint32_t DrmConfig::getDrmEncoder(int device) 40 { 41 if (device == IDisplayDevice::DEVICE_PRIMARY) 42 return DRM_MODE_ENCODER_DSI; 43 else if (device == IDisplayDevice::DEVICE_EXTERNAL) 44 return DRM_MODE_ENCODER_TMDS; 45 return DRM_MODE_ENCODER_NONE; 46 } 47 48 uint32_t DrmConfig::getFrameBufferFormat() 49 { 50 return HAL_PIXEL_FORMAT_RGBX_8888; 51 } 52 53 uint32_t DrmConfig::getFrameBufferDepth() 54 { 55 return 24; 56 } 57 58 uint32_t DrmConfig::getFrameBufferBpp() 59 { 60 return 32; 61 } 62 63 const char* DrmConfig::getUeventEnvelope() 64 { 65 return "change@/devices/pci0000:00/0000:00:02.0/drm/card0"; 66 } 67 68 const char* DrmConfig::getHotplugString() 69 { 70 return "HOTPLUG=1"; 71 } 72 73 const char* DrmConfig::getRepeatedFrameString() 74 { 75 return "REPEATED_FRAME"; 76 } 77 78 uint32_t DrmConfig::convertHalFormatToDrmFormat(uint32_t halFormat) 79 { 80 switch (halFormat) { 81 case HAL_PIXEL_FORMAT_RGBX_8888: 82 return DRM_FORMAT_XRGB8888; 83 default: 84 ETRACE("format %#x isn't supported by drm", halFormat); 85 return 0; 86 } 87 } 88 89 } // namespace intel 90 } // namespace android 91