vl_idct.h revision 2c9db2484b7c1cec7a3a629f70a5aa840e16268e
1c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath/**************************************************************************
2c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath *
3c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * Copyright 2010 Christian König
4c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * All Rights Reserved.
5c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath *
6c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * Permission is hereby granted, free of charge, to any person obtaining a
7c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * copy of this software and associated documentation files (the
8c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * "Software"), to deal in the Software without restriction, including
9c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * without limitation the rights to use, copy, modify, merge, publish,
10c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * distribute, sub license, and/or sell copies of the Software, and to
11c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * permit persons to whom the Software is furnished to do so, subject to
12c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * the following conditions:
13c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath *
14c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * The above copyright notice and this permission notice (including the
15c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * next paragraph) shall be included in all copies or substantial portions
16c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * of the Software.
17c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath *
18c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath *
26c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath **************************************************************************/
27c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
28c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#ifndef vl_idct_h
29c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#define vl_idct_h
30c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
31c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#include <pipe/p_state.h>
32c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
33c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathstruct vl_idct
34c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath{
35c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath   struct pipe_context *pipe;
36c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
37c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath   unsigned max_blocks;
38c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
39c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath   struct pipe_viewport_state viewport;
40c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath   struct pipe_resource *vs_const_buf;
41c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath   struct pipe_framebuffer_state fb_state;
42c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
43c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath   struct pipe_resource *destination;
44c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
45c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath   void *vertex_elems_state;
46c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
47c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath   union
48c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath   {
49c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      void *all[4];
50c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      void *stage[2][2];
51      struct {
52         void *transpose, *source;
53         void *matrix, *intermediate;
54      } individual;
55   } samplers;
56
57   union
58   {
59      struct pipe_sampler_view *all[4];
60      struct pipe_sampler_view *stage[2][2];
61      struct {
62         struct pipe_sampler_view *transpose, *source;
63         struct pipe_sampler_view *matrix, *intermediate;
64      } individual;
65   } sampler_views;
66
67   void *vs;
68   void *transpose_fs, *matrix_fs, *eb_fs;
69
70   union
71   {
72      struct pipe_resource *all[4];
73      struct pipe_resource *stage[2][2];
74      struct {
75         struct pipe_resource *transpose, *source;
76         struct pipe_resource *matrix, *intermediate;
77      } individual;
78   } textures;
79
80   union
81   {
82      struct pipe_vertex_buffer all[2];
83      struct { struct pipe_vertex_buffer quad, pos; } individual;
84   } vertex_bufs;
85
86   unsigned num_blocks;
87   unsigned num_empty_blocks;
88
89   struct pipe_transfer *tex_transfer;
90   short *texels;
91
92   struct pipe_transfer *vec_transfer;
93   struct vertex2f *vectors;
94
95   struct {
96      struct pipe_surface *intermediate, *destination;
97   } surfaces;
98};
99
100bool vl_idct_init(struct vl_idct *idct, struct pipe_context *pipe, struct pipe_resource *dst);
101
102void vl_idct_cleanup(struct vl_idct *idct);
103
104void vl_idct_add_block(struct vl_idct *idct, unsigned x, unsigned y, short *block);
105
106void vl_idct_flush(struct vl_idct *idct);
107
108#endif
109