xref: /aosp_15_r20/external/mesa3d/src/gallium/drivers/freedreno/freedreno_blitter.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright © 2017 Rob Clark <[email protected]>
3  * SPDX-License-Identifier: MIT
4  *
5  * Authors:
6  *    Rob Clark <[email protected]>
7  */
8 
9 #ifndef FREEDRENO_BLIT_H_
10 #define FREEDRENO_BLIT_H_
11 
12 #include "pipe/p_state.h"
13 #include "util/u_dump.h"
14 
15 #include "freedreno_context.h"
16 
17 BEGINC;
18 
19 bool fd_blitter_blit(struct fd_context *ctx,
20                      const struct pipe_blit_info *info) assert_dt;
21 
22 void fd_blitter_clear(struct pipe_context *pctx, unsigned buffers,
23                       const union pipe_color_union *color, double depth,
24                       unsigned stencil) assert_dt;
25 
26 void fd_blitter_clear_render_target(struct pipe_context *pctx, struct pipe_surface *ps,
27                                     const union pipe_color_union *color, unsigned x,
28                                     unsigned y, unsigned w, unsigned h,
29                                     bool render_condition_enabled) assert_dt;
30 
31 void fd_blitter_clear_depth_stencil(struct pipe_context *pctx, struct pipe_surface *ps,
32                                     unsigned buffers, double depth, unsigned stencil,
33                                     unsigned x, unsigned y, unsigned w, unsigned h,
34                                     bool render_condition_enabled) assert_dt;
35 
36 void fd_resource_copy_region(struct pipe_context *pctx,
37                              struct pipe_resource *dst, unsigned dst_level,
38                              unsigned dstx, unsigned dsty, unsigned dstz,
39                              struct pipe_resource *src, unsigned src_level,
40                              const struct pipe_box *src_box) assert_dt;
41 
42 bool fd_blit(struct pipe_context *pctx,
43              const struct pipe_blit_info *blit_info) assert_dt;
44 
45 #define DBG_BLIT(blit, batch) do { \
46    if (FD_DBG(MSGS)) { \
47       const struct fd_resource *src = fd_resource((blit)->src.resource); \
48       const struct fd_resource *dst = fd_resource((blit)->dst.resource); \
49       const char *src_target = util_str_tex_target((blit)->src.resource->target, true); \
50       const char *dst_target = util_str_tex_target((blit)->dst.resource->target, true); \
51       const char *src_format = util_format_short_name((blit)->src.format); \
52       const char *dst_format = util_format_short_name((blit)->dst.format); \
53       const char *src_tiling = fd_resource_tile_mode_desc(src, (blit)->src.level); \
54       const char *dst_tiling = fd_resource_tile_mode_desc(dst, (blit)->dst.level); \
55       if (batch) { \
56          DBG("%p: %s %s %s (%p) -> %s %s %s (%p)", (batch), \
57             src_target, src_format, src_tiling, src, \
58             dst_target, dst_format, dst_tiling, dst); \
59       } else { \
60          DBG("%s %s %s (%p) -> %s %s %s (%p)", \
61             src_target, src_format, src_tiling, src, \
62             dst_target, dst_format, dst_tiling, dst); \
63       } \
64    } \
65 } while (0)
66 
67 ENDC;
68 
69 #endif /* FREEDRENO_BLIT_H_ */
70