101e04c3fSmrg/*
201e04c3fSmrg * Copyright (C) 2017 Rob Clark <robclark@freedesktop.org>
301e04c3fSmrg *
401e04c3fSmrg * Permission is hereby granted, free of charge, to any person obtaining a
501e04c3fSmrg * copy of this software and associated documentation files (the "Software"),
601e04c3fSmrg * to deal in the Software without restriction, including without limitation
701e04c3fSmrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
801e04c3fSmrg * and/or sell copies of the Software, and to permit persons to whom the
901e04c3fSmrg * Software is furnished to do so, subject to the following conditions:
1001e04c3fSmrg *
1101e04c3fSmrg * The above copyright notice and this permission notice (including the next
1201e04c3fSmrg * paragraph) shall be included in all copies or substantial portions of the
1301e04c3fSmrg * Software.
1401e04c3fSmrg *
1501e04c3fSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1601e04c3fSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1701e04c3fSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1801e04c3fSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1901e04c3fSmrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2001e04c3fSmrg * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2101e04c3fSmrg * SOFTWARE.
2201e04c3fSmrg *
2301e04c3fSmrg * Authors:
2401e04c3fSmrg *    Rob Clark <robclark@freedesktop.org>
2501e04c3fSmrg */
2601e04c3fSmrg
2701e04c3fSmrg#ifndef FREEDRENO_BLIT_H_
2801e04c3fSmrg#define FREEDRENO_BLIT_H_
2901e04c3fSmrg
3001e04c3fSmrg#include "pipe/p_state.h"
317ec681f3Smrg#include "util/u_dump.h"
3201e04c3fSmrg
3301e04c3fSmrg#include "freedreno_context.h"
3401e04c3fSmrg
357ec681f3Smrgbool fd_blitter_blit(struct fd_context *ctx,
367ec681f3Smrg                     const struct pipe_blit_info *info) assert_dt;
379f464c52Smaya
387ec681f3Smrgvoid fd_blitter_clear(struct pipe_context *pctx, unsigned buffers,
397ec681f3Smrg                      const union pipe_color_union *color, double depth,
407ec681f3Smrg                      unsigned stencil) assert_dt;
419f464c52Smaya
429f464c52Smayavoid fd_resource_copy_region(struct pipe_context *pctx,
437ec681f3Smrg                             struct pipe_resource *dst, unsigned dst_level,
447ec681f3Smrg                             unsigned dstx, unsigned dsty, unsigned dstz,
457ec681f3Smrg                             struct pipe_resource *src, unsigned src_level,
467ec681f3Smrg                             const struct pipe_box *src_box) assert_dt;
477ec681f3Smrg
487ec681f3Smrgbool fd_blit(struct pipe_context *pctx,
497ec681f3Smrg             const struct pipe_blit_info *blit_info) assert_dt;
507ec681f3Smrg
517ec681f3Smrg#define DBG_BLIT(blit, batch) do { \
527ec681f3Smrg   if (FD_DBG(MSGS)) { \
537ec681f3Smrg      const struct fd_resource *src = fd_resource((blit)->src.resource); \
547ec681f3Smrg      const struct fd_resource *dst = fd_resource((blit)->dst.resource); \
557ec681f3Smrg      const char *src_target = util_str_tex_target((blit)->src.resource->target, true); \
567ec681f3Smrg      const char *dst_target = util_str_tex_target((blit)->dst.resource->target, true); \
577ec681f3Smrg      const char *src_format = util_format_short_name((blit)->src.format); \
587ec681f3Smrg      const char *dst_format = util_format_short_name((blit)->dst.format); \
597ec681f3Smrg      const char *src_tiling = fd_resource_tile_mode_desc(src, (blit)->src.level); \
607ec681f3Smrg      const char *dst_tiling = fd_resource_tile_mode_desc(dst, (blit)->dst.level); \
617ec681f3Smrg      if (batch) { \
627ec681f3Smrg         DBG("%p: %s %s %s (%p) -> %s %s %s (%p)", (batch), \
637ec681f3Smrg            src_target, src_format, src_tiling, src, \
647ec681f3Smrg            dst_target, dst_format, dst_tiling, dst); \
657ec681f3Smrg      } else { \
667ec681f3Smrg         DBG("%s %s %s (%p) -> %s %s %s (%p)", \
677ec681f3Smrg            src_target, src_format, src_tiling, src, \
687ec681f3Smrg            dst_target, dst_format, dst_tiling, dst); \
697ec681f3Smrg      } \
707ec681f3Smrg   } \
717ec681f3Smrg} while (0)
7201e04c3fSmrg
7301e04c3fSmrg#endif /* FREEDRENO_BLIT_H_ */
74