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 17 #include <HwcTrace.h> 18 #include <linux/psb_drm.h> 19 #include <Hwcomposer.h> 20 #include <common/DrmControl.h> 21 22 namespace android { 23 namespace intel { 24 25 DrmControl::DrmControl() 26 : mVideoExtCommand(0) 27 { 28 } 29 30 DrmControl::~DrmControl() 31 { 32 } 33 34 int DrmControl::getVideoExtCommand() 35 { 36 if (mVideoExtCommand) { 37 return mVideoExtCommand; 38 } 39 40 int fd = Hwcomposer::getInstance().getDrm()->getDrmFd(); 41 42 union drm_psb_extension_arg video_getparam_arg; 43 strncpy(video_getparam_arg.extension, 44 "lnc_video_getparam", sizeof(video_getparam_arg.extension)); 45 int ret = drmCommandWriteRead(fd, DRM_PSB_EXTENSION, 46 &video_getparam_arg, sizeof(video_getparam_arg)); 47 if (ret != 0) { 48 VTRACE("failed to get video extension command"); 49 return 0; 50 } 51 52 mVideoExtCommand = video_getparam_arg.rep.driver_ioctl_offset; 53 54 return mVideoExtCommand; 55 } 56 57 } // namespace intel 58 } // namespace android 59