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#include <HwcTrace.h> 17#include <IDisplayDevice.h> 18#include <Drm.h> 19#include <DrmConfig.h> 20 21 22namespace android { 23namespace intel { 24 25const char* DrmConfig::getDrmPath() 26{ 27 return "/dev/card0"; 28} 29 30uint32_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 39uint32_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 48uint32_t DrmConfig::getFrameBufferFormat() 49{ 50 return HAL_PIXEL_FORMAT_RGBX_8888; 51} 52 53uint32_t DrmConfig::getFrameBufferDepth() 54{ 55 return 24; 56} 57 58uint32_t DrmConfig::getFrameBufferBpp() 59{ 60 return 32; 61} 62 63const char* DrmConfig::getUeventEnvelope() 64{ 65 return "change@/devices/pci0000:00/0000:00:02.0/drm/card0"; 66} 67 68const char* DrmConfig::getHotplugString() 69{ 70 return "HOTPLUG=1"; 71} 72 73const char* DrmConfig::getRepeatedFrameString() 74{ 75 return "REPEATED_FRAME"; 76} 77 78uint32_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