Commit 84c862b5 authored by Thomas Zimmermann's avatar Thomas Zimmermann Committed by Ben Skeggs

drm/nouveau/kms: Move struct nouveau_framebuffer.vma to struct nouveau_fbdev

The vma field of struct nouveau_framebuffer is a special field for the
the accelerated fbdev console. Hence there's at most one single instance
for the active console. Moving it into struct nouveau_fbdev makes struct
nouveau_framebuffer slightly smaller and brings it closer to struct
drm_framebuffer.
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent e27ad35e
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
struct nouveau_framebuffer { struct nouveau_framebuffer {
struct drm_framebuffer base; struct drm_framebuffer base;
struct nouveau_bo *nvbo; struct nouveau_bo *nvbo;
struct nouveau_vma *vma;
}; };
static inline struct nouveau_framebuffer * static inline struct nouveau_framebuffer *
......
...@@ -353,7 +353,7 @@ nouveau_fbcon_create(struct drm_fb_helper *helper, ...@@ -353,7 +353,7 @@ nouveau_fbcon_create(struct drm_fb_helper *helper,
chan = nouveau_nofbaccel ? NULL : drm->channel; chan = nouveau_nofbaccel ? NULL : drm->channel;
if (chan && device->info.family >= NV_DEVICE_INFO_V0_TESLA) { if (chan && device->info.family >= NV_DEVICE_INFO_V0_TESLA) {
ret = nouveau_vma_new(nvbo, chan->vmm, &fb->vma); ret = nouveau_vma_new(nvbo, chan->vmm, &fbcon->vma);
if (ret) { if (ret) {
NV_ERROR(drm, "failed to map fb into chan: %d\n", ret); NV_ERROR(drm, "failed to map fb into chan: %d\n", ret);
chan = NULL; chan = NULL;
...@@ -400,7 +400,7 @@ nouveau_fbcon_create(struct drm_fb_helper *helper, ...@@ -400,7 +400,7 @@ nouveau_fbcon_create(struct drm_fb_helper *helper,
out_unlock: out_unlock:
if (chan) if (chan)
nouveau_vma_del(&fb->vma); nouveau_vma_del(&fbcon->vma);
nouveau_bo_unmap(fb->nvbo); nouveau_bo_unmap(fb->nvbo);
out_unpin: out_unpin:
nouveau_bo_unpin(fb->nvbo); nouveau_bo_unpin(fb->nvbo);
...@@ -419,7 +419,7 @@ nouveau_fbcon_destroy(struct drm_device *dev, struct nouveau_fbdev *fbcon) ...@@ -419,7 +419,7 @@ nouveau_fbcon_destroy(struct drm_device *dev, struct nouveau_fbdev *fbcon)
drm_fb_helper_fini(&fbcon->helper); drm_fb_helper_fini(&fbcon->helper);
if (nouveau_fb && nouveau_fb->nvbo) { if (nouveau_fb && nouveau_fb->nvbo) {
nouveau_vma_del(&nouveau_fb->vma); nouveau_vma_del(&fbcon->vma);
nouveau_bo_unmap(nouveau_fb->nvbo); nouveau_bo_unmap(nouveau_fb->nvbo);
nouveau_bo_unpin(nouveau_fb->nvbo); nouveau_bo_unpin(nouveau_fb->nvbo);
drm_framebuffer_put(&nouveau_fb->base); drm_framebuffer_put(&nouveau_fb->base);
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#include "nouveau_display.h" #include "nouveau_display.h"
struct nouveau_vma;
struct nouveau_fbdev { struct nouveau_fbdev {
struct drm_fb_helper helper; /* must be first */ struct drm_fb_helper helper; /* must be first */
unsigned int saved_flags; unsigned int saved_flags;
...@@ -41,6 +43,7 @@ struct nouveau_fbdev { ...@@ -41,6 +43,7 @@ struct nouveau_fbdev {
struct nvif_object gdi; struct nvif_object gdi;
struct nvif_object blit; struct nvif_object blit;
struct nvif_object twod; struct nvif_object twod;
struct nouveau_vma *vma;
struct mutex hotplug_lock; struct mutex hotplug_lock;
bool hotplug_waiting; bool hotplug_waiting;
......
...@@ -149,7 +149,6 @@ int ...@@ -149,7 +149,6 @@ int
nv50_fbcon_accel_init(struct fb_info *info) nv50_fbcon_accel_init(struct fb_info *info)
{ {
struct nouveau_fbdev *nfbdev = info->par; struct nouveau_fbdev *nfbdev = info->par;
struct nouveau_framebuffer *fb = nouveau_framebuffer(nfbdev->helper.fb);
struct drm_device *dev = nfbdev->helper.dev; struct drm_device *dev = nfbdev->helper.dev;
struct nouveau_drm *drm = nouveau_drm(dev); struct nouveau_drm *drm = nouveau_drm(dev);
struct nouveau_channel *chan = drm->channel; struct nouveau_channel *chan = drm->channel;
...@@ -240,8 +239,8 @@ nv50_fbcon_accel_init(struct fb_info *info) ...@@ -240,8 +239,8 @@ nv50_fbcon_accel_init(struct fb_info *info)
OUT_RING(chan, info->fix.line_length); OUT_RING(chan, info->fix.line_length);
OUT_RING(chan, info->var.xres_virtual); OUT_RING(chan, info->var.xres_virtual);
OUT_RING(chan, info->var.yres_virtual); OUT_RING(chan, info->var.yres_virtual);
OUT_RING(chan, upper_32_bits(fb->vma->addr)); OUT_RING(chan, upper_32_bits(nfbdev->vma->addr));
OUT_RING(chan, lower_32_bits(fb->vma->addr)); OUT_RING(chan, lower_32_bits(nfbdev->vma->addr));
BEGIN_NV04(chan, NvSub2D, 0x0230, 2); BEGIN_NV04(chan, NvSub2D, 0x0230, 2);
OUT_RING(chan, format); OUT_RING(chan, format);
OUT_RING(chan, 1); OUT_RING(chan, 1);
...@@ -249,8 +248,8 @@ nv50_fbcon_accel_init(struct fb_info *info) ...@@ -249,8 +248,8 @@ nv50_fbcon_accel_init(struct fb_info *info)
OUT_RING(chan, info->fix.line_length); OUT_RING(chan, info->fix.line_length);
OUT_RING(chan, info->var.xres_virtual); OUT_RING(chan, info->var.xres_virtual);
OUT_RING(chan, info->var.yres_virtual); OUT_RING(chan, info->var.yres_virtual);
OUT_RING(chan, upper_32_bits(fb->vma->addr)); OUT_RING(chan, upper_32_bits(nfbdev->vma->addr));
OUT_RING(chan, lower_32_bits(fb->vma->addr)); OUT_RING(chan, lower_32_bits(nfbdev->vma->addr));
FIRE_RING(chan); FIRE_RING(chan);
return 0; return 0;
......
...@@ -150,7 +150,6 @@ nvc0_fbcon_accel_init(struct fb_info *info) ...@@ -150,7 +150,6 @@ nvc0_fbcon_accel_init(struct fb_info *info)
{ {
struct nouveau_fbdev *nfbdev = info->par; struct nouveau_fbdev *nfbdev = info->par;
struct drm_device *dev = nfbdev->helper.dev; struct drm_device *dev = nfbdev->helper.dev;
struct nouveau_framebuffer *fb = nouveau_framebuffer(nfbdev->helper.fb);
struct nouveau_drm *drm = nouveau_drm(dev); struct nouveau_drm *drm = nouveau_drm(dev);
struct nouveau_channel *chan = drm->channel; struct nouveau_channel *chan = drm->channel;
int ret, format; int ret, format;
...@@ -240,8 +239,8 @@ nvc0_fbcon_accel_init(struct fb_info *info) ...@@ -240,8 +239,8 @@ nvc0_fbcon_accel_init(struct fb_info *info)
OUT_RING (chan, info->fix.line_length); OUT_RING (chan, info->fix.line_length);
OUT_RING (chan, info->var.xres_virtual); OUT_RING (chan, info->var.xres_virtual);
OUT_RING (chan, info->var.yres_virtual); OUT_RING (chan, info->var.yres_virtual);
OUT_RING (chan, upper_32_bits(fb->vma->addr)); OUT_RING (chan, upper_32_bits(nfbdev->vma->addr));
OUT_RING (chan, lower_32_bits(fb->vma->addr)); OUT_RING (chan, lower_32_bits(nfbdev->vma->addr));
BEGIN_NVC0(chan, NvSub2D, 0x0230, 10); BEGIN_NVC0(chan, NvSub2D, 0x0230, 10);
OUT_RING (chan, format); OUT_RING (chan, format);
OUT_RING (chan, 1); OUT_RING (chan, 1);
...@@ -251,8 +250,8 @@ nvc0_fbcon_accel_init(struct fb_info *info) ...@@ -251,8 +250,8 @@ nvc0_fbcon_accel_init(struct fb_info *info)
OUT_RING (chan, info->fix.line_length); OUT_RING (chan, info->fix.line_length);
OUT_RING (chan, info->var.xres_virtual); OUT_RING (chan, info->var.xres_virtual);
OUT_RING (chan, info->var.yres_virtual); OUT_RING (chan, info->var.yres_virtual);
OUT_RING (chan, upper_32_bits(fb->vma->addr)); OUT_RING (chan, upper_32_bits(nfbdev->vma->addr));
OUT_RING (chan, lower_32_bits(fb->vma->addr)); OUT_RING (chan, lower_32_bits(nfbdev->vma->addr));
FIRE_RING (chan); FIRE_RING (chan);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment