@@ -93,7 +93,6 @@ typedef struct {
9393 esp_lcd_video_timing_t video_timing ; /*!< Video timing */
9494 /// Extra configuration flags for MIPI DSI DPI panel
9595 struct extra_dpi_panel_flags {
96- uint32_t use_dma2d : 1 ; /*!< Use DMA2D to copy user buffer to the frame buffer when necessary */
9796 uint32_t disable_lp : 1 ;/*!< Disable low-power for DPI */
9897 } flags ; /*!< Extra configuration flags */
9998} esp_lcd_dpi_panel_config_t ;
@@ -200,6 +199,92 @@ typedef struct {
200199 */
201200esp_err_t esp_lcd_dpi_panel_register_event_callbacks (esp_lcd_panel_handle_t dpi_panel , const esp_lcd_dpi_panel_event_callbacks_t * cbs , void * user_ctx );
202201
202+ /**
203+ * @brief Type of draw bitmap hook data
204+ */
205+ typedef struct {
206+ void * dst_data ; /*!< Destination buffer (usually frame buffer) */
207+ int dst_x_size ; /*!< Destination bitmap width */
208+ int dst_y_size ; /*!< Destination bitmap height */
209+ int dst_x_start ; /*!< Destination start x coordinate */
210+ int dst_y_start ; /*!< Destination start y coordinate */
211+ int dst_x_end ; /*!< Destination end x coordinate (exclusive) */
212+ int dst_y_end ; /*!< Destination end y coordinate (exclusive) */
213+ const void * src_data ; /*!< Source bitmap data */
214+ int src_x_size ; /*!< Source bitmap width */
215+ int src_y_size ; /*!< Source bitmap height */
216+ int src_x_start ; /*!< Source start x coordinate */
217+ int src_y_start ; /*!< Source start y coordinate */
218+ int src_x_end ; /*!< Source end x coordinate (exclusive) */
219+ int src_y_end ; /*!< Source end y coordinate (exclusive) */
220+ int bits_per_pixel ; /*!< Bits per pixel */
221+ bool (* on_hook_end )(esp_lcd_panel_handle_t panel ); /*!< Callback to be invoked when the hook completes its operation */
222+ } esp_lcd_draw_bitmap_hook_data_t ;
223+
224+ /**
225+ * @brief draw bitmap hook function type for custom pixel processing operations
226+ *
227+ * This hook allows users to implement custom operations like scaling, rotation,
228+ * color space conversion, etc. using hardware accelerators like PPA or DMA2D.
229+ *
230+ * @note The hook should ensure the synchronization of draw operations on its own.
231+ *
232+ * @param[in] panel LCD panel handle
233+ * @param[in] hook_data Hook data
234+ * @param[in] hook_ctx Hook context
235+ * @return
236+ * - ESP_OK on success
237+ * - Other error codes on failure
238+ */
239+ typedef esp_err_t (* esp_lcd_panel_draw_bitmap_hook_t )(esp_lcd_panel_handle_t panel , const esp_lcd_draw_bitmap_hook_data_t * hook_data , void * hook_ctx );
240+
241+ /**
242+ * @brief Type of LCD panel hooks
243+ */
244+ typedef struct {
245+ esp_lcd_panel_draw_bitmap_hook_t draw_bitmap_hook ; /*!< Draw bitmap hook function */
246+ } esp_lcd_panel_hooks_t ;
247+
248+ /**
249+ * @brief Register panel hooks to the DPI panel
250+ *
251+ * @note You can register panel hooks to implement custom operations like scaling, rotation, color space conversion, etc.
252+ * with hardware accelerators like PPA or DMA2D.
253+ * The hook will be overridden when this function is called multiple times.
254+ *
255+ * @param[in] dpi_panel LCD DPI panel handle, which is returned from esp_lcd_new_panel_dpi()
256+ * @param[in] hooks Panel hooks
257+ * @param[in] hook_ctx Hook context
258+ * @return
259+ * - ESP_OK: Register hooks successfully
260+ * - Other error codes on failure
261+ */
262+ esp_err_t esp_lcd_dpi_panel_register_hooks (esp_lcd_panel_handle_t dpi_panel , const esp_lcd_panel_hooks_t * hooks , void * hook_ctx );
263+
264+ /**
265+ * @brief Enable DMA2D for DPI panel
266+ *
267+ * @note The function will register a built-in DMA2D draw bitmap hook to perform draw bitmap operations using DMA2D.
268+ *
269+ * @param[in] dpi_panel LCD DPI panel handle, which is returned from esp_lcd_new_panel_dpi()
270+ * @return
271+ * - ESP_OK: Enable DMA2D successfully
272+ * - Other error codes on failure
273+ */
274+ esp_err_t esp_lcd_dpi_panel_enable_dma2d (esp_lcd_panel_handle_t dpi_panel );
275+
276+ /**
277+ * @brief Disable DMA2D for DPI panel
278+ *
279+ * @note The function will unregister the built-in DMA2D draw bitmap hook.
280+ *
281+ * @param[in] dpi_panel LCD DPI panel handle, which is returned from esp_lcd_new_panel_dpi()
282+ * @return
283+ * - ESP_OK: Disable DMA2D successfully
284+ * - Other error codes on failure
285+ */
286+ esp_err_t esp_lcd_dpi_panel_disable_dma2d (esp_lcd_panel_handle_t dpi_panel );
287+
203288#ifdef __cplusplus
204289}
205290#endif
0 commit comments