1d722e3fbSopenharmony_ci/*
2d722e3fbSopenharmony_ci * Copyright © 2014 NVIDIA Corporation
3d722e3fbSopenharmony_ci *
4d722e3fbSopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
5d722e3fbSopenharmony_ci * copy of this software and associated documentation files (the "Software"),
6d722e3fbSopenharmony_ci * to deal in the Software without restriction, including without limitation
7d722e3fbSopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8d722e3fbSopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
9d722e3fbSopenharmony_ci * Software is furnished to do so, subject to the following conditions:
10d722e3fbSopenharmony_ci *
11d722e3fbSopenharmony_ci * The above copyright notice and this permission notice shall be included in
12d722e3fbSopenharmony_ci * all copies or substantial portions of the Software.
13d722e3fbSopenharmony_ci *
14d722e3fbSopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15d722e3fbSopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16d722e3fbSopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17d722e3fbSopenharmony_ci * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18d722e3fbSopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19d722e3fbSopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20d722e3fbSopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE.
21d722e3fbSopenharmony_ci */
22d722e3fbSopenharmony_ci
23d722e3fbSopenharmony_ci#ifndef TEGRA_DRM_TEST_TEGRA_H
24d722e3fbSopenharmony_ci#define TEGRA_DRM_TEST_TEGRA_H
25d722e3fbSopenharmony_ci
26d722e3fbSopenharmony_ci#include "drm-test.h"
27d722e3fbSopenharmony_ci#include "tegra.h"
28d722e3fbSopenharmony_ci
29d722e3fbSopenharmony_ci#define HOST1X_OPCODE_SETCL(offset, classid, mask) \
30d722e3fbSopenharmony_ci    ((0x0 << 28) | (((offset) & 0xfff) << 16) | (((classid) & 0x3ff) << 6) | ((mask) & 0x3f))
31d722e3fbSopenharmony_ci#define HOST1X_OPCODE_INCR(offset, count) \
32d722e3fbSopenharmony_ci    ((0x1 << 28) | (((offset) & 0xfff) << 16) | ((count) & 0xffff))
33d722e3fbSopenharmony_ci#define HOST1X_OPCODE_NONINCR(offset, count) \
34d722e3fbSopenharmony_ci    ((0x2 << 28) | (((offset) & 0xfff) << 16) | ((count) & 0xffff))
35d722e3fbSopenharmony_ci#define HOST1X_OPCODE_MASK(offset, mask) \
36d722e3fbSopenharmony_ci    ((0x3 << 28) | (((offset) & 0xfff) << 16) | ((mask) & 0xffff))
37d722e3fbSopenharmony_ci#define HOST1X_OPCODE_IMM(offset, data) \
38d722e3fbSopenharmony_ci    ((0x4 << 28) | (((offset) & 0xfff) << 16) | ((data) & 0xffff))
39d722e3fbSopenharmony_ci#define HOST1X_OPCODE_EXTEND(subop, value) \
40d722e3fbSopenharmony_ci    ((0xe << 28) | (((subop) & 0xf) << 24) | ((value) & 0xffffff))
41d722e3fbSopenharmony_ci
42d722e3fbSopenharmony_ci#define HOST1X_CLASS_GR2D 0x51
43d722e3fbSopenharmony_ci
44d722e3fbSopenharmony_cistruct drm_tegra_gr2d {
45d722e3fbSopenharmony_ci    struct drm_tegra *drm;
46d722e3fbSopenharmony_ci    struct drm_tegra_channel *channel;
47d722e3fbSopenharmony_ci};
48d722e3fbSopenharmony_ci
49d722e3fbSopenharmony_ciint drm_tegra_gr2d_open(struct drm_tegra *drm, struct drm_tegra_gr2d **gr2dp);
50d722e3fbSopenharmony_ciint drm_tegra_gr2d_close(struct drm_tegra_gr2d *gr2d);
51d722e3fbSopenharmony_ciint drm_tegra_gr2d_fill(struct drm_tegra_gr2d *gr2d, struct drm_framebuffer *fb,
52d722e3fbSopenharmony_ci                        unsigned int x, unsigned int y, unsigned int width,
53d722e3fbSopenharmony_ci                        unsigned int height, uint32_t color);
54d722e3fbSopenharmony_ci
55d722e3fbSopenharmony_ci#endif
56