Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/fb Name m...



details:   https://anonhg.NetBSD.org/src/rev/3eb84e9e8e3a
branches:  trunk
changeset: 992744:3eb84e9e8e3a
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 27 07:40:22 2018 +0000

description:
Name members judiciously to avoid unnecessary ifdefs/patches.

diffstat:

 sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/fb/gf100.h                        |   6 +-
 sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/fb/nouveau_nvkm_subdev_fb_gf100.c |  32 ++++-----
 sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/fb/nouveau_nvkm_subdev_fb_nv50.c  |  27 ++++----
 sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/fb/nv50.h                         |   6 +-
 4 files changed, 32 insertions(+), 39 deletions(-)

diffs (244 lines):

diff -r 4d95e4d939c9 -r 3eb84e9e8e3a sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/fb/gf100.h
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/fb/gf100.h     Mon Aug 27 07:40:11 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/fb/gf100.h     Mon Aug 27 07:40:22 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gf100.h,v 1.2 2018/08/27 04:58:33 riastradh Exp $      */
+/*     $NetBSD: gf100.h,v 1.3 2018/08/27 07:40:22 riastradh Exp $      */
 
 #ifndef __NVKM_RAM_NVC0_H__
 #define __NVKM_RAM_NVC0_H__
@@ -9,12 +9,12 @@
        struct nvkm_fb base;
 #ifdef __NetBSD__
        bus_dma_segment_t r100c10_seg;
-       bus_dmamap_t r100c10_map;
+       bus_dmamap_t r100c10_page;
        void *r100c10_kva;
 #else
        struct page *r100c10_page;
+#endif
        dma_addr_t r100c10;
-#endif
 };
 
 int gf100_fb_new_(const struct nvkm_fb_func *, struct nvkm_device *,
diff -r 4d95e4d939c9 -r 3eb84e9e8e3a sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/fb/nouveau_nvkm_subdev_fb_gf100.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/fb/nouveau_nvkm_subdev_fb_gf100.c      Mon Aug 27 07:40:11 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/fb/nouveau_nvkm_subdev_fb_gf100.c      Mon Aug 27 07:40:22 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_nvkm_subdev_fb_gf100.c,v 1.2 2018/08/27 04:58:33 riastradh Exp $       */
+/*     $NetBSD: nouveau_nvkm_subdev_fb_gf100.c,v 1.3 2018/08/27 07:40:22 riastradh Exp $       */
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -24,7 +24,7 @@
  * Authors: Ben Skeggs
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_fb_gf100.c,v 1.2 2018/08/27 04:58:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_fb_gf100.c,v 1.3 2018/08/27 07:40:22 riastradh Exp $");
 
 #include "gf100.h"
 #include "ram.h"
@@ -57,13 +57,8 @@
        struct gf100_fb *fb = gf100_fb(base);
        struct nvkm_device *device = fb->base.subdev.device;
 
-#ifdef __NetBSD__
-       if (fb->r100c10_map)
-               nvkm_wr32(device, 0x100c10, fb->r100c10 >> 8);
-#else
        if (fb->r100c10_page)
                nvkm_wr32(device, 0x100c10, fb->r100c10 >> 8);
-#endif
 
        nvkm_mask(device, 0x100c80, 0x00000001, 0x00000000); /* 128KiB lpg */
 }
@@ -74,23 +69,21 @@
        struct gf100_fb *fb = gf100_fb(base);
        struct nvkm_device *device = fb->base.subdev.device;
 
+       if (fb->r100c10_page) {
 #ifdef __NetBSD__
-       if (fb->r100c10_map) {
                const bus_dma_tag_t dmat = device->func->dma_tag(device);
 
-               bus_dmamap_unload(dmat, fb->r100c10_map);
+               bus_dmamap_unload(dmat, fb->r100c10_page);
                bus_dmamem_unmap(dmat, fb->r100c10_kva, PAGE_SIZE);
-               bus_dmamap_destroy(dmat, fb->r100c10_map);
+               bus_dmamap_destroy(dmat, fb->r100c10_page);
                bus_dmamem_free(dmat, &fb->r100c10_seg, 1);
-               fb->r100c10_map = NULL;
-       }
+               fb->r100c10_page = NULL;
 #else
-       if (fb->r100c10_page) {
                dma_unmap_page(device->dev, fb->r100c10, PAGE_SIZE,
                               DMA_BIDIRECTIONAL);
                __free_page(fb->r100c10_page);
+#endif
        }
-#endif
 
        return fb;
 }
