Merge "msm: vidc: Support ioctl VIDIOC_ENUM_FRAMESIZES"
This commit is contained in:
commit
fbd8b44c40
1 changed files with 31 additions and 8 deletions
|
@ -1198,6 +1198,8 @@ int msm_vidc_enum_framesizes(void *instance, struct v4l2_frmsizeenum *fsize)
|
|||
{
|
||||
struct msm_vidc_inst *inst = instance;
|
||||
struct msm_vidc_capability *capability = NULL;
|
||||
enum hal_video_codec codec;
|
||||
int i;
|
||||
|
||||
if (!inst || !fsize) {
|
||||
dprintk(VIDC_ERR, "%s: invalid parameter: %pK %pK\n",
|
||||
|
@ -1206,15 +1208,36 @@ int msm_vidc_enum_framesizes(void *instance, struct v4l2_frmsizeenum *fsize)
|
|||
}
|
||||
if (!inst->core)
|
||||
return -EINVAL;
|
||||
if (fsize->index != 0)
|
||||
return -EINVAL;
|
||||
|
||||
capability = &inst->capability;
|
||||
fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE;
|
||||
fsize->stepwise.min_width = capability->width.min;
|
||||
fsize->stepwise.max_width = capability->width.max;
|
||||
fsize->stepwise.step_width = capability->width.step_size;
|
||||
fsize->stepwise.min_height = capability->height.min;
|
||||
fsize->stepwise.max_height = capability->height.max;
|
||||
fsize->stepwise.step_height = capability->height.step_size;
|
||||
codec = get_hal_codec(fsize->pixel_format);
|
||||
if (codec == HAL_UNUSED_CODEC)
|
||||
return -EINVAL;
|
||||
|
||||
for (i = 0; i < VIDC_MAX_SESSIONS; i++) {
|
||||
if (inst->core->capabilities[i].codec == codec) {
|
||||
capability = &inst->core->capabilities[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (capability) {
|
||||
fsize->type = capability->width.step_size == 1 &&
|
||||
capability->height.step_size == 1 ?
|
||||
V4L2_FRMSIZE_TYPE_CONTINUOUS :
|
||||
V4L2_FRMSIZE_TYPE_STEPWISE;
|
||||
fsize->stepwise.min_width = capability->width.min;
|
||||
fsize->stepwise.max_width = capability->width.max;
|
||||
fsize->stepwise.step_width = capability->width.step_size;
|
||||
fsize->stepwise.min_height = capability->height.min;
|
||||
fsize->stepwise.max_height = capability->height.max;
|
||||
fsize->stepwise.step_height = capability->height.step_size;
|
||||
} else {
|
||||
dprintk(VIDC_ERR, "%s: Invalid Pixel Fmt %#x\n",
|
||||
__func__, fsize->pixel_format);
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(msm_vidc_enum_framesizes);
|
||||
|
|
Loading…
Add table
Reference in a new issue