diff options
author | Dave Airlie <airlied@redhat.com> | 2011-12-21 06:23:44 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-05-23 05:46:05 -0400 |
commit | 96503f592fd729f296f5870a57be0417eeffc92a (patch) | |
tree | f83af0f69cd4ca5023d44c7706ee4459918499b2 /drivers/gpu/drm/udl/udl_fb.c | |
parent | 0ff926c7d4f06f9703226dc09acad17e86f169d6 (diff) |
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, | |||
593 | struct drm_gem_object *obj; | 593 | struct drm_gem_object *obj; |
594 | struct udl_framebuffer *ufb; | 594 | struct udl_framebuffer *ufb; |
595 | int ret; | 595 | int ret; |
596 | uint32_t size; | ||
596 | 597 | ||
597 | obj = drm_gem_object_lookup(dev, file, mode_cmd->handles[0]); | 598 | obj = drm_gem_object_lookup(dev, file, mode_cmd->handles[0]); |
598 | if (obj == NULL) | 599 | if (obj == NULL) |
599 | return ERR_PTR(-ENOENT); | 600 | return ERR_PTR(-ENOENT); |
600 | 601 | ||
602 | size = mode_cmd->pitches[0] * mode_cmd->height; | ||
603 | size = ALIGN(size, PAGE_SIZE); | ||
604 | |||
605 | if (size > obj->size) { | ||
606 | DRM_ERROR("object size not sufficient for fb %d %zu %d %d\n", size, obj->size, mode_cmd->pitches[0], mode_cmd->height); | ||
607 | return ERR_PTR(-ENOMEM); | ||
608 | } | ||
609 | |||
601 | ufb = kzalloc(sizeof(*ufb), GFP_KERNEL); | 610 | ufb = kzalloc(sizeof(*ufb), GFP_KERNEL); |
602 | if (ufb == NULL) | 611 | if (ufb == NULL) |
603 | return ERR_PTR(-ENOMEM); | 612 | return ERR_PTR(-ENOMEM); |