[01/10] radeon/vcn: add vcn jpeg decode interface

Submitted by Zhang, Boyuan on Aug. 2, 2018, 7:44 p.m.

Details

Message ID 1533239090-1865-1-git-send-email-boyuan.zhang@amd.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Zhang, Boyuan Aug. 2, 2018, 7:44 p.m.
From: Boyuan Zhang <boyuan.zhang@amd.com>

Signed-off-by: Boyuan Zhang <boyuan.zhang@amd.com>
---
 src/gallium/drivers/radeon/Makefile.sources  |   1 +
 src/gallium/drivers/radeon/meson.build       |   1 +
 src/gallium/drivers/radeon/radeon_vcn_jpeg.h | 116 +++++++++++++++++++++++++++
 3 files changed, 118 insertions(+)
 create mode 100644 src/gallium/drivers/radeon/radeon_vcn_jpeg.h

Patch hide | download patch | download mbox

diff --git a/src/gallium/drivers/radeon/Makefile.sources b/src/gallium/drivers/radeon/Makefile.sources
index f8ee860..a11bffe 100644
--- a/src/gallium/drivers/radeon/Makefile.sources
+++ b/src/gallium/drivers/radeon/Makefile.sources
@@ -15,6 +15,7 @@  C_SOURCES := \
 	radeon_vcn_enc_1_2.c \
 	radeon_vcn_enc.c \
 	radeon_vcn_enc.h \
+	radeon_vcn_jpeg.h \
 	radeon_uvd_enc_1_1.c \
 	radeon_uvd_enc.c \
 	radeon_uvd_enc.h \
