radeon/drm: fixup ref counting in on fb objs
parent
fd9e05b3f4
commit
563e7e5930
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
||||
mm_private = drm_gem_object_lookup(dev, file_priv, mode_cmd->handle);
|
||||
return radeon_framebuffer_create(dev, mode_cmd, mm_private);
|
||||
obj = drm_gem_object_lookup(dev, file_priv, mode_cmd->handle);
|
||||
|
||||
return radeon_framebuffer_create(dev, mode_cmd, obj);
|
||||
}
|
||||
|
||||
static const struct drm_mode_config_funcs radeon_mode_funcs = {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue