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