17ec681f3Smrg/********************************************************** 27ec681f3Smrg * Copyright 2009-2011 VMware, Inc. All rights reserved. 37ec681f3Smrg * 47ec681f3Smrg * Permission is hereby granted, free of charge, to any person 57ec681f3Smrg * obtaining a copy of this software and associated documentation 67ec681f3Smrg * files (the "Software"), to deal in the Software without 77ec681f3Smrg * restriction, including without limitation the rights to use, copy, 87ec681f3Smrg * modify, merge, publish, distribute, sublicense, and/or sell copies 97ec681f3Smrg * of the Software, and to permit persons to whom the Software is 107ec681f3Smrg * furnished to do so, subject to the following conditions: 117ec681f3Smrg * 127ec681f3Smrg * The above copyright notice and this permission notice shall be 137ec681f3Smrg * included in all copies or substantial portions of the Software. 147ec681f3Smrg * 157ec681f3Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 167ec681f3Smrg * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 177ec681f3Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 187ec681f3Smrg * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 197ec681f3Smrg * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 207ec681f3Smrg * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 217ec681f3Smrg * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 227ec681f3Smrg * SOFTWARE. 237ec681f3Smrg * 247ec681f3Smrg ********************************************************* 257ec681f3Smrg * Authors: 267ec681f3Smrg * Zack Rusin <zackr-at-vmware-dot-com> 277ec681f3Smrg * Thomas Hellstrom <thellstrom-at-vmware-dot-com> 287ec681f3Smrg */ 297ec681f3Smrg 307ec681f3Smrg#ifndef _XA_COMPOSITE_H_ 317ec681f3Smrg#define _XA_COMPOSITE_H_ 327ec681f3Smrg 337ec681f3Smrg#include "xa_tracker.h" 347ec681f3Smrg#include "xa_context.h" 357ec681f3Smrg 367ec681f3Smrg/* 377ec681f3Smrg * Supported composite ops. 387ec681f3Smrg */ 397ec681f3Smrgenum xa_composite_op { 407ec681f3Smrg xa_op_clear, 417ec681f3Smrg xa_op_src, 427ec681f3Smrg xa_op_dst, 437ec681f3Smrg xa_op_over, 447ec681f3Smrg xa_op_over_reverse, 457ec681f3Smrg xa_op_in, 467ec681f3Smrg xa_op_in_reverse, 477ec681f3Smrg xa_op_out, 487ec681f3Smrg xa_op_out_reverse, 497ec681f3Smrg xa_op_atop, 507ec681f3Smrg xa_op_atop_reverse, 517ec681f3Smrg xa_op_xor, 527ec681f3Smrg xa_op_add 537ec681f3Smrg}; 547ec681f3Smrg 557ec681f3Smrg/* 567ec681f3Smrg * Supported filters. 577ec681f3Smrg */ 587ec681f3Smrgenum xa_composite_filter { 597ec681f3Smrg xa_filter_nearest, 607ec681f3Smrg xa_filter_linear 617ec681f3Smrg}; 627ec681f3Smrg 637ec681f3Smrg/* 647ec681f3Smrg * Supported clamp methods. 657ec681f3Smrg */ 667ec681f3Smrgenum xa_composite_wrap { 677ec681f3Smrg xa_wrap_clamp_to_border, 687ec681f3Smrg xa_wrap_repeat, 697ec681f3Smrg xa_wrap_mirror_repeat, 707ec681f3Smrg xa_wrap_clamp_to_edge 717ec681f3Smrg}; 727ec681f3Smrg 737ec681f3Smrg/* 747ec681f3Smrg * Src picture types. 757ec681f3Smrg */ 767ec681f3Smrgenum xa_composite_src_pict_type { 777ec681f3Smrg xa_src_pict_solid_fill, 787ec681f3Smrg xa_src_pict_float_solid_fill 797ec681f3Smrg}; 807ec681f3Smrg 817ec681f3Smrg 827ec681f3Smrg/* 837ec681f3Smrg * struct xa_pict_solid_fill - Description of a solid_fill picture 847ec681f3Smrg * Deprecated. Use struct xa_pict_float_solid_fill instead. 857ec681f3Smrg */ 867ec681f3Smrgstruct xa_pict_solid_fill { 877ec681f3Smrg enum xa_composite_src_pict_type type; 887ec681f3Smrg unsigned int class; 897ec681f3Smrg uint32_t color; 907ec681f3Smrg}; 917ec681f3Smrg 927ec681f3Smrg/* 937ec681f3Smrg * struct xa_pict_solid_fill - Description of a solid_fill picture 947ec681f3Smrg * with color channels represented by floats. 957ec681f3Smrg */ 967ec681f3Smrgstruct xa_pict_float_solid_fill { 977ec681f3Smrg enum xa_composite_src_pict_type type; 987ec681f3Smrg float color[4]; /* R, G, B, A */ 997ec681f3Smrg}; 1007ec681f3Smrg 1017ec681f3Smrgunion xa_source_pict { 1027ec681f3Smrg enum xa_composite_src_pict_type type; 1037ec681f3Smrg struct xa_pict_solid_fill solid_fill; 1047ec681f3Smrg struct xa_pict_float_solid_fill float_solid_fill; 1057ec681f3Smrg}; 1067ec681f3Smrg 1077ec681f3Smrgstruct xa_picture { 1087ec681f3Smrg enum xa_formats pict_format; 1097ec681f3Smrg struct xa_surface *srf; 1107ec681f3Smrg struct xa_surface *alpha_map; 1117ec681f3Smrg float transform[9]; 1127ec681f3Smrg int has_transform; 1137ec681f3Smrg int component_alpha; 1147ec681f3Smrg enum xa_composite_wrap wrap; 1157ec681f3Smrg enum xa_composite_filter filter; 1167ec681f3Smrg union xa_source_pict *src_pict; 1177ec681f3Smrg}; 1187ec681f3Smrg 1197ec681f3Smrgstruct xa_composite { 1207ec681f3Smrg struct xa_picture *src, *mask, *dst; 1217ec681f3Smrg int op; 1227ec681f3Smrg int no_solid; 1237ec681f3Smrg}; 1247ec681f3Smrg 1257ec681f3Smrgstruct xa_composite_allocation { 1267ec681f3Smrg unsigned int xa_composite_size; 1277ec681f3Smrg unsigned int xa_picture_size; 1287ec681f3Smrg unsigned int xa_source_pict_size; 1297ec681f3Smrg}; 1307ec681f3Smrg 1317ec681f3Smrg/* 1327ec681f3Smrg * Get allocation sizes for minor bump compatibility. 1337ec681f3Smrg */ 1347ec681f3Smrg 1357ec681f3Smrgextern const struct xa_composite_allocation * 1367ec681f3Smrgxa_composite_allocation(void); 1377ec681f3Smrg 1387ec681f3Smrg/* 1397ec681f3Smrg * This function checks most things except the format of the hardware 1407ec681f3Smrg * surfaces, since they are generally not available at the time this 1417ec681f3Smrg * function is called. Returns usual XA error codes. 1427ec681f3Smrg */ 1437ec681f3Smrgextern int 1447ec681f3Smrgxa_composite_check_accelerated(const struct xa_composite *comp); 1457ec681f3Smrg 1467ec681f3Smrgextern int 1477ec681f3Smrgxa_composite_prepare(struct xa_context *ctx, const struct xa_composite *comp); 1487ec681f3Smrg 1497ec681f3Smrgextern void 1507ec681f3Smrgxa_composite_rect(struct xa_context *ctx, 1517ec681f3Smrg int srcX, int srcY, int maskX, int maskY, 1527ec681f3Smrg int dstX, int dstY, int width, int height); 1537ec681f3Smrgextern void 1547ec681f3Smrgxa_composite_done(struct xa_context *ctx); 1557ec681f3Smrg 1567ec681f3Smrg#endif 157