Project

General

Profile

sb_sys_analyzer_linux.py

saen acro, 2017-08-23 13:06

 
1
#!/usr/bin/python
2
"""
3

4
Copyright (c) 2016 Intel Corporation All Rights Reserved.
5

6
THESE MATERIALS ARE PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
7
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
8
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
9
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
10
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
11
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
12
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
13
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
14
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
15
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THESE
16
MATERIALS, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17

18
File Name: sb_sys_analyzer.py
19

20
Abstract: Script for checking the environment for Intel Media Server Studio
21
Media SDK and SDK for OpenCL Applications install and run readiness
22

23
Notes: Run sb_sys_analyzer.py
24

25
"""
26

27
import os, sys, platform
28
import os.path
29

30
class diagnostic_colors:
31
    ERROR   = '\x1b[31;1m'  # Red/bold
32
    SUCCESS = '\x1b[32;1m'  # green/bold
33
    RESET   = '\x1b[0m'     # Reset attributes
34
    INFO    = '\x1b[34;1m'  # info
35
    OUTPUT  = ''            # command's coutput printing
36
    STDERR  = '\x1b[36;1m'  # cyan/bold
37
    SKIPPED = '\x1b[33;1m'  # yellow/bold
38

39
class loglevelcode:
40
    ERROR   = 0
41
    SUCCESS = 1
42
    INFO    = 2
43

44
GLOBAL_LOGLEVEL=1
45

46
def print_info( msg, loglevel ):
47
    global GLOBAL_LOGLEVEL
48

49
    """ printing information """    
50
    
51
    if loglevel==loglevelcode.ERROR and GLOBAL_LOGLEVEL>=0:
52
        color = diagnostic_colors.ERROR
53
        msgtype=" [ ERROR ] "
54
        print( color + msgtype + diagnostic_colors.RESET + msg )
55
    elif loglevel==loglevelcode.SUCCESS and GLOBAL_LOGLEVEL>=1:
56
        color = diagnostic_colors.SUCCESS
57
        msgtype=" [ OK ] "
58
        print( color + msgtype + diagnostic_colors.RESET + msg )
59
    elif loglevel==loglevelcode.INFO and GLOBAL_LOGLEVEL>=2:
60
        color = diagnostic_colors.INFO
61
        msgtype=" [ INFO ] "
62
        print( color + msgtype + diagnostic_colors.RESET + msg )
63

64

65
    
66
    return
67

68
def run_cmd(cmd):
69
    output=""
70
    fin=os.popen(cmd+" 2>&1","r")
71
    for line in fin:
72
        output+=line
73
    fin.close()
74
    return output
75

76
def find_library(libfile):
77
    search_path=os.environ.get("LD_LIBRARY_PATH","/usr/lib64")
78
    if not ('/usr/lib64' in search_path):
79
        search_path+=";/usr/lib64"
80
    paths=search_path.split(";")
81

82
    found=False
83
    for libpath in paths:
84
        if os.path.exists(libpath+"/"+libfile):
85
            found=True
86
            break
87
    
88
    return found
89

90

91
def parse_pciid(pciid):
92
    sts=loglevelcode.ERROR
93
    gpustr="unknown"
94

