Path: blob/21.2-virgl/src/gallium/frontends/xa/xa_context.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_CONTEXT_H_30#define _XA_CONTEXT_H_31#include "xa_tracker.h"32#include <stdint.h>3334struct xa_context;3536extern struct xa_context *xa_context_default(struct xa_tracker *xa);3738extern struct xa_context *xa_context_create(struct xa_tracker *xa);3940extern void xa_context_destroy(struct xa_context *r);4142extern void xa_context_flush(struct xa_context *ctx);4344/**45* xa_yuv_planar_blit - 2D blit with color conversion and scaling.46*47* Performs a scaled blit with color conversion according to48* (R,G,B,A)^T = (CM)^T (Y,U,V,1)^T, where @conversion_matrix or CM in the49* formula is a four by four coefficient matrix. The input variable50* @yuv is an array of three xa_yuv_component surfaces.51*/52extern int xa_yuv_planar_blit(struct xa_context *r,53int src_x,54int src_y,55int src_w,56int src_h,57int dst_x,58int dst_y,59int dst_w,60int dst_h,61struct xa_box *box,62unsigned int num_boxes,63const float conversion_matrix[],64struct xa_surface *dst, struct xa_surface *yuv[]);6566extern int xa_copy_prepare(struct xa_context *ctx,67struct xa_surface *dst, struct xa_surface *src);6869extern void xa_copy(struct xa_context *ctx,70int dx, int dy, int sx, int sy, int width, int height);7172extern void xa_copy_done(struct xa_context *ctx);7374extern int xa_surface_dma(struct xa_context *ctx,75struct xa_surface *srf,76void *data,77unsigned int byte_pitch,78int to_surface, struct xa_box *boxes,79unsigned int num_boxes);8081extern void *xa_surface_map(struct xa_context *ctx,82struct xa_surface *srf, unsigned int usage);8384extern void xa_surface_unmap(struct xa_surface *srf);8586extern int87xa_solid_prepare(struct xa_context *ctx, struct xa_surface *dst,88uint32_t fg);89extern void90xa_solid(struct xa_context *ctx, int x, int y, int width, int height);9192extern void93xa_solid_done(struct xa_context *ctx);9495extern struct xa_fence *xa_fence_get(struct xa_context *ctx);9697extern int xa_fence_wait(struct xa_fence *fence, uint64_t timeout);9899extern void xa_fence_destroy(struct xa_fence *fence);100#endif101102103