136ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller 236ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller#ifndef __NV50_BLIT_H__ 336ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller#define __NV50_BLIT_H__ 436ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller 536ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller#include "util/u_inlines.h" 636ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller#include "util/u_format.h" 736ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller 836ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumillervoid * 936ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumillernv50_blitter_make_fp(struct pipe_context *, 1036ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller unsigned mode, 1136ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller enum pipe_texture_target); 1236ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller 1336ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumillerunsigned 1436ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumillernv50_blit_select_mode(const struct pipe_blit_info *); 1536ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller 1636ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller/* Converted to a pipe->blit. */ 1736ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumillervoid 1836ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumillernv50_resource_resolve(struct pipe_context *, const struct pipe_resolve_info *); 1936ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller 2036ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller#define NV50_BLIT_MODE_PASS 0 /* pass through TEX $t0/$s0 output */ 2136ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller#define NV50_BLIT_MODE_Z24S8 1 /* encode ZS values for RGBA unorm8 */ 2236ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller#define NV50_BLIT_MODE_S8Z24 2 2336ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller#define NV50_BLIT_MODE_X24S8 3 2436ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller#define NV50_BLIT_MODE_S8X24 4 2536ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller#define NV50_BLIT_MODE_Z24X8 5 2636ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller#define NV50_BLIT_MODE_X8Z24 6 2736ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller#define NV50_BLIT_MODE_ZS 7 /* put $t0/$s0 into R, $t1/$s1 into G */ 2836ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller#define NV50_BLIT_MODE_XS 8 /* put $t1/$s1 into G */ 2936ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller#define NV50_BLIT_MODES 9 3036ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller 3136ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller/* CUBE and RECT textures are reinterpreted as 2D(_ARRAY) */ 3236ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller#define NV50_BLIT_TEXTURE_BUFFER 0 3336ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller#define NV50_BLIT_TEXTURE_1D 1 3436ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller#define NV50_BLIT_TEXTURE_2D 2 3536ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller#define NV50_BLIT_TEXTURE_3D 3 3636ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller#define NV50_BLIT_TEXTURE_1D_ARRAY 4 3736ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller#define NV50_BLIT_TEXTURE_2D_ARRAY 5 3836ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller#define NV50_BLIT_MAX_TEXTURE_TYPES 6 3936ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller 40a2a1a5805fd617e7f3cc8be44dd79b50da07ebb9Ilia Mirkinstatic inline unsigned 4136ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumillernv50_blit_texture_type(enum pipe_texture_target target) 4236ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller{ 4336ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller switch (target) { 4436ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller case PIPE_TEXTURE_1D: return NV50_BLIT_TEXTURE_1D; 4536ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller case PIPE_TEXTURE_2D: return NV50_BLIT_TEXTURE_2D; 4636ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller case PIPE_TEXTURE_3D: return NV50_BLIT_TEXTURE_3D; 4736ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller case PIPE_TEXTURE_1D_ARRAY: return NV50_BLIT_TEXTURE_1D_ARRAY; 4836ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller case PIPE_TEXTURE_2D_ARRAY: return NV50_BLIT_TEXTURE_2D_ARRAY; 4936ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller default: 5036ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller assert(target == PIPE_BUFFER); 5136ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller return NV50_BLIT_TEXTURE_BUFFER; 5236ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller } 5336ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller} 5436ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller 55a2a1a5805fd617e7f3cc8be44dd79b50da07ebb9Ilia Mirkinstatic inline unsigned 5636ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumillernv50_blit_get_tgsi_texture_target(enum pipe_texture_target target) 5736ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller{ 5836ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller switch (target) { 5936ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller case PIPE_TEXTURE_1D: return TGSI_TEXTURE_1D; 6036ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller case PIPE_TEXTURE_2D: return TGSI_TEXTURE_2D; 6136ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller case PIPE_TEXTURE_3D: return TGSI_TEXTURE_3D; 6236ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller case PIPE_TEXTURE_1D_ARRAY: return TGSI_TEXTURE_1D_ARRAY; 6336ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller case PIPE_TEXTURE_2D_ARRAY: return TGSI_TEXTURE_2D_ARRAY; 6436ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller default: 6536ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller assert(target == PIPE_BUFFER); 6636ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller return TGSI_TEXTURE_BUFFER; 6736ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller } 6836ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller} 6936ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller 70a2a1a5805fd617e7f3cc8be44dd79b50da07ebb9Ilia Mirkinstatic inline enum pipe_texture_target 7136ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumillernv50_blit_reinterpret_pipe_texture_target(enum pipe_texture_target target) 7236ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller{ 7336ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller switch (target) { 7436ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller case PIPE_TEXTURE_CUBE: 75f7599b2c32185535b4c215de0ba0454129fa523fChristoph Bumiller case PIPE_TEXTURE_CUBE_ARRAY: 7636ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller return PIPE_TEXTURE_2D_ARRAY; 7736ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller case PIPE_TEXTURE_RECT: 7836ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller return PIPE_TEXTURE_2D; 7936ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller default: 8036ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller return target; 8136ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller } 8236ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller} 8336ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller 84a2a1a5805fd617e7f3cc8be44dd79b50da07ebb9Ilia Mirkinstatic inline unsigned 8536ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumillernv50_blit_get_filter(const struct pipe_blit_info *info) 8636ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller{ 8736ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller if (info->dst.resource->nr_samples < info->src.resource->nr_samples) 8836ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller return util_format_is_depth_or_stencil(info->src.format) ? 0 : 1; 8936ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller 9036ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller if (info->filter != PIPE_TEX_FILTER_LINEAR) 9136ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller return 0; 9236ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller 9336ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller if ((info->dst.box.width == info->src.box.width || 9436ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller info->dst.box.width == -info->src.box.width) && 9536ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller (info->dst.box.height == info->src.box.height || 9636ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller info->dst.box.height == -info->src.box.height)) 9736ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller return 0; 9836ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller 9936ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller return 1; 10036ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller} 10136ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller 10236ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller/* Since shaders cannot export stencil, we cannot copy stencil values when 10336ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller * rendering to ZETA, so we attach the ZS surface to a colour render target. 10436ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller */ 105a2a1a5805fd617e7f3cc8be44dd79b50da07ebb9Ilia Mirkinstatic inline enum pipe_format 10636ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumillernv50_blit_zeta_to_colour_format(enum pipe_format format) 10736ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller{ 10836ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller switch (format) { 10936ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller case PIPE_FORMAT_Z16_UNORM: 11036ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller return PIPE_FORMAT_R16_UNORM; 11136ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller case PIPE_FORMAT_Z24_UNORM_S8_UINT: 11236ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller case PIPE_FORMAT_S8_UINT_Z24_UNORM: 11336ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller case PIPE_FORMAT_Z24X8_UNORM: 1141ae32e24ca0d03e739a39fa753a7e88cdd37681aIlia Mirkin case PIPE_FORMAT_X8Z24_UNORM: 1151ae32e24ca0d03e739a39fa753a7e88cdd37681aIlia Mirkin case PIPE_FORMAT_X24S8_UINT: 1161ae32e24ca0d03e739a39fa753a7e88cdd37681aIlia Mirkin case PIPE_FORMAT_S8X24_UINT: 11736ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller return PIPE_FORMAT_R8G8B8A8_UNORM; 11836ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller case PIPE_FORMAT_Z32_FLOAT: 11936ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller return PIPE_FORMAT_R32_FLOAT; 12036ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT: 1211ae32e24ca0d03e739a39fa753a7e88cdd37681aIlia Mirkin case PIPE_FORMAT_X32_S8X24_UINT: 12236ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller return PIPE_FORMAT_R32G32_FLOAT; 12336ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller default: 12436ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller assert(0); 12536ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller return PIPE_FORMAT_NONE; 12636ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller } 12736ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller} 12836ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller 12936ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller 130a2a1a5805fd617e7f3cc8be44dd79b50da07ebb9Ilia Mirkinstatic inline uint16_t 13136ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumillernv50_blit_derive_color_mask(const struct pipe_blit_info *info) 13236ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller{ 13336ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller const unsigned mask = info->mask; 13436ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller 13536ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller uint16_t color_mask = 0; 13636ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller 13736ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller switch (info->dst.format) { 1381ae32e24ca0d03e739a39fa753a7e88cdd37681aIlia Mirkin case PIPE_FORMAT_Z24X8_UNORM: 1391ae32e24ca0d03e739a39fa753a7e88cdd37681aIlia Mirkin case PIPE_FORMAT_X24S8_UINT: 14036ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller case PIPE_FORMAT_Z24_UNORM_S8_UINT: 14136ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller if (mask & PIPE_MASK_S) 14236ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller color_mask |= 0x1000; 14336ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller if (mask & PIPE_MASK_Z) 14436ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller color_mask |= 0x0111; 14536ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller break; 1461ae32e24ca0d03e739a39fa753a7e88cdd37681aIlia Mirkin case PIPE_FORMAT_X8Z24_UNORM: 1471ae32e24ca0d03e739a39fa753a7e88cdd37681aIlia Mirkin case PIPE_FORMAT_S8X24_UINT: 14836ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller case PIPE_FORMAT_S8_UINT_Z24_UNORM: 14936ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller if (mask & PIPE_MASK_S) 15036ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller color_mask |= 0x0001; 1511ae32e24ca0d03e739a39fa753a7e88cdd37681aIlia Mirkin if (mask & PIPE_MASK_Z) 1521ae32e24ca0d03e739a39fa753a7e88cdd37681aIlia Mirkin color_mask |= 0x1110; 15336ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller break; 15436ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller default: 15536ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller if (mask & (PIPE_MASK_R | PIPE_MASK_Z)) color_mask |= 0x0001; 15636ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller if (mask & (PIPE_MASK_G | PIPE_MASK_S)) color_mask |= 0x0010; 15736ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller if (mask & PIPE_MASK_B) color_mask |= 0x0100; 15836ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller if (mask & PIPE_MASK_A) color_mask |= 0x1000; 15936ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller break; 16036ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller } 16136ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller 16236ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller return color_mask; 16336ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller} 16436ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller 165a2a1a5805fd617e7f3cc8be44dd79b50da07ebb9Ilia Mirkinstatic inline uint32_t 16636ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumillernv50_blit_eng2d_get_mask(const struct pipe_blit_info *info) 16736ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller{ 16836ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller uint32_t mask = 0; 16936ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller 17036ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller switch (info->dst.format) { 1711ae32e24ca0d03e739a39fa753a7e88cdd37681aIlia Mirkin case PIPE_FORMAT_Z24X8_UNORM: 1721ae32e24ca0d03e739a39fa753a7e88cdd37681aIlia Mirkin case PIPE_FORMAT_X24S8_UINT: 17336ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller case PIPE_FORMAT_Z24_UNORM_S8_UINT: 17436ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller if (info->mask & PIPE_MASK_Z) mask |= 0x00ffffff; 17536ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller if (info->mask & PIPE_MASK_S) mask |= 0xff000000; 17636ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller break; 1771ae32e24ca0d03e739a39fa753a7e88cdd37681aIlia Mirkin case PIPE_FORMAT_X8Z24_UNORM: 1781ae32e24ca0d03e739a39fa753a7e88cdd37681aIlia Mirkin case PIPE_FORMAT_S8X24_UINT: 17936ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller case PIPE_FORMAT_S8_UINT_Z24_UNORM: 18036ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller if (info->mask & PIPE_MASK_Z) mask |= 0xffffff00; 18136ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller if (info->mask & PIPE_MASK_S) mask |= 0x000000ff; 18236ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller break; 18336ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller default: 18436ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller mask = 0xffffffff; 18536ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller break; 18636ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller } 18736ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller return mask; 18836ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller} 18936ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller 190d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller#if NOUVEAU_DRIVER == 0xc0 191d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller# define nv50_format_table nvc0_format_table 192d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller#endif 193d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller 194cd0dec0d9dfab642c51774c3f5788cbdf00b8c9bSamuel Pitoiset/* return true for formats that can be converted among each other by NVC0_2D */ 195a2a1a5805fd617e7f3cc8be44dd79b50da07ebb9Ilia Mirkinstatic inline bool 196d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumillernv50_2d_dst_format_faithful(enum pipe_format format) 197d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller{ 198d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller const uint64_t mask = 199d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller NV50_ENG2D_SUPPORTED_FORMATS & 200d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller ~NV50_ENG2D_NOCONVERT_FORMATS; 201d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller uint8_t id = nv50_format_table[format].rt; 202d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller return (id >= 0xc0) && (mask & (1ULL << (id - 0xc0))); 203d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller} 204a2a1a5805fd617e7f3cc8be44dd79b50da07ebb9Ilia Mirkinstatic inline bool 205d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumillernv50_2d_src_format_faithful(enum pipe_format format) 206d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller{ 207d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller const uint64_t mask = 208d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller NV50_ENG2D_SUPPORTED_FORMATS & 209d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller ~(NV50_ENG2D_LUMINANCE_FORMATS | NV50_ENG2D_INTENSITY_FORMATS); 210d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller uint8_t id = nv50_format_table[format].rt; 211d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller return (id >= 0xc0) && (mask & (1ULL << (id - 0xc0))); 212d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller} 213d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller 214a2a1a5805fd617e7f3cc8be44dd79b50da07ebb9Ilia Mirkinstatic inline bool 215d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumillernv50_2d_format_supported(enum pipe_format format) 216d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller{ 217d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller uint8_t id = nv50_format_table[format].rt; 218d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller return (id >= 0xc0) && 219d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller (NV50_ENG2D_SUPPORTED_FORMATS & (1ULL << (id - 0xc0))); 220d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller} 221d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller 222a2a1a5805fd617e7f3cc8be44dd79b50da07ebb9Ilia Mirkinstatic inline bool 223d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumillernv50_2d_dst_format_ops_supported(enum pipe_format format) 224d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller{ 225d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller uint8_t id = nv50_format_table[format].rt; 226d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller return (id >= 0xc0) && 227d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller (NV50_ENG2D_OPERATION_FORMATS & (1ULL << (id - 0xc0))); 228d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller} 229d801545964f8183bb17ed913b7c19482dad43b6cChristoph Bumiller 23036ea744f58e5b436c45ed857bd92bbb472e641d5Christoph Bumiller#endif /* __NV50_BLIT_H__ */ 231