pg-4039, rapidfire api, by dmitry kozlov

28
RAPIDFIRE API FOR WORKSTATIONS BRUNO STEFANIZZI CHRISTOPHER MAYER DMITRY KOZLOV

Upload: amd-developer-central

Post on 25-Jan-2015

582 views

Category:

Technology


2 download

DESCRIPTION

 

TRANSCRIPT

Page 1: PG-4039, RapidFire API, by Dmitry Kozlov

RAPIDFIRE  API  FOR  WORKSTATIONS    BRUNO  STEFANIZZI  

CHRISTOPHER  MAYER  DMITRY  KOZLOV  

Page 2: PG-4039, RapidFire API, by Dmitry Kozlov

2   |      PRESENTATION  TITLE      |      DECEMBER  4,  2013      |      CONFIDENTIAL  

AMD  VDI  SOLUTIONS  

Different  soluHons  for  each  workflows  

• No Virtualization required •  1-1 • High Performance/Watt/$ ratio

• Virtualization (VMWare, Citrix, Microsoft) •  1-1 or 1-n

High End GPU

Dual GPU card

High GPU density

APU

Low Power

High Density

Tablet   Notebook   Desktop   WorkstaHon  

Low  Power  High    Performance  

More flexibility in workflow

Regular workflow

GPU

•  Large Data

•  Compute and Graphics

•  Real time Graphics

Page 3: PG-4039, RapidFire API, by Dmitry Kozlov

3   |      PRESENTATION  TITLE      |      DECEMBER  4,  2013      |      CONFIDENTIAL  

AMD GPU for Server  

Engineering  -­‐  CAD/CAE  

Media  &  Entertainment  

Medical  

Educa@on  &  Research  

For  GPU  Compute  For  Virtualiza@on  

For  Virtualiza@on  

Cloud  Gaming    

AMD  FirePro Sky  

     AMD Radeon Sky

Page 4: PG-4039, RapidFire API, by Dmitry Kozlov

4   |      PRESENTATION  TITLE      |      DECEMBER  4,  2013      |      CONFIDENTIAL  

AMD RapidFire Technology

Low  Latency  

HD  Image/Audio  Quality   Mul@ple  Streams   Virtualiza@on  

Enablement  

! Most  remote  graphics  soluHons  are  CPU  based  ! RapidFire  is  dedicated  cloud  hardware  and  soVware  soluHon  with  API  to  simplify  integraHon  –   Deliver  more  HD  games  streams  per  GPU  with  low  latency  -­‐>  6  x  HD  720p30  fps  –   Leverage  AMD  hardware  on  both  server  and  client  –   Runs  on  any  hardware  

Page 5: PG-4039, RapidFire API, by Dmitry Kozlov

5   |      PRESENTATION  TITLE      |      DECEMBER  4,  2013      |      CONFIDENTIAL  

AMD RapidFire Technology

High  resolu@on  

Collabora@ve  applica@on    

with  mul@stream  Virtual  Desktop   Adap@ve  to    

Network  environment  

!   Design  for  many  use  cases  and  workflows  

Page 6: PG-4039, RapidFire API, by Dmitry Kozlov

6   |      PRESENTATION  TITLE      |      DECEMBER  4,  2013      |      CONFIDENTIAL  

AMD RapidFire Technology

Server   Network   Client   User  Interface  

!   4  independent  components  using  soVware  and  hardware  acceleraHon    

!  HW  H264  Encoding  !  GPU  Encoding  !  CPU  Encoding  !  Plugins  Encoding  !  MulH-­‐stream  

!  MulH-­‐API  (DX9/11/OpenGL/  

OpenCL)  

!  EncrypHon  !  Desktop  and  window  direct  encoding  

!  AdapHve  protocol   !  HW  H264  Decoding  !  CPU  Decoding  !  Custom  GPU  Decoding  

!  MulH-­‐plaeorm  (Win/Linux/IOS/Android)  

!  MulH-­‐API  (DX9/11/OpenGL/  

OpenCL)  

!  Touch  !  Keyboard  !  Mouse  

!  MulH-­‐plaeorm  