95
    id_directory={
96
    '0402':'HSW_D GT1 desktop',
97
    '0412':'HSW_D GT2 desktop',
98
    '0422':'HSW_D GT3 desktop',
99
    '040a':'HSW_D GT1 server',
100
    '041A':'HSW_D GT2 server', # Added by Inventos for Supermicro X10SLH-F and CPU E3-1276 v3
101
    '041a':'HSW_D GT2 server',
102
    '042a':'HSW_D GT3 server',
103
    '040B':'HSW_D GT1 reserved',
104
    '041B':'HSW_D GT2 reserved',
105
    '042B':'HSW_D GT3 reserved',
106
    '040E':'HSW_D GT1 reserved',
107
    '041E':'HSW_D GT2 reserved',
108
    '042E':'HSW_D GT3 reserved',
109
    '0C02':'HSW_D SDV GT1 desktop',
110
    '0C12':'HSW_D SDV GT2 desktop',
111
    '0C22':'HSW_D SDV GT3 desktop',
112
    '0C0A':'HSW_D SDV GT1 server',
113
    '0C1A':'HSW_D SDV GT2 server',
114
    '0C2A':'HSW_D SDV GT3 server',
115
    '0C0B':'HSW_D SDV GT1 reserved',
116
    '0C1B':'HSW_D SDV GT2 reserved',
117
    '0C2B':'HSW_D SDV GT3 reserved',
118
    '0C0E':'HSW_D SDV GT1 reserved',
119
    '0C1E':'HSW_D SDV GT2 reserved',
120
    '0C2E':'HSW_D SDV GT3 reserved',
121
    '0A02':'HSW_D ULT GT1 desktop',
122
    '0A12':'HSW_D ULT GT2 desktop',
123
    '0A22':'HSW_D ULT GT3 desktop',
124
    '0A0A':'HSW_D ULT GT1 server',
125
    '0A1A':'HSW_D ULT GT2 server',
126
    '0A2A':'HSW_D ULT GT3 server',
127
    '0A0B':'HSW_D ULT GT1 reserved',
128
    '0A1B':'HSW_D ULT GT2 reserved',
129
    '0A2B':'HSW_D ULT GT3 reserved',
130
    '0D02':'HSW_D CRW GT1 desktop',
131
    '0D12':'HSW_D CRW GT2 desktop',
132
    '0D22':'HSW_D CRW GT3 desktop',
133
    '0D0A':'HSW_D CRW GT1 server',
134
    '0D1A':'HSW_D CRW GT2 server',
135
    '0D2A':'HSW_D CRW GT3 server',
136
    '0D0B':'HSW_D CRW GT1 reserved',
137
    '0D1B':'HSW_D CRW GT2 reserved',
138
    '0D2B':'HSW_D CRW GT3 reserved',
139
    '0D0E':'HSW_D CRW GT1 reserved',
140
    '0D1E':'HSW_D CRW GT2 reserved',
141
    '0D2E':'HSW_D CRW GT3 reserved',
142
    '0406':'HSW_M GT1 mobile',
143
    '0416':'HSW_M GT2 mobile',
144
    '0426':'HSW_M GT2 mobile',
145
    '0C06':'HSW_M SDV GT1 mobile',
146
    '0C16':'HSW_M SDV GT2 mobile',
147
    '0C26':'HSW_M SDV GT3 mobile',
148
    '0A06':'HSW_M ULT GT1 mobile',
149
    '0A16':'HSW_M ULT GT2 mobile',
150
    '0A26':'HSW_M ULT GT3 mobile',
151
    '0A0E':'HSW_M ULX GT1 mobile',
152
    '0A1E':'HSW_M ULX GT2 mobile',
153
    '0A2E':'HSW_M ULT GT3 reserved',
154
    '0D06':'HSW_M CRW GT1 mobile',
155
    '0D16':'HSW_M CRW GT2 mobile',
156
    '0D26':'HSW_M CRW GT3 mobile',
157
    '1602':'BDW GT1 ULT',
158
    '1606':'BDW GT1 ULT',
159
    '160B':'BDW GT1 Iris',
160
    '160E':'BDW GT1 ULX',
161
    '1612':'BDW GT2 Halo',
162
    '1616':'BDW GT2 ULT',
163
    '161B':'BDW GT2 ULT',
164
    '161E':'BDW GT2 ULX',
165
    '160A':'BDW GT1 Server',
166
    '160D':'BDW GT1 Workstation',
167
    '161A':'BDW GT2 Server',
168
    '161D':'BDW GT2 Workstation',
169
    '1622':'BDW GT3 ULT',
170
    '1626':'BDW GT3 ULT',
171
    '162B':'BDW GT3 Iris',
172
    '162E':'BDW GT3 ULX',
173
    '162A':'BDW GT3 Server',
174
    '162D':'BDW GT3 Workstation',
175
    '1906':'SKL ULT GT1',
176
    '190E':'SKL ULX GT1',
177
    '1902':'SKL DT GT1',
178
    '190B':'SKL Halo GT1',
179
    '190A':'SKL SRV GT1',
180
    '1916':'SKL ULT GT2',
181
    '1921':'SKL ULT GT2F',
182
    '191E':'SKL ULX GT2',
183
    '1912':'SKL DT GT2',
184
    '191B':'SKL Halo GT2',
185
    '191A':'SKL SRV GT2',
186
    '191D':'SKL WKS GT2',
187
    '1926':'SKL ULT GT3',
188
    '192B':'SKL Halo GT3',
189
    '192A':'SKL SRV GT3'}
