[PATCH 2/4] nouveau: Add stubs for reserving old framebuffers

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

 



Add core support for allocating buffer objects that cover the existing
framebuffers at startup.

Signed-off-by: Matthew Garrett <mjg@xxxxxxxxxx>
---
 drivers/gpu/drm/nouveau/nouveau_drv.h   |    2 ++
 drivers/gpu/drm/nouveau/nouveau_mem.c   |    4 ++++
 drivers/gpu/drm/nouveau/nouveau_state.c |    9 ++++++++-
 3 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
index ab4c071..3186545 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -400,6 +400,7 @@ struct nouveau_display_engine {
 	void (*destroy)(struct drm_device *);
 	int (*init)(struct drm_device *);
 	void (*fini)(struct drm_device *);
+	void (*reserve_fbs)(struct drm_device *);
 
 	struct drm_property *dithering_mode;
 	struct drm_property *dithering_depth;
@@ -729,6 +730,7 @@ struct drm_nouveau_private {
 	struct list_head classes;
 
 	struct nouveau_bo *vga_ram;
+	struct nouveau_bo *old_fb[2];
 
 	/* interrupt handling */
 	void (*irq_handler[32])(struct drm_device *);
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c
index 1c510ef..7961331 100644
--- a/drivers/gpu/drm/nouveau/nouveau_mem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_mem.c
@@ -339,6 +339,7 @@ nouveau_mem_vram_init(struct drm_device *dev)
 	struct drm_nouveau_private *dev_priv = dev->dev_private;
 	struct ttm_bo_device *bdev = &dev_priv->ttm.bdev;
 	const struct vram_types *vram_type;
+	struct nouveau_engine *engine = &dev_priv->engine;
 	int ret, dma_bits;
 
 	dma_bits = 32;
@@ -426,6 +427,9 @@ nouveau_mem_vram_init(struct drm_device *dev)
 		}
 	}
 
+	if (engine->display.reserve_fbs)
+		engine->display.reserve_fbs(dev);
+
 	dev_priv->fb_mtrr = drm_mtrr_add(pci_resource_start(dev->pdev, 1),
 					 pci_resource_len(dev->pdev, 1),
 					 DRM_MTRR_WC);
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c
index 1e04305..aff3b8d 100644
--- a/drivers/gpu/drm/nouveau/nouveau_state.c
+++ b/drivers/gpu/drm/nouveau/nouveau_state.c
@@ -557,7 +557,7 @@ nouveau_card_init(struct drm_device *dev)
 {
 	struct drm_nouveau_private *dev_priv = dev->dev_private;
 	struct nouveau_engine *engine;
-	int ret, e = 0;
+	int ret, i, e = 0;
 
 	vga_client_register(dev->pdev, dev, NULL, nouveau_vga_set_decode);
 	vga_switcheroo_register_client(dev->pdev, nouveau_switcheroo_set_state,
@@ -759,6 +759,13 @@ nouveau_card_init(struct drm_device *dev)
 		nouveau_fbcon_init(dev);
 	}
 
+	for (i = 0; i < 2; i++) {
+		if (dev_priv->old_fb[i]) {
+			nouveau_bo_unpin(dev_priv->old_fb[i]);
+			nouveau_bo_ref(NULL, &dev_priv->old_fb[i]);
+		}
+	}
+
 	return 0;
 
 out_chan:
-- 
1.7.7.6

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux