11590700dSBen Skeggs /*
21590700dSBen Skeggs * Copyright 2018 Red Hat Inc.
31590700dSBen Skeggs *
41590700dSBen Skeggs * Permission is hereby granted, free of charge, to any person obtaining a
51590700dSBen Skeggs * copy of this software and associated documentation files (the "Software"),
61590700dSBen Skeggs * to deal in the Software without restriction, including without limitation
71590700dSBen Skeggs * the rights to use, copy, modify, merge, publish, distribute, sublicense,
81590700dSBen Skeggs * and/or sell copies of the Software, and to permit persons to whom the
91590700dSBen Skeggs * Software is furnished to do so, subject to the following conditions:
101590700dSBen Skeggs *
111590700dSBen Skeggs * The above copyright notice and this permission notice shall be included in
121590700dSBen Skeggs * all copies or substantial portions of the Software.
131590700dSBen Skeggs *
141590700dSBen Skeggs * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
151590700dSBen Skeggs * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
161590700dSBen Skeggs * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
171590700dSBen Skeggs * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
181590700dSBen Skeggs * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
191590700dSBen Skeggs * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
201590700dSBen Skeggs * OTHER DEALINGS IN THE SOFTWARE.
211590700dSBen Skeggs */
221590700dSBen Skeggs #include "curs.h"
231590700dSBen Skeggs
241590700dSBen Skeggs #include <nvif/class.h>
251590700dSBen Skeggs
261590700dSBen Skeggs int
nv50_curs_new(struct nouveau_drm * drm,int head,struct nv50_wndw ** pwndw)271590700dSBen Skeggs nv50_curs_new(struct nouveau_drm *drm, int head, struct nv50_wndw **pwndw)
281590700dSBen Skeggs {
291590700dSBen Skeggs struct {
301590700dSBen Skeggs s32 oclass;
311590700dSBen Skeggs int version;
321590700dSBen Skeggs int (*new)(struct nouveau_drm *, int, s32, struct nv50_wndw **);
331590700dSBen Skeggs } curses[] = {
34*8ef23b6fSBen Skeggs { GA102_DISP_CURSOR, 0, cursc37a_new },
3586037742SBen Skeggs { TU102_DISP_CURSOR, 0, cursc37a_new },
36facaed62SBen Skeggs { GV100_DISP_CURSOR, 0, cursc37a_new },
3753e0a3e7SBen Skeggs { GK104_DISP_CURSOR, 0, curs907a_new },
3853e0a3e7SBen Skeggs { GF110_DISP_CURSOR, 0, curs907a_new },
391590700dSBen Skeggs { GT214_DISP_CURSOR, 0, curs507a_new },
401590700dSBen Skeggs { G82_DISP_CURSOR, 0, curs507a_new },
411590700dSBen Skeggs { NV50_DISP_CURSOR, 0, curs507a_new },
421590700dSBen Skeggs {}
431590700dSBen Skeggs };
441590700dSBen Skeggs struct nv50_disp *disp = nv50_disp(drm->dev);
451590700dSBen Skeggs int cid;
461590700dSBen Skeggs
471590700dSBen Skeggs cid = nvif_mclass(&disp->disp->object, curses);
481590700dSBen Skeggs if (cid < 0) {
491590700dSBen Skeggs NV_ERROR(drm, "No supported cursor immediate class\n");
501590700dSBen Skeggs return cid;
511590700dSBen Skeggs }
521590700dSBen Skeggs
531590700dSBen Skeggs return curses[cid].new(drm, head, curses[cid].oclass, pwndw);
541590700dSBen Skeggs }
55