1b8e80941Smrg/************************************************************************** 2b8e80941Smrg * 3b8e80941Smrg * Copyright 2013 Advanced Micro Devices, Inc. 4b8e80941Smrg * All Rights Reserved. 5b8e80941Smrg * 6b8e80941Smrg * Permission is hereby granted, free of charge, to any person obtaining a 7b8e80941Smrg * copy of this software and associated documentation files (the 8b8e80941Smrg * "Software"), to deal in the Software without restriction, including 9b8e80941Smrg * without limitation the rights to use, copy, modify, merge, publish, 10b8e80941Smrg * distribute, sub license, and/or sell copies of the Software, and to 11b8e80941Smrg * permit persons to whom the Software is furnished to do so, subject to 12b8e80941Smrg * the following conditions: 13b8e80941Smrg * 14b8e80941Smrg * The above copyright notice and this permission notice (including the 15b8e80941Smrg * next paragraph) shall be included in all copies or substantial portions 16b8e80941Smrg * of the Software. 17b8e80941Smrg * 18b8e80941Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19b8e80941Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20b8e80941Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21b8e80941Smrg * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR 22b8e80941Smrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23b8e80941Smrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24b8e80941Smrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25b8e80941Smrg * 26b8e80941Smrg **************************************************************************/ 27b8e80941Smrg 28b8e80941Smrg/* 29b8e80941Smrg * Authors: 30b8e80941Smrg * Christian König <christian.koenig@amd.com> 31b8e80941Smrg * 32b8e80941Smrg */ 33b8e80941Smrg 34b8e80941Smrg#ifndef RADEON_VIDEO_H 35b8e80941Smrg#define RADEON_VIDEO_H 36b8e80941Smrg 37b8e80941Smrg#include "radeon/radeon_winsys.h" 38b8e80941Smrg#include "vl/vl_video_buffer.h" 39b8e80941Smrg 40b8e80941Smrg#define RVID_ERR(fmt, args...) \ 41b8e80941Smrg fprintf(stderr, "EE %s:%d %s UVD - "fmt, __FILE__, __LINE__, __func__, ##args) 42b8e80941Smrg 43b8e80941Smrg/* video buffer representation */ 44b8e80941Smrgstruct rvid_buffer 45b8e80941Smrg{ 46b8e80941Smrg unsigned usage; 47b8e80941Smrg struct r600_resource *res; 48b8e80941Smrg}; 49b8e80941Smrg 50b8e80941Smrg/* generate an stream handle */ 51b8e80941Smrgunsigned rvid_alloc_stream_handle(void); 52b8e80941Smrg 53b8e80941Smrg/* create a buffer in the winsys */ 54b8e80941Smrgbool rvid_create_buffer(struct pipe_screen *screen, struct rvid_buffer *buffer, 55b8e80941Smrg unsigned size, unsigned usage); 56b8e80941Smrg 57b8e80941Smrg/* destroy a buffer */ 58b8e80941Smrgvoid rvid_destroy_buffer(struct rvid_buffer *buffer); 59b8e80941Smrg 60b8e80941Smrg/* reallocate a buffer, preserving its content */ 61b8e80941Smrgbool rvid_resize_buffer(struct pipe_screen *screen, struct radeon_cmdbuf *cs, 62b8e80941Smrg struct rvid_buffer *new_buf, unsigned new_size); 63b8e80941Smrg 64b8e80941Smrg/* clear the buffer with zeros */ 65b8e80941Smrgvoid rvid_clear_buffer(struct pipe_context *context, struct rvid_buffer* buffer); 66b8e80941Smrg 67b8e80941Smrg/* join surfaces into the same buffer with identical tiling params 68b8e80941Smrg sumup their sizes and replace the backend buffers with a single bo */ 69b8e80941Smrgvoid rvid_join_surfaces(struct r600_common_context *rctx, 70b8e80941Smrg struct pb_buffer** buffers[VL_NUM_COMPONENTS], 71b8e80941Smrg struct radeon_surf *surfaces[VL_NUM_COMPONENTS]); 72b8e80941Smrg 73b8e80941Smrg/* returns supported codecs and other parameters */ 74b8e80941Smrgint rvid_get_video_param(struct pipe_screen *screen, 75b8e80941Smrg enum pipe_video_profile profile, 76b8e80941Smrg enum pipe_video_entrypoint entrypoint, 77b8e80941Smrg enum pipe_video_cap param); 78b8e80941Smrg 79b8e80941Smrg/* the hardware only supports NV12 */ 80b8e80941Smrgboolean rvid_is_format_supported(struct pipe_screen *screen, 81b8e80941Smrg enum pipe_format format, 82b8e80941Smrg enum pipe_video_profile profile, 83b8e80941Smrg enum pipe_video_entrypoint entrypoint); 84b8e80941Smrg 85b8e80941Smrg#endif // RADEON_VIDEO_H 86