summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2008-11-03 09:36:03 +1000
committerDave Airlie <airlied@redhat.com>2008-11-03 09:36:03 +1000
commit563e7e5930a8d628b33cb1f7a9aaea251f2fc50b (patch)
tree064d2f10bbd2b4eb9178cbafd12f0fb680ed5bdd /linux-core
parentfd9e05b3f4f464ddf08097817a3af824f54a97ca (diff)
radeon/drm: fixup ref counting in on fb objs
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/atombios_crtc.c2
-rw-r--r--linux-core/drm_crtc.h1
-rw-r--r--linux-core/drm_crtc_helper.c4
-rw-r--r--linux-core/drm_crtc_helper.h3
-rw-r--r--linux-core/radeon_display.c23
-rw-r--r--linux-core/radeon_fb.c2
-rw-r--r--linux-core/radeon_legacy_crtc.c4
-rw-r--r--linux-core/radeon_mode.h3
-rw-r--r--linux-core/radeon_pm.c8
9 files changed, 26 insertions, 24 deletions
diff --git a/linux-core/atombios_crtc.c b/linux-core/atombios_crtc.c
index 3856f8ca..2e144c90 100644
--- a/linux-core/atombios_crtc.c
+++ b/linux-core/atombios_crtc.c
@@ -276,7 +276,7 @@ void atombios_crtc_set_base(struct drm_crtc *crtc, int x, int y)
radeon_fb = to_radeon_framebuffer(crtc->fb);
- obj = radeon_fb->base.mm_private;
+ obj = radeon_fb->obj;
obj_priv = obj->driver_private;
fb_location = obj_priv->bo->offset + dev_priv->fb_location;
diff --git a/linux-core/drm_crtc.h b/linux-core/drm_crtc.h
index 6a73a71b..13fba4f2 100644
--- a/linux-core/drm_crtc.h
+++ b/linux-core/drm_crtc.h
@@ -240,7 +240,6 @@ struct drm_framebuffer {
void *fbdev;
u32 pseudo_palette[17];
struct list_head filp_head;
- void *mm_private;
};
struct drm_property_blob {
diff --git a/linux-core/drm_crtc_helper.c b/linux-core/drm_crtc_helper.c
index b334f5b5..776a98e1 100644
--- a/linux-core/drm_crtc_helper.c
+++ b/linux-core/drm_crtc_helper.c
@@ -771,15 +771,13 @@ int drm_helper_hotplug_stage_two(struct drm_device *dev)
EXPORT_SYMBOL(drm_helper_hotplug_stage_two);
int drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb,
- struct drm_mode_fb_cmd *mode_cmd,
- void *mm_private)
+ struct drm_mode_fb_cmd *mode_cmd)
{
fb->width = mode_cmd->width;
fb->height = mode_cmd->height;
fb->pitch = mode_cmd->pitch;
fb->bits_per_pixel = mode_cmd->bpp;
fb->depth = mode_cmd->depth;
- fb->mm_private = mm_private;
return 0;
}
diff --git a/linux-core/drm_crtc_helper.h b/linux-core/drm_crtc_helper.h
index 01b14239..c0719157 100644
--- a/linux-core/drm_crtc_helper.h
+++ b/linux-core/drm_crtc_helper.h
@@ -75,8 +75,7 @@ extern bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, struct drm_display_m
extern bool drm_helper_crtc_in_use(struct drm_crtc *crtc);
extern int drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb,
- struct drm_mode_fb_cmd *mode_cmd,
- void *mm_private);
+ struct drm_mode_fb_cmd *mode_cmd);
static inline void drm_crtc_helper_add(struct drm_crtc *crtc, const struct drm_crtc_helper_funcs *funcs)
{
diff --git a/linux-core/radeon_display.c b/linux-core/radeon_display.c
index ddc933cc..679244a9 100644
--- a/linux-core/radeon_display.c
+++ b/linux-core/radeon_display.c
@@ -601,17 +601,18 @@ static void radeon_user_framebuffer_destroy(struct drm_framebuffer *fb)
if (fb->fbdev)
radeonfb_remove(dev, fb);
+ drm_gem_object_unreference(radeon_fb->obj);
drm_framebuffer_cleanup(fb);
kfree(radeon_fb);
}
static int radeon_user_framebuffer_create_handle(struct drm_framebuffer *fb,
- struct drm_file *file_priv,
- unsigned int *handle)
+ struct drm_file *file_priv,
+ unsigned int *handle)
{
- struct drm_gem_object *object = fb->mm_private;
+ struct radeon_framebuffer *radeon_fb = to_radeon_framebuffer(fb);
- return drm_gem_handle_create(file_priv, object, handle);
+ return drm_gem_handle_create(file_priv, radeon_fb->obj, handle);
}
static const struct drm_framebuffer_funcs radeon_fb_funcs = {
@@ -622,7 +623,7 @@ static const struct drm_framebuffer_funcs radeon_fb_funcs = {
struct drm_framebuffer *
radeon_framebuffer_create(struct drm_device *dev,
struct drm_mode_fb_cmd *mode_cmd,
- void *mm_private)
+ struct drm_gem_object *obj)
{
struct radeon_framebuffer *radeon_fb;
@@ -631,7 +632,10 @@ radeon_framebuffer_create(struct drm_device *dev,
return NULL;
drm_framebuffer_init(dev, &radeon_fb->base, &radeon_fb_funcs);
- drm_helper_mode_fill_fb_struct(&radeon_fb->base, mode_cmd, mm_private);
+ drm_helper_mode_fill_fb_struct(&radeon_fb->base, mode_cmd);
+
+ radeon_fb->obj = obj;
+
return &radeon_fb->base;
}
@@ -641,10 +645,11 @@ radeon_user_framebuffer_create(struct drm_device *dev,
struct drm_mode_fb_cmd *mode_cmd)
{
struct radeon_framebuffer *radeon_fb;
- void *mm_private;
+ struct drm_gem_object *obj;
+
+ obj = drm_gem_object_lookup(dev, file_priv, mode_cmd->handle);
- mm_private = drm_gem_object_lookup(dev, file_priv, mode_cmd->handle);
- return radeon_framebuffer_create(dev, mode_cmd, mm_private);
+ return radeon_framebuffer_create(dev, mode_cmd, obj);
}
static const struct drm_mode_config_funcs radeon_mode_funcs = {
diff --git a/linux-core/radeon_fb.c b/linux-core/radeon_fb.c
index 8d4181e8..405f1da9 100644
--- a/linux-core/radeon_fb.c
+++ b/linux-core/radeon_fb.c
@@ -1148,7 +1148,7 @@ int radeonfb_remove(struct drm_device *dev, struct drm_framebuffer *fb)
unregister_framebuffer(info);
drm_bo_kunmap(&radeon_fb->kmap_obj);
mutex_lock(&dev->struct_mutex);
- drm_gem_object_unreference(fb->mm_private);
+ drm_gem_object_unreference(radeon_fb->obj);
mutex_unlock(&dev->struct_mutex);
framebuffer_release(info);
}
diff --git a/linux-core/radeon_legacy_crtc.c b/linux-core/radeon_legacy_crtc.c
index 820bd548..c0a3c0fa 100644
--- a/linux-core/radeon_legacy_crtc.c
+++ b/linux-core/radeon_legacy_crtc.c
@@ -231,7 +231,7 @@ static bool radeon_set_crtc1_base(struct drm_crtc *crtc, int x, int y)
radeon_fb = to_radeon_framebuffer(crtc->fb);
- obj = radeon_fb->base.mm_private;
+ obj = radeon_fb->obj;
obj_priv = obj->driver_private;
crtc_offset = obj_priv->bo->offset;
@@ -654,7 +654,7 @@ static bool radeon_set_crtc2_base(struct drm_crtc *crtc, int x, int y)
radeon_fb = to_radeon_framebuffer(crtc->fb);
- obj = radeon_fb->base.mm_private;
+ obj = radeon_fb->obj;
obj_priv = obj->driver_private;
crtc2_offset = obj_priv->bo->offset;
diff --git a/linux-core/radeon_mode.h b/linux-core/radeon_mode.h
index 64608e35..23de1088 100644
--- a/linux-core/radeon_mode.h
+++ b/linux-core/radeon_mode.h
@@ -255,6 +255,7 @@ struct radeon_connector {
struct radeon_framebuffer {
struct drm_framebuffer base;
struct drm_bo_kmap_obj kmap_obj;
+ struct drm_gem_object *obj;
};
extern struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev,
@@ -323,7 +324,7 @@ extern void radeon_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
u16 blue, int regno);
struct drm_framebuffer *radeon_framebuffer_create(struct drm_device *dev,
struct drm_mode_fb_cmd *mode_cmd,
- void *mm_private);
+ struct drm_gem_object *obj);
int radeonfb_probe(struct drm_device *dev);
diff --git a/linux-core/radeon_pm.c b/linux-core/radeon_pm.c
index db8f44c4..259d42da 100644
--- a/linux-core/radeon_pm.c
+++ b/linux-core/radeon_pm.c
@@ -54,10 +54,10 @@ int radeon_suspend(struct drm_device *dev, pm_message_t state)
if (!radeon_fb)
continue;
- if (!radeon_fb->base.mm_private)
+ if (!radeon_fb->obj)
continue;
- radeon_gem_object_unpin(radeon_fb->base.mm_private);
+ radeon_gem_object_unpin(radeon_fb->obj);
}
if (!(dev_priv->flags & RADEON_IS_IGP))
@@ -175,10 +175,10 @@ int radeon_resume(struct drm_device *dev)
if (!radeon_fb)
continue;
- if (!radeon_fb->base.mm_private)
+ if (!radeon_fb->obj)
continue;
- radeon_gem_object_pin(radeon_fb->base.mm_private,
+ radeon_gem_object_pin(radeon_fb->obj,
PAGE_SIZE, RADEON_GEM_DOMAIN_VRAM);
}
/* blat the mode back in */