1af69d88dSmrg/************************************************************************** 2af69d88dSmrg * 3af69d88dSmrg * Copyright 2009 Younes Manton. 4af69d88dSmrg * All Rights Reserved. 5af69d88dSmrg * 6af69d88dSmrg * Permission is hereby granted, free of charge, to any person obtaining a 7af69d88dSmrg * copy of this software and associated documentation files (the 8af69d88dSmrg * "Software"), to deal in the Software without restriction, including 9af69d88dSmrg * without limitation the rights to use, copy, modify, merge, publish, 10af69d88dSmrg * distribute, sub license, and/or sell copies of the Software, and to 11af69d88dSmrg * permit persons to whom the Software is furnished to do so, subject to 12af69d88dSmrg * the following conditions: 13af69d88dSmrg * 14af69d88dSmrg * The above copyright notice and this permission notice (including the 15af69d88dSmrg * next paragraph) shall be included in all copies or substantial portions 16af69d88dSmrg * of the Software. 17af69d88dSmrg * 18af69d88dSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19af69d88dSmrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20af69d88dSmrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21af69d88dSmrg * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 22af69d88dSmrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23af69d88dSmrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24af69d88dSmrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25af69d88dSmrg * 26af69d88dSmrg **************************************************************************/ 27af69d88dSmrg 28af69d88dSmrg#ifndef vl_mc_h 29af69d88dSmrg#define vl_mc_h 30af69d88dSmrg 31af69d88dSmrg#include "pipe/p_state.h" 32af69d88dSmrg#include "pipe/p_video_state.h" 33af69d88dSmrg 34af69d88dSmrg#include "tgsi/tgsi_ureg.h" 35af69d88dSmrg 36af69d88dSmrg#include "vl_defines.h" 37af69d88dSmrg#include "vl_types.h" 38af69d88dSmrg 39af69d88dSmrg#define VL_MC_NUM_BLENDERS (1 << VL_NUM_COMPONENTS) 40af69d88dSmrg 41af69d88dSmrgstruct pipe_context; 42af69d88dSmrg 43af69d88dSmrgstruct vl_mc 44af69d88dSmrg{ 45af69d88dSmrg struct pipe_context *pipe; 46af69d88dSmrg unsigned buffer_width; 47af69d88dSmrg unsigned buffer_height; 48af69d88dSmrg unsigned macroblock_size; 49af69d88dSmrg 50af69d88dSmrg void *rs_state; 51af69d88dSmrg 52af69d88dSmrg void *blend_clear[VL_MC_NUM_BLENDERS]; 53af69d88dSmrg void *blend_add[VL_MC_NUM_BLENDERS]; 54af69d88dSmrg void *blend_sub[VL_MC_NUM_BLENDERS]; 55af69d88dSmrg void *vs_ref, *vs_ycbcr; 56af69d88dSmrg void *fs_ref, *fs_ycbcr, *fs_ycbcr_sub; 57af69d88dSmrg void *sampler_ref; 58af69d88dSmrg}; 59af69d88dSmrg 60af69d88dSmrgstruct vl_mc_buffer 61af69d88dSmrg{ 62af69d88dSmrg bool surface_cleared; 63af69d88dSmrg 64af69d88dSmrg struct pipe_viewport_state viewport; 65af69d88dSmrg struct pipe_framebuffer_state fb_state; 66af69d88dSmrg}; 67af69d88dSmrg 68af69d88dSmrgtypedef void (*vl_mc_ycbcr_vert_shader)(void *priv, struct vl_mc *mc, 69af69d88dSmrg struct ureg_program *shader, 70af69d88dSmrg unsigned first_output, 71af69d88dSmrg struct ureg_dst tex); 72af69d88dSmrg 73af69d88dSmrgtypedef void (*vl_mc_ycbcr_frag_shader)(void *priv, struct vl_mc *mc, 74af69d88dSmrg struct ureg_program *shader, 75af69d88dSmrg unsigned first_input, 76af69d88dSmrg struct ureg_dst dst); 77af69d88dSmrg 78af69d88dSmrgbool vl_mc_init(struct vl_mc *renderer, struct pipe_context *pipe, 79af69d88dSmrg unsigned picture_width, unsigned picture_height, 80af69d88dSmrg unsigned macroblock_size, float scale, 81af69d88dSmrg vl_mc_ycbcr_vert_shader vs_callback, 82af69d88dSmrg vl_mc_ycbcr_frag_shader fs_callback, 83af69d88dSmrg void *callback_priv); 84af69d88dSmrg 85af69d88dSmrgvoid vl_mc_cleanup(struct vl_mc *renderer); 86af69d88dSmrg 87af69d88dSmrgbool vl_mc_init_buffer(struct vl_mc *renderer, struct vl_mc_buffer *buffer); 88af69d88dSmrg 89af69d88dSmrgvoid vl_mc_cleanup_buffer(struct vl_mc_buffer *buffer); 90af69d88dSmrg 91af69d88dSmrgvoid vl_mc_set_surface(struct vl_mc_buffer *buffer, struct pipe_surface *surface); 92af69d88dSmrg 93af69d88dSmrgvoid vl_mc_render_ref(struct vl_mc *renderer, struct vl_mc_buffer *buffer, struct pipe_sampler_view *ref); 94af69d88dSmrg 95af69d88dSmrgvoid vl_mc_render_ycbcr(struct vl_mc *renderer, struct vl_mc_buffer *buffer, unsigned component, unsigned num_instances); 96af69d88dSmrg 97af69d88dSmrg#endif /* vl_mc_h */ 98