@@ -110,8 +103,9 @@
     {
        const bus_dma_tag_t dmat = device->func->dma_tag(device);
        int nsegs;
+       int ret;
 
-       fb->r100c10_map = NULL; /* paranoia */
+       fb->r100c10_page = NULL; /* paranoia */
        fb->r100c10_kva = NULL;
 
        /* XXX errno NetBSD->Linux */
@@ -123,7 +117,7 @@
 
        /* XXX errno NetBSD->Linux */
        ret = -bus_dmamap_create(dmat, PAGE_SIZE, 1, PAGE_SIZE, 0,
-           BUS_DMA_WAITOK, &fb->r100c10_map);
+           BUS_DMA_WAITOK, &fb->r100c10_page);
        if (ret) {
 fail1:         bus_dmamem_free(dmat, &fb->r100c10_seg, 1);
                goto fail0;
@@ -133,20 +127,20 @@
        ret = -bus_dmamem_map(dmat, &fb->r100c10_seg, 1, PAGE_SIZE,
            &fb->r100c10_kva, BUS_DMA_WAITOK);
        if (ret) {
-fail2:         bus_dmamap_destroy(dmat, fb->r100c10_map);
+fail2:         bus_dmamap_destroy(dmat, fb->r100c10_page);
                goto fail1;
        }
        (void)memset(fb->r100c10_kva, 0, PAGE_SIZE);
 
        /* XXX errno NetBSD->Linux */
-       ret = -bus_dmamap_load(dmat, fb->r100c10_map, fb->r100c10_kva,
+       ret = -bus_dmamap_load(dmat, fb->r100c10_page, fb->r100c10_kva,
            PAGE_SIZE, NULL, BUS_DMA_WAITOK);
        if (ret) {
 fail3: __unused        bus_dmamem_unmap(dmat, fb->r100c10_kva, PAGE_SIZE);
                goto fail2;
        }
 
-       fb->r100c10 = fb->r100c10_map->dm_segs[0].ds_addr;
+       fb->r100c10 = fb->r100c10_page->dm_segs[0].ds_addr;
     }
 #else
        fb->r100c10_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
diff -r 4d95e4d939c9 -r 3eb84e9e8e3a sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/fb/nouveau_nvkm_subdev_fb_nv50.c
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/fb/nouveau_nvkm_subdev_fb_nv50.c       Mon Aug 27 07:40:11 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/fb/nouveau_nvkm_subdev_fb_nv50.c       Mon Aug 27 07:40:22 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nouveau_nvkm_subdev_fb_nv50.c,v 1.2 2018/08/27 04:58:33 riastradh Exp $        */
+/*     $NetBSD: nouveau_nvkm_subdev_fb_nv50.c,v 1.3 2018/08/27 07:40:22 riastradh Exp $        */
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -24,7 +24,7 @@
  * Authors: Ben Skeggs
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_fb_nv50.c,v 1.2 2018/08/27 04:58:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_fb_nv50.c,v 1.3 2018/08/27 07:40:22 riastradh Exp $");
 
 #include "nv50.h"
 #include "ram.h"
@@ -238,23 +238,21 @@
        struct nv50_fb *fb = nv50_fb(base);
        struct nvkm_device *device = fb->base.subdev.device;
 
+       if (fb->r100c08_page) {
 #ifdef __NetBSD__
-       if (fb->r100c08_map) {
                const bus_dma_tag_t dmat = device->func->dma_tag(device);
 
-               bus_dmamap_unload(dmat, fb->r100c08_map);
+               bus_dmamap_unload(dmat, fb->r100c08_page);
                bus_dmamem_unmap(dmat, fb->r100c08_kva, PAGE_SIZE);
-               bus_dmamap_destroy(dmat, fb->r100c08_map);
+               bus_dmamap_destroy(dmat, fb->r100c08_page);
                bus_dmamem_free(dmat, &fb->r100c08_seg, 1);
-               fb->r100c08_map = NULL;
-       }
+               fb->r100c08_page = NULL;
 #else
-       if (fb->r100c08_page) {
                dma_unmap_page(device->dev, fb->r100c08, PAGE_SIZE,
                               DMA_BIDIRECTIONAL);
                __free_page(fb->r100c08_page);
+#endif
        }
-#endif
 
        return fb;
 }
@@ -284,8 +282,9 @@
     {
        const bus_dma_tag_t dmat = device->func->dma_tag(device);
        int nsegs;
+       int ret;
 
-       fb->r100c08_map = NULL; /* paranoia */
+       fb->r100c08_page = NULL; /* paranoia */
        fb->r100c08_kva = NULL;
 
        /* XXX errno NetBSD->Linux */
@@ -297,7 +296,7 @@
 
        /* XXX errno NetBSD->Linux */
        ret = -bus_dmamap_create(dmat, PAGE_SIZE, 1, PAGE_SIZE, 0,
-           BUS_DMA_WAITOK, &fb->r100c08_map);
+           BUS_DMA_WAITOK, &fb->r100c08_page);
        if (ret) {
 fail1:         bus_dmamem_free(dmat, &fb->r100c08_seg, 1);
                goto fail0;
@@ -307,20 +306,20 @@
        ret = -bus_dmamem_map(dmat, &fb->r100c08_seg, 1, PAGE_SIZE,
            &fb->r100c08_kva, BUS_DMA_WAITOK);
        if (ret) {
-fail2:         bus_dmamap_destroy(dmat, fb->r100c08_map);
+fail2:         bus_dmamap_destroy(dmat, fb->r100c08_page);
                goto fail1;
        }
        (void)memset(fb->r100c08_kva, 0, PAGE_SIZE);
 
        /* XXX errno NetBSD->Linux */
-       ret = -bus_dmamap_load(dmat, fb->r100c08_map, fb->r100c08_kva,
+       ret = -bus_dmamap_load(dmat, fb->r100c08_page, fb->r100c08_kva,
            PAGE_SIZE, NULL, BUS_DMA_WAITOK);
        if (ret) {
 fail3: __unused        bus_dmamem_unmap(dmat, fb->r100c08_kva, PAGE_SIZE);
                goto fail2;
        }
 
-       fb->r100c08 = fb->r100c08_map->dm_segs[0].ds_addr;
+       fb->r100c08 = fb->r100c08_page->dm_segs[0].ds_addr;
     }
 #else
        fb->r100c08_page = alloc_page(GFP_KERNEL | __GFP_ZERO);
diff -r 4d95e4d939c9 -r 3eb84e9e8e3a sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/fb/nv50.h
--- a/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/fb/nv50.h      Mon Aug 27 07:40:11 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/fb/nv50.h      Mon Aug 27 07:40:22 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nv50.h,v 1.2 2018/08/27 04:58:33 riastradh Exp $       */
+/*     $NetBSD: nv50.h,v 1.3 2018/08/27 07:40:22 riastradh Exp $       */
 
 #ifndef __NVKM_FB_NV50_H__
 #define __NVKM_FB_NV50_H__
@@ -10,12 +10,12 @@
        struct nvkm_fb base;
 #ifdef __NetBSD__
        bus_dma_segment_t r100c08_seg;
-       bus_dmamap_t r100c08_map;
+       bus_dmamap_t r100c08_page;
        void *r100c08_kva;
 #else
        struct page *r100c08_page;
+#endif
        dma_addr_t r100c08;
-#endif
 };
 
 struct nv50_fb_func {



Home | Main Index | Thread Index | Old Index