Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 217923
b: refs/heads/master
c: 9f7c3f4
h: refs/heads/master
i:
  217921: 2962917
  217919: 699dbe4
v: v3
  • Loading branch information
Chris Wilson committed Sep 8, 2010
1 parent bb78262 commit e55cc75
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 446d2183af68c0fd2772f5ef97a033efe69904a5
refs/heads/master: 9f7c3f442bb7c0d0a0ed25cc287932450a1f2bab
28 changes: 16 additions & 12 deletions trunk/drivers/gpu/drm/i915/intel_overlay.c
Original file line number Diff line number Diff line change
Expand Up @@ -989,38 +989,40 @@ static int check_overlay_src(struct drm_device *dev,
struct drm_intel_overlay_put_image *rec,
struct drm_gem_object *new_bo)
{
u32 stride_mask;
int depth;
int uv_hscale = uv_hsubsampling(rec->flags);
int uv_vscale = uv_vsubsampling(rec->flags);
size_t tmp;
u32 stride_mask, depth, tmp;

/* check src dimensions */
if (IS_845G(dev) || IS_I830(dev)) {
if (rec->src_height > IMAGE_MAX_HEIGHT_LEGACY ||
rec->src_width > IMAGE_MAX_WIDTH_LEGACY)
rec->src_width > IMAGE_MAX_WIDTH_LEGACY)
return -EINVAL;
} else {
if (rec->src_height > IMAGE_MAX_HEIGHT ||
rec->src_width > IMAGE_MAX_WIDTH)
rec->src_width > IMAGE_MAX_WIDTH)
return -EINVAL;
}

/* better safe than sorry, use 4 as the maximal subsampling ratio */
if (rec->src_height < N_VERT_Y_TAPS*4 ||
rec->src_width < N_HORIZ_Y_TAPS*4)
rec->src_width < N_HORIZ_Y_TAPS*4)
return -EINVAL;

/* check alignment constraints */
switch (rec->flags & I915_OVERLAY_TYPE_MASK) {
case I915_OVERLAY_RGB:
/* not implemented */
return -EINVAL;

case I915_OVERLAY_YUV_PACKED:
depth = packed_depth_bytes(rec->flags);
if (uv_vscale != 1)
return -EINVAL;

depth = packed_depth_bytes(rec->flags);
if (depth < 0)
return depth;

/* ignore UV planes */
rec->stride_UV = 0;
rec->offset_U = 0;
Expand All @@ -1029,11 +1031,13 @@ static int check_overlay_src(struct drm_device *dev,
if (rec->offset_Y % depth)
return -EINVAL;
break;

case I915_OVERLAY_YUV_PLANAR:
if (uv_vscale < 0 || uv_hscale < 0)
return -EINVAL;
/* no offset restrictions for planar formats */
break;

default:
return -EINVAL;
}
Expand All @@ -1053,8 +1057,8 @@ static int check_overlay_src(struct drm_device *dev,
return -EINVAL;

tmp = (rec->flags & I915_OVERLAY_TYPE_MASK) == I915_OVERLAY_YUV_PLANAR ?
4 : 8;
if (rec->stride_Y > tmp*1024 || rec->stride_UV > 2*1024)
4096 : 8192;
if (rec->stride_Y > tmp || rec->stride_UV > 2*1024)
return -EINVAL;

/* check buffer dimensions */
Expand All @@ -1076,11 +1080,11 @@ static int check_overlay_src(struct drm_device *dev,
if (rec->src_width/uv_hscale > rec->stride_UV)
return -EINVAL;

tmp = rec->stride_Y*rec->src_height;
tmp = rec->stride_Y * rec->src_height;
if (rec->offset_Y + tmp > new_bo->size)
return -EINVAL;
tmp = rec->stride_UV*rec->src_height;
tmp /= uv_vscale;

tmp = rec->stride_UV * (rec->src_height / uv_vscale);
if (rec->offset_U + tmp > new_bo->size ||
rec->offset_V + tmp > new_bo->size)
return -EINVAL;
Expand Down

0 comments on commit e55cc75

Please sign in to comment.