190

191
    try:
192
        gpustr=id_directory[pciid]
193
        sts=loglevelcode.SUCCESS
194
    except:
195
        pass
196

197
    return (sts,gpustr)
198

199
def get_processor():
200
    processor_name="unknown"
201
    f=open("/proc/cpuinfo","r")
202
    for line in f:
203
        if line.find("model name")<0: continue
204
        line=line.strip()
205
        (var,val)=line.split(":")
206
        processor_name=val
207
        break
208

209
    return processor_name.strip()
210

211

212

213
def does_processor_have_gen_graphics():
214
    processor_name=get_processor()
215
    print_info("Processor name: "+processor_name,loglevelcode.SUCCESS)
216
    processor_name=processor_name.upper()        
217

218

219
    if (processor_name.find("INTEL")>=0):
220
        print_info("Intel Processor",loglevelcode.INFO) 
221
    else:
222
        print_info("Not an Intel processor.  No Media GPU capabilities supported.",loglevelcode.ERROR)
223

224

225
    if (processor_name.find("CORE")>=0):
226
        print_info("Processor brand: Core",loglevelcode.INFO)
227

228
        pos=-1
229
        pos=processor_name.find("I7-")
230
        if (pos<0): pos=processor_name.find("I5-")
231
        if (pos<0): pos=processor_name.find("I3-")
232

233
        core_vnum=processor_name[pos+3:pos+7]
234
        try:
235
            procnum=int(core_vnum)
236
            archnum=procnum/1000
237
            if (archnum==4):
238
                print_info("Processor arch: Haswell",loglevelcode.INFO)
239
            elif (archnum==5):
240
                print_info("Processor arch: Broadwell",loglevelcode.INFO)
241
            elif (archnum==6): 
242
                print_info("Processor arch: Skylake",loglevelcode.INFO)
243
        except:
244
            pass
245
        
246

247
    elif (processor_name.find("XEON")>=0):
248
        print_info("Processor brand: Xeon",loglevelcode.INFO)
249
        pos=processor_name.find(" V")
250
        if pos>0:
251
            xeon_vnum=processor_name[pos+1:pos+3]
252
            if ("V3" in xeon_vnum):
253
                print_info("Processor arch: Haswell",loglevelcode.INFO)
254
            elif ("V4" in xeon_vnum):
255
                print_info("Processor arch: Broadwell",loglevelcode.INFO)
256
            elif ("V5" in xeon_vnum): 
257
                print_info("Processor arch: Skylake",loglevelcode.INFO)
258

259
    else:
260
        print_info("Processor not Xeon or Core.  Not supported.",loglevelcode.ERROR)
261
    
262
   
263

264
    return loglevelcode.SUCCESS
265
 
266
def is_OS_media_ready():
267

268
    #check GPU PCIid
269
    lspci_output=run_cmd("lspci -nn -s 0:02.0")
270
    pos=lspci_output.rfind("[8086:")
271
    pciid=lspci_output[pos+6:pos+10].upper()
272
    print(pciid)
273
    (sts,gpustr)=parse_pciid(pciid)