Page 7: PG-4039, RapidFire API, by Dmitry Kozlov

7   |      PRESENTATION  TITLE      |      DECEMBER  4,  2013      |      CONFIDENTIAL  

RAPIDFIRE  TECHNOLOGY  DATA  FLOW  OVERVIEW  

Server   Client  

FirePro  Sky  GPU  

NETWORK    

ENCODE  3D  ENGINE  

FRAME  BUFFER  

NETWORK  SERVER  

SOFTWARE  

 DECODE   UI  

FRAME  BUFFER  

    !  RF  API  module  

!  external  module  

Page 8: PG-4039, RapidFire API, by Dmitry Kozlov

8   |      PRESENTATION  TITLE      |      DECEMBER  4,  2013      |      CONFIDENTIAL  

RAPIDFIRE  TECHNOLOGY  SERVER  SIDE  DATA  FLOW  

Server  FirePro  Sky  GPU  

NETWORK  

ENCODE  

3D  ENGINE  SERVER  

SOFTWARE  

! Network  component  transfers  UI  events  from  the  client  to  the  server  

EXECUTION  RESOURCES  

FRAME  BUFFER  

Page 9: PG-4039, RapidFire API, by Dmitry Kozlov

9   |      PRESENTATION  TITLE      |      DECEMBER  4,  2013      |      CONFIDENTIAL  

RAPIDFIRE  TECHNOLOGY  SERVER  SIDE  DATA  FLOW  

Server  FirePro  Sky  GPU  

NETWORK  

ENCODE  

3D  ENGINE  SERVER  

SOFTWARE  

! Network  component  transfers  UI  events  from  the  client  to  the  server  

!  Server  renders  the  desktop  

EXECUTION  RESOURCES  

FRAME  BUFFER  

Page 10: PG-4039, RapidFire API, by Dmitry Kozlov

10   |      PRESENTATION  TITLE      |      DECEMBER  4,  2013      |      CONFIDENTIAL  

RAPIDFIRE  TECHNOLOGY  SERVER  SIDE  DATA  FLOW  

Server  FirePro  Sky  GPU  

NETWORK  

ENCODE  

3D  ENGINE  SERVER  

SOFTWARE  

! Network  component  transfers  UI  events  from  the  client  to  the  server  

!  Server  renders  the  desktop  

EXECUTION  RESOURCES  

FRAME  BUFFER  

Page 11: PG-4039, RapidFire API, by Dmitry Kozlov

11   |      PRESENTATION  TITLE      |      DECEMBER  4,  2013      |      CONFIDENTIAL  

RAPIDFIRE  TECHNOLOGY  SERVER  SIDE  DATA  FLOW  

Server  FirePro  Sky  GPU  

NETWORK  

ENCODE  

3D  ENGINE  SERVER  

SOFTWARE  

! Network  component  transfers  UI  events  from  the  client  to  the  server  

!  Server  renders  the  desktop  !  VCE  is  performing  asynchronous  desktop  capture  and  encoding  into  H264  video  stream  and  the  data  is  fetched  to  system  memory  by  the  app  

EXECUTION  RESOURCES  

FRAME  BUFFER  

Page 12: PG-4039, RapidFire API, by Dmitry Kozlov

12   |      PRESENTATION  TITLE      |      DECEMBER  4,  2013      |      CONFIDENTIAL  

RAPIDFIRE  TECHNOLOGY  SERVER  SIDE  DATA  FLOW  

Server  FirePro  Sky  GPU  

NETWORK  

ENCODE  

3D  ENGINE  SERVER  

SOFTWARE  

! Network  component  transfers  UI  events  from  the  client  to  the  server  

!  Server  renders  the  desktop  !  VCE  is  performing  asynchronous  desktop  capture  and  encoding  into  H264  video  stream  and  the  data  is  fetched  to  system  memory  by  the  app  

!  Video  stream  gets  send  to  the  client  

EXECUTION  RESOURCES  

FRAME  BUFFER  

Page 13: PG-4039, RapidFire API, by Dmitry Kozlov

13   |      PRESENTATION  TITLE      |      DECEMBER  4,  2013      |      CONFIDENTIAL  

