Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/nouveau/vdec: implement stub modules for the known engines

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>

+363 -6
+4 -1
drivers/gpu/drm/nouveau/Makefile
··· 19 19 nv04_graph.o nv10_graph.o nv20_graph.o \ 20 20 nv40_graph.o nv50_graph.o nvc0_graph.o \ 21 21 nv40_grctx.o nv50_grctx.o nvc0_grctx.o \ 22 - nv84_crypt.o \ 22 + nv84_crypt.o nv98_crypt.o \ 23 23 nva3_copy.o nvc0_copy.o \ 24 24 nv31_mpeg.o nv50_mpeg.o \ 25 + nv84_bsp.o \ 26 + nv84_vp.o \ 27 + nv98_ppp.o \ 25 28 nv04_instmem.o nv50_instmem.o nvc0_instmem.o \ 26 29 nv04_dac.o nv04_dfp.o nv04_tv.o nv17_tv.o nv17_tv_modes.o \ 27 30 nv04_crtc.o nv04_display.o nv04_cursor.o \
+17
drivers/gpu/drm/nouveau/nouveau_drv.h
··· 163 163 #define NVOBJ_ENGINE_COPY0 3 164 164 #define NVOBJ_ENGINE_COPY1 4 165 165 #define NVOBJ_ENGINE_MPEG 5 166 + #define NVOBJ_ENGINE_PPP NVOBJ_ENGINE_MPEG 167 + #define NVOBJ_ENGINE_BSP 6 168 + #define NVOBJ_ENGINE_VP 7 166 169 #define NVOBJ_ENGINE_DISPLAY 15 167 170 #define NVOBJ_ENGINE_NR 16 168 171 ··· 1229 1226 /* nv84_crypt.c */ 1230 1227 extern int nv84_crypt_create(struct drm_device *); 1231 1228 1229 + /* nv98_crypt.c */ 1230 + extern int nv98_crypt_create(struct drm_device *dev); 1231 + 1232 1232 /* nva3_copy.c */ 1233 1233 extern int nva3_copy_create(struct drm_device *dev); 1234 1234 ··· 1243 1237 1244 1238 /* nv50_mpeg.c */ 1245 1239 extern int nv50_mpeg_create(struct drm_device *dev); 1240 + 1241 + /* nv84_bsp.c */ 1242 + /* nv98_bsp.c */ 1243 + extern int nv84_bsp_create(struct drm_device *dev); 1244 + 1245 + /* nv84_vp.c */ 1246 + /* nv98_vp.c */ 1247 + extern int nv84_vp_create(struct drm_device *dev); 1248 + 1249 + /* nv98_ppp.c */ 1250 + extern int nv98_ppp_create(struct drm_device *dev); 1246 1251 1247 1252 /* nv04_instmem.c */ 1248 1253 extern int nv04_instmem_init(struct drm_device *);
+20 -5
drivers/gpu/drm/nouveau/nouveau_state.c
··· 679 679 case 0xa0: 680 680 nv84_crypt_create(dev); 681 681 break; 682 + case 0x98: 683 + case 0xaa: 684 + case 0xac: 685 + nv98_crypt_create(dev); 686 + break; 682 687 } 683 688 684 689 switch (dev_priv->card_type) { ··· 705 700 break; 706 701 } 707 702 703 + if (dev_priv->chipset >= 0xa3 || dev_priv->chipset == 0x98) { 704 + nv84_bsp_create(dev); 705 + nv84_vp_create(dev); 706 + nv98_ppp_create(dev); 707 + } else 708 + if (dev_priv->chipset >= 0x84) { 709 + nv50_mpeg_create(dev); 710 + nv84_bsp_create(dev); 711 + nv84_vp_create(dev); 712 + } else 713 + if (dev_priv->chipset >= 0x50) { 714 + nv50_mpeg_create(dev); 715 + } else 708 716 if (dev_priv->card_type == NV_40 || 709 717 dev_priv->chipset == 0x31 || 710 718 dev_priv->chipset == 0x34 || 711 - dev_priv->chipset == 0x36) 719 + dev_priv->chipset == 0x36) { 712 720 nv31_mpeg_create(dev); 713 - else 714 - if (dev_priv->card_type == NV_50 && 715 - (dev_priv->chipset < 0x98 || dev_priv->chipset == 0xa0)) 716 - nv50_mpeg_create(dev); 721 + } 717 722 718 723 for (e = 0; e < NVOBJ_ENGINE_NR; e++) { 719 724 if (dev_priv->eng[e]) {
+83
drivers/gpu/drm/nouveau/nv84_bsp.c
··· 1 + /* 2 + * Copyright 2011 Red Hat Inc. 3 + * 4 + * Permission is hereby granted, free of charge, to any person obtaining a 5 + * copy of this software and associated documentation files (the "Software"), 6 + * to deal in the Software without restriction, including without limitation 7 + * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 + * and/or sell copies of the Software, and to permit persons to whom the 9 + * Software is furnished to do so, subject to the following conditions: 10 + * 11 + * The above copyright notice and this permission notice shall be included in 12 + * all copies or substantial portions of the Software. 13 + * 14 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 + * OTHER DEALINGS IN THE SOFTWARE. 21 + * 22 + * Authors: Ben Skeggs 23 + */ 24 + 25 + #include "drmP.h" 26 + #include "nouveau_drv.h" 27 + #include "nouveau_util.h" 28 + #include "nouveau_vm.h" 29 + #include "nouveau_ramht.h" 30 + 31 + /*XXX: This stub is currently used on NV98+ also, as soon as this becomes 32 + * more than just an enable/disable stub this needs to be split out to 33 + * nv98_bsp.c... 34 + */ 35 + 36 + struct nv84_bsp_engine { 37 + struct nouveau_exec_engine base; 38 + }; 39 + 40 + static int 41 + nv84_bsp_fini(struct drm_device *dev, int engine, bool suspend) 42 + { 43 + if (!(nv_rd32(dev, 0x000200) & 0x00008000)) 44 + return 0; 45 + 46 + nv_mask(dev, 0x000200, 0x00008000, 0x00000000); 47 + return 0; 48 + } 49 + 50 + static int 51 + nv84_bsp_init(struct drm_device *dev, int engine) 52 + { 53 + nv_mask(dev, 0x000200, 0x00008000, 0x00000000); 54 + nv_mask(dev, 0x000200, 0x00008000, 0x00008000); 55 + return 0; 56 + } 57 + 58 + static void 59 + nv84_bsp_destroy(struct drm_device *dev, int engine) 60 + { 61 + struct nv84_bsp_engine *pbsp = nv_engine(dev, engine); 62 + 63 + NVOBJ_ENGINE_DEL(dev, BSP); 64 + 65 + kfree(pbsp); 66 + } 67 + 68 + int 69 + nv84_bsp_create(struct drm_device *dev) 70 + { 71 + struct nv84_bsp_engine *pbsp; 72 + 73 + pbsp = kzalloc(sizeof(*pbsp), GFP_KERNEL); 74 + if (!pbsp) 75 + return -ENOMEM; 76 + 77 + pbsp->base.destroy = nv84_bsp_destroy; 78 + pbsp->base.init = nv84_bsp_init; 79 + pbsp->base.fini = nv84_bsp_fini; 80 + 81 + NVOBJ_ENGINE_ADD(dev, BSP, &pbsp->base); 82 + return 0; 83 + }
+83
drivers/gpu/drm/nouveau/nv84_vp.c
··· 1 + /* 2 + * Copyright 2011 Red Hat Inc. 3 + * 4 + * Permission is hereby granted, free of charge, to any person obtaining a 5 + * copy of this software and associated documentation files (the "Software"), 6 + * to deal in the Software without restriction, including without limitation 7 + * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 + * and/or sell copies of the Software, and to permit persons to whom the 9 + * Software is furnished to do so, subject to the following conditions: 10 + * 11 + * The above copyright notice and this permission notice shall be included in 12 + * all copies or substantial portions of the Software. 13 + * 14 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 + * OTHER DEALINGS IN THE SOFTWARE. 21 + * 22 + * Authors: Ben Skeggs 23 + */ 24 + 25 + #include "drmP.h" 26 + #include "nouveau_drv.h" 27 + #include "nouveau_util.h" 28 + #include "nouveau_vm.h" 29 + #include "nouveau_ramht.h" 30 + 31 + /*XXX: This stub is currently used on NV98+ also, as soon as this becomes 32 + * more than just an enable/disable stub this needs to be split out to 33 + * nv98_vp.c... 34 + */ 35 + 36 + struct nv84_vp_engine { 37 + struct nouveau_exec_engine base; 38 + }; 39 + 40 + static int 41 + nv84_vp_fini(struct drm_device *dev, int engine, bool suspend) 42 + { 43 + if (!(nv_rd32(dev, 0x000200) & 0x00020000)) 44 + return 0; 45 + 46 + nv_mask(dev, 0x000200, 0x00020000, 0x00000000); 47 + return 0; 48 + } 49 + 50 + static int 51 + nv84_vp_init(struct drm_device *dev, int engine) 52 + { 53 + nv_mask(dev, 0x000200, 0x00020000, 0x00000000); 54 + nv_mask(dev, 0x000200, 0x00020000, 0x00020000); 55 + return 0; 56 + } 57 + 58 + static void 59 + nv84_vp_destroy(struct drm_device *dev, int engine) 60 + { 61 + struct nv84_vp_engine *pvp = nv_engine(dev, engine); 62 + 63 + NVOBJ_ENGINE_DEL(dev, VP); 64 + 65 + kfree(pvp); 66 + } 67 + 68 + int 69 + nv84_vp_create(struct drm_device *dev) 70 + { 71 + struct nv84_vp_engine *pvp; 72 + 73 + pvp = kzalloc(sizeof(*pvp), GFP_KERNEL); 74 + if (!pvp) 75 + return -ENOMEM; 76 + 77 + pvp->base.destroy = nv84_vp_destroy; 78 + pvp->base.init = nv84_vp_init; 79 + pvp->base.fini = nv84_vp_fini; 80 + 81 + NVOBJ_ENGINE_ADD(dev, VP, &pvp->base); 82 + return 0; 83 + }
+78
drivers/gpu/drm/nouveau/nv98_crypt.c
··· 1 + /* 2 + * Copyright 2011 Red Hat Inc. 3 + * 4 + * Permission is hereby granted, free of charge, to any person obtaining a 5 + * copy of this software and associated documentation files (the "Software"), 6 + * to deal in the Software without restriction, including without limitation 7 + * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 + * and/or sell copies of the Software, and to permit persons to whom the 9 + * Software is furnished to do so, subject to the following conditions: 10 + * 11 + * The above copyright notice and this permission notice shall be included in 12 + * all copies or substantial portions of the Software. 13 + * 14 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 + * OTHER DEALINGS IN THE SOFTWARE. 21 + * 22 + * Authors: Ben Skeggs 23 + */ 24 + 25 + #include "drmP.h" 26 + #include "nouveau_drv.h" 27 + #include "nouveau_util.h" 28 + #include "nouveau_vm.h" 29 + #include "nouveau_ramht.h" 30 + 31 + struct nv98_crypt_engine { 32 + struct nouveau_exec_engine base; 33 + }; 34 + 35 + static int 36 + nv98_crypt_fini(struct drm_device *dev, int engine, bool suspend) 37 + { 38 + if (!(nv_rd32(dev, 0x000200) & 0x00004000)) 39 + return 0; 40 + 41 + nv_mask(dev, 0x000200, 0x00004000, 0x00000000); 42 + return 0; 43 + } 44 + 45 + static int 46 + nv98_crypt_init(struct drm_device *dev, int engine) 47 + { 48 + nv_mask(dev, 0x000200, 0x00004000, 0x00000000); 49 + nv_mask(dev, 0x000200, 0x00004000, 0x00004000); 50 + return 0; 51 + } 52 + 53 + static void 54 + nv98_crypt_destroy(struct drm_device *dev, int engine) 55 + { 56 + struct nv98_crypt_engine *pcrypt = nv_engine(dev, engine); 57 + 58 + NVOBJ_ENGINE_DEL(dev, CRYPT); 59 + 60 + kfree(pcrypt); 61 + } 62 + 63 + int 64 + nv98_crypt_create(struct drm_device *dev) 65 + { 66 + struct nv98_crypt_engine *pcrypt; 67 + 68 + pcrypt = kzalloc(sizeof(*pcrypt), GFP_KERNEL); 69 + if (!pcrypt) 70 + return -ENOMEM; 71 + 72 + pcrypt->base.destroy = nv98_crypt_destroy; 73 + pcrypt->base.init = nv98_crypt_init; 74 + pcrypt->base.fini = nv98_crypt_fini; 75 + 76 + NVOBJ_ENGINE_ADD(dev, CRYPT, &pcrypt->base); 77 + return 0; 78 + }
+78
drivers/gpu/drm/nouveau/nv98_ppp.c
··· 1 + /* 2 + * Copyright 2011 Red Hat Inc. 3 + * 4 + * Permission is hereby granted, free of charge, to any person obtaining a 5 + * copy of this software and associated documentation files (the "Software"), 6 + * to deal in the Software without restriction, including without limitation 7 + * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 + * and/or sell copies of the Software, and to permit persons to whom the 9 + * Software is furnished to do so, subject to the following conditions: 10 + * 11 + * The above copyright notice and this permission notice shall be included in 12 + * all copies or substantial portions of the Software. 13 + * 14 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 + * OTHER DEALINGS IN THE SOFTWARE. 21 + * 22 + * Authors: Ben Skeggs 23 + */ 24 + 25 + #include "drmP.h" 26 + #include "nouveau_drv.h" 27 + #include "nouveau_util.h" 28 + #include "nouveau_vm.h" 29 + #include "nouveau_ramht.h" 30 + 31 + struct nv98_ppp_engine { 32 + struct nouveau_exec_engine base; 33 + }; 34 + 35 + static int 36 + nv98_ppp_fini(struct drm_device *dev, int engine, bool suspend) 37 + { 38 + if (!(nv_rd32(dev, 0x000200) & 0x00000002)) 39 + return 0; 40 + 41 + nv_mask(dev, 0x000200, 0x00000002, 0x00000000); 42 + return 0; 43 + } 44 + 45 + static int 46 + nv98_ppp_init(struct drm_device *dev, int engine) 47 + { 48 + nv_mask(dev, 0x000200, 0x00000002, 0x00000000); 49 + nv_mask(dev, 0x000200, 0x00000002, 0x00000002); 50 + return 0; 51 + } 52 + 53 + static void 54 + nv98_ppp_destroy(struct drm_device *dev, int engine) 55 + { 56 + struct nv98_ppp_engine *pppp = nv_engine(dev, engine); 57 + 58 + NVOBJ_ENGINE_DEL(dev, PPP); 59 + 60 + kfree(pppp); 61 + } 62 + 63 + int 64 + nv98_ppp_create(struct drm_device *dev) 65 + { 66 + struct nv98_ppp_engine *pppp; 67 + 68 + pppp = kzalloc(sizeof(*pppp), GFP_KERNEL); 69 + if (!pppp) 70 + return -ENOMEM; 71 + 72 + pppp->base.destroy = nv98_ppp_destroy; 73 + pppp->base.init = nv98_ppp_init; 74 + pppp->base.fini = nv98_ppp_fini; 75 + 76 + NVOBJ_ENGINE_ADD(dev, PPP, &pppp->base); 77 + return 0; 78 + }