274
    print_info("GPU PCI id     : " +pciid,loglevelcode.INFO)
275
    print_info("GPU description: "+gpustr,loglevelcode.INFO)
276
    if sts==loglevelcode.SUCCESS:
277
        print_info("GPU visible to OS",loglevelcode.SUCCESS)
278
    else:
279
        print_info("No compatible GPU available.  Check BIOS settings?",loglevelcode.ERROR)
280
        return loglevelcode.ERROR
281

282
    #check for nomodeset
283
    grub_cmdline_output=run_cmd("cat /proc/cmdline")
284
    if (grub_cmdline_output.find("nomodeset")>0):
285
        print_info("nomodeset detected in GRUB cmdline",loglevelcode.ERROR)
286
        return loglevelcode.ERROR
287
    else:
288
        print_info("no nomodeset in GRUB cmdline (good)",loglevelcode.INFO)
289
        
290

291
    #Linux distro
292
    (linux_distro_name,linux_distro_version,linux_distro_details)=platform.linux_distribution()
293
    linux_distro=linux_distro_name+" "+linux_distro_version
294
    print_info("Linux distro   : "+linux_distro,loglevelcode.INFO)
295

296
    #kernel
297
    uname_output=run_cmd("uname -r")
298
    print_info("Linux kernel   : "+uname_output.strip(),loglevelcode.INFO)
299

300
    #glibc version
301
    ldd_version_output=run_cmd("ldd --version")
302
    pos=ldd_version_output.find("Copyright")
303
    ldd_version_output=ldd_version_output[0:pos-1]
304
    tmp=ldd_version_output.split()
305

306
    try:
307
        ldd_version=float(tmp.pop())
308
    except:
309
        ldd_version=0
310

311
    if (ldd_version>=2.12):
312
        outstr="glibc version  : %4.2f"%(ldd_version)
313
        print_info(outstr,loglevelcode.INFO)
314
    else:
315
        outstr="glibc version  : %4.2f >= 2.12 required!"%(ldd_version)
316
        print_info(outstr,loglevelcode.ERROR)
317
        return loglevelcode.ERROR
318

319
 
320
    
321
    if (linux_distro.find("CentOS Linux 7.1.1503")>=0):
322
        print_info("Linux distro suitable for Media Server Studio 2016 Gold",loglevelcode.SUCCESS)
323
    else:
324
        print_info("Linux distro suitable for Generic install",loglevelcode.INFO)
325

326

327

328
    #gcc version
329
    gcc_version_output=run_cmd("gcc --version")
330
    if ("not found" in gcc_version_output):
331
        print_info("gcc not found",loglevelcode.ERROR)
332
        sys.exit(1)
333
    else:
334
            pos=gcc_version_output.find("Copyright")
335
            gcc_version_output=gcc_version_output[0:pos-1]
336
            tmp=gcc_version_output.split()    
337
            gcc_version=tmp.pop()
338
            print_info("gcc version    : "+gcc_version + " (>=4.8.2 suggested)",loglevelcode.INFO)
339

340

341
    return loglevelcode.SUCCESS
342