RAPIDFIRE  TECHNOLOGY  CLIENT  SIDE  DATA  FLOW  

Client  

Radeon  GPU  NETWORK  

DECODE  

!  Client  receives  H264  stream  from  the  server  using  RTSP  protocol  

FRAME  BUFFER  

CLIENT  SOFTWARE  

DECODE  AUDIO  

Audio  device  

UI  

Input  devices  

Page 14: PG-4039, RapidFire API, by Dmitry Kozlov

14   |      PRESENTATION  TITLE      |      DECEMBER  4,  2013      |      CONFIDENTIAL  

RAPIDFIRE  TECHNOLOGY  CLIENT  SIDE  DATA  FLOW  

Client  

Radeon  GPU  NETWORK  

H264  DECODE  

!   Client  receives  H264  stream  from  the  server  using  RTSP  protocol  

!  The  client  sends  the  stream  to  Radeon  GPU  which  performs  H264  hardware  decoding  to  the  frame  buffer  

FRAME  BUFFER  

CLIENT  SOFTWARE  

DECODE  

Audio  device  

UI  

Input  devices  

Page 15: PG-4039, RapidFire API, by Dmitry Kozlov

15   |      PRESENTATION  TITLE      |      DECEMBER  4,  2013      |      CONFIDENTIAL  

RAPIDFIRE  TECHNOLOGY  CLIENT  SIDE  DATA  FLOW  

Client  

Radeon  GPU  NETWORK  

DECODE  

!  Client  receives  H264  stream  from  the  server  using  RTSP  protocol  

!  The  client  sends  the  stream  to  Radeon  GPU  which  performs  H264  hardware  decoding  to  the  frame  buffer  

!  Sound  stream  is  decoded  using  soVware  audio  codec  and  sent  to  audio  hardware  

FRAME  BUFFER  

CLIENT  SOFTWARE  

DECODE  AUDIO  

Audio  device  

UI  

Input  devices  

Page 16: PG-4039, RapidFire API, by Dmitry Kozlov

16   |      PRESENTATION  TITLE      |      DECEMBER  4,  2013      |      CONFIDENTIAL  

RAPIDFIRE  TECHNOLOGY  CLIENT  SIDE  DATA  FLOW  

Client  

Radeon  GPU  NETWORK  

DECODE  

!  Client  receives  H264  stream  from  the  server  using  RTSP  protocol  

!  The  client  sends  the  stream  to  Radeon  GPU  which  performs  H264  hardware  decoding  to  the  frame  buffer  

!  Sound  stream  is  decoded  using  soVware  audio  codec  and  sent  to  audio  hardware  

! UI  events  are  collected  by  the  client  and  sent  over  the  network  to  the  server  

FRAME  BUFFER  

CLIENT  SOFTWARE  

DECODE  AUDIO  

Audio  device  

UI  

Input  devices  

Page 17: PG-4039, RapidFire API, by Dmitry Kozlov

17   |      PRESENTATION  TITLE      |      DECEMBER  4,  2013      |      CONFIDENTIAL  

THE  RAPIDFIRE  API  

"  Server  component  The  server  component  provides  funcHons  for  the:  ‒ Encoding  of  video  and  audio  data  ‒ Color  space  conversion  ‒ Capturing  of  the  desktop  ‒ Handling  of  mulHple  render  targets  ‒  Interoperability  with  OpenGL,  D3D9  and  D3D11    

"  Client  component  The  client  component  provides  funcHons  for:  ‒ Decoding  of  video  and  audio  streams  ‒ Color  space  conversion  ‒  Interoperability  with  OpenGL,  D3D9  and  D3D11    

COMPONENTS  

"  Network  component  The  Network  component  is  a  sample  implementaHon  of  video  and  audio  streaming  based  on  the  LIVE555  Media  Server.      

"  User  Interface  The  UI  component  provide  funcHons  to:  ‒ Capture  user  events  on  the  client  ‒  Send  the  events  to  the  server  for  processing  

 

Page 18: PG-4039, RapidFire API, by Dmitry Kozlov

