Add virtio gpu driver.
Subsystems (6)
Gerd Hoffmann
maintainerv2 cover Add virtio gpu driver.
Hi,
Next version of the virtio-gpu driver. Turned into a little patch series now. Most review comments should be addressed.
Changes in v2:
* add support for universal plane
* add support for atomic modesetting
* make non-failing funcs return void, kill pointless error checking
* allocate vbuffers at init time, to avoid allocations in critical paths
* license clarification (dual mit/gpl)
* splitted vga handling into separate patch
* improve error handling
* codestyle fixes
* misc minor tweaks here and there
Still on the todo list:
* sort how to handle vga compatibility best, for now the bits just have been splitted into a separate patch so they are easier to spot and don't confuse when reviewing the main parts of the driver.
* properly handle page flip.
cheers,
Gerd
Dave Airlie (1):
Add virtio gpu driver.
Gerd Hoffmann (3):
break kconfig dependency loop
drm_vblank_get: don't WARN_ON in case vblanks are not initialized Add virtio-vga bits.
drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/drm_irq.c | 3 + drivers/gpu/drm/virtio/Kconfig | 14 + drivers/gpu/drm/virtio/Makefile | 11 + drivers/gpu/drm/virtio/virtgpu_debugfs.c | 64 ++++ drivers/gpu/drm/virtio/virtgpu_display.c | 485 ++++++++++++++++++++++++ drivers/gpu/drm/virtio/virtgpu_drm_bus.c | 95 +++++ drivers/gpu/drm/virtio/virtgpu_drv.c | 136 +++++++ drivers/gpu/drm/virtio/virtgpu_drv.h | 350 ++++++++++++++++++ drivers/gpu/drm/virtio/virtgpu_fb.c | 431 ++++++++++++++++++++++ drivers/gpu/drm/virtio/virtgpu_fence.c | 119 ++++++ drivers/gpu/drm/virtio/virtgpu_gem.c | 140 +++++++ drivers/gpu/drm/virtio/virtgpu_kms.c | 163 ++++++++ drivers/gpu/drm/virtio/virtgpu_object.c | 170 +++++++++ drivers/gpu/drm/virtio/virtgpu_plane.c | 120 ++++++ drivers/gpu/drm/virtio/virtgpu_ttm.c | 469 +++++++++++++++++++++++ drivers/gpu/drm/virtio/virtgpu_vq.c | 614 +++++++++++++++++++++++++++++++ drivers/media/platform/Kconfig | 2 +- drivers/virtio/virtio_pci_common.c | 7 +- include/drm/drmP.h | 1 + include/uapi/linux/Kbuild | 1 + include/uapi/linux/virtio_gpu.h | 204 ++++++++++ include/uapi/linux/virtio_ids.h | 1 + 24 files changed, 3601 insertions(+), 2 deletions(-) create mode 100644 drivers/gpu/drm/virtio/Kconfig create mode 100644 drivers/gpu/drm/virtio/Makefile create mode 100644 drivers/gpu/drm/virtio/virtgpu_debugfs.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_display.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_drm_bus.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_drv.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_drv.h create mode 100644 drivers/gpu/drm/virtio/virtgpu_fb.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_fence.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_gem.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_kms.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_object.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_plane.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_ttm.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_vq.c create mode 100644 include/uapi/linux/virtio_gpu.h
Signature · 6 lines
1.8.3.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Gerd Hoffmann
maintainerPATCH v2 1/4 break kconfig dependency loop
After adding virtio-gpu I get this funky kconfig dependency loop.
scripts/kconfig/conf --oldconfig Kconfig drivers/video/fbdev/Kconfig:5:error: recursive dependency detected! drivers/video/fbdev/Kconfig:5: symbol FB is selected by DRM_KMS_FB_HELPERdrivers/gpu/drm/Kconfig:34: symbol DRM_KMS_FB_HELPER is selected by DRM_VIRTIO_GPUdrivers/gpu/drm/virtio/Kconfig:1: symbol DRM_VIRTIO_GPU depends on VIRTIO
drivers/virtio/Kconfig:1: symbol VIRTIO is selected by REMOTEPROC drivers/remoteproc/Kconfig:4: symbol REMOTEPROC is selected by OMAP_REMOTEPROC drivers/remoteproc/Kconfig:12: symbol OMAP_REMOTEPROC depends on OMAP_IOMMU drivers/iommu/Kconfig:141: symbol OMAP_IOMMU is selected by VIDEO_OMAP3
drivers/media/platform/Kconfig:96: symbol VIDEO_OMAP3 depends on VIDEO_V4L2drivers/media/v4l2-core/Kconfig:6: symbol VIDEO_V4L2 depends on I2Cdrivers/i2c/Kconfig:7: symbol I2C is selected by FB_DDC drivers/video/fbdev/Kconfig:59: symbol FB_DDC is selected by FB_CYBER2000_DDCdrivers/video/fbdev/Kconfig:374: symbol FB_CYBER2000_DDC depends on FB_CYBER2000drivers/video/fbdev/Kconfig:362: symbol FB_CYBER2000 depends on FB
Making VIDEO_OMAP3 depend on OMAP_IOMMU instead of selecting it breaks the loop, which looks like the best way to handle it to me. I'm open to better suggestions though.
--- drivers/media/platform/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/Kconfig +1 -1
@@ -87,8 +87,8 @@ config VIDEO_OMAP3 tristate "OMAP 3 Camera support" depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API && ARCH_OMAP3 depends on HAS_DMA + depends on OMAP_IOMMU select ARM_DMA_USE_IOMMU - select OMAP_IOMMU select VIDEOBUF2_DMA_CONTIG ---help--- Driver for an OMAP 3 camera controller.
Signature · 6 lines
1.8.3.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 1/4] break kconfig dependency loop
Quoted 18 lines · Gerd Hoffmann
After adding virtio-gpu I get this funky kconfig dependency loop.
scripts/kconfig/conf--oldconfigKconfigdrivers/video/fbdev/Kconfig:5:error: recursive dependency detected!drivers/video/fbdev/Kconfig:5: symbol FB is selected byDRM_KMS_FB_HELPERdrivers/gpu/drm/Kconfig:34: symbolDRM_KMS_FB_HELPERis selected byDRM_VIRTIO_GPUdrivers/gpu/drm/virtio/Kconfig:1: symbolDRM_VIRTIO_GPUdepends on VIRTIOdrivers/virtio/Kconfig:1: symbol VIRTIO is selected by REMOTEPROC drivers/remoteproc/Kconfig:4: symbol REMOTEPROC is selected by OMAP_REMOTEPROC drivers/remoteproc/Kconfig:12: symbol OMAP_REMOTEPROC depends on OMAP_IOMMU drivers/iommu/Kconfig:141: symbol OMAP_IOMMU is selected by VIDEO_OMAP3
drivers/media/platform/Kconfig:96: symbolVIDEO_OMAP3depends onVIDEO_V4L2drivers/media/v4l2-core/Kconfig:6: symbolVIDEO_V4L2depends on I2Cdrivers/i2c/Kconfig:7: symbol I2C is selected byFB_DDCdrivers/video/fbdev/Kconfig:59: symbolFB_DDCis selected byFB_CYBER2000_DDCdrivers/video/fbdev/Kconfig:374: symbolFB_CYBER2000_DDCdepends onFB_CYBER2000drivers/video/fbdev/Kconfig:362: symbolFB_CYBER2000depends on FB
Quoted 3 lines
Making
VIDEO_OMAP3depend onOMAP_IOMMUinstead of selecting it breaks the loop, which looks like the best way to handle it to me. I'm open to better suggestions though.
I think part of the problem is that "select" is often used not as documented [1] but rather as "show my config in menuconfig for convenience even if my dependency is not met, and select the dependency even though I know it can screw up the dependency chain".
In light of the documentation, your patch seems to DTRT. (Disclaimer: I don't work with the drivers in question, hence no Reviewed-by.)
In the big picture, it feels like menuconfig needs a way to display items whose dependencies are not met, and a way to recursively enable said items and all their dependencies when told. This would reduce the resistance to sticking with "select" when clearly "depends" is what's meant.
BR,
Jani.
[1] Documentation/kbuild/kconfig-language.txt: "In general use select only for non-visible symbols (no prompts anywhere) and for symbols with no dependencies. That will limit the usefulness but on the other hand avoid the illegal configurations all over."
Quoted 27 lines
Signed-off-by Gerd Hoffmann <[email protected]>--- drivers/media/platform/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/platform/Kconfig +1
-1@@ -87,8 +87,8 @@ config VIDEO_OMAP3 tristate "OMAP 3 Camera support" depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API && ARCH_OMAP3 depends on HAS_DMA + depends on OMAP_IOMMU select ARM_DMA_USE_IOMMU - select OMAP_IOMMU select VIDEOBUF2_DMA_CONTIG ---help--- Driver for an OMAP 3 camera controller.Signature · 6 lines
1.8.3.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Re: [PATCH v2 1/4] break kconfig dependency loop
Quoted 4 lines · Jani Nikula
I think part of the problem is that "select" is often used not as documented [1] but rather as "show my config in menuconfig for convenience even if my dependency is not met, and select the dependency even though I know it can screw up the dependency chain".
Perhaps people use select because it offers, given the problem they face, a reasonable way to make the kconfig tools generate a sensible .config. It helps them to spend less time fiddling with Kconfig files. And they expect that it helps others to configure their build more easily, as it might save those others some work.
Quoted 3 lines
In the big picture, it feels like menuconfig needs a way to display items whose dependencies are not met, and a way to recursively enable said items and all their dependencies when told.
How could that work its way through (multiple levels of) things like:
depends on FOO || (BAZ && BAR)
Quoted 3 lines
This would reduce the
resistance to sticking with "select" when clearly "depends" is what's meant.
I had drafted a rather verbose response to this. But I think I'm not really sure what you're saying here, probably because "select" and "depends on" are rather different. How would you know that the actual intention was to use "depends on"?
Paul Bolle
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 1/4] break kconfig dependency loop
Em Mon, 06 Apr 2015 11:50:21 +0200
Paul Bolle <[email protected]> escreveu:
Quoted 11 lines · Jani Nikula
Quoted 4 lines
I think part of the problem is that "select" is often used not as documented [1] but rather as "show my config in menuconfig for convenience even if my dependency is not met, and select the dependency even though I know it can screw up the dependency chain".
Perhaps people use select because it offers, given the problem they face, a reasonable way to make the kconfig tools generate a sensible .config. It helps them to spend less time fiddling with
Kconfigfiles. And they expect that it helps others to configure their build more easily, as it might save those others some work.
At least on media, the main usage of select is to handle complex hardware where lots of drivers are needed in order to have support for all boards supported by a given board.
On a practical example, let's take a look at em28xx driver. This is a bridge driver for media boards. It supports ~100 different boards. Each board may have different tuners, different analog TV demods, different digital TV demods, eeproms attached into one of its I2C buses.
As this is an USB stick, the normal user will never know what are the other components of the board without some hard work (by opening the USB stick by seeking for the information at the Internet until he discovers all the components).
Even after knowing the hardware components, he has to figure out what drivers implement support for each component.
So, for the normal user, we offer a way for the user to select all possible combinations via MEDIA_SUBDRV_AUTOSELECT. This way, he'll know for sure that all boards supported by em28xx will be available.
For those that would embedded em28xx on some hardware (like a TV PVR box), he can disable such option and manually select the specific components his hardware uses.
For obvious reasons, we recommend distros to always enable MEDIA_SUBDRV_AUTOSELECT.
So, yes, select saves a lot of work to configure the build what they want on an easy and sane way.
That's said, while it would be possible to convert select into depends on, the result would be really ugly, and very hard to be maintained, as I2C drivers that don't actually depend on the bridge drivers would need a fake depends on list:
config DVB_MB86A20S
tristate "Fujitsu mb86a20s"
# real dependency chain
depends on DVB_CORE && I2C
# fake dependency chain
depends on (!MEDIA_SUBDRV_AUTOSELECT || CONFIG_VIDEO_CX23885_DVB || CONFIG_VIDEO_CX231XX_DVB || CONFIG_VIDEO_EM28xx_DVB)
I got here an easy example of an ISDB-T driver, with is not used on many boards. There are other I2C drivers that are used by almost all media drivers, with would result on a very complex fake dependency chain.
The worse thing with such ugly fake dependency chain is that people adding a new driver (or support for a new board) would need to remember to dig into drivers that weren't touched, adding new stuff on their Kconfig.
Quoted 3 lines
Quoted 3 lines
In the big picture, it feels like menuconfig needs a way to display items whose dependencies are not met, and a way to recursively enable said items and all their dependencies when told.
I believe so.
Quoted 2 lines
How could that work its way through (multiple levels of) things like:
depends on FOO || (BAZ && BAR)
At least for our typical use case, the dependency chain should not have things like the above, as we use this mainly for I2C drivers, and the bridge drivers also depend on I2C.
I would say that, if Kconfig adds a recursive select implementation, such implementation should:
- stop recursion if the depends condition was met;
- if the depends condition is unmet and has two or more possible options to satisfy (like on your above example), it should prompt the user about what option it would want. If it can't do it (for example, for a "silent" type of config, where it shouldn't be expected any userspace interaction), it should print a warning and not enable the driver.
Granted, this is easier said than done. We have this problem mapped for a long time, but none was brave enough (or had enough time) to actually try to implement something like that. So, what we generally do, as a workaround, is to try to simplify the Kconfig stuff to avoid complex use cases. We do that by adding fake dependencies to drivers that might require another driver for some board to work. For example, several USB media drivers now depends on I2C_MUX just because a few of the possible drivers it may need should select I2C_MUX.
Btw, I2C_MUX is an optional feature of the I2C core. There's no way for a normal user to know if a driver would need such feature or not, as it basically depends on how the device was internally wired and if the Kernel driver would use it (older drivers have their own solution without using the I2C_MUX new way).
There are a few other such options at the I2C sub-system. All of them depends on I2C only (with is a mandatory option for any I2C driver), so select works fine for such features.
Quoted 5 lines
Quoted 4 lines
This would reduce the
resistance to sticking with "select" when clearly "depends" is what's meant.
Quoted 7 lines
I had drafted a rather verbose response to this. But I think I'm not really sure what you're saying here, probably because "select" and "depends on" are rather different. How would you know that the actual intention was to use "depends on"?
Paul Bolle
Regards,
Mauro
Re: [PATCH v2 1/4] break kconfig dependency loop
In reply to Gerd HoffmannHi Gerd,
I've read the patches about the virtio-gpu, it's a nice design. As far as I know, there are two other drivers used by qemu, CIRRUS and BOCHS.
I have a question about the relationship of these three drivers, is that the virtio-gpu
designed to replace the other two drivers? I mean are the CIRRUS and BOCHS going to be deprecated in the future?
Would you please kindly explain this a little bit?
Actually, this is a problem by *Martin Peres* who is the GSoC xorg administor.
My proposal is "Convert the BOCHS and CIRRUS drivers to atomic mode-setting".
Martin wonder if the two drivers are going to be deprecated, there is no need for
me to do the job.
Best regards,
John
Quoted 58 lines · Gerd Hoffmann
After adding virtio-gpu I get this funky kconfig dependency loop.
scripts/kconfig/conf--oldconfigKconfigdrivers/video/fbdev/Kconfig:5:error: recursive dependency detected!drivers/video/fbdev/Kconfig:5: symbol FB is selected byDRM_KMS_FB_HELPERdrivers/gpu/drm/Kconfig:34: symbolDRM_KMS_FB_HELPERis selected byDRM_VIRTIO_GPUdrivers/gpu/drm/virtio/Kconfig:1: symbolDRM_VIRTIO_GPUdepends on
VIRTIOdrivers/virtio/Kconfig:1: symbol VIRTIO is selected by REMOTEPROCdrivers/remoteproc/Kconfig:4: symbol REMOTEPROC is selected byOMAP_REMOTEPROCdrivers/remoteproc/Kconfig:12: symbolOMAP_REMOTEPROCdepends onOMAP_IOMMUdrivers/iommu/Kconfig:141: symbolOMAP_IOMMUis selected byVIDEO_OMAP3drivers/media/platform/Kconfig:96: symbolVIDEO_OMAP3depends onVIDEO_V4L2drivers/media/v4l2-core/Kconfig:6: symbolVIDEO_V4L2depends on I2Cdrivers/i2c/Kconfig:7: symbol I2C is selected byFB_DDCdrivers/video/fbdev/Kconfig:59: symbolFB_DDCis selected byFB_CYBER2000_DDCdrivers/video/fbdev/Kconfig:374: symbolFB_CYBER2000_DDCdepends onFB_CYBER2000drivers/video/fbdev/Kconfig:362: symbolFB_CYBER2000depends on FBMaking
VIDEO_OMAP3depend onOMAP_IOMMUinstead of selecting it breaks the loop, which looks like the best way to handle it to me. I'm open to better suggestions though.Signed-off-by Gerd Hoffmann <[email protected]>--- drivers/media/platform/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/platform/Kconfig +1
-2@@ -87,8 +87,8 @@ config VIDEO_OMAP3 tristate "OMAP 3 Camera support" depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API && ARCH_OMAP3 depends on HAS_DMA + depends on OMAP_IOMMU select ARM_DMA_USE_IOMMU - select OMAP_IOMMU select VIDEOBUF2_DMA_CONTIG ---help--- Driver for an OMAP 3 camera controller. --1.8.3.1
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Best regards Junwang Zhao Microprocessor Research and Develop Center Department of Computer Science &Technology Peking University Beijing, 100871, PRC
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Michael S. Tsirkin
maintainerRe: [PATCH v2 1/4] break kconfig dependency loop
Quoted 10 lines · John Hunter
Hi Gerd,
I've read the patches about the virtio-gpu, it's a nice design. As far as I know, there are two other drivers used by qemu, CIRRUS and BOCHS. I have a question about the relationship of these three drivers, is that the virtio-gpu
designed to replace the other two drivers? I mean are the CIRRUS and BOCHS going to be deprecated in the future?Would you please kindly explain this a little bit?
Quoted 8 lines
Actually, this is a problem by Martin Peres who is the GSoC xorg administor. My proposal is "Convert the BOCHS and CIRRUS drivers to atomic mode-setting". Martin wonder if the two drivers are going to be deprecated, there is no need for
me to do the job.Best regards,
John
Hypervisors are going to support BOCHS and CIRRUS for years to come.
Signature · 5 lines
MST _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Gerd Hoffmann
maintainerRe: [PATCH v2 1/4] break kconfig dependency loop
In reply to John HunterQuoted 9 lines · John Hunter
Hi Gerd,
I've read the patches about the virtio-gpu, it's a nice design. As far as I know, there are two other drivers used by qemu, CIRRUS and BOCHS.
I have a question about the relationship of these three drivers, is that the virtio-gpu
designed to replace the other two drivers? I mean are the CIRRUS and BOCHS
going to be deprecated in the future?
qemu has a bunch of different virtual graphics cards, and these are the drivers for them. cirrus used to be the default gfx card until recently (qemu older then version 2.2). stdvga (bochs driver) is the current default. So expect them to be around for a while.
virtio-gpu will not replace them.
Quoted 4 lines
Actually, this is a problem by Martin Peres who is the GSoC xorg administor.
My proposal is "Convert the BOCHS and CIRRUS drivers to atomic mode-setting".
Surely makes sense for bochs and you shouldn't find major blockers. Not sure this is a reasonable task size for gsoc given it took me only a few days to convert virtio-gpu to atomic modesetting. But maybe fine if you are new to drm kernel hacking and therefore the task includes learning alot new stuff.
I have my doubts it'll work out for cirrus though, due to the small amount of video memory it has (and other limitations, because we mimic hardware from the 90ies here). Current code is already swapping framebuffers in and out of video ram because of that. So atomic modesetting, page flip, running wayland on that beast all is going to be problematic I expect.
See also:
https://www.kraxel.org/blog/2014/10/qemu-using-cirrus-considered-harmful/
HTH,
Gerd
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 1/4] break kconfig dependency loop
In reply to Gerd HoffmannEm Wed, 1 Apr 2015 15:15:27 +0200
Gerd Hoffmann <[email protected]> escreveu:
Quoted 18 lines
After adding virtio-gpu I get this funky kconfig dependency loop.
scripts/kconfig/conf--oldconfigKconfigdrivers/video/fbdev/Kconfig:5:error: recursive dependency detected!drivers/video/fbdev/Kconfig:5: symbol FB is selected byDRM_KMS_FB_HELPERdrivers/gpu/drm/Kconfig:34: symbolDRM_KMS_FB_HELPERis selected byDRM_VIRTIO_GPUdrivers/gpu/drm/virtio/Kconfig:1: symbolDRM_VIRTIO_GPUdepends on VIRTIOdrivers/virtio/Kconfig:1: symbol VIRTIO is selected by REMOTEPROC drivers/remoteproc/Kconfig:4: symbol REMOTEPROC is selected by OMAP_REMOTEPROC drivers/remoteproc/Kconfig:12: symbol OMAP_REMOTEPROC depends on OMAP_IOMMU drivers/iommu/Kconfig:141: symbol OMAP_IOMMU is selected by VIDEO_OMAP3
drivers/media/platform/Kconfig:96: symbolVIDEO_OMAP3depends onVIDEO_V4L2drivers/media/v4l2-core/Kconfig:6: symbolVIDEO_V4L2depends on I2Cdrivers/i2c/Kconfig:7: symbol I2C is selected byFB_DDCdrivers/video/fbdev/Kconfig:59: symbolFB_DDCis selected byFB_CYBER2000_DDCdrivers/video/fbdev/Kconfig:374: symbolFB_CYBER2000_DDCdepends onFB_CYBER2000drivers/video/fbdev/Kconfig:362: symbolFB_CYBER2000depends on FB
Quoted 3 lines
Making
VIDEO_OMAP3depend onOMAP_IOMMUinstead of selecting it breaks the loop, which looks like the best way to handle it to me. I'm open to better suggestions though.
Gerd,
It seems that I never actually acked or nacked about this patch.
I'm ok with such change. So:
Btw, it would make sense to add some help for config OMAP_IOMMU and say that this is required in order to compile the OMAP3 media platform drivers at drivers/iommu/Kconfig.
Regards,
Mauro
Quoted 20 lines
Signed-off-by Gerd Hoffmann <[email protected]>--- drivers/media/platform/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/platform/Kconfig +1
-1@@ -87,8 +87,8 @@ config VIDEO_OMAP3 tristate "OMAP 3 Camera support" depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API && ARCH_OMAP3 depends on HAS_DMA + depends on OMAP_IOMMU select ARM_DMA_USE_IOMMU - select OMAP_IOMMU select VIDEOBUF2_DMA_CONTIG ---help--- Driver for an OMAP 3 camera controller.
Gerd Hoffmann
maintainerPATCH v2 2/4 drm_vblank_get: don't WARN_ON in case vblanks are not initialized
In reply to Gerd Hoffmann--- drivers/gpu/drm/drm_irq.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_irq.c +3 -0
@@ -1026,6 +1026,9 @@ int drm_vblank_get(struct drm_device *dev, int crtc)unsigned long irqflags;int ret =0 ; +if (!dev->num_crtcs) +return -EINVAL ; +if (WARN_ON (crtc >= dev->num_crtcs))return -EINVAL ;
Signature · 6 lines
1.8.3.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 2/4] drm_vblank_get: don't WARN_ON in case vblanks are not initialized
Quoted 1 line · Gerd Hoffmann
Signed-off-by Gerd Hoffmann <[email protected]>
Quoted 25 lines
--- drivers/gpu/drm/drm_irq.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/drm_irq.c +3
-1@@ -1026,6 +1026,9 @@ int drm_vblank_get(struct drm_device *dev, int crtc)unsigned long irqflags;int ret =0 ; +if (!dev->num_crtcs) +return -EINVAL ; +if (WARN_ON (crtc >= dev->num_crtcs))return -EINVAL ; --1.8.3.1
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Gerd Hoffmann
maintainerPATCH v2 3/4 Add virtio gpu driver.
In reply to Gerd HoffmannFrom: Dave Airlie <[email protected]>
This patch adds a kms driver for the virtio gpu. The xorg modesetting driver can handle the device just fine, the framebuffer for fbcon is there too.
Qemu patches for the host side are under review currently.
The pci version of the device comes in two variants: with and without vga compatibility. The former has a extra memory bar for the vga framebuffer, the later is a pure virtio device. The only concern for this driver is that in the virtio-vga case we have to kick out the firmware framebuffer.
Initial revision has only 2d support, 3d (virgl) support requires some more work on the qemu side and will be added later.
--- drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/virtio/Kconfig | 14 + drivers/gpu/drm/virtio/Makefile | 11 + drivers/gpu/drm/virtio/virtgpu_debugfs.c | 64 ++++ drivers/gpu/drm/virtio/virtgpu_display.c | 485 ++++++++++++++++++++++++ drivers/gpu/drm/virtio/virtgpu_drm_bus.c | 67 ++++ drivers/gpu/drm/virtio/virtgpu_drv.c | 136 +++++++ drivers/gpu/drm/virtio/virtgpu_drv.h | 350 ++++++++++++++++++ drivers/gpu/drm/virtio/virtgpu_fb.c | 431 ++++++++++++++++++++++ drivers/gpu/drm/virtio/virtgpu_fence.c | 119 ++++++ drivers/gpu/drm/virtio/virtgpu_gem.c | 140 +++++++ drivers/gpu/drm/virtio/virtgpu_kms.c | 163 ++++++++ drivers/gpu/drm/virtio/virtgpu_object.c | 170 +++++++++ drivers/gpu/drm/virtio/virtgpu_plane.c | 120 ++++++ drivers/gpu/drm/virtio/virtgpu_ttm.c | 469 +++++++++++++++++++++++ drivers/gpu/drm/virtio/virtgpu_vq.c | 614 +++++++++++++++++++++++++++++++ include/drm/drmP.h | 1 + include/uapi/linux/Kbuild | 1 + include/uapi/linux/virtio_gpu.h | 204 ++++++++++ include/uapi/linux/virtio_ids.h | 1 + 21 files changed, 3563 insertions(+) create mode 100644 drivers/gpu/drm/virtio/Kconfig create mode 100644 drivers/gpu/drm/virtio/Makefile create mode 100644 drivers/gpu/drm/virtio/virtgpu_debugfs.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_display.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_drm_bus.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_drv.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_drv.h create mode 100644 drivers/gpu/drm/virtio/virtgpu_fb.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_fence.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_gem.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_kms.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_object.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_plane.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_ttm.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_vq.c create mode 100644 include/uapi/linux/virtio_gpu.h
drivers/gpu/drm/Kconfig +2 -0
@@ -197,6 +197,8 @@ source "drivers/gpu/drm/qxl/Kconfig" source "drivers/gpu/drm/bochs/Kconfig" +source "drivers/gpu/drm/virtio/Kconfig" + source "drivers/gpu/drm/msm/Kconfig" source "drivers/gpu/drm/tegra/Kconfig"
drivers/gpu/drm/Makefile +1 -0
@@ -62,6 +62,7 @@ obj-$(CONFIG_DRM_OMAP) += omapdrm/ obj-$(CONFIG_DRM_TILCDC) += tilcdc/ obj-$(CONFIG_DRM_QXL) += qxl/ obj-$(CONFIG_DRM_BOCHS) += bochs/ +obj-$(CONFIG_DRM_VIRTIO_GPU) += virtio/ obj-$(CONFIG_DRM_MSM) += msm/ obj-$(CONFIG_DRM_TEGRA) += tegra/ obj-$(CONFIG_DRM_STI) += sti/
drivers/gpu/drm/virtio/Kconfig new file +14 -0
@@ -0,0 +1,14 @@ +config DRM_VIRTIO_GPU + tristate "Virtio GPU driver" + depends on DRM && VIRTIO + select FB_SYS_FILLRECT + select FB_SYS_COPYAREA + select FB_SYS_IMAGEBLIT + select DRM_KMS_HELPER + select DRM_KMS_FB_HELPER + select DRM_TTM + help + This is the virtual GPU driver for virtio. It can be used with + QEMU based VMMs (like KVM or Xen). + + If unsure say M.
drivers/gpu/drm/virtio/Makefile new file +11 -0
@@ -0,0 +1,11 @@ +# +# Makefile for the drm device driver. This driver provides support for the +# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. + +ccflags-y := -Iinclude/drm + +virtio-gpu-y := virtgpu_drv.o virtgpu_kms.o virtgpu_drm_bus.o virtgpu_gem.o \ + virtgpu_fb.o virtgpu_display.o virtgpu_vq.o virtgpu_ttm.o \ + virtgpu_fence.o virtgpu_object.o virtgpu_debugfs.o virtgpu_plane.o + +obj-$(CONFIG_DRM_VIRTIO_GPU) += virtio-gpu.o
drivers/gpu/drm/virtio/virtgpu_debugfs.c new file +64 -0
64 lines not on this page · raw message
drivers/gpu/drm/virtio/virtgpu_display.c new file +485 -0
485 lines not on this page · raw message
drivers/gpu/drm/virtio/virtgpu_drm_bus.c new file +67 -0
67 lines not on this page · raw message
drivers/gpu/drm/virtio/virtgpu_drv.c new file +136 -0
136 lines not on this page · raw message
drivers/gpu/drm/virtio/virtgpu_drv.h new file +350 -0
350 lines not on this page · raw message
drivers/gpu/drm/virtio/virtgpu_fb.c new file +431 -0
431 lines not on this page · raw message
drivers/gpu/drm/virtio/virtgpu_fence.c new file +119 -0
119 lines not on this page · raw message
drivers/gpu/drm/virtio/virtgpu_gem.c new file +140 -0
140 lines not on this page · raw message
drivers/gpu/drm/virtio/virtgpu_kms.c new file +163 -0
163 lines not on this page · raw message
drivers/gpu/drm/virtio/virtgpu_object.c new file +170 -0
170 lines not on this page · raw message
drivers/gpu/drm/virtio/virtgpu_plane.c new file +120 -0
120 lines not on this page · raw message
drivers/gpu/drm/virtio/virtgpu_ttm.c new file +469 -0
469 lines not on this page · raw message
drivers/gpu/drm/virtio/virtgpu_vq.c new file +614 -0
246 lines not on this page · raw message
include/uapi/linux/virtio_gpu.h new file +204 -0
204 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 6 lines
1.8.3.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Part of the diff is not shown here. View the raw message.
Michael S. Tsirkin
maintainerdrivers/gpu/drm/virtio/virtgpu_kms.c line 153
Quoted 5 lines · Gerd Hoffmann
drivers/gpu/drm/virtio/virtgpu_kms.c new file +5
-0+int virtio_gpu_driver_unload (struct drm_device *dev) +{ +struct virtio_gpu_device *vgdev = dev->dev_private; + + vgdev->vqs_ready = false;
Probably ok since flush below will sync all cpus,
but this needs a comment I think.
drivers/gpu/drm/virtio/virtgpu_kms.c line 155
Quoted 2 lines
drivers/gpu/drm/virtio/virtgpu_kms.c new file +2
-0+flush_work (&vgdev->ctrlq.dequeue_work); +flush_work (&vgdev->cursorq.dequeue_work);
I see there are a bunch of other work entries -
don't all of them need to be flushed?
Quoted 8 lines
drivers/gpu/drm/virtio/virtgpu_kms.c new file +8
-0+ vgdev->vdev->config->del_vqs (vgdev->vdev); + +virtio_gpu_modeset_fini (vgdev); +virtio_gpu_ttm_fini (vgdev); +virtio_gpu_free_vbufs (vgdev); +kfree (vgdev); +return 0 ; +}
Hi Gerd
While doing some testing with your brance, I reached that:
Quoted 2 lines · Gerd Hoffmann
+#define
MAX_INLINE_CMD_SIZE96
[ 750.446449] kernel BUG at drivers/gpu/drm/virtio/virtgpu_vq.c:132! [ 750.447005] Call Trace: [ 750.447005] [<ffffffffa00f3592>] virtio_gpu_alloc_cmd+0x22/0x50 [virtio_gpu] [ 750.447005] [<ffffffffa00f4580>]
virtio_gpu_cmd_context_create+0x30/0xa0 [virtio_gpu]
struct virtio_gpu_ctx_create {
struct virtio_gpu_ctrl_hdr hdr;
__le32 nlen;
__le32 padding;
char debug_name[64];
};Is actually 96 bytes.
Perhaps that condition should be changed:
+ BUG_ON(size >= MAX_INLINE_CMD_SIZE);
Signature · 1 line
Marc-André Lureau
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Gerd Hoffmann
maintainerQuoted 2 lines · Marc-André Lureau
Perhaps that condition should be changed:
+BUG_ON(size >= MAX_INLINE_CMD_SIZE);
Done.
thanks,
Gerd
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Gerd Hoffmann
maintainerQuoted 2 lines · Marc-André Lureau
Perhaps that condition should be changed:
+BUG_ON(size >= MAX_INLINE_CMD_SIZE);
Done.
thanks,
Gerd
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Hi Gerd
While doing some testing with your brance, I reached that:
Quoted 2 lines · Gerd Hoffmann
+#define
MAX_INLINE_CMD_SIZE96
[ 750.446449] kernel BUG at drivers/gpu/drm/virtio/virtgpu_vq.c:132! [ 750.447005] Call Trace: [ 750.447005] [<ffffffffa00f3592>] virtio_gpu_alloc_cmd+0x22/0x50 [virtio_gpu] [ 750.447005] [<ffffffffa00f4580>]
virtio_gpu_cmd_context_create+0x30/0xa0 [virtio_gpu]
struct virtio_gpu_ctx_create {
struct virtio_gpu_ctrl_hdr hdr;
__le32 nlen;
__le32 padding;
char debug_name[64];
};Is actually 96 bytes.
Perhaps that condition should be changed:
+ BUG_ON(size >= MAX_INLINE_CMD_SIZE);
Signature · 1 line
Marc-André Lureau
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Gerd Hoffmann
maintainerPATCH v2 3/4 Add virtio gpu driver.
In reply to Gerd HoffmannFrom: Dave Airlie <[email protected]>
This patch adds a kms driver for the virtio gpu. The xorg modesetting driver can handle the device just fine, the framebuffer for fbcon is there too.
Qemu patches for the host side are under review currently.
The pci version of the device comes in two variants: with and without vga compatibility. The former has a extra memory bar for the vga framebuffer, the later is a pure virtio device. The only concern for this driver is that in the virtio-vga case we have to kick out the firmware framebuffer.
Initial revision has only 2d support, 3d (virgl) support requires some more work on the qemu side and will be added later.
--- drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/virtio/Kconfig | 14 + drivers/gpu/drm/virtio/Makefile | 11 + drivers/gpu/drm/virtio/virtgpu_debugfs.c | 64 ++++ drivers/gpu/drm/virtio/virtgpu_display.c | 485 ++++++++++++++++++++++++ drivers/gpu/drm/virtio/virtgpu_drm_bus.c | 67 ++++ drivers/gpu/drm/virtio/virtgpu_drv.c | 136 +++++++ drivers/gpu/drm/virtio/virtgpu_drv.h | 350 ++++++++++++++++++ drivers/gpu/drm/virtio/virtgpu_fb.c | 431 ++++++++++++++++++++++ drivers/gpu/drm/virtio/virtgpu_fence.c | 119 ++++++ drivers/gpu/drm/virtio/virtgpu_gem.c | 140 +++++++ drivers/gpu/drm/virtio/virtgpu_kms.c | 163 ++++++++ drivers/gpu/drm/virtio/virtgpu_object.c | 170 +++++++++ drivers/gpu/drm/virtio/virtgpu_plane.c | 120 ++++++ drivers/gpu/drm/virtio/virtgpu_ttm.c | 469 +++++++++++++++++++++++ drivers/gpu/drm/virtio/virtgpu_vq.c | 614 +++++++++++++++++++++++++++++++ include/drm/drmP.h | 1 + include/uapi/linux/Kbuild | 1 + include/uapi/linux/virtio_gpu.h | 204 ++++++++++ include/uapi/linux/virtio_ids.h | 1 + 21 files changed, 3563 insertions(+) create mode 100644 drivers/gpu/drm/virtio/Kconfig create mode 100644 drivers/gpu/drm/virtio/Makefile create mode 100644 drivers/gpu/drm/virtio/virtgpu_debugfs.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_display.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_drm_bus.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_drv.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_drv.h create mode 100644 drivers/gpu/drm/virtio/virtgpu_fb.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_fence.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_gem.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_kms.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_object.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_plane.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_ttm.c create mode 100644 drivers/gpu/drm/virtio/virtgpu_vq.c create mode 100644 include/uapi/linux/virtio_gpu.h
drivers/gpu/drm/Kconfig +2 -0
@@ -197,6 +197,8 @@ source "drivers/gpu/drm/qxl/Kconfig" source "drivers/gpu/drm/bochs/Kconfig" +source "drivers/gpu/drm/virtio/Kconfig" + source "drivers/gpu/drm/msm/Kconfig" source "drivers/gpu/drm/tegra/Kconfig"
drivers/gpu/drm/Makefile +1 -0
@@ -62,6 +62,7 @@ obj-$(CONFIG_DRM_OMAP) += omapdrm/ obj-$(CONFIG_DRM_TILCDC) += tilcdc/ obj-$(CONFIG_DRM_QXL) += qxl/ obj-$(CONFIG_DRM_BOCHS) += bochs/ +obj-$(CONFIG_DRM_VIRTIO_GPU) += virtio/ obj-$(CONFIG_DRM_MSM) += msm/ obj-$(CONFIG_DRM_TEGRA) += tegra/ obj-$(CONFIG_DRM_STI) += sti/
drivers/gpu/drm/virtio/Kconfig new file +14 -0
@@ -0,0 +1,14 @@ +config DRM_VIRTIO_GPU + tristate "Virtio GPU driver" + depends on DRM && VIRTIO + select FB_SYS_FILLRECT + select FB_SYS_COPYAREA + select FB_SYS_IMAGEBLIT + select DRM_KMS_HELPER + select DRM_KMS_FB_HELPER + select DRM_TTM + help + This is the virtual GPU driver for virtio. It can be used with + QEMU based VMMs (like KVM or Xen). + + If unsure say M.
drivers/gpu/drm/virtio/Makefile new file +11 -0
@@ -0,0 +1,11 @@ +# +# Makefile for the drm device driver. This driver provides support for the +# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. + +ccflags-y := -Iinclude/drm + +virtio-gpu-y := virtgpu_drv.o virtgpu_kms.o virtgpu_drm_bus.o virtgpu_gem.o \ + virtgpu_fb.o virtgpu_display.o virtgpu_vq.o virtgpu_ttm.o \ + virtgpu_fence.o virtgpu_object.o virtgpu_debugfs.o virtgpu_plane.o + +obj-$(CONFIG_DRM_VIRTIO_GPU) += virtio-gpu.o
drivers/gpu/drm/virtio/virtgpu_debugfs.c new file +64 -0
64 lines not on this page · raw message
drivers/gpu/drm/virtio/virtgpu_display.c new file +485 -0
485 lines not on this page · raw message
drivers/gpu/drm/virtio/virtgpu_drm_bus.c new file +67 -0
67 lines not on this page · raw message
drivers/gpu/drm/virtio/virtgpu_drv.c new file +136 -0
136 lines not on this page · raw message
drivers/gpu/drm/virtio/virtgpu_drv.h new file +350 -0
350 lines not on this page · raw message
drivers/gpu/drm/virtio/virtgpu_fb.c new file +431 -0
431 lines not on this page · raw message
drivers/gpu/drm/virtio/virtgpu_fence.c new file +119 -0
119 lines not on this page · raw message
drivers/gpu/drm/virtio/virtgpu_gem.c new file +140 -0
140 lines not on this page · raw message
drivers/gpu/drm/virtio/virtgpu_kms.c new file +163 -0
163 lines not on this page · raw message
drivers/gpu/drm/virtio/virtgpu_object.c new file +170 -0
170 lines not on this page · raw message
drivers/gpu/drm/virtio/virtgpu_plane.c new file +120 -0
120 lines not on this page · raw message
drivers/gpu/drm/virtio/virtgpu_ttm.c new file +469 -0
469 lines not on this page · raw message
drivers/gpu/drm/virtio/virtgpu_vq.c new file +614 -0
246 lines not on this page · raw message
include/uapi/linux/virtio_gpu.h new file +204 -0
204 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.8.3.1
Part of the diff is not shown here. View the raw message.
Gerd Hoffmann
maintainerPATCH v2 4/4 Add virtio-vga bits.
In reply to Gerd Hoffmann--- drivers/gpu/drm/virtio/virtgpu_drm_bus.c | 32 ++++++++++++++++++++++++++++++-- drivers/virtio/virtio_pci_common.c | 7 ++++++- 2 files changed, 36 insertions(+), 3 deletions(-)
drivers/gpu/drm/virtio/virtgpu_drm_bus.c +30 -2
@@ -37,6 +37,26 @@ int drm_virtio_set_busid(struct drm_device *dev, struct drm_master *master)return 0 ; } +static void virtio_pci_kick_out_firmware_fb (struct pci_dev *pci_dev) +{ +struct apertures_struct *ap; +bool primary; + + ap =alloc_apertures (1 ); +if (!ap) +return ; + + ap->ranges[0 ].base =pci_resource_start (pci_dev,2 ); + ap->ranges[0 ].size =pci_resource_len (pci_dev,2 ); + + primary = pci_dev->resource[PCI_ROM_RESOURCE ].flags + &IORESOURCE_ROM_SHADOW ; + +remove_conflicting_framebuffers (ap,"virtiodrmfb" , primary); + +kfree (ap); +} +int drm_virtio_init (struct drm_driver *driver,struct virtio_device *vdev) {struct drm_device *dev;
@@ -48,8 +68,16 @@ int drm_virtio_init(struct drm_driver *driver, struct virtio_device *vdev) dev->virtdev = vdev; vdev->priv = dev; -if (strcmp (vdev->dev.parent->bus->name,"pci" ) ==0 ) - dev->pdev =to_pci_dev (vdev->dev.parent); +if (strcmp (vdev->dev.parent->bus->name,"pci" ) ==0 ) { +struct pci_dev *pdev =to_pci_dev (vdev->dev.parent); +bool vga = (pdev->class >>8 ) ==PCI_CLASS_DISPLAY_VGA ; + +DRM_INFO ("pci: %s detected\n" , + vga ?"virtio-vga" :"virtio-gpu-pci" ); + dev->pdev = pdev; +if (vga) +virtio_pci_kick_out_firmware_fb (pdev); + } ret =drm_dev_register (dev,0 );if (ret)
drivers/virtio/virtio_pci_common.c +6 -1
@@ -510,7 +510,12 @@ static int virtio_pci_probe(struct pci_dev *pci_dev, goto err_enable_device; rc =pci_request_regions (pci_dev,"virtio-pci" ); -if (rc) +/* +* virtio-vga: vesafb/efifb might hold vga framebuffer +* resource, but don't fail on that, we'll kick out vesafb +* later on. +*/ +if (rc && ((pci_dev->class >>8 ) !=PCI_CLASS_DISPLAY_VGA )) goto err_request_regions;if (force_legacy) {
Signature · 1 line
1.8.3.1
Gerd Hoffmann
maintainerPATCH v2 4/4 Add virtio-vga bits.
In reply to Gerd Hoffmann--- drivers/gpu/drm/virtio/virtgpu_drm_bus.c | 32 ++++++++++++++++++++++++++++++-- drivers/virtio/virtio_pci_common.c | 7 ++++++- 2 files changed, 36 insertions(+), 3 deletions(-)
drivers/gpu/drm/virtio/virtgpu_drm_bus.c +30 -2
@@ -37,6 +37,26 @@ int drm_virtio_set_busid(struct drm_device *dev, struct drm_master *master)return 0 ; } +static void virtio_pci_kick_out_firmware_fb (struct pci_dev *pci_dev) +{ +struct apertures_struct *ap; +bool primary; + + ap =alloc_apertures (1 ); +if (!ap) +return ; + + ap->ranges[0 ].base =pci_resource_start (pci_dev,2 ); + ap->ranges[0 ].size =pci_resource_len (pci_dev,2 ); + + primary = pci_dev->resource[PCI_ROM_RESOURCE ].flags + &IORESOURCE_ROM_SHADOW ; + +remove_conflicting_framebuffers (ap,"virtiodrmfb" , primary); + +kfree (ap); +} +int drm_virtio_init (struct drm_driver *driver,struct virtio_device *vdev) {struct drm_device *dev;
@@ -48,8 +68,16 @@ int drm_virtio_init(struct drm_driver *driver, struct virtio_device *vdev) dev->virtdev = vdev; vdev->priv = dev; -if (strcmp (vdev->dev.parent->bus->name,"pci" ) ==0 ) - dev->pdev =to_pci_dev (vdev->dev.parent); +if (strcmp (vdev->dev.parent->bus->name,"pci" ) ==0 ) { +struct pci_dev *pdev =to_pci_dev (vdev->dev.parent); +bool vga = (pdev->class >>8 ) ==PCI_CLASS_DISPLAY_VGA ; + +DRM_INFO ("pci: %s detected\n" , + vga ?"virtio-vga" :"virtio-gpu-pci" ); + dev->pdev = pdev; +if (vga) +virtio_pci_kick_out_firmware_fb (pdev); + } ret =drm_dev_register (dev,0 );if (ret)
drivers/virtio/virtio_pci_common.c +6 -1
@@ -510,7 +510,12 @@ static int virtio_pci_probe(struct pci_dev *pci_dev, goto err_enable_device; rc =pci_request_regions (pci_dev,"virtio-pci" ); -if (rc) +/* +* virtio-vga: vesafb/efifb might hold vga framebuffer +* resource, but don't fail on that, we'll kick out vesafb +* later on. +*/ +if (rc && ((pci_dev->class >>8 ) !=PCI_CLASS_DISPLAY_VGA )) goto err_request_regions;if (force_legacy) {
Signature · 6 lines
1.8.3.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Michael S. Tsirkin
maintainerRe: [PATCH v2 4/4] Add virtio-vga bits.
drivers/gpu/drm/virtio/virtgpu_drm_bus.c int drm_virtio_set_busid(struct drm_device *dev, struct drm_master *master) · line 50
Quoted 11 lines · Gerd Hoffmann
drivers/gpu/drm/virtio/virtgpu_drm_bus.c +11
-0+static void virtio_pci_kick_out_firmware_fb (struct pci_dev *pci_dev) +{ +struct apertures_struct *ap; +bool primary; + + ap =alloc_apertures (1 ); +if (!ap) +return ; + + ap->ranges[0 ].base =pci_resource_start (pci_dev,2 ); + ap->ranges[0 ].size =pci_resource_len (pci_dev,2 );
I thought you mentioned it's better to switch to a different BAR to be compatible with stdvga?
Signature · 1 line
MST
Michael S. Tsirkin
maintainerRe: [PATCH v2 4/4] Add virtio-vga bits.
In reply to Gerd Hoffmanndrivers/gpu/drm/virtio/virtgpu_drm_bus.c int drm_virtio_set_busid(struct drm_device *dev, struct drm_master *master) · line 50
Quoted 11 lines · Gerd Hoffmann
drivers/gpu/drm/virtio/virtgpu_drm_bus.c +11
-0+static void virtio_pci_kick_out_firmware_fb (struct pci_dev *pci_dev) +{ +struct apertures_struct *ap; +bool primary; + + ap =alloc_apertures (1 ); +if (!ap) +return ; + + ap->ranges[0 ].base =pci_resource_start (pci_dev,2 ); + ap->ranges[0 ].size =pci_resource_len (pci_dev,2 );
I thought you mentioned it's better to switch to a different BAR to be compatible with stdvga?
Signature · 5 lines
MST _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Gerd Hoffmann
maintainerRe: [PATCH v2 4/4] Add virtio-vga bits.
Quoted 15 lines · Michael S. Tsirkin
drivers/gpu/drm/virtio/virtgpu_drm_bus.c int drm_virtio_set_busid(struct drm_device *dev, struct drm_master *master) · line 50
Quoted 11 lines · Gerd Hoffmann
drivers/gpu/drm/virtio/virtgpu_drm_bus.c +11
-0+static void virtio_pci_kick_out_firmware_fb (struct pci_dev *pci_dev) +{ +struct apertures_struct *ap; +bool primary; + + ap =alloc_apertures (1 ); +if (!ap) +return ; + + ap->ranges[0 ].base =pci_resource_start (pci_dev,2 ); + ap->ranges[0 ].size =pci_resource_len (pci_dev,2 );I thought you mentioned it's better to switch to a different BAR to be compatible with stdvga?
Indeed, thats why the cover letter lists this as todo item, because it isn't sorted yet.
Need to figure a sane way to handle this on the host side. Current plan is trying to make virtio_pci_device_plugged() configurable without making things too messy.
cheers,
Gerd