From 08dae1647f282656f5185497e96d712a4ccebc26 Mon Sep 17 00:00:00 2001 From: Topi Pohjolainen Date: Fri, 27 Apr 2012 17:24:24 +0300 Subject: [PATCH] staging: msvdx: check context type before resetting Part of video hw driver update from UMG. Signed-off-by: Topi Pohjolainen --- drivers/staging/mrst/imgv/psb_msvdx.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/staging/mrst/imgv/psb_msvdx.c b/drivers/staging/mrst/imgv/psb_msvdx.c index 240d73e..a4d9ad0 100644 --- a/drivers/staging/mrst/imgv/psb_msvdx.c +++ b/drivers/staging/mrst/imgv/psb_msvdx.c @@ -1216,15 +1216,24 @@ int psb_remove_videoctx(struct drm_psb_private *dev_priv, struct file *filp) " entrypoint %d", (pos->ctx_type >> 8), (pos->ctx_type & 0xff)); - /*Reset fw load status here.*/ - if ((VAEntrypointEncSlice == (pos->ctx_type & 0xff) - || VAEntrypointEncPicture == - (pos->ctx_type & 0xff))) - pnw_reset_fw_status(dev_priv->dev); /* if current ctx points to it, set to NULL */ - if (dev_priv->topaz_ctx == pos) + if (dev_priv->topaz_ctx == pos) { + /*Reset fw load status here.*/ + if (VAEntrypointEncSlice == + (pos->ctx_type & 0xff) + || VAEntrypointEncPicture == + (pos->ctx_type & 0xff)) + pnw_reset_fw_status(dev_priv->dev); + dev_priv->topaz_ctx = NULL; + } else if (VAEntrypointEncSlice == + (pos->ctx_type & 0xff) + || VAEntrypointEncPicture == + (pos->ctx_type & 0xff)) + PSB_DEBUG_GENERAL("Remove a inactive "\ + "encoding context.\n"); + if (dev_priv->last_topaz_ctx == pos) dev_priv->last_topaz_ctx = NULL; @@ -1295,6 +1304,10 @@ int lnc_video_getparam(struct drm_device *dev, void *data, video_ctx->ctx_type = ctx_type; video_ctx->filp = file_priv->filp; list_add(&video_ctx->head, &dev_priv->video_ctx); + + if (VAEntrypointEncSlice == (ctx_type & 0xff)) + pnw_reset_fw_status(dev_priv->dev); + PSB_DEBUG_GENERAL("Video:add context profile %d, entrypoint %d", (ctx_type >> 8), (ctx_type & 0xff)); break; -- 2.7.4