summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
authorJesse Barnes <jbarnes@nietzche.virtuousgeek.org>2008-04-08 12:48:41 -0700
committerJesse Barnes <jbarnes@nietzche.virtuousgeek.org>2008-04-08 12:48:41 -0700
commite3c7a0fcb0122400e5b5035125ad4fa88599f28a (patch)
tree03d8d134df6037eea33cc29a9705f311cfbc667d /linux-core
parenta2edd07f20df67e741026097c5d46f12296d7c9d (diff)
parent779e826c1e2c127f4950c78a56cc314c43b7eb56 (diff)
Merge branch 'modesetting-101' of ssh://git.freedesktop.org/git/mesa/drm into modesetting-101
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/Makefile.kernel3
l---------linux-core/amd.h1
l---------linux-core/amd_cbuffer.h1
l---------linux-core/amd_legacy.h1
l---------linux-core/amd_legacy_cbuffer.c1
-rw-r--r--linux-core/radeon_ms_fb.c53
6 files changed, 35 insertions, 25 deletions
diff --git a/linux-core/Makefile.kernel b/linux-core/Makefile.kernel
index ad62eff4..91decfc8 100644
--- a/linux-core/Makefile.kernel
+++ b/linux-core/Makefile.kernel
@@ -40,7 +40,8 @@ radeon_ms-objs := radeon_ms_drv.o radeon_ms_drm.o radeon_ms_family.o \
radeon_ms_cp.o radeon_ms_cp_mc.o radeon_ms_i2c.o \
radeon_ms_output.o radeon_ms_crtc.o radeon_ms_fb.o \
radeon_ms_exec.o radeon_ms_gpu.o radeon_ms_dac.o \
- radeon_ms_properties.o radeon_ms_rom.o radeon_ms_combios.o
+ radeon_ms_properties.o radeon_ms_rom.o radeon_ms_combios.o \
+ amd_legacy_cbuffer.o
sis-objs := sis_drv.o sis_mm.o
ffb-objs := ffb_drv.o ffb_context.o
savage-objs := savage_drv.o savage_bci.o savage_state.o
diff --git a/linux-core/amd.h b/linux-core/amd.h
new file mode 120000
index 00000000..b4882447
--- /dev/null
+++ b/linux-core/amd.h
@@ -0,0 +1 @@
+../shared-core/amd.h \ No newline at end of file
diff --git a/linux-core/amd_cbuffer.h b/linux-core/amd_cbuffer.h
deleted file mode 120000
index 780b9d8f..00000000
--- a/linux-core/amd_cbuffer.h
+++ /dev/null
@@ -1 +0,0 @@
-../shared-core/amd_cbuffer.h \ No newline at end of file
diff --git a/linux-core/amd_legacy.h b/linux-core/amd_legacy.h
new file mode 120000
index 00000000..1a7786fc
--- /dev/null
+++ b/linux-core/amd_legacy.h
@@ -0,0 +1 @@
+../shared-core/amd_legacy.h \ No newline at end of file
diff --git a/linux-core/amd_legacy_cbuffer.c b/linux-core/amd_legacy_cbuffer.c
new file mode 120000
index 00000000..eab329b5
--- /dev/null
+++ b/linux-core/amd_legacy_cbuffer.c
@@ -0,0 +1 @@
+../shared-core/amd_legacy_cbuffer.c \ No newline at end of file
diff --git a/linux-core/radeon_ms_fb.c b/linux-core/radeon_ms_fb.c
index a8fba712..dbbddaf4 100644
--- a/linux-core/radeon_ms_fb.c
+++ b/linux-core/radeon_ms_fb.c
@@ -40,19 +40,15 @@
#include "drm.h"
#include "drm_crtc.h"
#include "radeon_ms.h"
+#include "amd.h"
-struct radeonfb_par {
- struct drm_device *dev;
- struct drm_crtc *crtc;
- struct drm_display_mode *fb_mode;
-};
static int radeonfb_setcolreg(unsigned regno, unsigned red,
unsigned green, unsigned blue,
unsigned transp, struct fb_info *info)
{
- struct radeonfb_par *par = info->par;
- struct drm_framebuffer *fb = par->crtc->fb;
+ struct amd_fb *par = info->par;
+ struct drm_framebuffer *fb = par->fb;
struct drm_crtc *crtc = par->crtc;
if (regno > 255) {
@@ -87,8 +83,8 @@ static int radeonfb_setcolreg(unsigned regno, unsigned red,
static int radeonfb_check_var(struct fb_var_screeninfo *var,
struct fb_info *info)
{
- struct radeonfb_par *par = info->par;
- struct drm_framebuffer *fb = par->crtc->fb;
+ struct amd_fb *par = info->par;
+ struct drm_framebuffer *fb = par->fb;
if (!var->pixclock)
return -EINVAL;
@@ -176,8 +172,8 @@ static bool radeonfb_mode_equal(struct drm_display_mode *mode1,
static int radeonfb_set_par(struct fb_info *info)
{
- struct radeonfb_par *par = info->par;
- struct drm_framebuffer *fb = par->crtc->fb;
+ struct amd_fb *par = info->par;
+ struct drm_framebuffer *fb = par->fb;
struct drm_device *dev = par->dev;
struct drm_display_mode *drm_mode, *search_mode;
struct drm_output *output;
@@ -247,7 +243,9 @@ static int radeonfb_set_par(struct fb_info *info)
}
if (par->crtc->enabled) {
- if (!drm_mode_equal(&par->crtc->mode, drm_mode)) {
+ if (!drm_mode_equal(&par->crtc->mode, drm_mode) ||
+ par->crtc->fb != par->fb) {
+ par->crtc->fb = par->fb;
if (!drm_crtc_set_mode(par->crtc, drm_mode, 0, 0)) {
return -EINVAL;
}
@@ -274,14 +272,15 @@ static struct fb_ops radeonfb_ops = {
int radeonfb_probe(struct drm_device *dev, struct drm_crtc *crtc)
{
+ struct drm_radeon_private *dev_priv = dev->dev_private;
struct fb_info *info;
- struct radeonfb_par *par;
+ struct amd_fb *par;
struct device *device = &dev->pdev->dev;
struct drm_framebuffer *fb;
struct drm_display_mode *mode = crtc->desired_mode;
int ret;
- info = framebuffer_alloc(sizeof(struct radeonfb_par), device);
+ info = framebuffer_alloc(sizeof(struct amd_fb), device);
if (!info){
DRM_INFO("[radeon_ms] framebuffer_alloc failed\n");
return -EINVAL;
@@ -324,8 +323,10 @@ int radeonfb_probe(struct drm_device *dev, struct drm_crtc *crtc)
fb->fbdev = info;
par = info->par;
+ dev_priv->fb = par;
par->dev = dev;
par->crtc = crtc;
+ par->fb = fb;
info->fbops = &radeonfb_ops;
strcpy(info->fix.id, "radeonfb");
info->fix.type = FB_TYPE_PACKED_PIXELS;
@@ -439,16 +440,22 @@ EXPORT_SYMBOL(radeonfb_probe);
int radeonfb_remove(struct drm_device *dev, struct drm_crtc *crtc)
{
- struct drm_framebuffer *fb = crtc->fb;
- struct fb_info *info = fb->fbdev;
-
- if (info) {
- unregister_framebuffer(info);
- drm_bo_kunmap(&fb->kmap);
- drm_bo_usage_deref_unlocked(&fb->bo);
- drm_framebuffer_destroy(fb);
- framebuffer_release(info);
+ struct drm_radeon_private *dev_priv = dev->dev_private;
+ struct amd_fb *fb = dev_priv->fb;
+ struct fb_info *info;
+
+ if (fb == NULL || fb->fb == NULL || fb->fb->fbdev == NULL) {
+ DRM_INFO("[radeon_ms] %s: no crtc, or fb or fbdev\n",
+ __func__);
+ return 0;
}
+ info = fb->fb->fbdev;
+ unregister_framebuffer(info);
+ drm_bo_kunmap(&fb->fb->kmap);
+ drm_bo_usage_deref_unlocked(&fb->fb->bo);
+ drm_framebuffer_destroy(fb->fb);
+ framebuffer_release(info);
+ dev_priv->fb = NULL;
return 0;
}
EXPORT_SYMBOL(radeonfb_remove);