18   |      PRESENTATION  TITLE      |      DECEMBER  4,  2013      |      CONFIDENTIAL  

THE  RAPIDFIRE  API  THE  SERVER  COMPONENT  

Create  RenderTarget  

rfCreateEncodeSession  

rfCreateEncoder  

rfRegisterRenderTarget  

IniHalizaHon   Render  Loop  

rfGetEncodedFrame  

rfEncodeFrame  

Draw  to  free  RenderTarget  

rfRtspServerSendFrame  

Done?  

Page 19: PG-4039, RapidFire API, by Dmitry Kozlov

19   |      PRESENTATION  TITLE      |      DECEMBER  4,  2013      |      CONFIDENTIAL  

THE  RAPIDFIRE  API  

"  rfCreateEncodeSession  ‒ Creates  an  encoding  session  on  the  server.  The  sessions  encapsulates  the  following  components:  ‒  Rendering  context/device  ‒  Compute  context  that  is  used  for  the  color  space  conversion  ‒  Render  targets  ‒ Desktop  ‒  The  encoder:  SW,  VCE  or  IDENTITY    

‒ The  following  session  types  are  supported  ‒ OpenGL  ‒ DX9  /  DX9Ex  ‒ DX11  ‒ Desktop  capturing  

THE  SERVER  COMPONENT    

Create  RenderTarget  

rfCreateEncodeSession  

rfCreateEncoder  

rfRegisterRenderTarget  

IniHalizaHon  

Page 20: PG-4039, RapidFire API, by Dmitry Kozlov

20   |      PRESENTATION  TITLE      |      DECEMBER  4,  2013      |      CONFIDENTIAL  

THE  RAPIDFIRE  API  THE  SERVER  COMPONENT    

Create  RenderTarget  

rfCreateEncodeSession  

rfCreateEncoder  

rfRegisterRenderTarget  

IniHalizaHon   "  rfCreateEncodeSession  ‒ CreaHng  an  OpenGL  session  that  uses  the  VCE  HW  encoding  

"  rfRegisterRenderTargt    

   ‒  Input:  Name  of  the  OpenGL  Texture,  dimension  of  the  texture  ‒ Output:  The  index  used  by  RF  to  idenHfy  this  render  target  

       RFProperties  props[]  =  {  RF_GL_GRAPHICS_CTX,  (RFProperties)hGLRC,                                                            RF_GL_DEVICE_CTX,      (RFProperties)hDC,                                                            RF_ENCODER,                  (RFProperties)RF_VCE,                                                            0  };            //  Create  RapidFire  encoding  session          RFEncodeSession  session  =  rfCreateEncodeSession(props);    

       for  (unsigned  int  i  =  0;  i  <  NUM_RENDER_TARGETS;  i++)          {                rfRegisterRenderTarget(session,  RF_RT_GL_TEXTURE,  uiTexName[i],  uiWidth,  uiHeight,  &renderTargetIdx[i]));          }    

Page 21: PG-4039, RapidFire API, by Dmitry Kozlov

21   |      PRESENTATION  TITLE      |      DECEMBER  4,  2013      |      CONFIDENTIAL  

THE  RAPIDFIRE  API  THE  SERVER  COMPONENT    

Create  RenderTarget  

rfCreateEncodeSession  

rfCreateEncoder  

rfRegisterRenderTarget  

IniHalizaHon   "  rfCreateEncoder  ‒ CreaHng  an  Encoder  using  a  preset  configuraHon  

‒ The  following  presets  are  supported:  ‒  RF_ENCODE_FAST  ‒  RF_ENCODE_BALANCED  ‒  RF_ENCODE_QUALITY  

"  rfCreateEncoder2  ‒ CreaHng  an  encoder  using  properHes  

rfCreateEncoder(session,  uiWidth,  uiHeight,  RF_ENCODE_FAST)    

//  Create  encoder  using  properties  RFProperties  props[]  =  {  RF_ENCODER_PROFILE,  (RFProperties)RF_MAIN,                                                    RF_ENCODER_LEVEL,      (RFProperties)41,                                                    RF_ENCODER_BITRATE,  (RFProperties)6000000,                                                    RF_ENCODER_FPS,          (RFProperties)30,                                                    0  };    rfCreateEncoder2(session,  uiWidth,  uiHeight,  props));    

