src/graphics/display/drivers/amlogic-display/osd.cc
// These configuration could be done during initialization.
These configuration could be done during initialization.
These configuration could be done during initialization .
zx_status_t Osd::ConfigAfbc() {
  AfbcFormatSpecifierS0Reg::Get()
      .FromValue(0)
      .set_block_split(kAfbcSplitOff)
      .set_yuv_transform(kAfbcYuvTransferOff)
      .set_super_block_aspect(kAfbcb16x16Pixel)
      .set_pixel_format(kAfbcRGBA8888)
      .WriteTo(&(*vpu_mmio_));
  Osd1MaliUnpackCtrlReg::Get()
      .ReadFrom(&(*vpu_mmio_))
      .set_r(kAfbcColorReorderR)
      .set_g(kAfbcColorReorderG)
      .set_b(kAfbcColorReorderB)
      .set_a(kAfbcColorReorderA)
      .WriteTo(&(*vpu_mmio_));
  AfbcBufferWidthS0Reg::Get().FromValue(0).set_buffer_width(fb_width_).WriteTo(&(*vpu_mmio_));
  AfbcBufferHeightS0Reg::Get().FromValue(0).set_buffer_height(fb_height_).WriteTo(&(*vpu_mmio_));
  AfbcBoundingBoxXStartS0Reg::Get().FromValue(0).set_buffer_x_start(0).WriteTo(&(*vpu_mmio_));
  AfbcBoundingBoxXEndS0Reg::Get()
      .FromValue(0)
      .set_buffer_x_end(fb_width_ - 2)  
      .WriteTo(&(*vpu_mmio_));
  AfbcBoundingBoxYStartS0Reg::Get().FromValue(0).set_buffer_y_start(0).WriteTo(&(*vpu_mmio_));
  AfbcBoundingBoxYEndS0Reg::Get()
      .FromValue(0)
      .set_buffer_y_end(fb_height_ - 2)  
      .WriteTo(&(*vpu_mmio_));
  AfbcOutputBufStrideS0Reg::Get()
      .FromValue(0)
      .set_output_buffer_stride(fb_width_ * 4)
      .WriteTo(&(*vpu_mmio_));
  AfbcOutputBufAddrLowS0Reg::Get().FromValue(0).set_output_buffer_addr(1 << 24).WriteTo(
      &(*vpu_mmio_));
  AfbcOutputBufAddrHighS0Reg::Get().FromValue(0).set_output_buffer_addr(0).WriteTo(&(*vpu_mmio_));
  Osd1Blk1CfgW4Reg::Get().FromValue(0).set_frame_addr(1 << 24).WriteTo(&(*vpu_mmio_));
  return ZX_OK;
}
zx_status_t Osd :: ConfigAfbc ( ) { AfbcFormatSpecifierS0Reg :: Get ( ) . FromValue ( 0 ) . set_block_split ( kAfbcSplitOff ) . set_yuv_transform ( kAfbcYuvTransferOff ) . set_super_block_aspect ( kAfbcb16x16Pixel ) . set_pixel_format ( kAfbcRGBA8888 ) . WriteTo ( & ( * vpu_mmio_ ) ) ; Osd1MaliUnpackCtrlReg :: Get ( ) . ReadFrom ( & ( * vpu_mmio_ ) ) . set_r ( kAfbcColorReorderR ) . set_g ( kAfbcColorReorderG ) . set_b ( kAfbcColorReorderB ) . set_a ( kAfbcColorReorderA ) . WriteTo ( & ( * vpu_mmio_ ) ) ; AfbcBufferWidthS0Reg :: Get ( ) . FromValue ( 0 ) . set_buffer_width ( fb_width_ ) . WriteTo ( & ( * vpu_mmio_ ) ) ; AfbcBufferHeightS0Reg :: Get ( ) . FromValue ( 0 ) . set_buffer_height ( fb_height_ ) . WriteTo ( & ( * vpu_mmio_ ) ) ; AfbcBoundingBoxXStartS0Reg :: Get ( ) . FromValue ( 0 ) . set_buffer_x_start ( 0 ) . WriteTo ( & ( * vpu_mmio_ ) ) ; AfbcBoundingBoxXEndS0Reg :: Get ( ) . FromValue ( 0 ) . set_buffer_x_end ( fb_width_ - 2 ) . WriteTo ( & ( * vpu_mmio_ ) ) ; AfbcBoundingBoxYStartS0Reg :: Get ( ) . FromValue ( 0 ) . set_buffer_y_start ( 0 ) . WriteTo ( & ( * vpu_mmio_ ) ) ; AfbcBoundingBoxYEndS0Reg :: Get ( ) . FromValue ( 0 ) . set_buffer_y_end ( fb_height_ - 2 ) . WriteTo ( & ( * vpu_mmio_ ) ) ; AfbcOutputBufStrideS0Reg :: Get ( ) . FromValue ( 0 ) . set_output_buffer_stride ( fb_width_ * 4 ) . WriteTo ( & ( * vpu_mmio_ ) ) ; AfbcOutputBufAddrLowS0Reg :: Get ( ) . FromValue ( 0 ) . set_output_buffer_addr ( 1 << 24 ) . WriteTo ( & ( * vpu_mmio_ ) ) ; AfbcOutputBufAddrHighS0Reg :: Get ( ) . FromValue ( 0 ) . set_output_buffer_addr ( 0 ) . WriteTo ( & ( * vpu_mmio_ ) ) ; Osd1Blk1CfgW4Reg :: Get ( ) . FromValue ( 0 ) . set_frame_addr ( 1 << 24 ) . WriteTo ( & ( * vpu_mmio_ ) ) ; return ZX_OK ; }
These configuration could be done during initialization.
These configuration could be done during initialization .
// Set AFBC to 16x16 Blocks, Split Mode OFF, YUV Transfer OFF, and RGBA8888 Format // Note RGBA8888 works for both RGBA and ABGR formats. The channels order will be set // by mali_unpack_ctrl register // Setup color RGBA channel order // Set afbc input buffer width/height in pixel // Set afbc input buffer // vendor code has width - 1 - 1 // vendor code has height -1 -1 // Set output buffer stride // Set afbc output buffer index // The way this is calculated based on vendor code is as follows: // Take OSD being used (1-based index): Therefore OSD1 -> index 1 // out_addr = index << 24 // Set linear address to the out_addr mentioned above