Home | History | Annotate | Line # | Download | only in nvenc
      1 /*	$NetBSD: nouveau_nvkm_engine_nvenc_gm107.c,v 1.2 2021/12/18 23:45:37 riastradh Exp $	*/
      2 
      3 /*
      4  * Copyright 2019 Red Hat Inc.
      5  *
      6  * Permission is hereby granted, free of charge, to any person obtaining a
      7  * copy of this software and associated documentation files (the "Software"),
      8  * to deal in the Software without restriction, including without limitation
      9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
     10  * and/or sell copies of the Software, and to permit persons to whom the
     11  * Software is furnished to do so, subject to the following conditions:
     12  *
     13  * The above copyright notice and this permission notice shall be included in
     14  * all copies or substantial portions of the Software.
     15  *
     16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     19  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
     20  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
     21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     22  * OTHER DEALINGS IN THE SOFTWARE.
     23  */
     24 
     25 #include <sys/cdefs.h>
     26 __KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_engine_nvenc_gm107.c,v 1.2 2021/12/18 23:45:37 riastradh Exp $");
     27 
     28 #include "priv.h"
     29 
     30 static const struct nvkm_falcon_func
     31 gm107_nvenc_flcn = {
     32 	.fbif = 0x800,
     33 	.load_imem = nvkm_falcon_v1_load_imem,
     34 	.load_dmem = nvkm_falcon_v1_load_dmem,
     35 	.read_dmem = nvkm_falcon_v1_read_dmem,
     36 	.bind_context = nvkm_falcon_v1_bind_context,
     37 	.wait_for_halt = nvkm_falcon_v1_wait_for_halt,
     38 	.clear_interrupt = nvkm_falcon_v1_clear_interrupt,
     39 	.set_start_addr = nvkm_falcon_v1_set_start_addr,
     40 	.start = nvkm_falcon_v1_start,
     41 	.enable = nvkm_falcon_v1_enable,
     42 	.disable = nvkm_falcon_v1_disable,
     43 };
     44 
     45 static const struct nvkm_nvenc_func
     46 gm107_nvenc = {
     47 	.flcn = &gm107_nvenc_flcn,
     48 };
     49 
     50 static int
     51 gm107_nvenc_nofw(struct nvkm_nvenc *nvenc, int ver,
     52 		 const struct nvkm_nvenc_fwif *fwif)
     53 {
     54 	return 0;
     55 }
     56 
     57 static const struct nvkm_nvenc_fwif
     58 gm107_nvenc_fwif[] = {
     59 	{ -1, gm107_nvenc_nofw, &gm107_nvenc },
     60 	{}
     61 };
     62 
     63 int
     64 gm107_nvenc_new(struct nvkm_device *device, int index,
     65 		struct nvkm_nvenc **pnvenc)
     66 {
     67 	return nvkm_nvenc_new_(gm107_nvenc_fwif, device, index, pnvenc);
     68 }
     69