Commit 722506f0 authored by Chris Wilson's avatar Chris Wilson

drm/i915/overlay: Whitespace

Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 4fc6ee76
......@@ -291,7 +291,7 @@ extern void intel_setup_overlay(struct drm_device *dev);
extern void intel_cleanup_overlay(struct drm_device *dev);
extern int intel_overlay_switch_off(struct intel_overlay *overlay);
extern int intel_overlay_recover_from_interrupt(struct intel_overlay *overlay,
int interruptible);
bool interruptible);
extern int intel_overlay_put_image(struct drm_device *dev, void *data,
struct drm_file *file_priv);
extern int intel_overlay_attrs(struct drm_device *dev, void *data,
......
......@@ -176,7 +176,6 @@ struct overlay_registers {
#define OVERLAY_NONPHYSICAL(dev) (IS_G33(dev) || IS_I965G(dev))
#define OVERLAY_EXISTS(dev) (!IS_G4X(dev) && !IS_IRONLAKE(dev) && !IS_GEN6(dev))
static struct overlay_registers *intel_overlay_map_regs_atomic(struct intel_overlay *overlay)
{
drm_i915_private_t *dev_priv = overlay->dev->dev_private;
......@@ -235,7 +234,8 @@ static int intel_overlay_on(struct intel_overlay *overlay)
return -ENOMEM;
ret = i915_do_wait_request(dev,
overlay->last_flip_req, 1, &dev_priv->render_ring);
overlay->last_flip_req, true,
&dev_priv->render_ring);
if (ret != 0)
return ret;
......@@ -280,8 +280,9 @@ static int intel_overlay_wait_flip(struct intel_overlay *overlay)
u32 tmp;
if (overlay->last_flip_req != 0) {
ret = i915_do_wait_request(dev, overlay->last_flip_req,
1, &dev_priv->render_ring);
ret = i915_do_wait_request(dev,
overlay->last_flip_req, true,
&dev_priv->render_ring);
if (ret == 0) {
overlay->last_flip_req = 0;
......@@ -305,8 +306,9 @@ static int intel_overlay_wait_flip(struct intel_overlay *overlay)
if (overlay->last_flip_req == 0)
return -ENOMEM;
ret = i915_do_wait_request(dev, overlay->last_flip_req,
1, &dev_priv->render_ring);
ret = i915_do_wait_request(dev,
overlay->last_flip_req, true,
&dev_priv->render_ring);
if (ret != 0)
return ret;
......@@ -346,8 +348,9 @@ static int intel_overlay_off(struct intel_overlay *overlay)
if (overlay->last_flip_req == 0)
return -ENOMEM;
ret = i915_do_wait_request(dev, overlay->last_flip_req,
1, &dev_priv->render_ring);
ret = i915_do_wait_request(dev,
overlay->last_flip_req, true,
&dev_priv->render_ring);
if (ret != 0)
return ret;
......@@ -366,8 +369,9 @@ static int intel_overlay_off(struct intel_overlay *overlay)
if (overlay->last_flip_req == 0)
return -ENOMEM;
ret = i915_do_wait_request(dev, overlay->last_flip_req,
1, &dev_priv->render_ring);
ret = i915_do_wait_request(dev,
overlay->last_flip_req, true,
&dev_priv->render_ring);
if (ret != 0)
return ret;
......@@ -396,7 +400,7 @@ static void intel_overlay_off_tail(struct intel_overlay *overlay)
/* recover from an interruption due to a signal
* We have to be careful not to repeat work forever an make forward progess. */
int intel_overlay_recover_from_interrupt(struct intel_overlay *overlay,
int interruptible)
bool interruptible)
{
struct drm_device *dev = overlay->dev;
struct drm_gem_object *obj;
......@@ -446,7 +450,8 @@ int intel_overlay_recover_from_interrupt(struct intel_overlay *overlay,
return -ENOMEM;
ret = i915_do_wait_request(dev, overlay->last_flip_req,
interruptible, &dev_priv->render_ring);
interruptible,
&dev_priv->render_ring);
if (ret != 0)
return ret;
......@@ -588,7 +593,9 @@ static const u16 y_static_hcoeffs[N_HORIZ_Y_TAPS * N_PHASES] = {
0x3020, 0xb340, 0x1fb8, 0x34a0, 0xb060,
0x3020, 0xb240, 0x1fe0, 0x32e0, 0xb040,
0x3020, 0xb140, 0x1ff8, 0x3160, 0xb020,
0xb000, 0x3000, 0x0800, 0x3000, 0xb000};
0xb000, 0x3000, 0x0800, 0x3000, 0xb000
};
static const u16 uv_static_hcoeffs[N_HORIZ_UV_TAPS * N_PHASES] = {
0x3000, 0x1800, 0x1800, 0xb000, 0x18d0, 0x2e60,
0xb000, 0x1990, 0x2ce0, 0xb020, 0x1a68, 0x2b40,
......@@ -598,7 +605,8 @@ static const u16 uv_static_hcoeffs[N_HORIZ_UV_TAPS * N_PHASES] = {
0xb100, 0x1eb8, 0x3620, 0xb100, 0x1f18, 0x34a0,
0xb100, 0x1f68, 0x3360, 0xb0e0, 0x1fa8, 0x3240,
0xb0c0, 0x1fe0, 0x3140, 0xb060, 0x1ff0, 0x30a0,
0x3000, 0x0800, 0x3000};
0x3000, 0x0800, 0x3000
};
static void update_polyphase_filter(struct overlay_registers *regs)
{
......@@ -646,14 +654,16 @@ static bool update_scaling_factors(struct intel_overlay *overlay,
overlay->old_xscale = xscale;
overlay->old_yscale = yscale;
regs->YRGBSCALE = ((yscale & FRACT_MASK) << 20)
| ((xscale >> FP_SHIFT) << 16)
| ((xscale & FRACT_MASK) << 3);
regs->UVSCALE = ((yscale_UV & FRACT_MASK) << 20)
| ((xscale_UV >> FP_SHIFT) << 16)
| ((xscale_UV & FRACT_MASK) << 3);
regs->UVSCALEV = ((yscale >> FP_SHIFT) << 16)
| ((yscale_UV >> FP_SHIFT) << 0);
regs->YRGBSCALE = (((yscale & FRACT_MASK) << 20) |
((xscale >> FP_SHIFT) << 16) |
((xscale & FRACT_MASK) << 3));
regs->UVSCALE = (((yscale_UV & FRACT_MASK) << 20) |
((xscale_UV >> FP_SHIFT) << 16) |
((xscale_UV & FRACT_MASK) << 3));
regs->UVSCALEV = ((((yscale >> FP_SHIFT) << 16) |
((yscale_UV >> FP_SHIFT) << 0)));
if (scale_changed)
update_polyphase_filter(regs);
......@@ -911,12 +921,10 @@ static int check_overlay_dst(struct intel_overlay *overlay,
{
struct drm_display_mode *mode = &overlay->crtc->base.mode;
if ((rec->dst_x < mode->crtc_hdisplay)
&& (rec->dst_x + rec->dst_width
<= mode->crtc_hdisplay)
&& (rec->dst_y < mode->crtc_vdisplay)
&& (rec->dst_y + rec->dst_height
<= mode->crtc_vdisplay))
if (rec->dst_x < mode->crtc_hdisplay &&
rec->dst_x + rec->dst_width <= mode->crtc_hdisplay &&
rec->dst_y < mode->crtc_vdisplay &&
rec->dst_y + rec->dst_height <= mode->crtc_vdisplay)
return 0;
else
return -EINVAL;
......@@ -949,17 +957,17 @@ static int check_overlay_src(struct drm_device *dev,
/* 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)
if (rec->src_height > IMAGE_MAX_HEIGHT_LEGACY ||
rec->src_width > IMAGE_MAX_WIDTH_LEGACY)
return -EINVAL;
} else {
if (rec->src_height > IMAGE_MAX_HEIGHT
|| rec->src_width > IMAGE_MAX_WIDTH)
if (rec->src_height > IMAGE_MAX_HEIGHT ||
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)
if (rec->src_height < N_VERT_Y_TAPS*4 ||
rec->src_width < N_HORIZ_Y_TAPS*4)
return -EINVAL;
/* check alignment constraints */
......@@ -1014,14 +1022,14 @@ static int check_overlay_src(struct drm_device *dev,
case I915_OVERLAY_RGB:
case I915_OVERLAY_YUV_PACKED:
/* always 4 Y values per depth pixels */
if (packed_width_bytes(rec->flags, rec->src_width)
> rec->stride_Y)
if (packed_width_bytes(rec->flags, rec->src_width) > rec->stride_Y)
return -EINVAL;
tmp = rec->stride_Y*rec->src_height;
if (rec->offset_Y + tmp > new_bo->size)
return -EINVAL;
break;
case I915_OVERLAY_YUV_PLANAR:
if (rec->src_width > rec->stride_Y)
return -EINVAL;
......@@ -1033,8 +1041,8 @@ static int check_overlay_src(struct drm_device *dev,
return -EINVAL;
tmp = rec->stride_UV*rec->src_height;
tmp /= uv_vscale;
if (rec->offset_U + tmp > new_bo->size
|| rec->offset_V + tmp > new_bo->size)
if (rec->offset_U + tmp > new_bo->size ||
rec->offset_V + tmp > new_bo->size)
return -EINVAL;
break;
}
......@@ -1148,8 +1156,8 @@ int intel_overlay_put_image(struct drm_device *dev, void *data,
params->src_h = put_image_rec->src_height;
params->src_scan_w = put_image_rec->src_scan_width;
params->src_scan_h = put_image_rec->src_scan_height;
if (params->src_scan_h > params->src_h
|| params->src_scan_w > params->src_w) {
if (params->src_scan_h > params->src_h ||
params->src_scan_w > params->src_w) {
ret = -EINVAL;
goto out_unlock;
}
......@@ -1205,7 +1213,7 @@ static bool check_gamma_bounds(u32 gamma1, u32 gamma2)
return false;
for (i = 0; i < 3; i++) {
if (((gamma1 >> i * 8) & 0xff) >= ((gamma2 >> i*8) & 0xff))
if (((gamma1 >> i*8) & 0xff) >= ((gamma2 >> i*8) & 0xff))
return false;
}
......@@ -1226,16 +1234,18 @@ static bool check_gamma5_errata(u32 gamma5)
static int check_gamma(struct drm_intel_overlay_attrs *attrs)
{
if (!check_gamma_bounds(0, attrs->gamma0)
|| !check_gamma_bounds(attrs->gamma0, attrs->gamma1)
|| !check_gamma_bounds(attrs->gamma1, attrs->gamma2)
|| !check_gamma_bounds(attrs->gamma2, attrs->gamma3)
|| !check_gamma_bounds(attrs->gamma3, attrs->gamma4)
|| !check_gamma_bounds(attrs->gamma4, attrs->gamma5)
|| !check_gamma_bounds(attrs->gamma5, 0x00ffffff))
if (!check_gamma_bounds(0, attrs->gamma0) ||
!check_gamma_bounds(attrs->gamma0, attrs->gamma1) ||
!check_gamma_bounds(attrs->gamma1, attrs->gamma2) ||
!check_gamma_bounds(attrs->gamma2, attrs->gamma3) ||
!check_gamma_bounds(attrs->gamma3, attrs->gamma4) ||
!check_gamma_bounds(attrs->gamma4, attrs->gamma5) ||
!check_gamma_bounds(attrs->gamma5, 0x00ffffff))
return -EINVAL;
if (!check_gamma5_errata(attrs->gamma5))
return -EINVAL;
return 0;
}
......@@ -1285,12 +1295,14 @@ int intel_overlay_attrs(struct drm_device *dev, void *data,
ret = -EINVAL;
goto out_unlock;
}
if (attrs->contrast <= 255) {
overlay->contrast = attrs->contrast;
} else {
ret = -EINVAL;
goto out_unlock;
}
if (attrs->saturation <= 1023) {
overlay->saturation = attrs->saturation;
} else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment