Path: blob/21.2-virgl/src/gallium/auxiliary/vl/vl_mc.h
4565 views
/**************************************************************************1*2* Copyright 2009 Younes Manton.3* All Rights Reserved.4*5* Permission is hereby granted, free of charge, to any person obtaining a6* copy of this software and associated documentation files (the7* "Software"), to deal in the Software without restriction, including8* without limitation the rights to use, copy, modify, merge, publish,9* distribute, sub license, and/or sell copies of the Software, and to10* permit persons to whom the Software is furnished to do so, subject to11* the following conditions:12*13* The above copyright notice and this permission notice (including the14* next paragraph) shall be included in all copies or substantial portions15* of the Software.16*17* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS18* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF19* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.20* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR21* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,22* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE23* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.24*25**************************************************************************/2627#ifndef vl_mc_h28#define vl_mc_h2930#include "pipe/p_state.h"31#include "pipe/p_video_state.h"3233#include "tgsi/tgsi_ureg.h"3435#include "vl_defines.h"36#include "vl_types.h"3738#define VL_MC_NUM_BLENDERS (1 << VL_NUM_COMPONENTS)3940struct pipe_context;4142struct vl_mc43{44struct pipe_context *pipe;45unsigned buffer_width;46unsigned buffer_height;47unsigned macroblock_size;4849void *rs_state;5051void *blend_clear[VL_MC_NUM_BLENDERS];52void *blend_add[VL_MC_NUM_BLENDERS];53void *blend_sub[VL_MC_NUM_BLENDERS];54void *vs_ref, *vs_ycbcr;55void *fs_ref, *fs_ycbcr, *fs_ycbcr_sub;56void *sampler_ref;57};5859struct vl_mc_buffer60{61bool surface_cleared;6263struct pipe_viewport_state viewport;64struct pipe_framebuffer_state fb_state;65};6667typedef void (*vl_mc_ycbcr_vert_shader)(void *priv, struct vl_mc *mc,68struct ureg_program *shader,69unsigned first_output,70struct ureg_dst tex);7172typedef void (*vl_mc_ycbcr_frag_shader)(void *priv, struct vl_mc *mc,73struct ureg_program *shader,74unsigned first_input,75struct ureg_dst dst);7677bool vl_mc_init(struct vl_mc *renderer, struct pipe_context *pipe,78unsigned picture_width, unsigned picture_height,79unsigned macroblock_size, float scale,80vl_mc_ycbcr_vert_shader vs_callback,81vl_mc_ycbcr_frag_shader fs_callback,82void *callback_priv);8384void vl_mc_cleanup(struct vl_mc *renderer);8586bool vl_mc_init_buffer(struct vl_mc *renderer, struct vl_mc_buffer *buffer);8788void vl_mc_cleanup_buffer(struct vl_mc_buffer *buffer);8990void vl_mc_set_surface(struct vl_mc_buffer *buffer, struct pipe_surface *surface);9192void vl_mc_render_ref(struct vl_mc *renderer, struct vl_mc_buffer *buffer, struct pipe_sampler_view *ref);9394void vl_mc_render_ycbcr(struct vl_mc *renderer, struct vl_mc_buffer *buffer, unsigned component, unsigned num_instances);9596#endif /* vl_mc_h */979899