Page 22: PG-4039, RapidFire API, by Dmitry Kozlov

22   |      PRESENTATION  TITLE      |      DECEMBER  4,  2013      |      CONFIDENTIAL  

THE  RAPIDFIRE  API  THE  SERVER  COMPONENT    

Render  Loop   "  rfEncodeFrame  

‒ Non-­‐blocking  call  to  submit  a  frame  for  encoding  

"  rfGetEncodedFrame  

‒ Check  first  if  a  frame  is  ready  ‒  If  a  frame  is  available  get  the  data  to  system  memory  ‒  Send  the  frame  over  the  network  to  the  client  

rfGetEncodedFrame  

rfEncodeFrame  

Draw  to  free  RenderTarget  

rfRtspServerSendFrame  

Done?  

rfEncodeFrame(session,  renderTargetIdx[uiCurrentRT]));  

//  Check  if  encoded  frame  is  ready  if  (rfIsEncodedFrameReady(session))  {        if  (rfGetEncodedFrame(session,  &uiBitStreamSize,  (void**)&pBitStreamdata)  ==  RF_STATUS_OK)        {              if  (uiBitStreamSize  >  0)              {                    //  Send  encoded  frame  to  Network                    rtspStatus  =  rfRtspServerSendFrame(rtsp_sn,  pBitStreamdata,  uiBitStreamSize,  tv.tv_sec,  tv.tv_usec,  1);              }        }                                      }  

Page 23: PG-4039, RapidFire API, by Dmitry Kozlov

23   |      PRESENTATION  TITLE      |      DECEMBER  4,  2013      |      CONFIDENTIAL  

THE  RAPIDFIRE  API  THE  CLIENT  COMPONENT    

Create  Target  Textures  

rfCreateDecodeSession  

rfCreateVideoDecoder  

rfRegisterTargetTexture  

IniHalizaHon   Render  Loop  

Display  frame  using  Target  Texture  

rfDecodeFrame  

Wait  to  receive  frame  

Done?  

Page 24: PG-4039, RapidFire API, by Dmitry Kozlov

24   |      PRESENTATION  TITLE      |      DECEMBER  4,  2013      |      CONFIDENTIAL  

THE  RAPIDFIRE  API  THE  CLIENT  COMPONENT    

Create  Target  Textures  

rfCreateDecodeSession  

rfCreateVideoDecoder  

rfRegisterTargetTexture  

IniHalizaHon   "  rfCreateDecodeSession  ‒ Creates  a  decoding  session  on  the  client.  The  sessions  encapsulates  the  following  components:  ‒  Rendering  context/device  ‒  Compute  context  that  is  used  for  the  color  space  conversion  ‒  Target  Textures  ‒ Decoder:  SW  or  UVD    

‒ The  following  session  are  supported  ‒ OpenGL  ‒ DX9  /  DX9Ex  ‒ DX11  

Page 25: PG-4039, RapidFire API, by Dmitry Kozlov

25   |      PRESENTATION  TITLE      |      DECEMBER  4,  2013      |      CONFIDENTIAL  

THE  RAPIDFIRE  API  THE  CLIENT  COMPONENT    

Create  Target  Textures  

rfCreateDecodeSession  

rfCreateVideoDecoder  

rfRegisterTargetTexture  

IniHalizaHon   "  rfCreateDecodeSession  

‒ Creates  an  OpenGL  session  that  uses  the  UVD  decoder  

"  rfRegisterTargetTexture  

‒ Registers  an  OpenGL  texture    ‒ The  texture  will  be  used  to  store  the  decoded  frame  

RFProperties  props[]  =  {  RF_GL_GRAPHICS_CTX,  (RFProperties)hGLRC,                                                    RF_GL_DEVICE_CTX,      (RFProperties)hDC,                                                    RF_DECODER,                  (RFProperties)RF_UVD,                                                    0  };    //  Create  RapidFire  decoding  session  RFDecSession  session  =  rfCreateDecodeSession(props);    

