Merge tag 'io_uring-5.11-2021-01-16' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / drivers / gpu / drm / nouveau / dispnv50 / wndwc67e.c
blob7a370fa1df20c85a7d64393e9acaaf122da717ae
1 /*
2 * Copyright 2021 Red Hat Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
22 #include "wndw.h"
23 #include "atom.h"
25 #include <nvif/pushc37b.h>
27 #include <nvhw/class/clc57e.h>
29 static int
30 wndwc67e_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
32 struct nvif_push *push = wndw->wndw.push;
33 int ret;
35 if ((ret = PUSH_WAIT(push, 17)))
36 return ret;
38 PUSH_MTHD(push, NVC57E, SET_PRESENT_CONTROL,
39 NVVAL(NVC57E, SET_PRESENT_CONTROL, MIN_PRESENT_INTERVAL, asyw->image.interval) |
40 NVVAL(NVC57E, SET_PRESENT_CONTROL, BEGIN_MODE, asyw->image.mode) |
41 NVDEF(NVC57E, SET_PRESENT_CONTROL, TIMESTAMP_MODE, DISABLE));
43 PUSH_MTHD(push, NVC57E, SET_SIZE,
44 NVVAL(NVC57E, SET_SIZE, WIDTH, asyw->image.w) |
45 NVVAL(NVC57E, SET_SIZE, HEIGHT, asyw->image.h),
47 SET_STORAGE,
48 NVVAL(NVC57E, SET_STORAGE, BLOCK_HEIGHT, asyw->image.blockh),
50 SET_PARAMS,
51 NVVAL(NVC57E, SET_PARAMS, FORMAT, asyw->image.format) |
52 NVDEF(NVC57E, SET_PARAMS, CLAMP_BEFORE_BLEND, DISABLE) |
53 NVDEF(NVC57E, SET_PARAMS, SWAP_UV, DISABLE) |
54 NVDEF(NVC57E, SET_PARAMS, FMT_ROUNDING_MODE, ROUND_TO_NEAREST),
56 SET_PLANAR_STORAGE(0),
57 NVVAL(NVC57E, SET_PLANAR_STORAGE, PITCH, asyw->image.blocks[0]) |
58 NVVAL(NVC57E, SET_PLANAR_STORAGE, PITCH, asyw->image.pitch[0] >> 6));
60 PUSH_MTHD(push, NVC57E, SET_CONTEXT_DMA_ISO(0), asyw->image.handle, 1);
61 PUSH_MTHD(push, NVC57E, SET_OFFSET(0), asyw->image.offset[0] >> 8);
63 PUSH_MTHD(push, NVC57E, SET_POINT_IN(0),
64 NVVAL(NVC57E, SET_POINT_IN, X, asyw->state.src_x >> 16) |
65 NVVAL(NVC57E, SET_POINT_IN, Y, asyw->state.src_y >> 16));
67 PUSH_MTHD(push, NVC57E, SET_SIZE_IN,
68 NVVAL(NVC57E, SET_SIZE_IN, WIDTH, asyw->state.src_w >> 16) |
69 NVVAL(NVC57E, SET_SIZE_IN, HEIGHT, asyw->state.src_h >> 16));
71 PUSH_MTHD(push, NVC57E, SET_SIZE_OUT,
72 NVVAL(NVC57E, SET_SIZE_OUT, WIDTH, asyw->state.crtc_w) |
73 NVVAL(NVC57E, SET_SIZE_OUT, HEIGHT, asyw->state.crtc_h));
74 return 0;
77 static const struct nv50_wndw_func
78 wndwc67e = {
79 .acquire = wndwc37e_acquire,
80 .release = wndwc37e_release,
81 .sema_set = wndwc37e_sema_set,
82 .sema_clr = wndwc37e_sema_clr,
83 .ntfy_set = wndwc37e_ntfy_set,
84 .ntfy_clr = wndwc37e_ntfy_clr,
85 .ntfy_reset = corec37d_ntfy_init,
86 .ntfy_wait_begun = base507c_ntfy_wait_begun,
87 .ilut = wndwc57e_ilut,
88 .ilut_identity = true,
89 .ilut_size = 1024,
90 .xlut_set = wndwc57e_ilut_set,
91 .xlut_clr = wndwc57e_ilut_clr,
92 .csc = base907c_csc,
93 .csc_set = wndwc57e_csc_set,
94 .csc_clr = wndwc57e_csc_clr,
95 .image_set = wndwc67e_image_set,
96 .image_clr = wndwc37e_image_clr,
97 .blend_set = wndwc37e_blend_set,
98 .update = wndwc37e_update,
102 wndwc67e_new(struct nouveau_drm *drm, enum drm_plane_type type, int index,
103 s32 oclass, struct nv50_wndw **pwndw)
105 return wndwc37e_new_(&wndwc67e, drm, type, index, oclass, BIT(index >> 1), pwndw);