Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 217918
b: refs/heads/master
c: 60fc332
h: refs/heads/master
v: v3
  • Loading branch information
Chris Wilson committed Sep 8, 2010
1 parent ecf827e commit 25430d9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 27 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: 8d74f656dd78ae1ba813389cd46197c6329696bc
refs/heads/master: 60fc332cb5ab19e5a86d696b210df65814b2ad8a
40 changes: 14 additions & 26 deletions trunk/drivers/gpu/drm/i915/intel_overlay.c
Original file line number Diff line number Diff line change
Expand Up @@ -1314,10 +1314,11 @@ int intel_overlay_attrs(struct drm_device *dev, void *data,
mutex_lock(&dev->mode_config.mutex);
mutex_lock(&dev->struct_mutex);

ret = -EINVAL;
if (!(attrs->flags & I915_OVERLAY_UPDATE_ATTRS)) {
attrs->color_key = overlay->color_key;
attrs->color_key = overlay->color_key;
attrs->brightness = overlay->brightness;
attrs->contrast = overlay->contrast;
attrs->contrast = overlay->contrast;
attrs->saturation = overlay->saturation;

if (IS_I9XX(dev)) {
Expand All @@ -1328,29 +1329,18 @@ int intel_overlay_attrs(struct drm_device *dev, void *data,
attrs->gamma4 = I915_READ(OGAMC4);
attrs->gamma5 = I915_READ(OGAMC5);
}
ret = 0;
} else {
overlay->color_key = attrs->color_key;
if (attrs->brightness >= -128 && attrs->brightness <= 127) {
overlay->brightness = attrs->brightness;
} else {
ret = -EINVAL;
if (attrs->brightness < -128 || attrs->brightness > 127)
goto out_unlock;
}

if (attrs->contrast <= 255) {
overlay->contrast = attrs->contrast;
} else {
ret = -EINVAL;
if (attrs->contrast > 255)
goto out_unlock;
}

if (attrs->saturation <= 1023) {
overlay->saturation = attrs->saturation;
} else {
ret = -EINVAL;
if (attrs->saturation > 1023)
goto out_unlock;
}

overlay->color_key = attrs->color_key;
overlay->brightness = attrs->brightness;
overlay->contrast = attrs->contrast;
overlay->saturation = attrs->saturation;

regs = intel_overlay_map_regs(overlay);
if (!regs) {
Expand All @@ -1363,18 +1353,16 @@ int intel_overlay_attrs(struct drm_device *dev, void *data,
intel_overlay_unmap_regs(overlay);

if (attrs->flags & I915_OVERLAY_UPDATE_GAMMA) {
if (!IS_I9XX(dev)) {
ret = -EINVAL;
if (!IS_I9XX(dev))
goto out_unlock;
}

if (overlay->active) {
ret = -EBUSY;
goto out_unlock;
}

ret = check_gamma(attrs);
if (ret != 0)
if (ret)
goto out_unlock;

I915_WRITE(OGAMC0, attrs->gamma0);
Expand All @@ -1384,9 +1372,9 @@ int intel_overlay_attrs(struct drm_device *dev, void *data,
I915_WRITE(OGAMC4, attrs->gamma4);
I915_WRITE(OGAMC5, attrs->gamma5);
}
ret = 0;
}

ret = 0;
out_unlock:
mutex_unlock(&dev->struct_mutex);
mutex_unlock(&dev->mode_config.mutex);
Expand Down

0 comments on commit 25430d9

Please sign in to comment.