rfRegisterTargetTexture(session,  uiTextureName);    

Page 26: PG-4039, RapidFire API, by Dmitry Kozlov

26   |      PRESENTATION  TITLE      |      DECEMBER  4,  2013      |      CONFIDENTIAL  

THE  RAPIDFIRE  API  THE  CLIENT  COMPONENT    

Create  Target  Textures  

rfCreateDecodeSession  

rfCreateVideoDecoder  

rfRegisterTargetTexture  

IniHalizaHon   "  rfCreateVideoDecoder  

‒ Create  the  actual  decoder  

rfCreateVideoDecoder(session,  uiWidth,  uiHeight);    

Page 27: PG-4039, RapidFire API, by Dmitry Kozlov

27   |      PRESENTATION  TITLE      |      DECEMBER  4,  2013      |      CONFIDENTIAL  

THE  RAPIDFIRE  API  THE  CLIENT  COMPONENT    

"  rfDecodeFrame  

‒ Decodes  a  frame  ‒ The  decoded  frame  is  stored  in  the  registered  texture  ‒ Now  the  applicaHon  can  use  the  texture  to  display  the  frame  

rfDecodeFrame(session);    

Render  Loop  

Display  frame  using  Target  Texture  

rfDecodeFrame  

Wait  to  receive  frame  

Done?  

Page 28: PG-4039, RapidFire API, by Dmitry Kozlov

28   |      PRESENTATION  TITLE      |      DECEMBER  4,  2013      |      CONFIDENTIAL  

DISCLAIMER  &  ATTRIBUTION  

The  informaHon  presented  in  this  document  is  for  informaHonal  purposes  only  and  may  contain  technical  inaccuracies,  omissions  and  typographical  errors.    

The  informaHon  contained  herein  is  subject  to  change  and  may  be  rendered  inaccurate  for  many  reasons,  including  but  not  limited  to  product  and  roadmap  changes,  component  and  motherboard  version  changes,  new  model  and/or  product  releases,  product  differences  between  differing  manufacturers,  soVware  changes,  BIOS  flashes,  firmware  upgrades,  or  the  like.  AMD  assumes  no  obligaHon  to  update  or  otherwise  correct  or  revise  this  informaHon.  However,  AMD  reserves  the  right  to  revise  this  informaHon  and  to  make  changes  from  Hme  to  Hme  to  the  content  hereof  without  obligaHon  of  AMD  to  noHfy  any  person  of  such  revisions  or  changes.    

AMD  MAKES  NO  REPRESENTATIONS  OR  WARRANTIES  WITH  RESPECT  TO  THE  CONTENTS  HEREOF  AND  ASSUMES  NO  RESPONSIBILITY  FOR  ANY  INACCURACIES,  ERRORS  OR  OMISSIONS  THAT  MAY  APPEAR  IN  THIS  INFORMATION.    

AMD  SPECIFICALLY  DISCLAIMS  ANY  IMPLIED  WARRANTIES  OF  MERCHANTABILITY  OR  FITNESS  FOR  ANY  PARTICULAR  PURPOSE.  IN  NO  EVENT  WILL  AMD  BE  LIABLE  TO  ANY  PERSON  FOR  ANY  DIRECT,  INDIRECT,  SPECIAL  OR  OTHER  CONSEQUENTIAL  DAMAGES  ARISING  FROM  THE  USE  OF  ANY  INFORMATION  CONTAINED  HEREIN,  EVEN  IF  AMD  IS  EXPRESSLY  ADVISED  OF  THE  POSSIBILITY  OF  SUCH  DAMAGES.  

 

ATTRIBUTION  

©  2013  Advanced  Micro  Devices,  Inc.  All  rights  reserved.  AMD,  the  AMD  Arrow  logo  and  combinaHons  thereof  are  trademarks  of  Advanced  Micro  Devices,  Inc.  in  the  United  States  and/or  other  jurisdicHons.    SPEC    is  a  registered  trademark  of  the  Standard  Performance  EvaluaHon  CorporaHon  (SPEC).  Other  names  are  for  informaHonal  purposes  only  and  may  be  trademarks  of  their  respecHve  owners.