Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright 2018 Red Hat Inc.
0003  *
0004  * Permission is hereby granted, free of charge, to any person obtaining a
0005  * copy of this software and associated documentation files (the "Software"),
0006  * to deal in the Software without restriction, including without limitation
0007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0008  * and/or sell copies of the Software, and to permit persons to whom the
0009  * Software is furnished to do so, subject to the following conditions:
0010  *
0011  * The above copyright notice and this permission notice shall be included in
0012  * all copies or substantial portions of the Software.
0013  *
0014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0017  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
0018  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0019  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0020  * OTHER DEALINGS IN THE SOFTWARE.
0021  */
0022 #include "curs.h"
0023 #include "atom.h"
0024 
0025 #include <nvhw/class/clc37a.h>
0026 
0027 static int
0028 cursc37a_update(struct nv50_wndw *wndw, u32 *interlock)
0029 {
0030     struct nvif_object *user = &wndw->wimm.base.user;
0031     int ret = nvif_chan_wait(&wndw->wimm, 1);
0032     if (ret == 0)
0033         NVIF_WR32(user, NVC37A, UPDATE, 0x00000001);
0034     return ret;
0035 }
0036 
0037 static int
0038 cursc37a_point(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw)
0039 {
0040     struct nvif_object *user = &wndw->wimm.base.user;
0041     int ret = nvif_chan_wait(&wndw->wimm, 1);
0042     if (ret == 0) {
0043         NVIF_WR32(user, NVC37A, SET_CURSOR_HOT_SPOT_POINT_OUT(0),
0044               NVVAL(NVC37A, SET_CURSOR_HOT_SPOT_POINT_OUT, X, asyw->point.x) |
0045               NVVAL(NVC37A, SET_CURSOR_HOT_SPOT_POINT_OUT, Y, asyw->point.y));
0046     }
0047     return ret;
0048 }
0049 
0050 static const struct nv50_wimm_func
0051 cursc37a = {
0052     .point = cursc37a_point,
0053     .update = cursc37a_update,
0054 };
0055 
0056 int
0057 cursc37a_new(struct nouveau_drm *drm, int head, s32 oclass,
0058          struct nv50_wndw **pwndw)
0059 {
0060     return curs507a_new_(&cursc37a, drm, head, oclass,
0061                  0x00000001 << head, pwndw);
0062 }