mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-04 10:56:06 -04:00
drm/radeon: Improve fbdev object-test helper
Look up the framebuffer GEM object in fbdev object test with the respective helper drm_gem_fb_get_obj(). The look-up helper warns if no GEM object has been installed. Upcasting types prevents runtime type checking, so avoid upcast to struct radeon_bo. Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
f04b8af5e9
commit
276f7b4bd5
@@ -35,6 +35,7 @@
|
||||
#include <drm/drm_fb_helper.h>
|
||||
#include <drm/drm_fourcc.h>
|
||||
#include <drm/drm_framebuffer.h>
|
||||
#include <drm/drm_gem_framebuffer_helper.h>
|
||||
#include <drm/radeon_drm.h>
|
||||
|
||||
#include "radeon.h"
|
||||
@@ -366,10 +367,17 @@ void radeon_fbdev_set_suspend(struct radeon_device *rdev, int state)
|
||||
|
||||
bool radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo *robj)
|
||||
{
|
||||
if (!rdev->mode_info.rfbdev)
|
||||
struct drm_fb_helper *fb_helper = rdev->ddev->fb_helper;
|
||||
struct drm_gem_object *gobj;
|
||||
|
||||
if (!fb_helper)
|
||||
return false;
|
||||
|
||||
if (robj == gem_to_radeon_bo(rdev->mode_info.rfbdev->fb.obj[0]))
|
||||
return true;
|
||||
return false;
|
||||
gobj = drm_gem_fb_get_obj(fb_helper->fb, 0);
|
||||
if (!gobj)
|
||||
return false;
|
||||
if (gobj != &robj->tbo.base)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user