343
def check_libdrm():
344
    codestr="""#include <stdio.h>
345
#include <stdlib.h>
346
#include <string.h>
347
#include <sys/types.h>
348
#include <sys/stat.h>
349
#include "xf86drm.h"
350
#include <fcntl.h>
351
#include <unistd.h>
352
#include <va/va.h>
353
#include <va/va_drm.h>
354
int main(int argc,char **argv)
355
{
356

357
  int devices_found=0;
358

359
  // VAAPI display handle
360
  VADisplay va_dpy=NULL;
361
  VAStatus va_res = VA_STATUS_SUCCESS;
362
  int major_version = 0, minor_version = 0;
363
  int fd=-1;
364
  drmVersionPtr pDRMVersionInfo=NULL;
365

366

367
  //search for valid graphics device
368
  
369

370
    char adapterpath[256];
371
    char drivername[256];
372

373
    snprintf(adapterpath,sizeof(adapterpath),"%s",argv[1]);
374

375
    printf("trying %s\\n",adapterpath);
376

377
    fd = open(adapterpath, O_RDWR);
378

379
    
380
    if (fd < 0) {
381
      printf("could not open %s\\n",adapterpath);
382
      return -1;
383
    }
384

385
    va_dpy = vaGetDisplayDRM(fd);
386

387
    if (!va_dpy) {
388
      printf("could get display DRM for %s\\n",adapterpath);
389
      close(fd);
390
      return -2;
391
    }
392

393
    //get driver corresponding to this adapter
394
    pDRMVersionInfo=drmGetVersion(fd);
395
    strncpy (drivername, pDRMVersionInfo->name, sizeof(drivername) );
396
    drmFreeVersion(pDRMVersionInfo);
397

398
    printf("%s driver=%s ",adapterpath,drivername);
399

400
    if (strncmp(drivername,"i915",4)!=0)
401
      {
402
        printf("Non-Intel driver\\n");
403
        close(fd);
404
        fd = -1;
405
        return -4;
406
      }
407

408
    va_res = vaInitialize(va_dpy, &major_version, &minor_version);
409

410
    if (VA_STATUS_SUCCESS != va_res) {
411
      printf("vaInitialize failed\\n");
412
      close(fd);
413
      fd = -1;
414
      return -5;
415
    }
416
    else
417
      {
418
        printf("Intel driver OK\\n");
419
        devices_found++;
420
      }
421
  
422

423
  if (devices_found==0) puts("NO DEVICES FOUND!");
424
  else printf("devices found: %d\\n",devices_found);
425

426
}
427
"""
428
    if not os.path.exists("/usr/include/xf86drm.h"):
429
        print_info("no libdrm include files. Are Intel components installed?",loglevelcode.ERROR)
430
        return
431

432
    if not os.path.exists("/usr/include/va/va.h"):
433
        print_info("no libva include files.  Are Intel components installed?",loglevelcode.ERROR)
434
        return
435

436
    f=open("drmcheck_tmp.c","w")
437
    f.write(codestr)
438
    f.close()
439

440
    cmd="g++ -o drmcheck drmcheck_tmp.c -I/usr/include/libdrm -lva -lva-drm -ldl -ldrm "
441
    sts=os.system(cmd)
442
    if not sts==0:
443
        print_info("libdrm check failed. Are Intel components installed?",loglevelcode.ERROR)
444
        
445
    if os.path.exists("/dev/dri/renderD128"):
446
        f=os.popen("ls -1 /dev/dri/renderD*")
447
        for line in f:
448
            interface_str=line.strip()
449
            drmsts=os.system("./drmcheck %s >/dev/null 2>&1"%(interface_str))
450
            if drmsts==0:
451
                print_info(interface_str+" connects to Intel i915",loglevelcode.SUCCESS)
452
            else:
453
                print_info("could not open "+interface_str,loglevelcode.ERROR)
454
    else:
455
        print_info("no /dev/dri/renderD* interfaces found",loglevelcode.ERROR)
456

457
    os.remove("drmcheck")
458
    os.remove("drmcheck_tmp.c")
459

460

461
def check_msdk_api():
462
    codestr="""
463
#include <mfxvideo.h>
464
#include <stdlib.h>
465
#include <stdio.h>
466
#include <string.h>
467
int main(int argc, char **argv)
468
{
469
    mfxVersion ver = { {0, 1} };
470
    mfxSession session;
471
    if (argc<2) return 0;
472
    if (strncmp(argv[1],"HW",2)==0) {
473
       MFXInit(MFX_IMPL_HARDWARE_ANY,&ver,&session);
474
    } else {
475
        MFXInit(MFX_IMPL_SOFTWARE,&ver,&session);
476
    }
477
    MFXQueryVersion(session,&ver);
478
    printf("%d.%d\\n",ver.Major,ver.Minor);
479
    return 0;
480
}
481
"""
482