diff --git a/src/gallium/drivers/radeon/meson.build b/src/gallium/drivers/radeon/meson.build
index 582a5ff..eb68b57 100644
--- a/src/gallium/drivers/radeon/meson.build
+++ b/src/gallium/drivers/radeon/meson.build
@@ -35,6 +35,7 @@  files_libradeon = files(
   'radeon_vcn_enc.h',
   'radeon_vcn_dec.c',
   'radeon_vcn_dec.h',
+  'radeon_vcn_jpeg.h',
   'radeon_uvd_enc_1_1.c',
   'radeon_uvd_enc.c',
   'radeon_uvd_enc.h',
diff --git a/src/gallium/drivers/radeon/radeon_vcn_jpeg.h b/src/gallium/drivers/radeon/radeon_vcn_jpeg.h
new file mode 100644
index 0000000..7eda6f7
--- /dev/null
+++ b/src/gallium/drivers/radeon/radeon_vcn_jpeg.h
@@ -0,0 +1,116 @@ 
+/**************************************************************************
+ *
+ * Copyright 2018 Advanced Micro Devices, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef _RADEON_VCN_JPEG_H
+#define _RADEON_VCN_JPEG_H
+
+#define mmUVD_JPEG_CNTL                                                                                0x0200
+#define mmUVD_JPEG_CNTL_BASE_IDX                                                                       1
+#define mmUVD_JPEG_RB_BASE                                                                             0x0201
+#define mmUVD_JPEG_RB_BASE_BASE_IDX                                                                    1
+#define mmUVD_JPEG_RB_WPTR                                                                             0x0202
+#define mmUVD_JPEG_RB_WPTR_BASE_IDX                                                                    1
+#define mmUVD_JPEG_RB_RPTR                                                                             0x0203
+#define mmUVD_JPEG_RB_RPTR_BASE_IDX                                                                    1
+#define mmUVD_JPEG_RB_SIZE                                                                             0x0204
+#define mmUVD_JPEG_RB_SIZE_BASE_IDX                                                                    1
+#define mmUVD_JPEG_TIER_CNTL2                                                                          0x021a
+#define mmUVD_JPEG_TIER_CNTL2_BASE_IDX                                                                 1
+#define mmUVD_JPEG_UV_TILING_CTRL                                                                      0x021c
+#define mmUVD_JPEG_UV_TILING_CTRL_BASE_IDX                                                             1
+#define mmUVD_JPEG_TILING_CTRL                                                                         0x021e
+#define mmUVD_JPEG_TILING_CTRL_BASE_IDX                                                                1
+#define mmUVD_JPEG_OUTBUF_RPTR                                                                         0x0220
+#define mmUVD_JPEG_OUTBUF_RPTR_BASE_IDX                                                                1
+#define mmUVD_JPEG_OUTBUF_WPTR                                                                         0x0221
+#define mmUVD_JPEG_OUTBUF_WPTR_BASE_IDX                                                                1
+#define mmUVD_JPEG_PITCH                                                                               0x0222
+#define mmUVD_JPEG_PITCH_BASE_IDX                                                                      1
+#define mmUVD_JPEG_INT_EN                                                                              0x0229
+#define mmUVD_JPEG_INT_EN_BASE_IDX                                                                     1
+#define mmUVD_JPEG_UV_PITCH                                                                            0x022b
+#define mmUVD_JPEG_UV_PITCH_BASE_IDX                                                                   1
+#define mmUVD_JPEG_INDEX                                                                               0x023e
+#define mmUVD_JPEG_INDEX_BASE_IDX                                                                      1
+#define mmUVD_JPEG_DATA                                                                                0x023f
+#define mmUVD_JPEG_DATA_BASE_IDX                                                                       1
+#define mmUVD_LMI_JPEG_WRITE_64BIT_BAR_HIGH                                                            0x0438
+#define mmUVD_LMI_JPEG_WRITE_64BIT_BAR_HIGH_BASE_IDX                                                   1
+#define mmUVD_LMI_JPEG_WRITE_64BIT_BAR_LOW                                                             0x0439
+#define mmUVD_LMI_JPEG_WRITE_64BIT_BAR_LOW_BASE_IDX                                                    1
+#define mmUVD_LMI_JPEG_READ_64BIT_BAR_HIGH                                                             0x045a
+#define mmUVD_LMI_JPEG_READ_64BIT_BAR_HIGH_BASE_IDX                                                    1
+#define mmUVD_LMI_JPEG_READ_64BIT_BAR_LOW                                                              0x045b
+#define mmUVD_LMI_JPEG_READ_64BIT_BAR_LOW_BASE_IDX                                                     1
+#define mmUVD_CTX_INDEX                                                                                0x0528
+#define mmUVD_CTX_INDEX_BASE_IDX                                                                       1
+#define mmUVD_CTX_DATA                                                                                 0x0529
+#define mmUVD_CTX_DATA_BASE_IDX                                                                        1
+#define mmUVD_SOFT_RESET                                                                               0x05a0
+#define mmUVD_SOFT_RESET_BASE_IDX                                                                      1
+
+#define RDECODE_PKT_REG_J(x)			((unsigned)(x) & 0x3FFFF)
+#define RDECODE_PKT_RES_J(x)			(((unsigned)(x)	& 0x3F) << 18)
+#define RDECODE_PKT_COND_J(x)			(((unsigned)(x)	& 0xF) << 24)
+#define RDECODE_PKT_TYPE_J(x)			(((unsigned)(x)	& 0xF) << 28)
+#define RDECODE_PKTJ(reg, cond, type)		(RDECODE_PKT_REG_J(reg) | \
+						RDECODE_PKT_RES_J(0) | \
+						RDECODE_PKT_COND_J(cond) | \
+						RDECODE_PKT_TYPE_J(type))
+
+#define UVD_BASE_INST0_SEG0		0x00007800
+#define UVD_BASE_INST0_SEG1		0x00007E00
+#define UVD_BASE_INST0_SEG2		0
+#define UVD_BASE_INST0_SEG3		0
+#define UVD_BASE_INST0_SEG4		0
+
+#define SOC15_REG_ADDR(reg)	(UVD_BASE_INST0_SEG1 + reg)
+
+#define	COND0	0
+#define	COND1	1
+#define	COND2	2
+#define	COND3	3
+#define	COND4	4
+#define	COND5	5
+#define	COND6	6
+#define	COND7	7
+
+#define	TYPE0	0
+#define	TYPE1	1
+#define	TYPE2	2
+#define	TYPE3	3
+#define	TYPE4	4
+#define	TYPE5	5
+#define	TYPE6	6
+#define	TYPE7	7
+
+#define RDECODE_CODEC_JPEG				0x00000008
+
+struct pipe_video_codec *radeon_create_decoder_jpeg(struct pipe_context *context,
+		const struct pipe_video_codec *templat);
+
+#endif