Path: blob/21.2-virgl/src/gallium/frontends/xa/xa_composite.h
4561 views
/**********************************************************1* Copyright 2009-2011 VMware, Inc. All rights reserved.2*3* Permission is hereby granted, free of charge, to any person4* obtaining a copy of this software and associated documentation5* files (the "Software"), to deal in the Software without6* restriction, including without limitation the rights to use, copy,7* modify, merge, publish, distribute, sublicense, and/or sell copies8* of the Software, and to permit persons to whom the Software is9* furnished to do so, subject to the following conditions:10*11* The above copyright notice and this permission notice shall be12* included in all copies or substantial portions of the Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,15* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF16* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND17* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS18* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN19* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN20* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE21* SOFTWARE.22*23*********************************************************24* Authors:25* Zack Rusin <zackr-at-vmware-dot-com>26* Thomas Hellstrom <thellstrom-at-vmware-dot-com>27*/2829#ifndef _XA_COMPOSITE_H_30#define _XA_COMPOSITE_H_3132#include "xa_tracker.h"33#include "xa_context.h"3435/*36* Supported composite ops.37*/38enum xa_composite_op {39xa_op_clear,40xa_op_src,41xa_op_dst,42xa_op_over,43xa_op_over_reverse,44xa_op_in,45xa_op_in_reverse,46xa_op_out,47xa_op_out_reverse,48xa_op_atop,49xa_op_atop_reverse,50xa_op_xor,51xa_op_add52};5354/*55* Supported filters.56*/57enum xa_composite_filter {58xa_filter_nearest,59xa_filter_linear60};6162/*63* Supported clamp methods.64*/65enum xa_composite_wrap {66xa_wrap_clamp_to_border,67xa_wrap_repeat,68xa_wrap_mirror_repeat,69xa_wrap_clamp_to_edge70};7172/*73* Src picture types.74*/75enum xa_composite_src_pict_type {76xa_src_pict_solid_fill,77xa_src_pict_float_solid_fill78};798081/*82* struct xa_pict_solid_fill - Description of a solid_fill picture83* Deprecated. Use struct xa_pict_float_solid_fill instead.84*/85struct xa_pict_solid_fill {86enum xa_composite_src_pict_type type;87unsigned int class;88uint32_t color;89};9091/*92* struct xa_pict_solid_fill - Description of a solid_fill picture93* with color channels represented by floats.94*/95struct xa_pict_float_solid_fill {96enum xa_composite_src_pict_type type;97float color[4]; /* R, G, B, A */98};99100union xa_source_pict {101enum xa_composite_src_pict_type type;102struct xa_pict_solid_fill solid_fill;103struct xa_pict_float_solid_fill float_solid_fill;104};105106struct xa_picture {107enum xa_formats pict_format;108struct xa_surface *srf;109struct xa_surface *alpha_map;110float transform[9];111int has_transform;112int component_alpha;113enum xa_composite_wrap wrap;114enum xa_composite_filter filter;115union xa_source_pict *src_pict;116};117118struct xa_composite {119struct xa_picture *src, *mask, *dst;120int op;121int no_solid;122};123124struct xa_composite_allocation {125unsigned int xa_composite_size;126unsigned int xa_picture_size;127unsigned int xa_source_pict_size;128};129130/*131* Get allocation sizes for minor bump compatibility.132*/133134extern const struct xa_composite_allocation *135xa_composite_allocation(void);136137/*138* This function checks most things except the format of the hardware139* surfaces, since they are generally not available at the time this140* function is called. Returns usual XA error codes.141*/142extern int143xa_composite_check_accelerated(const struct xa_composite *comp);144145extern int146xa_composite_prepare(struct xa_context *ctx, const struct xa_composite *comp);147148extern void149xa_composite_rect(struct xa_context *ctx,150int srcX, int srcY, int maskX, int maskY,151int dstX, int dstY, int width, int height);152extern void153xa_composite_done(struct xa_context *ctx);154155#endif156157158