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 <nvif/disp.h>
0023 #include <nvif/device.h>
0024 #include <nvif/printf.h>
0025 
0026 #include <nvif/class.h>
0027 #include <nvif/if0010.h>
0028 
0029 void
0030 nvif_disp_dtor(struct nvif_disp *disp)
0031 {
0032     nvif_object_dtor(&disp->object);
0033 }
0034 
0035 int
0036 nvif_disp_ctor(struct nvif_device *device, const char *name, s32 oclass, struct nvif_disp *disp)
0037 {
0038     static const struct nvif_mclass disps[] = {
0039         { GA102_DISP, 0 },
0040         { TU102_DISP, 0 },
0041         { GV100_DISP, 0 },
0042         { GP102_DISP, 0 },
0043         { GP100_DISP, 0 },
0044         { GM200_DISP, 0 },
0045         { GM107_DISP, 0 },
0046         { GK110_DISP, 0 },
0047         { GK104_DISP, 0 },
0048         { GF110_DISP, 0 },
0049         { GT214_DISP, 0 },
0050         { GT206_DISP, 0 },
0051         { GT200_DISP, 0 },
0052         {   G82_DISP, 0 },
0053         {  NV50_DISP, 0 },
0054         {  NV04_DISP, 0 },
0055         {}
0056     };
0057     struct nvif_disp_v0 args;
0058     int cid, ret;
0059 
0060     cid = nvif_sclass(&device->object, disps, oclass);
0061     disp->object.client = NULL;
0062     if (cid < 0) {
0063         NVIF_ERRON(cid, &device->object, "[NEW disp%04x] not supported", oclass);
0064         return cid;
0065     }
0066 
0067     args.version = 0;
0068 
0069     ret = nvif_object_ctor(&device->object, name ?: "nvifDisp", 0,
0070                    disps[cid].oclass, &args, sizeof(args), &disp->object);
0071     NVIF_ERRON(ret, &device->object, "[NEW disp%04x]", disps[cid].oclass);
0072     if (ret)
0073         return ret;
0074 
0075     NVIF_DEBUG(&disp->object, "[NEW] conn_mask:%08x outp_mask:%08x",
0076            args.conn_mask, args.outp_mask);
0077     disp->conn_mask = args.conn_mask;
0078     disp->outp_mask = args.outp_mask;
0079     return 0;
0080 }