소스 검색

bochs: ignore device if there isn't enougth memory

The qemu stdvga can be configured with a wide range of video memory,
from 1 MB to 256 MB (default is 16 MB).  In case it is configured
with only 1 or 2 MB it isn't really usable with bochsdrm, due to
depths other than 32bpp not being supported so that isn't enough
memory for a reasonable sized framebuffer.  So skip the device
and let vgacon or vesafb+fbcon handle the it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Gerd Hoffmann 10 년 전
부모
커밋
de59576293
1개의 변경된 파일7개의 추가작업 그리고 0개의 파일을 삭제
  1. 7 0
      drivers/gpu/drm/bochs/bochs_drv.c

+ 7 - 0
drivers/gpu/drm/bochs/bochs_drv.c

@@ -162,8 +162,15 @@ static int bochs_kick_out_firmware_fb(struct pci_dev *pdev)
 static int bochs_pci_probe(struct pci_dev *pdev,
 static int bochs_pci_probe(struct pci_dev *pdev,
 			   const struct pci_device_id *ent)
 			   const struct pci_device_id *ent)
 {
 {
+	unsigned long fbsize;
 	int ret;
 	int ret;
 
 
+	fbsize = pci_resource_len(pdev, 0);
+	if (fbsize < 4 * 1024 * 1024) {
+		DRM_ERROR("less than 4 MB video memory, ignoring device\n");
+		return -ENOMEM;
+	}
+
 	ret = bochs_kick_out_firmware_fb(pdev);
 	ret = bochs_kick_out_firmware_fb(pdev);
 	if (ret)
 	if (ret)
 		return ret;
 		return ret;