0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #include "wimm.h"
0023 #include "atom.h"
0024 #include "wndw.h"
0025
0026 #include <nvif/if0014.h>
0027 #include <nvif/pushc37b.h>
0028
0029 #include <nvhw/class/clc37b.h>
0030
0031 static int
0032 wimmc37b_update(struct nv50_wndw *wndw, u32 *interlock)
0033 {
0034 struct nvif_push *push = wndw->wimm.push;
0035 int ret;
0036
0037 if ((ret = PUSH_WAIT(push, 2)))
0038 return ret;
0039
0040 PUSH_MTHD(push, NVC37B, UPDATE, 0x00000001 |
0041 NVVAL(NVC37B, UPDATE, INTERLOCK_WITH_WINDOW,
0042 !!(interlock[NV50_DISP_INTERLOCK_WNDW] & wndw->interlock.data)));
0043 return PUSH_KICK(push);
0044 }
0045
0046 static int
0047 wimmc37b_point(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
0048 {
0049 struct nvif_push *push = wndw->wimm.push;
0050 int ret;
0051
0052 if ((ret = PUSH_WAIT(push, 2)))
0053 return ret;
0054
0055 PUSH_MTHD(push, NVC37B, SET_POINT_OUT(0),
0056 NVVAL(NVC37B, SET_POINT_OUT, X, asyw->point.x) |
0057 NVVAL(NVC37B, SET_POINT_OUT, Y, asyw->point.y));
0058 return 0;
0059 }
0060
0061 static const struct nv50_wimm_func
0062 wimmc37b = {
0063 .point = wimmc37b_point,
0064 .update = wimmc37b_update,
0065 };
0066
0067 static int
0068 wimmc37b_init_(const struct nv50_wimm_func *func, struct nouveau_drm *drm,
0069 s32 oclass, struct nv50_wndw *wndw)
0070 {
0071 struct nvif_disp_chan_v0 args = {
0072 .id = wndw->id,
0073 };
0074 struct nv50_disp *disp = nv50_disp(drm->dev);
0075 int ret;
0076
0077 ret = nv50_dmac_create(&drm->client.device, &disp->disp->object,
0078 &oclass, 0, &args, sizeof(args), -1,
0079 &wndw->wimm);
0080 if (ret) {
0081 NV_ERROR(drm, "wimm%04x allocation failed: %d\n", oclass, ret);
0082 return ret;
0083 }
0084
0085 wndw->interlock.wimm = wndw->interlock.data;
0086 wndw->immd = func;
0087 return 0;
0088 }
0089
0090 int
0091 wimmc37b_init(struct nouveau_drm *drm, s32 oclass, struct nv50_wndw *wndw)
0092 {
0093 return wimmc37b_init_(&wimmc37b, drm, oclass, wndw);
0094 }