• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**********************************************************
2  * Copyright 2009-2011 VMware, Inc. All rights reserved.
3  *
4  * Permission is hereby granted, free of charge, to any person
5  * obtaining a copy of this software and associated documentation
6  * files (the "Software"), to deal in the Software without
7  * restriction, including without limitation the rights to use, copy,
8  * modify, merge, publish, distribute, sublicense, and/or sell copies
9  * of the Software, and to permit persons to whom the Software is
10  * furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be
13  * included in all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  *
24  *********************************************************
25  * Authors:
26  * Zack Rusin <zackr-at-vmware-dot-com>
27  * Thomas Hellstrom <thellstrom-at-vmware-dot-com>
28  */
29 
30 #ifndef _XA_CONTEXT_H_
31 #define _XA_CONTEXT_H_
32 #include "xa_tracker.h"
33 #include <stdint.h>
34 
35 struct xa_context;
36 
37 extern struct xa_context *xa_context_default(struct xa_tracker *xa);
38 
39 extern struct xa_context *xa_context_create(struct xa_tracker *xa);
40 
41 extern void xa_context_destroy(struct xa_context *r);
42 
43 extern void xa_context_flush(struct xa_context *ctx);
44 
45 /**
46  * xa_yuv_planar_blit - 2D blit with color conversion and scaling.
47  *
48  * Performs a scaled blit with color conversion according to
49  * (R,G,B,A)^T = (CM)^T (Y,U,V,1)^T, where @conversion_matrix or CM in the
50  * formula is a four by four coefficient matrix. The input variable
51  * @yuv is an array of three xa_yuv_component surfaces.
52  */
53 extern int xa_yuv_planar_blit(struct xa_context *r,
54 			      int src_x,
55 			      int src_y,
56 			      int src_w,
57 			      int src_h,
58 			      int dst_x,
59 			      int dst_y,
60 			      int dst_w,
61 			      int dst_h,
62 			      struct xa_box *box,
63 			      unsigned int num_boxes,
64 			      const float conversion_matrix[],
65 			      struct xa_surface *dst, struct xa_surface *yuv[]);
66 
67 extern int xa_copy_prepare(struct xa_context *ctx,
68 			   struct xa_surface *dst, struct xa_surface *src);
69 
70 extern void xa_copy(struct xa_context *ctx,
71 		    int dx, int dy, int sx, int sy, int width, int height);
72 
73 extern void xa_copy_done(struct xa_context *ctx);
74 
75 extern int xa_surface_dma(struct xa_context *ctx,
76 			  struct xa_surface *srf,
77 			  void *data,
78 			  unsigned int byte_pitch,
79 			  int to_surface, struct xa_box *boxes,
80 			  unsigned int num_boxes);
81 
82 extern void *xa_surface_map(struct xa_context *ctx,
83 			    struct xa_surface *srf, unsigned int usage);
84 
85 extern void xa_surface_unmap(struct xa_surface *srf);
86 
87 extern int
88 xa_solid_prepare(struct xa_context *ctx, struct xa_surface *dst,
89 		 uint32_t fg);
90 extern void
91 xa_solid(struct xa_context *ctx, int x, int y, int width, int height);
92 
93 extern void
94 xa_solid_done(struct xa_context *ctx);
95 
96 extern struct xa_fence *xa_fence_get(struct xa_context *ctx);
97 
98 extern int xa_fence_wait(struct xa_fence *fence, uint64_t timeout);
99 
100 extern void xa_fence_destroy(struct xa_fence *fence);
101 #endif
102