1af69d88dSmrg/**************************************************************************
2af69d88dSmrg *
3af69d88dSmrg * Copyright 2013 Advanced Micro Devices, Inc.
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 THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 RADEON_VIDEO_H
29af69d88dSmrg#define RADEON_VIDEO_H
30af69d88dSmrg
3101e04c3fSmrg#include "radeon/radeon_winsys.h"
32af69d88dSmrg#include "vl/vl_video_buffer.h"
33af69d88dSmrg
347ec681f3Smrg#define RVID_ERR(fmt, args...)                                                                     \
357ec681f3Smrg   fprintf(stderr, "EE %s:%d %s UVD - " fmt, __FILE__, __LINE__, __func__, ##args)
36af69d88dSmrg
3701e04c3fSmrg#define UVD_FW_1_66_16 ((1 << 24) | (66 << 16) | (16 << 8))
3801e04c3fSmrg
39af69d88dSmrg/* video buffer representation */
407ec681f3Smrgstruct rvid_buffer {
417ec681f3Smrg   unsigned usage;
427ec681f3Smrg   struct si_resource *res;
43af69d88dSmrg};
44af69d88dSmrg
45af69d88dSmrg/* generate an stream handle */
4601e04c3fSmrgunsigned si_vid_alloc_stream_handle(void);
47af69d88dSmrg
48af69d88dSmrg/* create a buffer in the winsys */
497ec681f3Smrgbool si_vid_create_buffer(struct pipe_screen *screen, struct rvid_buffer *buffer, unsigned size,
507ec681f3Smrg                          unsigned usage);
517ec681f3Smrg
527ec681f3Smrg/* create a tmz buffer in the winsys */
537ec681f3Smrgbool si_vid_create_tmz_buffer(struct pipe_screen *screen, struct rvid_buffer *buffer, unsigned size,
547ec681f3Smrg                              unsigned usage);
55af69d88dSmrg
56af69d88dSmrg/* destroy a buffer */
5701e04c3fSmrgvoid si_vid_destroy_buffer(struct rvid_buffer *buffer);
58af69d88dSmrg
59af69d88dSmrg/* reallocate a buffer, preserving its content */
6001e04c3fSmrgbool si_vid_resize_buffer(struct pipe_screen *screen, struct radeon_cmdbuf *cs,
617ec681f3Smrg                          struct rvid_buffer *new_buf, unsigned new_size);
62af69d88dSmrg
63af69d88dSmrg/* clear the buffer with zeros */
647ec681f3Smrgvoid si_vid_clear_buffer(struct pipe_context *context, struct rvid_buffer *buffer);
65af69d88dSmrg
66af69d88dSmrg#endif // RADEON_VIDEO_H
67