483
    if not os.path.exists("/opt/intel/mediasdk/include/mfxvideo.h"):
484
        print_info("no Media SDK include files.  Are Intel components installed?",loglevelcode.ERROR)
485
        return
486

487
    if not find_library("libva.so"):
488
        print_info("no libva.so.  Are Intel components installed?",loglevelcode.ERROR)
489
        return        
490

491
    if not find_library("libdrm.so"):
492
        print_info("no libdrm.so.  Are Intel components installed?",loglevelcode.ERROR)
493
        return        
494

495
    f=open("msdkcheck_tmp.c","w")
496
    f.write(codestr)
497
    f.close()
498

499
    cmd="g++ -o msdkcheck msdkcheck_tmp.c -I/opt/intel/mediasdk/include -L/opt/intel/mediasdk/lib/lin_x64 -lmfx -lva -ldl"
500
    sts=os.system(cmd)
501
    if (sts>0): 
502
        print_info("could not compile Media SDK test",loglevelcode.ERROR)
503

504
    out=run_cmd("./msdkcheck HW")
505
    print_info("Media SDK HW API level:"+out.strip(),loglevelcode.SUCCESS)
506

507

508
    out=run_cmd("./msdkcheck SW")
509
    print_info("Media SDK SW API level:"+out.strip(),loglevelcode.SUCCESS)
510

511
    os.remove("msdkcheck")
512
    os.remove("msdkcheck_tmp.c")
513

514

515
def check_OCL_caps():
516
    codestr="""
517
#include <CL/cl.h>
518
#include <stdio.h>
519
#define MAX_OCL_PLATFORMS 2
520
int main()
521
{
522
  cl_int err = CL_SUCCESS;
523
  cl_platform_id platforms[MAX_OCL_PLATFORMS];
524
  char platform_name[256];
525

526
  cl_uint num_of_platforms;
527
  err = clGetPlatformIDs(MAX_OCL_PLATFORMS, platforms, &num_of_platforms);
528

529
  for(cl_uint i = 0; i < num_of_platforms; ++i)
530
    {
531
      err = clGetPlatformInfo(platforms[i],CL_PLATFORM_NAME,256,platform_name,0);
532
      cl_uint gpucount,cpucount,accelcount;
533
      err = clGetDeviceIDs(platforms[i],CL_DEVICE_TYPE_GPU,0,0,&gpucount);
534
      err = clGetDeviceIDs(platforms[i],CL_DEVICE_TYPE_CPU,0,0,&cpucount);
535
      printf("platform:%s GPU %s CPU %s\\n",
536
          platform_name,
537
          (gpucount>0)?"OK":"FAIL",
538
          (cpucount>0)?"OK":"FAIL");
539
    }
540
}
541
"""
542

543
    if not os.path.exists("/opt/intel/opencl/include/CL/cl.h"):
544
        print_info("no OpenCL include files.  Are Intel components installed?",loglevelcode.ERROR)
545
        return
546

547
    f=open("oclcheck_tmp.c","w")
548
    f.write(codestr)
549
    f.close()
550

551
    cmd="g++ -o oclcheck oclcheck_tmp.c -I/opt/intel/opencl/include  -L/opt/intel/opencl -lOpenCL"
552
    sts=os.system(cmd)
553
    if (sts>0): 
554
        print_info("could not compile OpenCL test",loglevelcode.ERROR)
555

556
    out=run_cmd("./oclcheck")
557

558
    print_info("OpenCL check:"+out.strip(),loglevelcode.SUCCESS)
559

560
    os.remove("oclcheck")
561
    os.remove("oclcheck_tmp.c")
562

563

564
def check_plugins():
565
    if not os.path.exists("/opt/intel/mediasdk/plugins/plugins.cfg"):
566
        print_info("no plugins/plugins.cfg.  Are Intel components installed?",loglevelcode.ERROR)
567
        return
