[PATCH v3 1/9] drm/hisilicon/hibmc: Add hisilicon hibmc drm master driver
On 14 October 2016 at 22:33, Benjamin Gaignard wrote: > Just by curiosity, why using "old" TTM instead of GEM ? any particular > reasons ? >From the linux kernel DRM mm doc[1] it says: "GEM has simpler initialization and execution requirements than 25 TTM, but has no video RAM management capabilities and is thus limited to 26 UMA devices." So, I think we can't use GEM to managing video RAM. But in fact, in this driver fb buffer is also created as an GEM object though it use TTM to manage video RAM. So GEM ,like its name, say mostly use for execution management ??? [1] Documentation/gpu/drm-mm.rst -xinliang > > 2016-10-14 16:44 GMT+02:00 Rongrong Zou : >> Hi Benjamin, >> >> Thanks for reviewing! >> >> Benjamin Gaignard æ¼ 2016/10/14 16:29 寫é: >>> >>> [snip] >>> --- /dev/null +++ b/drivers/gpu/drm/hisilicon/hibmc/Kconfig @@ -0,0 +1,15 @@ +config DRM_HISI_HIBMC + tristate "DRM Support for Hisilicon Hibmc" + depends on DRM && PCI + select DRM_KMS_HELPER + select DRM_KMS_FB_HELPER + select DRM_GEM_CMA_HELPER + select DRM_KMS_CMA_HELPER >>> >>> >>> since you use TTM I don't think that selecting DRM_GEM_CMA_HELPER and >>> DRM_KMS_CMA_HELPER >>> help you lot here. >>> You could add configuration flags step by step in following patches >>> that will make you needs more clear (that also true for #include) >> >> >> will delete them, thanks. >> >> >>> + select FB_SYS_FILLRECT + select FB_SYS_COPYAREA + select FB_SYS_IMAGEBLIT + select DRM_TTM + + help + Choose this option if you have a Hisilicon Hibmc soc chipset. + If M is selected the module will be called hibmc-drm. diff --git a/drivers/gpu/drm/hisilicon/hibmc/Makefile b/drivers/gpu/drm/hisilicon/hibmc/Makefile new file mode 100644 index 000..97cf4a0 --- /dev/null +++ b/drivers/gpu/drm/hisilicon/hibmc/Makefile @@ -0,0 +1,5 @@ +ccflags-y := -Iinclude/drm +hibmc-drm-y := hibmc_drm_drv.o hibmc_drm_power.o + +obj-$(CONFIG_DRM_HISI_HIBMC) +=hibmc-drm.o +#obj-y += hibmc-drm.o diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c new file mode 100644 index 000..52c9353 --- /dev/null +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c @@ -0,0 +1,288 @@ +/* Hisilicon Hibmc SoC drm driver + * + * Based on the bochs drm driver. + * + * Copyright (c) 2016 Huawei Limited. + * + * Author: + * Rongrong Zou >>> >>> >>> ".com" is missing in you email address (same typo in all other files) >> >> >> will fix it in next version, thanks. :) >> >>> + * Rongrong Zou + * Jianhua Li + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + */ + +#include +#include +#include +#include +#include +#include +#include >>> >>> >>> cma_helpers look useless since you use TTM, no ? >> >> >> I add TTM just in this version, and forgot to clean these >> cma relevant code, will fix in next version. Thanks. >> >>> +#include + +#include "hibmc_drm_drv.h" +#include "hibmc_drm_regs.h" +#include "hibmc_drm_power.h" + >> >> >> Regards, >> Rongrong > > > > -- > Benjamin Gaignard > > Graphic Study Group > > Linaro.org â Open source software for ARM SoCs > > Follow Linaro: Facebook | Twitter | Blog
[PATCH v3 1/9] drm/hisilicon/hibmc: Add hisilicon hibmc drm master driver
Benjamin Gaignard æ¼ 2016/10/14 22:33 寫é: > Just by curiosity, why using "old" TTM instead of GEM ? any particular > reasons ? Do you mean i can manage the video memory visiable to pci without TTM, i found all the other simple gpu chips(eg: AST, mgag200) use TTM, so i chose TTM. > > 2016-10-14 16:44 GMT+02:00 Rongrong Zou : >> Hi Benjamin, >> >> Thanks for reviewing! >> >> Benjamin Gaignard æ¼ 2016/10/14 16:29 寫é: >>> >>> [snip] >>> --- /dev/null +++ b/drivers/gpu/drm/hisilicon/hibmc/Kconfig @@ -0,0 +1,15 @@ +config DRM_HISI_HIBMC + tristate "DRM Support for Hisilicon Hibmc" + depends on DRM && PCI + select DRM_KMS_HELPER + select DRM_KMS_FB_HELPER + select DRM_GEM_CMA_HELPER + select DRM_KMS_CMA_HELPER >>> >>> >>> since you use TTM I don't think that selecting DRM_GEM_CMA_HELPER and >>> DRM_KMS_CMA_HELPER >>> help you lot here. >>> You could add configuration flags step by step in following patches >>> that will make you needs more clear (that also true for #include) >> >> >> will delete them, thanks. >> >> >>> + select FB_SYS_FILLRECT + select FB_SYS_COPYAREA + select FB_SYS_IMAGEBLIT + select DRM_TTM + + help + Choose this option if you have a Hisilicon Hibmc soc chipset. + If M is selected the module will be called hibmc-drm. diff --git a/drivers/gpu/drm/hisilicon/hibmc/Makefile b/drivers/gpu/drm/hisilicon/hibmc/Makefile new file mode 100644 index 000..97cf4a0 --- /dev/null +++ b/drivers/gpu/drm/hisilicon/hibmc/Makefile @@ -0,0 +1,5 @@ +ccflags-y := -Iinclude/drm +hibmc-drm-y := hibmc_drm_drv.o hibmc_drm_power.o + +obj-$(CONFIG_DRM_HISI_HIBMC) +=hibmc-drm.o +#obj-y += hibmc-drm.o diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c new file mode 100644 index 000..52c9353 --- /dev/null +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c @@ -0,0 +1,288 @@ +/* Hisilicon Hibmc SoC drm driver + * + * Based on the bochs drm driver. + * + * Copyright (c) 2016 Huawei Limited. + * + * Author: + * Rongrong Zou >>> >>> >>> ".com" is missing in you email address (same typo in all other files) >> >> >> will fix it in next version, thanks. :) >> >>> + * Rongrong Zou + * Jianhua Li + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + */ + +#include +#include +#include +#include +#include +#include +#include >>> >>> >>> cma_helpers look useless since you use TTM, no ? >> >> >> I add TTM just in this version, and forgot to clean these >> cma relevant code, will fix in next version. Thanks. >> >>> +#include + +#include "hibmc_drm_drv.h" +#include "hibmc_drm_regs.h" +#include "hibmc_drm_power.h" + >> >> >> Regards, >> Rongrong > > >
[PATCH v3 1/9] drm/hisilicon/hibmc: Add hisilicon hibmc drm master driver
Hi Benjamin, Thanks for reviewing! Benjamin Gaignard æ¼ 2016/10/14 16:29 寫é: > [snip] > >> --- /dev/null >> +++ b/drivers/gpu/drm/hisilicon/hibmc/Kconfig >> @@ -0,0 +1,15 @@ >> +config DRM_HISI_HIBMC >> + tristate "DRM Support for Hisilicon Hibmc" >> + depends on DRM && PCI >> + select DRM_KMS_HELPER >> + select DRM_KMS_FB_HELPER >> + select DRM_GEM_CMA_HELPER >> + select DRM_KMS_CMA_HELPER > > since you use TTM I don't think that selecting DRM_GEM_CMA_HELPER and > DRM_KMS_CMA_HELPER > help you lot here. > You could add configuration flags step by step in following patches > that will make you needs more clear (that also true for #include) will delete them, thanks. > >> + select FB_SYS_FILLRECT >> + select FB_SYS_COPYAREA >> + select FB_SYS_IMAGEBLIT >> + select DRM_TTM >> + >> + help >> + Choose this option if you have a Hisilicon Hibmc soc chipset. >> + If M is selected the module will be called hibmc-drm. >> diff --git a/drivers/gpu/drm/hisilicon/hibmc/Makefile >> b/drivers/gpu/drm/hisilicon/hibmc/Makefile >> new file mode 100644 >> index 000..97cf4a0 >> --- /dev/null >> +++ b/drivers/gpu/drm/hisilicon/hibmc/Makefile >> @@ -0,0 +1,5 @@ >> +ccflags-y := -Iinclude/drm >> +hibmc-drm-y := hibmc_drm_drv.o hibmc_drm_power.o >> + >> +obj-$(CONFIG_DRM_HISI_HIBMC) +=hibmc-drm.o >> +#obj-y += hibmc-drm.o >> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c >> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c >> new file mode 100644 >> index 000..52c9353 >> --- /dev/null >> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c >> @@ -0,0 +1,288 @@ >> +/* Hisilicon Hibmc SoC drm driver >> + * >> + * Based on the bochs drm driver. >> + * >> + * Copyright (c) 2016 Huawei Limited. >> + * >> + * Author: >> + * Rongrong Zou > > ".com" is missing in you email address (same typo in all other files) will fix it in next version, thanks. :) > >> + * Rongrong Zou >> + * Jianhua Li >> + * >> + * This program is free software; you can redistribute it and/or modify >> + * it under the terms of the GNU General Public License as published by >> + * the Free Software Foundation; either version 2 of the License, or >> + * (at your option) any later version. >> + * >> + */ >> + >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include > > cma_helpers look useless since you use TTM, no ? I add TTM just in this version, and forgot to clean these cma relevant code, will fix in next version. Thanks. > >> +#include >> + >> +#include "hibmc_drm_drv.h" >> +#include "hibmc_drm_regs.h" >> +#include "hibmc_drm_power.h" >> + Regards, Rongrong
[PATCH v3 1/9] drm/hisilicon/hibmc: Add hisilicon hibmc drm master driver
Just by curiosity, why using "old" TTM instead of GEM ? any particular reasons ? 2016-10-14 16:44 GMT+02:00 Rongrong Zou : > Hi Benjamin, > > Thanks for reviewing! > > Benjamin Gaignard æ¼ 2016/10/14 16:29 寫é: >> >> [snip] >> >>> --- /dev/null >>> +++ b/drivers/gpu/drm/hisilicon/hibmc/Kconfig >>> @@ -0,0 +1,15 @@ >>> +config DRM_HISI_HIBMC >>> + tristate "DRM Support for Hisilicon Hibmc" >>> + depends on DRM && PCI >>> + select DRM_KMS_HELPER >>> + select DRM_KMS_FB_HELPER >>> + select DRM_GEM_CMA_HELPER >>> + select DRM_KMS_CMA_HELPER >> >> >> since you use TTM I don't think that selecting DRM_GEM_CMA_HELPER and >> DRM_KMS_CMA_HELPER >> help you lot here. >> You could add configuration flags step by step in following patches >> that will make you needs more clear (that also true for #include) > > > will delete them, thanks. > > >> >>> + select FB_SYS_FILLRECT >>> + select FB_SYS_COPYAREA >>> + select FB_SYS_IMAGEBLIT >>> + select DRM_TTM >>> + >>> + help >>> + Choose this option if you have a Hisilicon Hibmc soc chipset. >>> + If M is selected the module will be called hibmc-drm. >>> diff --git a/drivers/gpu/drm/hisilicon/hibmc/Makefile >>> b/drivers/gpu/drm/hisilicon/hibmc/Makefile >>> new file mode 100644 >>> index 000..97cf4a0 >>> --- /dev/null >>> +++ b/drivers/gpu/drm/hisilicon/hibmc/Makefile >>> @@ -0,0 +1,5 @@ >>> +ccflags-y := -Iinclude/drm >>> +hibmc-drm-y := hibmc_drm_drv.o hibmc_drm_power.o >>> + >>> +obj-$(CONFIG_DRM_HISI_HIBMC) +=hibmc-drm.o >>> +#obj-y += hibmc-drm.o >>> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c >>> b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c >>> new file mode 100644 >>> index 000..52c9353 >>> --- /dev/null >>> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c >>> @@ -0,0 +1,288 @@ >>> +/* Hisilicon Hibmc SoC drm driver >>> + * >>> + * Based on the bochs drm driver. >>> + * >>> + * Copyright (c) 2016 Huawei Limited. >>> + * >>> + * Author: >>> + * Rongrong Zou >> >> >> ".com" is missing in you email address (same typo in all other files) > > > will fix it in next version, thanks. :) > >> >>> + * Rongrong Zou >>> + * Jianhua Li >>> + * >>> + * This program is free software; you can redistribute it and/or modify >>> + * it under the terms of the GNU General Public License as published by >>> + * the Free Software Foundation; either version 2 of the License, or >>> + * (at your option) any later version. >>> + * >>> + */ >>> + >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >>> +#include >> >> >> cma_helpers look useless since you use TTM, no ? > > > I add TTM just in this version, and forgot to clean these > cma relevant code, will fix in next version. Thanks. > >> >>> +#include >>> + >>> +#include "hibmc_drm_drv.h" >>> +#include "hibmc_drm_regs.h" >>> +#include "hibmc_drm_power.h" >>> + > > > Regards, > Rongrong -- Benjamin Gaignard Graphic Study Group Linaro.org â Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
[PATCH v3 1/9] drm/hisilicon/hibmc: Add hisilicon hibmc drm master driver
[snip] > --- /dev/null > +++ b/drivers/gpu/drm/hisilicon/hibmc/Kconfig > @@ -0,0 +1,15 @@ > +config DRM_HISI_HIBMC > + tristate "DRM Support for Hisilicon Hibmc" > + depends on DRM && PCI > + select DRM_KMS_HELPER > + select DRM_KMS_FB_HELPER > + select DRM_GEM_CMA_HELPER > + select DRM_KMS_CMA_HELPER since you use TTM I don't think that selecting DRM_GEM_CMA_HELPER and DRM_KMS_CMA_HELPER help you lot here. You could add configuration flags step by step in following patches that will make you needs more clear (that also true for #include) > + select FB_SYS_FILLRECT > + select FB_SYS_COPYAREA > + select FB_SYS_IMAGEBLIT > + select DRM_TTM > + > + help > + Choose this option if you have a Hisilicon Hibmc soc chipset. > + If M is selected the module will be called hibmc-drm. > diff --git a/drivers/gpu/drm/hisilicon/hibmc/Makefile > b/drivers/gpu/drm/hisilicon/hibmc/Makefile > new file mode 100644 > index 000..97cf4a0 > --- /dev/null > +++ b/drivers/gpu/drm/hisilicon/hibmc/Makefile > @@ -0,0 +1,5 @@ > +ccflags-y := -Iinclude/drm > +hibmc-drm-y := hibmc_drm_drv.o hibmc_drm_power.o > + > +obj-$(CONFIG_DRM_HISI_HIBMC) +=hibmc-drm.o > +#obj-y += hibmc-drm.o > diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c > b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c > new file mode 100644 > index 000..52c9353 > --- /dev/null > +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c > @@ -0,0 +1,288 @@ > +/* Hisilicon Hibmc SoC drm driver > + * > + * Based on the bochs drm driver. > + * > + * Copyright (c) 2016 Huawei Limited. > + * > + * Author: > + * Rongrong Zou ".com" is missing in you email address (same typo in all other files) > + * Rongrong Zou > + * Jianhua Li > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + * > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include cma_helpers look useless since you use TTM, no ? > +#include > + > +#include "hibmc_drm_drv.h" > +#include "hibmc_drm_regs.h" > +#include "hibmc_drm_power.h" > +
[PATCH v3 1/9] drm/hisilicon/hibmc: Add hisilicon hibmc drm master driver
Add DRM master driver for Hisilicon Hibmc SoC which used for Out-of-band management. Blow is the general hardware connection, both the Hibmc and the host CPU are on the same mother board. +--+ +--+ | | PCIe | Hibmc | |host CPU( |<->| display | |arm64,x86)| |subsystem | +--+ +--+ Signed-off-by: Rongrong Zou --- drivers/gpu/drm/hisilicon/Kconfig | 1 + drivers/gpu/drm/hisilicon/Makefile| 1 + drivers/gpu/drm/hisilicon/hibmc/Kconfig | 15 ++ drivers/gpu/drm/hisilicon/hibmc/Makefile | 5 + drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 288 ++ drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h | 41 +++ drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_power.c | 88 +++ drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_power.h | 28 +++ drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_regs.h | 212 9 files changed, 679 insertions(+) create mode 100644 drivers/gpu/drm/hisilicon/hibmc/Kconfig create mode 100644 drivers/gpu/drm/hisilicon/hibmc/Makefile create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_power.c create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_power.h create mode 100644 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_regs.h diff --git a/drivers/gpu/drm/hisilicon/Kconfig b/drivers/gpu/drm/hisilicon/Kconfig index 558c61b..2fd2724 100644 --- a/drivers/gpu/drm/hisilicon/Kconfig +++ b/drivers/gpu/drm/hisilicon/Kconfig @@ -2,4 +2,5 @@ # hisilicon drm device configuration. # Please keep this list sorted alphabetically +source "drivers/gpu/drm/hisilicon/hibmc/Kconfig" source "drivers/gpu/drm/hisilicon/kirin/Kconfig" diff --git a/drivers/gpu/drm/hisilicon/Makefile b/drivers/gpu/drm/hisilicon/Makefile index e3f6d49..c8155bf 100644 --- a/drivers/gpu/drm/hisilicon/Makefile +++ b/drivers/gpu/drm/hisilicon/Makefile @@ -2,4 +2,5 @@ # Makefile for hisilicon drm drivers. # Please keep this list sorted alphabetically +obj-$(CONFIG_DRM_HISI_HIBMC) += hibmc/ obj-$(CONFIG_DRM_HISI_KIRIN) += kirin/ diff --git a/drivers/gpu/drm/hisilicon/hibmc/Kconfig b/drivers/gpu/drm/hisilicon/hibmc/Kconfig new file mode 100644 index 000..277f9c8 --- /dev/null +++ b/drivers/gpu/drm/hisilicon/hibmc/Kconfig @@ -0,0 +1,15 @@ +config DRM_HISI_HIBMC + tristate "DRM Support for Hisilicon Hibmc" + depends on DRM && PCI + select DRM_KMS_HELPER + select DRM_KMS_FB_HELPER + select DRM_GEM_CMA_HELPER + select DRM_KMS_CMA_HELPER + select FB_SYS_FILLRECT + select FB_SYS_COPYAREA + select FB_SYS_IMAGEBLIT + select DRM_TTM + + help + Choose this option if you have a Hisilicon Hibmc soc chipset. + If M is selected the module will be called hibmc-drm. diff --git a/drivers/gpu/drm/hisilicon/hibmc/Makefile b/drivers/gpu/drm/hisilicon/hibmc/Makefile new file mode 100644 index 000..97cf4a0 --- /dev/null +++ b/drivers/gpu/drm/hisilicon/hibmc/Makefile @@ -0,0 +1,5 @@ +ccflags-y := -Iinclude/drm +hibmc-drm-y := hibmc_drm_drv.o hibmc_drm_power.o + +obj-$(CONFIG_DRM_HISI_HIBMC) +=hibmc-drm.o +#obj-y += hibmc-drm.o diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c new file mode 100644 index 000..52c9353 --- /dev/null +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c @@ -0,0 +1,288 @@ +/* Hisilicon Hibmc SoC drm driver + * + * Based on the bochs drm driver. + * + * Copyright (c) 2016 Huawei Limited. + * + * Author: + * Rongrong Zou + * Rongrong Zou + * Jianhua Li + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "hibmc_drm_drv.h" +#include "hibmc_drm_regs.h" +#include "hibmc_drm_power.h" + +static const struct file_operations hibmc_fops = { + .owner = THIS_MODULE, + .open = drm_open, + .release= drm_release, + .unlocked_ioctl = drm_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = drm_compat_ioctl, +#endif + .poll = drm_poll, + .read = drm_read, + .llseek = no_llseek, +}; + +static int hibmc_enable_vblank(struct drm_device *dev, unsigned int pipe) +{ + return 0; +} + +static void hibmc_disable_vblank(struct drm_device *dev, unsigned int pipe) +{ +} + +static struct drm_driver hibmc_driver = { + .driver_features= DRIVER_ATOMIC, + .fops = _fops, + .name = "hibmc", + .date