Android Overlay HAL架構初探

來源:互聯網
上載者:User


1 overlay可能支援的顏色格式
/* possible overlay formats可能支援的顏色格式 */
enum {
    OVERLAY_FORMAT_RGBA_8888    = HAL_PIXEL_FORMAT_RGBA_8888,
    OVERLAY_FORMAT_RGB_565      = HAL_PIXEL_FORMAT_RGB_565,
    OVERLAY_FORMAT_BGRA_8888    = HAL_PIXEL_FORMAT_BGRA_8888,
    OVERLAY_FORMAT_YCbCr_422_SP = HAL_PIXEL_FORMAT_YCbCr_422_SP,
    OVERLAY_FORMAT_YCbCr_420_SP = HAL_PIXEL_FORMAT_YCbCr_420_SP,
    OVERLAY_FORMAT_YCbYCr_422_I = HAL_PIXEL_FORMAT_YCbCr_422_I,
    OVERLAY_FORMAT_YCbYCr_420_I = HAL_PIXEL_FORMAT_YCbCr_420_I,
    OVERLAY_FORMAT_CbYCrY_422_I = HAL_PIXEL_FORMAT_CbYCrY_422_I,
    OVERLAY_FORMAT_CbYCrY_420_I = HAL_PIXEL_FORMAT_CbYCrY_420_I,
    OVERLAY_FORMAT_DEFAULT      = 99    // The actual color format is determined
                                        // by the overlay
};

2 overlay_control_device_t結構的子函數

   /* get static informations about the capabilities of the overlay engine 擷取overlay引擎的固定資訊*/
    int (*get)(struct overlay_control_device_t *dev, int name);

    /* creates an overlay matching the given parameters as closely as possible.根據所給的參數,儘可能得建立一個overlay。
     * returns an error if no more overlays are available. The actual 如果沒有更多的overlay可擷取,返回錯誤。
     * size and format is returned in overlay_t. 實際的尺寸和格式通過overlay_t結構返回*/
    overlay_t* (*createOverlay)(struct overlay_control_device_t *dev,
            uint32_t w, uint32_t h, int32_t format);
   
    /* destroys an overlay. This call releases all 銷毀一個overlay,釋放所有資源
     * resources associated with overlay_t and make it invalid */
    void (*destroyOverlay)(struct overlay_control_device_t *dev,
            overlay_t* overlay);

    /* set position and scaling of the given overlay as closely as possible. 根據所給的參數,儘可能的設定座標和縮放。
     * if scaling cannot be performed, overlay must be centered. 如果無法執行尺寸變化,必須為中心覆蓋*/
    int (*setPosition)(struct overlay_control_device_t *dev,
            overlay_t* overlay,
            int x, int y, uint32_t w, uint32_t h);

    /* returns the actual position and size of the overlay 擷取overlay的實際位置*/
    int (*getPosition)(struct overlay_control_device_t *dev,
            overlay_t* overlay,
            int* x, int* y, uint32_t* w, uint32_t* h);

    /* sets configurable parameters for this overlay. returns an error if not設定配置參數,如果不支援返回錯誤
     * supported. */
    int (*setParameter)(struct overlay_control_device_t *dev,
            overlay_t* overlay, int param, int value);
/*以下兩個函數沒有實現*/
    int (*stage)(struct overlay_control_device_t *dev, overlay_t* overlay);
    int (*commit)(struct overlay_control_device_t *dev, overlay_t* overlay);

3、 overlay_data_device_t結構體函數子函數
    /* initialize the overlay from the given handle. this associates this通過傳入的handle初始化overlay
     * overlay data module to its control module將data模組附加到控制模組上 */
    int (*initialize)(struct overlay_data_device_t *dev,
            overlay_handle_t handle);

    /* can be called to change the width and height of the overlay.改變overlay的寬度和高度 */
    int (*resizeInput)(struct overlay_data_device_t *dev,
            uint32_t w, uint32_t h);
/*以下三個函數沒有實現*/
    int (*setCrop)(struct overlay_data_device_t *dev,
            uint32_t x, uint32_t y, uint32_t w, uint32_t h) ;

    int (*getCrop)(struct overlay_data_device_t *dev,
       uint32_t* x, uint32_t* y, uint32_t* w, uint32_t* h) ;

    int (*setParameter)(struct overlay_data_device_t *dev,
            int param, int value);

    /* blocks until an overlay buffer is available and return that buffer.阻塞直到一個overlay釋放buffer */
    int (*dequeueBuffer)(struct overlay_data_device_t *dev,
           overlay_buffer_t *buf);

    /* release the overlay buffer and post it釋放overlay buffer,post我理解是貼到screen上 */
    int (*queueBuffer)(struct overlay_data_device_t *dev,
            overlay_buffer_t buffer);

    /* returns the address of a given buffer if supported, NULL otherwise.返回given buffer的地址 */
    void* (*getBufferAddress)(struct overlay_data_device_t *dev,
            overlay_buffer_t buffer);
/*暫未實現*/
    int (*getBufferCount)(struct overlay_data_device_t *dev);

4、get()函數可以提供的種類
enum {
    /* Maximum amount of minification supported by the hardware硬體支援的最大縮小倍數*/
    OVERLAY_MINIFICATION_LIMIT      = 1,
    /* Maximum amount of magnification supported by the hardware硬體支援的最大放大倍數 */
    OVERLAY_MAGNIFICATION_LIMIT     = 2,
    /* Number of fractional bits support by the overlay scaling engine 縮放引擎支援的小數位元 */
    OVERLAY_SCALING_FRAC_BITS       = 3,
    /* Supported rotation step in degrees. 旋轉步進*/
    OVERLAY_ROTATION_STEP_DEG       = 4,
    /* horizontal alignment in pixels 像素中的水平對齊?*/
    OVERLAY_HORIZONTAL_ALIGNMENT    = 5,
    /* vertical alignment in pixels 像素中的垂直對齊*/
    OVERLAY_VERTICAL_ALIGNMENT      = 6,
    /* width alignment restrictions. negative number for max. power-of-two 寬度對齊限制。負數為最大值。雙功率?*/
    OVERLAY_WIDTH_ALIGNMENT         = 7,
    /* height alignment restrictions. negative number for max. power-of-two 高度對齊限制。負數為最大值。雙功率?*/
    OVERLAY_HEIGHT_ALIGNMENT        = 8,
};

5、設定setParameter()函數可設定的種類
enum {
    /* rotation of the source image in degrees (0 to 359)源映像旋轉角度(0 到 359)6410好像還不支援任意角度旋轉 */
    OVERLAY_ROTATION_DEG = 1,
    /* enable or disable dithering */
    OVERLAY_DITHER        = 3,
    /* transformation applied (this is a superset of COPYBIT_ROTATION_DEG) */
    OVERLAY_TRANSFORM    = 4,
};

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.