568

569
    f=open("/opt/intel/mediasdk/plugins/plugins.cfg")
570
    for line in f:
571
        if not line[0:1]=='[': continue
572
        line=line.strip()
573
        line=line.replace("[","")
574
        line=line.replace("]","")
575
        tmp=line.split("_")
576
        if len(tmp)==3:
577
            print "   ",tmp[0],tmp[1],"\t=",tmp[2]
578
        else:
579
            print "   ",line
580
    f.close()
581

582
if __name__ == "__main__":
583

584

585
    if len(sys.argv)>1:
586
        if (sys.argv[1]=="--help"):
587
            print "usage: python sb_sys_analyzer_linux.py [-v]"
588
            print "-v = verbose"
589

590
        if (sys.argv[1]=="-v"):
591
            GLOBAL_LOGLEVEL=2
592

593

594
    #HW media ready: processor,gpu ID (yes,no,advice)
595
    print "--------------------------"
596
    print "Hardware readiness checks:"
597
    print "--------------------------"
598
    sts=does_processor_have_gen_graphics()
599
    if (sts<loglevelcode.SUCCESS): sys.exit(1)
600

601
    #OS media ready: OS,glibc version,gcc version,nomodeset,gpuID (yes, no, advice, gold/generic)
602
    print "--------------------------"
603
    print "OS readiness checks:"
604
    print "--------------------------"    
605
    sts=is_OS_media_ready()
606
    if (sts<loglevelcode.SUCCESS): sys.exit(1)
607

608

609
    #MSS install correctness: vainfo, /dev/dri, check MSDK dirs, check OCL dirs, check MSDK/OCL funcs
610
    print "--------------------------"
611
    print "Media Server Studio Install:"
612
    print "--------------------------"      
613
    #in video group
614
    out=run_cmd("groups")
615
    if ("video" in out):
616
        print_info("user in video group",loglevelcode.SUCCESS)
617
    elif("root" in out):
618
        print_info("user is root",loglevelcode.SUCCESS)
619
    else:
620
        print_info("user not in video group.  Add with usermod -a -G video {user}",loglevelcode.ERROR)       
621

622
    if find_library("libva.so.1"):
623
        print_info("libva.so.1 found",loglevelcode.SUCCESS)
624
    else:
625
        print_info("libva.so.1 not found.  Check LD_LIBRARY_PATH contains '/usr/lib64;/usr/local/lib'",loglevelcode.ERROR)               
626

627
    #vainfo: exists,correct iHD used
628
    out=run_cmd("vainfo 2>&1")
629
    if ("iHD_drv_video.so" in out):
630
        print_info("Intel iHD used by libva",loglevelcode.INFO)
631
    else:
632
        print_info("libva not loading Intel iHD",loglevelcode.ERROR)
633
    
634
    if ("VAEntrypoint" in out):
635
        print_info("vainfo reports valid codec entry points",loglevelcode.SUCCESS)
636
    else:
637
        print_info("vainfo not reporting codec entry points",loglevelcode.ERROR)       
638

639
    #check i915 use
640
    out=run_cmd("lspci -v -s 0:02.0")
641
    if ("Kernel driver in use: i915" in out):
642
        print_info("i915 driver in use by Intel video adapter",loglevelcode.INFO)
643
    else:
644
        print_info("Intel video adapter not using i915",loglevelcode.ERROR)
645

646
    check_libdrm()
647

648

649
    print "--------------------------"
650
    print "Component Smoke Tests:"
651
    print "--------------------------"
652

653
    # check if possible to start Media SDK HW or SW sessions, get API version available
654
    check_msdk_api()
655

656
    # check if possible to start an OpenCL context
657
    check_OCL_caps()
658

659
    print ""
660
    print "--------------------------"
661
    print "Media SDK Plugins available:"
662
    print "(for more info see /opt/intel/mediasdk/plugins/plugins.cfg)"
663
    print "--------------------------"   
664

665
    check_plugins()