Skip to content

Commit

Permalink
vidc_3x: Add snapshot of video driver
Browse files Browse the repository at this point in the history
This is snapshot of the video driver as of msm-4.14(vidc_3x)
commit 9dc1a255ba77c95 (" Fix qbuf error in gralloc buffers encoding").

Change-Id: I146b66cb0e0ce44d8414efaa8748c2de87b9fc74
Signed-off-by: Vasantha Balla <[email protected]>
  • Loading branch information
Vasantha Balla authored and Gerrit - the friendly Code Review server committed Jul 12, 2020
1 parent 74de771 commit 6e7d1f9
Show file tree
Hide file tree
Showing 53 changed files with 37,856 additions and 4 deletions.
2 changes: 2 additions & 0 deletions arch/arm64/configs/vendor/sdm660-perf_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,8 @@ CONFIG_VIDEO_FIXED_MINOR_RANGES=y
CONFIG_MEDIA_USB_SUPPORT=y
CONFIG_USB_VIDEO_CLASS=y
CONFIG_V4L_PLATFORM_DRIVERS=y
CONFIG_MSM_VIDC_3X_GOVERNORS=y
CONFIG_MSM_VIDC_3X_V4L2=y
CONFIG_DVB_MPQ=m
CONFIG_DVB_MPQ_DEMUX=m
CONFIG_FB=y
Expand Down
2 changes: 2 additions & 0 deletions arch/arm64/configs/vendor/sdm660_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,8 @@ CONFIG_VIDEO_FIXED_MINOR_RANGES=y
CONFIG_MEDIA_USB_SUPPORT=y
CONFIG_USB_VIDEO_CLASS=y
CONFIG_V4L_PLATFORM_DRIVERS=y
CONFIG_MSM_VIDC_3X_GOVERNORS=y
CONFIG_MSM_VIDC_3X_V4L2=y
CONFIG_DVB_MPQ=m
CONFIG_DVB_MPQ_DEMUX=m
CONFIG_FB=y
Expand Down
1 change: 1 addition & 0 deletions drivers/media/platform/msm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ menuconfig SPECTRA_CAMERA
Enabling this adds support for the camera driver stack including sensor,
IFE and postprocessing drivers.

source "drivers/media/platform/msm/vidc_3x/Kconfig"
source "drivers/media/platform/msm/cvp/Kconfig"
source "drivers/media/platform/msm/npu/Kconfig"
source "drivers/media/platform/msm/synx/Kconfig"
Expand Down
1 change: 1 addition & 0 deletions drivers/media/platform/msm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Makefile for the qti specific video device drivers
# based on V4L2.
#
obj-$(CONFIG_MSM_VIDC_3X_V4L2) += vidc_3x/
obj-$(CONFIG_MSM_CVP_V4L2) += cvp/
obj-$(CONFIG_MSM_NPU) += npu/
obj-$(CONFIG_MSM_GLOBAL_SYNX) += synx/
Expand Down
14 changes: 14 additions & 0 deletions drivers/media/platform/msm/vidc_3x/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# VIDEO CORE
#
source "drivers/media/platform/msm/vidc_3x/governors/Kconfig"

menuconfig MSM_VIDC_3X_V4L2
tristate "Qualcomm Technologies, Inc. MSM V4L2 3X based video driver"
depends on ARCH_QCOM && VIDEO_V4L2
select VIDEOBUF2_CORE
help
Enable support of MSM V4L2 3X based video driver for
Qualcomm Technologies, Inc.

19 changes: 19 additions & 0 deletions drivers/media/platform/msm/vidc_3x/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_MSM_VIDC_3X_V4L2) := msm_v4l2_vidc.o \
msm_vidc_common.o \
msm_vidc.o \
msm_vdec.o \
msm_venc.o \
msm_smem.o \
msm_vidc_debug.o \
msm_vidc_res_parse.o \
venus_hfi.o \
hfi_response_handler.o \
hfi_packetization.o \
vidc_hfi.o \
venus_boot.o \
msm_vidc_dcvs.o

obj-$(CONFIG_MSM_VIDC_3X_V4L2) += governors/

obj-$(CONFIG_MSM_VIDC_VMEM) += vmem/
7 changes: 7 additions & 0 deletions drivers/media/platform/msm/vidc_3x/governors/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
menuconfig MSM_VIDC_3X_GOVERNORS
tristate "Clock and bandwidth governors for QTI MSM V4L2 based video driver"
depends on MSM_VIDC_3X_V4L2 && PM_DEVFREQ
help
Chooses a set of devfreq governors aimed at providing accurate bandwidth
or clock frequency values for MSM V4L2 video driver.
6 changes: 6 additions & 0 deletions drivers/media/platform/msm/vidc_3x/governors/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
ccflags-y := -I$(srctree)/drivers/devfreq/ \
-I$(srctree)/drivers/media/platform/msm/vidc_3x/

obj-$(CONFIG_MSM_VIDC_3X_GOVERNORS) := msm_vidc_dyn_gov.o \
msm_vidc_table_gov.o
74 changes: 74 additions & 0 deletions drivers/media/platform/msm/vidc_3x/governors/fixedpoint.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2015, 2019-2020, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/

#ifdef _FIXP_ARITH_H
#error "This implementation is meant to override fixp-arith.h, don't use both"
#endif

#ifndef __FP_H__
#define __FP_H__

/*
* Normally would typedef'ed, but checkpatch doesn't like typedef.
* Also should be normally typedef'ed to intmax_t but that doesn't seem to be
* available in the kernel
*/
#define fp_t size_t

/* (Arbitrarily) make the first 25% of the bits to be the fractional bits */
#define FP_FRACTIONAL_BITS ((sizeof(fp_t) * 8) / 4)

#define FP(__i, __f_n, __f_d) \
((((fp_t)(__i)) << FP_FRACTIONAL_BITS) + \
(((__f_n) << FP_FRACTIONAL_BITS) / (__f_d)))

#define FP_INT(__i) FP(__i, 0, 1)
#define FP_ONE FP_INT(1)
#define FP_ZERO FP_INT(0)

static inline size_t fp_frac_base(void)
{
return GENMASK(FP_FRACTIONAL_BITS - 1, 0);
}

static inline size_t fp_frac(fp_t a)
{
return a & GENMASK(FP_FRACTIONAL_BITS - 1, 0);
}

static inline size_t fp_int(fp_t a)
{
return a >> FP_FRACTIONAL_BITS;
}

static inline size_t fp_round(fp_t a)
{
/* is the fractional part >= frac_max / 2? */
bool round_up = fp_frac(a) >= fp_frac_base() / 2;

return fp_int(a) + round_up;
}

static inline fp_t fp_mult(fp_t a, fp_t b)
{
return (a * b) >> FP_FRACTIONAL_BITS;
}


static inline fp_t fp_div(fp_t a, fp_t b)
{
return (a << FP_FRACTIONAL_BITS) / b;
}

#endif
Loading

0 comments on commit 6e7d1f9

Please sign in to comment.