diff options
author | Dave Airlie <airlied@redhat.com> | 2011-12-21 15:23:44 +0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-05-23 13:46:05 +0400 |
commit | 96503f592fd729f296f5870a57be0417eeffc92a (patch) | |
tree | f83af0f69cd4ca5023d44c7706ee4459918499b2 /drivers/gpu/drm/udl/udl_fb.c | |
parent | 0ff926c7d4f06f9703226dc09acad17e86f169d6 (diff) | |
download | linux-96503f592fd729f296f5870a57be0417eeffc92a.tar.xz |
udl: add prime fd->handle support.
udl can only be used as an output offload so doesn't need to support
handle->fd direction.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/udl/udl_fb.c')
-rw-r--r-- | drivers/gpu/drm/udl/udl_fb.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c index 4d9c3a5d8a45..a029ee39b0c5 100644 --- a/drivers/gpu/drm/udl/udl_fb.c +++ b/drivers/gpu/drm/udl/udl_fb.c @@ -593,11 +593,20 @@ udl_fb_user_fb_create(struct drm_device *dev, struct drm_gem_object *obj; struct udl_framebuffer *ufb; int ret; + uint32_t size; obj = drm_gem_object_lookup(dev, file, mode_cmd->handles[0]); if (obj == NULL) return ERR_PTR(-ENOENT); + size = mode_cmd->pitches[0] * mode_cmd->height; + size = ALIGN(size, PAGE_SIZE); + + if (size > obj->size) { + DRM_ERROR("object size not sufficient for fb %d %zu %d %d\n", size, obj->size, mode_cmd->pitches[0], mode_cmd->height); + return ERR_PTR(-ENOMEM); + } + ufb = kzalloc(sizeof(*ufb), GFP_KERNEL); if (ufb == NULL) return ERR_PTR(-ENOMEM); |