tree: Run clang-format to conform to the kernel coding style

The coding style has been a bit erratic. Enforce the linux kernel coding
style by reusing their .clang-format file, running clang-format on the
source, and ignoring the few shortcomings that clang-format has at the
moment (especially on aligning the define values).

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
This commit is contained in:
Maxime Ripard
2018-07-16 22:02:38 +02:00
parent f831082a09
commit 5aeb07f8bf
28 changed files with 1066 additions and 386 deletions
+427
View File
@@ -0,0 +1,427 @@
# SPDX-License-Identifier: GPL-2.0
#
# clang-format configuration file. Intended for clang-format >= 4.
#
# For more information, see:
#
# Documentation/process/clang-format.rst
# https://clang.llvm.org/docs/ClangFormat.html
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
#
---
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
#AfterExternBlock: false # Unknown to clang-format-5.0
BeforeCatch: false
BeforeElse: false
IndentBraces: false
#SplitEmptyFunction: true # Unknown to clang-format-4.0
#SplitEmptyRecord: true # Unknown to clang-format-4.0
#SplitEmptyNamespace: true # Unknown to clang-format-4.0
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false # Unknown to clang-format-4.0
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeComma # Unknown to clang-format-4.0
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: false
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false # Unknown to clang-format-4.0
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 8
ContinuationIndentWidth: 8
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: false # Unknown to clang-format-4.0
# Taken from:
# git grep -h '^#define [^[:space:]]*for_each[^[:space:]]*(' include/ \
# | sed "s,^#define \([^[:space:]]*for_each[^[:space:]]*\)(.*$, - '\1'," \
# | sort | uniq
ForEachMacros:
- 'apei_estatus_for_each_section'
- 'ata_for_each_dev'
- 'ata_for_each_link'
- 'ax25_for_each'
- 'ax25_uid_for_each'
- 'bio_for_each_integrity_vec'
- '__bio_for_each_segment'
- 'bio_for_each_segment'
- 'bio_for_each_segment_all'
- 'bio_list_for_each'
- 'bip_for_each_vec'
- 'blkg_for_each_descendant_post'
- 'blkg_for_each_descendant_pre'
- 'blk_queue_for_each_rl'
- 'bond_for_each_slave'
- 'bond_for_each_slave_rcu'
- 'btree_for_each_safe128'
- 'btree_for_each_safe32'
- 'btree_for_each_safe64'
- 'btree_for_each_safel'
- 'card_for_each_dev'
- 'cgroup_taskset_for_each'
- 'cgroup_taskset_for_each_leader'
- 'cpufreq_for_each_entry'
- 'cpufreq_for_each_entry_idx'
- 'cpufreq_for_each_valid_entry'
- 'cpufreq_for_each_valid_entry_idx'
- 'css_for_each_child'
- 'css_for_each_descendant_post'
- 'css_for_each_descendant_pre'
- 'device_for_each_child_node'
- 'drm_atomic_crtc_for_each_plane'
- 'drm_atomic_crtc_state_for_each_plane'
- 'drm_atomic_crtc_state_for_each_plane_state'
- 'drm_for_each_connector_iter'
- 'drm_for_each_crtc'
- 'drm_for_each_encoder'
- 'drm_for_each_encoder_mask'
- 'drm_for_each_fb'
- 'drm_for_each_legacy_plane'
- 'drm_for_each_plane'
- 'drm_for_each_plane_mask'
- 'drm_mm_for_each_hole'
- 'drm_mm_for_each_node'
- 'drm_mm_for_each_node_in_range'
- 'drm_mm_for_each_node_safe'
- 'for_each_active_drhd_unit'
- 'for_each_active_iommu'
- 'for_each_available_child_of_node'
- 'for_each_bio'
- 'for_each_board_func_rsrc'
- 'for_each_bvec'
- 'for_each_child_of_node'
- 'for_each_clear_bit'
- 'for_each_clear_bit_from'
- 'for_each_cmsghdr'
- 'for_each_compatible_node'
- 'for_each_console'
- 'for_each_cpu'
- 'for_each_cpu_and'
- 'for_each_cpu_not'
- 'for_each_cpu_wrap'
- 'for_each_dev_addr'
- 'for_each_dma_cap_mask'
- 'for_each_drhd_unit'
- 'for_each_dss_dev'
- 'for_each_efi_memory_desc'
- 'for_each_efi_memory_desc_in_map'
- 'for_each_endpoint_of_node'
- 'for_each_evictable_lru'
- 'for_each_fib6_node_rt_rcu'
- 'for_each_fib6_walker_rt'
- 'for_each_free_mem_range'
- 'for_each_free_mem_range_reverse'
- 'for_each_func_rsrc'
- 'for_each_hstate'
- 'for_each_if'
- 'for_each_iommu'
- 'for_each_ip_tunnel_rcu'
- 'for_each_irq_nr'
- 'for_each_lru'
- 'for_each_matching_node'
- 'for_each_matching_node_and_match'
- 'for_each_memblock'
- 'for_each_memblock_type'
- 'for_each_memcg_cache_index'
- 'for_each_mem_pfn_range'
- 'for_each_mem_range'
- 'for_each_mem_range_rev'
- 'for_each_migratetype_order'
- 'for_each_msi_entry'
- 'for_each_net'
- 'for_each_netdev'
- 'for_each_netdev_continue'
- 'for_each_netdev_continue_rcu'
- 'for_each_netdev_feature'
- 'for_each_netdev_in_bond_rcu'
- 'for_each_netdev_rcu'
- 'for_each_netdev_reverse'
- 'for_each_netdev_safe'
- 'for_each_net_rcu'
- 'for_each_new_connector_in_state'
- 'for_each_new_crtc_in_state'
- 'for_each_new_plane_in_state'
- 'for_each_new_private_obj_in_state'
- 'for_each_node'
- 'for_each_node_by_name'
- 'for_each_node_by_type'
- 'for_each_node_mask'
- 'for_each_node_state'
- 'for_each_node_with_cpus'
- 'for_each_node_with_property'
- 'for_each_of_allnodes'
- 'for_each_of_allnodes_from'
- 'for_each_of_pci_range'
- 'for_each_old_connector_in_state'
- 'for_each_old_crtc_in_state'
- 'for_each_oldnew_connector_in_state'
- 'for_each_oldnew_crtc_in_state'
- 'for_each_oldnew_plane_in_state'
- 'for_each_oldnew_private_obj_in_state'
- 'for_each_old_plane_in_state'
- 'for_each_old_private_obj_in_state'
- 'for_each_online_cpu'
- 'for_each_online_node'
- 'for_each_online_pgdat'
- 'for_each_pci_bridge'
- 'for_each_pci_dev'
- 'for_each_pci_msi_entry'
- 'for_each_populated_zone'
- 'for_each_possible_cpu'
- 'for_each_present_cpu'
- 'for_each_prime_number'
- 'for_each_prime_number_from'
- 'for_each_process'
- 'for_each_process_thread'
- 'for_each_property_of_node'
- 'for_each_reserved_mem_region'
- 'for_each_resv_unavail_range'
- 'for_each_rtdcom'
- 'for_each_rtdcom_safe'
- 'for_each_set_bit'
- 'for_each_set_bit_from'
- 'for_each_sg'
- 'for_each_sg_page'
- '__for_each_thread'
- 'for_each_thread'
- 'for_each_zone'
- 'for_each_zone_zonelist'
- 'for_each_zone_zonelist_nodemask'
- 'fwnode_for_each_available_child_node'
- 'fwnode_for_each_child_node'
- 'fwnode_graph_for_each_endpoint'
- 'gadget_for_each_ep'
- 'hash_for_each'
- 'hash_for_each_possible'
- 'hash_for_each_possible_rcu'
- 'hash_for_each_possible_rcu_notrace'
- 'hash_for_each_possible_safe'
- 'hash_for_each_rcu'
- 'hash_for_each_safe'
- 'hctx_for_each_ctx'
- 'hlist_bl_for_each_entry'
- 'hlist_bl_for_each_entry_rcu'
- 'hlist_bl_for_each_entry_safe'
- 'hlist_for_each'
- 'hlist_for_each_entry'
- 'hlist_for_each_entry_continue'
- 'hlist_for_each_entry_continue_rcu'
- 'hlist_for_each_entry_continue_rcu_bh'
- 'hlist_for_each_entry_from'
- 'hlist_for_each_entry_from_rcu'
- 'hlist_for_each_entry_rcu'
- 'hlist_for_each_entry_rcu_bh'
- 'hlist_for_each_entry_rcu_notrace'
- 'hlist_for_each_entry_safe'
- '__hlist_for_each_rcu'
- 'hlist_for_each_safe'
- 'hlist_nulls_for_each_entry'
- 'hlist_nulls_for_each_entry_from'
- 'hlist_nulls_for_each_entry_rcu'
- 'hlist_nulls_for_each_entry_safe'
- 'ide_host_for_each_port'
- 'ide_port_for_each_dev'
- 'ide_port_for_each_present_dev'
- 'idr_for_each_entry'
- 'idr_for_each_entry_continue'
- 'idr_for_each_entry_ul'
- 'inet_bind_bucket_for_each'
- 'inet_lhash2_for_each_icsk_rcu'
- 'iov_for_each'
- 'key_for_each'
- 'key_for_each_safe'
- 'klp_for_each_func'
- 'klp_for_each_object'
- 'kvm_for_each_memslot'
- 'kvm_for_each_vcpu'
- 'list_for_each'
- 'list_for_each_entry'
- 'list_for_each_entry_continue'
- 'list_for_each_entry_continue_rcu'
- 'list_for_each_entry_continue_reverse'
- 'list_for_each_entry_from'
- 'list_for_each_entry_from_reverse'
- 'list_for_each_entry_lockless'
- 'list_for_each_entry_rcu'
- 'list_for_each_entry_reverse'
- 'list_for_each_entry_safe'
- 'list_for_each_entry_safe_continue'
- 'list_for_each_entry_safe_from'
- 'list_for_each_entry_safe_reverse'
- 'list_for_each_prev'
- 'list_for_each_prev_safe'
- 'list_for_each_safe'
- 'llist_for_each'
- 'llist_for_each_entry'
- 'llist_for_each_entry_safe'
- 'llist_for_each_safe'
- 'media_device_for_each_entity'
- 'media_device_for_each_intf'
- 'media_device_for_each_link'
- 'media_device_for_each_pad'
- 'netdev_for_each_lower_dev'
- 'netdev_for_each_lower_private'
- 'netdev_for_each_lower_private_rcu'
- 'netdev_for_each_mc_addr'
- 'netdev_for_each_uc_addr'
- 'netdev_for_each_upper_dev_rcu'
- 'netdev_hw_addr_list_for_each'
- 'nft_rule_for_each_expr'
- 'nla_for_each_attr'
- 'nla_for_each_nested'
- 'nlmsg_for_each_attr'
- 'nlmsg_for_each_msg'
- 'nr_neigh_for_each'
- 'nr_neigh_for_each_safe'
- 'nr_node_for_each'
- 'nr_node_for_each_safe'
- 'of_for_each_phandle'
- 'of_property_for_each_string'
- 'of_property_for_each_u32'
- 'pci_bus_for_each_resource'
- 'ping_portaddr_for_each_entry'
- 'plist_for_each'
- 'plist_for_each_continue'
- 'plist_for_each_entry'
- 'plist_for_each_entry_continue'
- 'plist_for_each_entry_safe'
- 'plist_for_each_safe'
- 'pnp_for_each_card'
- 'pnp_for_each_dev'
- 'protocol_for_each_card'
- 'protocol_for_each_dev'
- 'queue_for_each_hw_ctx'
- 'radix_tree_for_each_contig'
- 'radix_tree_for_each_slot'
- 'radix_tree_for_each_tagged'
- 'rbtree_postorder_for_each_entry_safe'
- 'resource_list_for_each_entry'
- 'resource_list_for_each_entry_safe'
- 'rhl_for_each_entry_rcu'
- 'rhl_for_each_rcu'
- 'rht_for_each'
- 'rht_for_each_continue'
- 'rht_for_each_entry'
- 'rht_for_each_entry_continue'
- 'rht_for_each_entry_rcu'
- 'rht_for_each_entry_rcu_continue'
- 'rht_for_each_entry_safe'
- 'rht_for_each_rcu'
- 'rht_for_each_rcu_continue'
- '__rq_for_each_bio'
- 'rq_for_each_segment'
- 'scsi_for_each_prot_sg'
- 'scsi_for_each_sg'
- 'sctp_for_each_hentry'
- 'sctp_skb_for_each'
- 'shdma_for_each_chan'
- '__shost_for_each_device'
- 'shost_for_each_device'
- 'sk_for_each'
- 'sk_for_each_bound'
- 'sk_for_each_entry_offset_rcu'
- 'sk_for_each_from'
- 'sk_for_each_rcu'
- 'sk_for_each_safe'
- 'sk_nulls_for_each'
- 'sk_nulls_for_each_from'
- 'sk_nulls_for_each_rcu'
- 'snd_pcm_group_for_each_entry'
- 'snd_soc_dapm_widget_for_each_path'
- 'snd_soc_dapm_widget_for_each_path_safe'
- 'snd_soc_dapm_widget_for_each_sink_path'
- 'snd_soc_dapm_widget_for_each_source_path'
- 'tb_property_for_each'
- 'udp_portaddr_for_each_entry'
- 'udp_portaddr_for_each_entry_rcu'
- 'usb_hub_for_each_child'
- 'v4l2_device_for_each_subdev'
- 'v4l2_m2m_for_each_dst_buf'
- 'v4l2_m2m_for_each_dst_buf_safe'
- 'v4l2_m2m_for_each_src_buf'
- 'v4l2_m2m_for_each_src_buf_safe'
- 'zorro_for_each_dev'
IncludeBlocks: Preserve # Unknown to clang-format-5.0
IncludeCategories:
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentPPDirectives: None # Unknown to clang-format-5.0
IndentWidth: 8
IndentWrappedFunctionNames: true
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: Inner
ObjCBlockIndentWidth: 8
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
# Taken from git's rules
PenaltyBreakAssignment: 10 # Unknown to clang-format-4.0
PenaltyBreakBeforeFirstCallParameter: 30
PenaltyBreakComment: 10
PenaltyBreakFirstLessLess: 0
PenaltyBreakString: 10
PenaltyExcessCharacter: 100
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
ReflowComments: false
SortIncludes: true
SortUsingDeclarations: false # Unknown to clang-format-4.0
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
# SpaceBeforeCtorInitializerColon: true # Unknown to clang-format-5.0
# SpaceBeforeInheritanceColon: true # Unknown to clang-format-5.0
SpaceBeforeParens: ControlStatements
# SpaceBeforeRangeBasedForLoopColon: true # Unknown to clang-format-5.0
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp03
TabWidth: 8
UseTab: Always
...
+14 -9
View File
@@ -23,16 +23,16 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "sunxi_cedrus.h"
#include "buffer.h"
#include "context.h"
#include "sunxi_cedrus.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <linux/videodev2.h>
@@ -40,8 +40,9 @@
#include "v4l2.h"
VAStatus SunxiCedrusCreateBuffer(VADriverContextP context,
VAContextID context_id, VABufferType type, unsigned int size,
unsigned int count, void *data, VABufferID *buffer_id)
VAContextID context_id, VABufferType type,
unsigned int size, unsigned int count,
void *data, VABufferID *buffer_id)
{
struct cedrus_data *driver_data =
(struct cedrus_data *)context->pDriverData;
@@ -92,7 +93,8 @@ VAStatus SunxiCedrusCreateBuffer(VADriverContextP context,
error:
if (buffer_object != NULL)
object_heap_free(&driver_data->buffer_heap, (struct object_base *) buffer_object);
object_heap_free(&driver_data->buffer_heap,
(struct object_base *)buffer_object);
complete:
return status;
@@ -112,7 +114,8 @@ VAStatus SunxiCedrusDestroyBuffer(VADriverContextP context,
if (buffer_object->data != NULL)
free(buffer_object->data);
object_heap_free(&driver_data->buffer_heap, (struct object_base *) buffer_object);
object_heap_free(&driver_data->buffer_heap,
(struct object_base *)buffer_object);
return VA_STATUS_SUCCESS;
}
@@ -150,7 +153,8 @@ VAStatus SunxiCedrusUnmapBuffer(VADriverContextP context, VABufferID buffer_id)
}
VAStatus SunxiCedrusBufferSetNumElements(VADriverContextP context,
VABufferID buffer_id, unsigned int count)
VABufferID buffer_id,
unsigned int count)
{
struct cedrus_data *driver_data =
(struct cedrus_data *)context->pDriverData;
@@ -169,7 +173,8 @@ VAStatus SunxiCedrusBufferSetNumElements(VADriverContextP context,
}
VAStatus SunxiCedrusBufferInfo(VADriverContextP context, VABufferID buffer_id,
VABufferType *type, unsigned int *size, unsigned int *count)
VABufferType *type, unsigned int *size,
unsigned int *count)
{
struct cedrus_data *driver_data =
(struct cedrus_data *)context->pDriverData;
+9 -5
View File
@@ -31,7 +31,8 @@
#include "object_heap.h"
#include "sunxi_cedrus.h"
#define BUFFER(data, id) ((struct object_buffer *) object_heap_lookup(&(data)->buffer_heap, id))
#define BUFFER(data, id) \
((struct object_buffer *)object_heap_lookup(&(data)->buffer_heap, id))
#define BUFFER_ID_OFFSET 0x08000000
struct object_buffer {
@@ -46,8 +47,9 @@ struct object_buffer {
};
VAStatus SunxiCedrusCreateBuffer(VADriverContextP context,
VAContextID context_id, VABufferType type, unsigned int size,
unsigned int count, void *data, VABufferID *buffer_id);
VAContextID context_id, VABufferType type,
unsigned int size, unsigned int count,
void *data, VABufferID *buffer_id);
void sunxi_cedrus_destroy_buffer(struct cedrus_data *driver_data,
struct object_buffer *obj_buffer);
VAStatus SunxiCedrusDestroyBuffer(VADriverContextP context,
@@ -56,8 +58,10 @@ VAStatus SunxiCedrusMapBuffer(VADriverContextP context, VABufferID buffer_id,
void **data_map);
VAStatus SunxiCedrusUnmapBuffer(VADriverContextP context, VABufferID buffer_id);
VAStatus SunxiCedrusBufferSetNumElements(VADriverContextP context,
VABufferID buffer_id, unsigned int count);
VABufferID buffer_id,
unsigned int count);
VAStatus SunxiCedrusBufferInfo(VADriverContextP context, VABufferID buffer_id,
VABufferType *type, unsigned int *size, unsigned int *count);
VABufferType *type, unsigned int *size,
unsigned int *count);
#endif
+33 -15
View File
@@ -23,8 +23,8 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "sunxi_cedrus.h"
#include "config.h"
#include "sunxi_cedrus.h"
#include <assert.h>
#include <string.h>
@@ -33,11 +33,12 @@
#include <linux/videodev2.h>
#include "v4l2.h"
#include "utils.h"
#include "v4l2.h"
VAStatus SunxiCedrusCreateConfig(VADriverContextP context, VAProfile profile,
VAEntrypoint entrypoint, VAConfigAttrib *attributes,
VAEntrypoint entrypoint,
VAConfigAttrib *attributes,
int attributes_count, VAConfigID *config_id)
{
struct cedrus_data *driver_data =
@@ -79,7 +80,8 @@ VAStatus SunxiCedrusCreateConfig(VADriverContextP context, VAProfile profile,
for (i = 1; i < attributes_count; i++) {
index = config_object->attributes_count++;
config_object->attributes[index].type = attributes[index].type;
config_object->attributes[index].value = attributes[index].value;
config_object->attributes[index].value =
attributes[index].value;
}
*config_id = id;
@@ -98,26 +100,32 @@ VAStatus SunxiCedrusDestroyConfig(VADriverContextP context,
if (config_object == NULL)
return VA_STATUS_ERROR_INVALID_CONFIG;
object_heap_free(&driver_data->config_heap, (struct object_base *) config_object);
object_heap_free(&driver_data->config_heap,
(struct object_base *)config_object);
return VA_STATUS_SUCCESS;
}
VAStatus SunxiCedrusQueryConfigProfiles(VADriverContextP context,
VAProfile *profiles, int *profiles_count)
VAProfile *profiles,
int *profiles_count)
{
struct cedrus_data *driver_data =
(struct cedrus_data *)context->pDriverData;
unsigned int index = 0;
bool found;
found = v4l2_find_format(driver_data->video_fd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_PIX_FMT_MPEG2_SLICE);
found = v4l2_find_format(driver_data->video_fd,
V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
V4L2_PIX_FMT_MPEG2_SLICE);
if (found && index < (SUNXI_CEDRUS_MAX_CONFIG_ATTRIBUTES - 2)) {
profiles[index++] = VAProfileMPEG2Simple;
profiles[index++] = VAProfileMPEG2Main;
}
found = v4l2_find_format(driver_data->video_fd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_PIX_FMT_H264_SLICE);
found = v4l2_find_format(driver_data->video_fd,
V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
V4L2_PIX_FMT_H264_SLICE);
if (found && index < (SUNXI_CEDRUS_MAX_CONFIG_ATTRIBUTES - 5)) {
profiles[index++] = VAProfileH264Main;
profiles[index++] = VAProfileH264High;
@@ -132,7 +140,9 @@ VAStatus SunxiCedrusQueryConfigProfiles(VADriverContextP context,
}
VAStatus SunxiCedrusQueryConfigEntrypoints(VADriverContextP context,
VAProfile profile, VAEntrypoint *entrypoints, int *entrypoints_count)
VAProfile profile,
VAEntrypoint *entrypoints,
int *entrypoints_count)
{
switch (profile) {
case VAProfileMPEG2Simple:
@@ -155,8 +165,11 @@ VAStatus SunxiCedrusQueryConfigEntrypoints(VADriverContextP context,
}
VAStatus SunxiCedrusQueryConfigAttributes(VADriverContextP context,
VAConfigID config_id, VAProfile *profile, VAEntrypoint *entrypoint,
VAConfigAttrib *attributes, int *attributes_count)
VAConfigID config_id,
VAProfile *profile,
VAEntrypoint *entrypoint,
VAConfigAttrib *attributes,
int *attributes_count)
{
struct cedrus_data *driver_data =
(struct cedrus_data *)context->pDriverData;
@@ -185,7 +198,9 @@ VAStatus SunxiCedrusQueryConfigAttributes(VADriverContextP context,
}
VAStatus SunxiCedrusGetConfigAttributes(VADriverContextP context,
VAProfile profile, VAEntrypoint entrypoint, VAConfigAttrib *attributes,
VAProfile profile,
VAEntrypoint entrypoint,
VAConfigAttrib *attributes,
int attributes_count)
{
unsigned int i;
@@ -205,19 +220,22 @@ VAStatus SunxiCedrusGetConfigAttributes(VADriverContextP context,
}
VAStatus SunxiCedrusQueryDisplayAttributes(VADriverContextP context,
VADisplayAttribute *attributes, int *attributes_count)
VADisplayAttribute *attributes,
int *attributes_count)
{
return VA_STATUS_ERROR_UNIMPLEMENTED;
}
VAStatus SunxiCedrusGetDisplayAttributes(VADriverContextP context,
VADisplayAttribute *attributes, int attributes_count)
VADisplayAttribute *attributes,
int attributes_count)
{
return VA_STATUS_ERROR_UNIMPLEMENTED;
}
VAStatus SunxiCedrusSetDisplayAttributes(VADriverContextP context,
VADisplayAttribute *attributes, int attributes_count)
VADisplayAttribute *attributes,
int attributes_count)
{
return VA_STATUS_ERROR_UNIMPLEMENTED;
}
+23 -10
View File
@@ -31,7 +31,8 @@
#include "object_heap.h"
#include "sunxi_cedrus.h"
#define CONFIG(data, id) ((struct object_config *) object_heap_lookup(&(data)->config_heap, id))
#define CONFIG(data, id) \
((struct object_config *)object_heap_lookup(&(data)->config_heap, id))
#define CONFIG_ID_OFFSET 0x01000000
struct object_config {
@@ -44,25 +45,37 @@ struct object_config {
};
VAStatus SunxiCedrusCreateConfig(VADriverContextP context, VAProfile profile,
VAEntrypoint entrypoint, VAConfigAttrib *attributes,
VAEntrypoint entrypoint,
VAConfigAttrib *attributes,
int attributes_count, VAConfigID *config_id);
VAStatus SunxiCedrusDestroyConfig(VADriverContextP context,
VAConfigID config_id);
VAStatus SunxiCedrusQueryConfigProfiles(VADriverContextP context,
VAProfile *profiles, int *profiles_count);
VAProfile *profiles,
int *profiles_count);
VAStatus SunxiCedrusQueryConfigEntrypoints(VADriverContextP context,
VAProfile profile, VAEntrypoint *entrypoints, int *entrypoints_count);
VAProfile profile,
VAEntrypoint *entrypoints,
int *entrypoints_count);
VAStatus SunxiCedrusQueryConfigAttributes(VADriverContextP context,
VAConfigID config_id, VAProfile *profile, VAEntrypoint *entrypoint,
VAConfigAttrib *attributes, int *attributes_count);
VAConfigID config_id,
VAProfile *profile,
VAEntrypoint *entrypoint,
VAConfigAttrib *attributes,
int *attributes_count);
VAStatus SunxiCedrusGetConfigAttributes(VADriverContextP context,
VAProfile profile, VAEntrypoint entrypoint, VAConfigAttrib *attributes,
VAProfile profile,
VAEntrypoint entrypoint,
VAConfigAttrib *attributes,
int attributes_count);
VAStatus SunxiCedrusQueryDisplayAttributes(VADriverContextP context,
VADisplayAttribute *attributes, int *attributes_count);
VADisplayAttribute *attributes,
int *attributes_count);
VAStatus SunxiCedrusGetDisplayAttributes(VADriverContextP context,
VADisplayAttribute *attributes, int attributes_count);
VADisplayAttribute *attributes,
int attributes_count);
VAStatus SunxiCedrusSetDisplayAttributes(VADriverContextP context,
VADisplayAttribute *attributes, int attributes_count);
VADisplayAttribute *attributes,
int attributes_count);
#endif
+27 -13
View File
@@ -23,9 +23,9 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "sunxi_cedrus.h"
#include "context.h"
#include "config.h"
#include "sunxi_cedrus.h"
#include "surface.h"
#include <stdlib.h>
@@ -38,11 +38,12 @@
#include <linux/videodev2.h>
#include "v4l2.h"
#include "utils.h"
#include "v4l2.h"
VAStatus SunxiCedrusCreateContext(VADriverContextP context,
VAConfigID config_id, int picture_width, int picture_height, int flags,
VAConfigID config_id, int picture_width,
int picture_height, int flags,
VASurfaceID *surfaces_ids, int surfaces_count,
VAContextID *context_id)
{
@@ -93,13 +94,17 @@ VAStatus SunxiCedrusCreateContext(VADriverContextP context,
goto error;
}
rc = v4l2_set_format(driver_data->video_fd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, pixelformat, picture_width, picture_height);
rc = v4l2_set_format(driver_data->video_fd,
V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, pixelformat,
picture_width, picture_height);
if (rc < 0) {
status = VA_STATUS_ERROR_OPERATION_FAILED;
goto error;
}
rc = v4l2_create_buffers(driver_data->video_fd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, surfaces_count);
rc = v4l2_create_buffers(driver_data->video_fd,
V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
surfaces_count);
if (rc < 0) {
status = VA_STATUS_ERROR_ALLOCATION_FAILED;
goto error;
@@ -125,13 +130,16 @@ VAStatus SunxiCedrusCreateContext(VADriverContextP context,
goto error;
}
rc = v4l2_request_buffer(driver_data->video_fd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, i, &length, &offset, 1);
rc = v4l2_request_buffer(driver_data->video_fd,
V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, i,
&length, &offset, 1);
if (rc < 0) {
status = VA_STATUS_ERROR_ALLOCATION_FAILED;
goto error;
}
source_data = mmap(NULL, length, PROT_READ | PROT_WRITE, MAP_SHARED, driver_data->video_fd, offset);
source_data = mmap(NULL, length, PROT_READ | PROT_WRITE,
MAP_SHARED, driver_data->video_fd, offset);
if (source_data == MAP_FAILED) {
status = VA_STATUS_ERROR_ALLOCATION_FAILED;
goto error;
@@ -143,13 +151,15 @@ VAStatus SunxiCedrusCreateContext(VADriverContextP context,
surface_object->source_size = length;
}
rc = v4l2_set_stream(driver_data->video_fd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, true);
rc = v4l2_set_stream(driver_data->video_fd,
V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, true);
if (rc < 0) {
status = VA_STATUS_ERROR_OPERATION_FAILED;
goto error;
}
rc = v4l2_set_stream(driver_data->video_fd, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, true);
rc = v4l2_set_stream(driver_data->video_fd,
V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, true);
if (rc < 0) {
status = VA_STATUS_ERROR_OPERATION_FAILED;
goto error;
@@ -176,7 +186,8 @@ error:
free(ids);
if (context_object != NULL)
object_heap_free(&driver_data->context_heap, (struct object_base *) context_object);
object_heap_free(&driver_data->context_heap,
(struct object_base *)context_object);
complete:
return status;
@@ -194,13 +205,16 @@ VAStatus SunxiCedrusDestroyContext(VADriverContextP context,
if (context_object == NULL)
return VA_STATUS_ERROR_INVALID_CONTEXT;
object_heap_free(&driver_data->context_heap, (struct object_base *) context_object);
object_heap_free(&driver_data->context_heap,
(struct object_base *)context_object);
rc = v4l2_set_stream(driver_data->video_fd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, false);
rc = v4l2_set_stream(driver_data->video_fd,
V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, false);
if (rc < 0)
return VA_STATUS_ERROR_OPERATION_FAILED;
rc = v4l2_set_stream(driver_data->video_fd, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, false);
rc = v4l2_set_stream(driver_data->video_fd,
V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, false);
if (rc < 0)
return VA_STATUS_ERROR_OPERATION_FAILED;
+4 -2
View File
@@ -30,7 +30,8 @@
#include "object_heap.h"
#define CONTEXT(data, id) ((struct object_context *) object_heap_lookup(&(data)->context_heap, id))
#define CONTEXT(data, id) \
((struct object_context *)object_heap_lookup(&(data)->context_heap, id))
#define CONTEXT_ID_OFFSET 0x02000000
struct object_context {
@@ -47,7 +48,8 @@ struct object_context {
};
VAStatus SunxiCedrusCreateContext(VADriverContextP context,
VAConfigID config_id, int picture_width, int picture_height, int flags,
VAConfigID config_id, int picture_width,
int picture_height, int flags,
VASurfaceID *surfaces_ids, int surfaces_count,
VAContextID *context_id);
VAStatus SunxiCedrusDestroyContext(VADriverContextP context,
+18 -21
View File
@@ -27,13 +27,13 @@
#include <assert.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <linux/videodev2.h>
#include "surface.h"
#include "sunxi_cedrus.h"
#include "surface.h"
#include "v4l2.h"
enum h264_slice_type {
@@ -71,8 +71,8 @@ static void h264_va_picture_to_v4l2(struct cedrus_data *driver_data,
for (i = 0; i < VAPicture->num_ref_frames; i++) {
struct v4l2_h264_dpb_entry *dpb = &decode->dpb[i];
VAPictureH264 *pic = &VAPicture->ReferenceFrames[i];
struct object_surface *surface_object = SURFACE(driver_data,
pic->picture_id);
struct object_surface *surface_object =
SURFACE(driver_data, pic->picture_id);
if (surface_object)
dpb->buf_index = surface_object->destination_index;
@@ -188,9 +188,8 @@ static void h264_va_slice_to_v4l2(struct cedrus_data *driver_data,
VASlice->num_ref_idx_l0_active_minus1;
for (i = 0; i < VASlice->num_ref_idx_l0_active_minus1 + 1; i++)
slice->ref_pic_list0[i] =
h264_lookup_ref_pic(VAPicture,
VASlice->RefPicList0[i].frame_idx);
slice->ref_pic_list0[i] = h264_lookup_ref_pic(
VAPicture, VASlice->RefPicList0[i].frame_idx);
}
if ((VASlice->slice_type % 5) == H264_SLICE_B) {
@@ -198,9 +197,8 @@ static void h264_va_slice_to_v4l2(struct cedrus_data *driver_data,
VASlice->num_ref_idx_l1_active_minus1;
for (i = 0; i < VASlice->num_ref_idx_l1_active_minus1 + 1; i++)
slice->ref_pic_list1[i] =
h264_lookup_ref_pic(VAPicture,
VASlice->RefPicList1[i].frame_idx);
slice->ref_pic_list1[i] = h264_lookup_ref_pic(
VAPicture, VASlice->RefPicList1[i].frame_idx);
}
if (VASlice->direct_spatial_mv_pred_flag)
@@ -244,37 +242,36 @@ int h264_set_controls(struct cedrus_data *driver_data,
h264_va_picture_to_v4l2(driver_data, &surface->params.h264.picture,
&decode, &pps, &sps);
h264_va_matrix_to_v4l2(driver_data, &surface->params.h264.matrix, &matrix);
h264_va_matrix_to_v4l2(driver_data, &surface->params.h264.matrix,
&matrix);
h264_va_slice_to_v4l2(driver_data, &surface->params.h264.slice,
&surface->params.h264.picture, &slice);
rc = v4l2_set_control(driver_data->video_fd, surface->request_fd,
V4L2_CID_MPEG_VIDEO_H264_DECODE_PARAMS,
&decode, sizeof(decode));
V4L2_CID_MPEG_VIDEO_H264_DECODE_PARAMS, &decode,
sizeof(decode));
if (rc < 0)
return VA_STATUS_ERROR_OPERATION_FAILED;
rc = v4l2_set_control(driver_data->video_fd, surface->request_fd,
V4L2_CID_MPEG_VIDEO_H264_SLICE_PARAMS,
&slice, sizeof(slice));
V4L2_CID_MPEG_VIDEO_H264_SLICE_PARAMS, &slice,
sizeof(slice));
if (rc < 0)
return VA_STATUS_ERROR_OPERATION_FAILED;
rc = v4l2_set_control(driver_data->video_fd, surface->request_fd,
V4L2_CID_MPEG_VIDEO_H264_PPS,
&pps, sizeof(pps));
V4L2_CID_MPEG_VIDEO_H264_PPS, &pps, sizeof(pps));
if (rc < 0)
return VA_STATUS_ERROR_OPERATION_FAILED;
rc = v4l2_set_control(driver_data->video_fd, surface->request_fd,
V4L2_CID_MPEG_VIDEO_H264_SPS,
&sps, sizeof(sps));
V4L2_CID_MPEG_VIDEO_H264_SPS, &sps, sizeof(sps));
if (rc < 0)
return VA_STATUS_ERROR_OPERATION_FAILED;
rc = v4l2_set_control(driver_data->video_fd, surface->request_fd,
V4L2_CID_MPEG_VIDEO_H264_SCALING_MATRIX,
&matrix, sizeof(matrix));
V4L2_CID_MPEG_VIDEO_H264_SCALING_MATRIX, &matrix,
sizeof(matrix));
if (rc < 0)
return VA_STATUS_ERROR_OPERATION_FAILED;
+1 -2
View File
@@ -30,7 +30,6 @@
struct object_surface;
struct cedrus_data;
int h264_set_controls(struct cedrus_data *data,
struct object_surface *surface);
int h264_set_controls(struct cedrus_data *data, struct object_surface *surface);
#endif
+30 -15
View File
@@ -23,17 +23,17 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "sunxi_cedrus.h"
#include "image.h"
#include "surface.h"
#include "buffer.h"
#include "sunxi_cedrus.h"
#include "surface.h"
#include <assert.h>
#include <string.h>
#include "v4l2.h"
#include "tiled_yuv.h"
#include "utils.h"
#include "v4l2.h"
VAStatus SunxiCedrusCreateImage(VADriverContextP context, VAImageFormat *format,
int width, int height, VAImage *image)
@@ -51,7 +51,10 @@ VAStatus SunxiCedrusCreateImage(VADriverContextP context, VAImageFormat *format,
unsigned int i;
int rc;
rc = v4l2_get_format(driver_data->video_fd, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, NULL, NULL, destination_bytesperlines, destination_sizes, &destination_planes_count);
rc = v4l2_get_format(driver_data->video_fd,
V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, NULL, NULL,
destination_bytesperlines, destination_sizes,
&destination_planes_count);
if (rc < 0)
return VA_STATUS_ERROR_OPERATION_FAILED;
@@ -65,9 +68,11 @@ VAStatus SunxiCedrusCreateImage(VADriverContextP context, VAImageFormat *format,
if (image_object == NULL)
return VA_STATUS_ERROR_ALLOCATION_FAILED;
status = SunxiCedrusCreateBuffer(context, 0, VAImageBufferType, size, 1, NULL, &buffer_id);
status = SunxiCedrusCreateBuffer(context, 0, VAImageBufferType, size, 1,
NULL, &buffer_id);
if (status != VA_STATUS_SUCCESS) {
object_heap_free(&driver_data->image_heap, (struct object_base *) image_object);
object_heap_free(&driver_data->image_heap,
(struct object_base *)image_object);
return status;
}
@@ -107,7 +112,8 @@ VAStatus SunxiCedrusDestroyImage(VADriverContextP context, VAImageID image_id)
if (status != VA_STATUS_SUCCESS)
return status;
object_heap_free(&driver_data->image_heap, (struct object_base *) image_object);
object_heap_free(&driver_data->image_heap,
(struct object_base *)image_object);
return VA_STATUS_SUCCESS;
}
@@ -137,7 +143,8 @@ VAStatus SunxiCedrusDeriveImage(VADriverContextP context,
format.fourcc = VA_FOURCC_NV12;
status = SunxiCedrusCreateImage(context, &format, surface_object->width, surface_object->height, image);
status = SunxiCedrusCreateImage(context, &format, surface_object->width,
surface_object->height, image);
if (status != VA_STATUS_SUCCESS)
return status;
@@ -147,9 +154,15 @@ VAStatus SunxiCedrusDeriveImage(VADriverContextP context,
for (i = 0; i < surface_object->destination_planes_count; i++) {
if (driver_data->tiled_format)
tiled_to_planar(surface_object->destination_data[i], buffer_object->data + image->offsets[i], image->pitches[i], image->width, i == 0 ? image->height : image->height / 2);
tiled_to_planar(surface_object->destination_data[i],
buffer_object->data + image->offsets[i],
image->pitches[i], image->width,
i == 0 ? image->height :
image->height / 2);
else
memcpy(buffer_object->data + image->offsets[i], surface_object->destination_data[i], surface_object->destination_sizes[i]);
memcpy(buffer_object->data + image->offsets[i],
surface_object->destination_data[i],
surface_object->destination_sizes[i]);
}
surface_object->status = VASurfaceReady;
@@ -158,7 +171,8 @@ VAStatus SunxiCedrusDeriveImage(VADriverContextP context,
}
VAStatus SunxiCedrusQueryImageFormats(VADriverContextP context,
VAImageFormat *formats, int *formats_count)
VAImageFormat *formats,
int *formats_count)
{
formats[0].fourcc = VA_FOURCC_NV12;
*formats_count = 1;
@@ -173,15 +187,16 @@ VAStatus SunxiCedrusSetImagePalette(VADriverContextP context,
}
VAStatus SunxiCedrusGetImage(VADriverContextP context, VASurfaceID surface_id,
int x, int y, unsigned int width, unsigned int height,
VAImageID image_id)
int x, int y, unsigned int width,
unsigned int height, VAImageID image_id)
{
return VA_STATUS_SUCCESS;
}
VAStatus SunxiCedrusPutImage(VADriverContextP context, VASurfaceID surface_id,
VAImageID image, int src_x, int src_y, unsigned int src_width,
unsigned int src_height, int dst_x, int dst_y, unsigned int dst_width,
VAImageID image, int src_x, int src_y,
unsigned int src_width, unsigned int src_height,
int dst_x, int dst_y, unsigned int dst_width,
unsigned int dst_height)
{
return VA_STATUS_SUCCESS;
+10 -6
View File
@@ -30,7 +30,9 @@
#include "object_heap.h"
#define IMAGE(id) ((struct object_image *) object_heap_lookup(&driver_data->image_heap, id))
#define IMAGE(id) \
((struct object_image *)object_heap_lookup(&driver_data->image_heap, \
id))
#define IMAGE_ID_OFFSET 0x10000000
struct object_image {
@@ -44,15 +46,17 @@ VAStatus SunxiCedrusDestroyImage(VADriverContextP context, VAImageID image_id);
VAStatus SunxiCedrusDeriveImage(VADriverContextP context,
VASurfaceID surface_id, VAImage *image);
VAStatus SunxiCedrusQueryImageFormats(VADriverContextP context,
VAImageFormat *formats, int *formats_count);
VAImageFormat *formats,
int *formats_count);
VAStatus SunxiCedrusSetImagePalette(VADriverContextP context,
VAImageID image_id, unsigned char *palette);
VAStatus SunxiCedrusGetImage(VADriverContextP context, VASurfaceID surface_id,
int x, int y, unsigned int width, unsigned int height,
VAImageID image_id);
int x, int y, unsigned int width,
unsigned int height, VAImageID image_id);
VAStatus SunxiCedrusPutImage(VADriverContextP context, VASurfaceID surface_id,
VAImageID image, int src_x, int src_y, unsigned int src_width,
unsigned int src_height, int dst_x, int dst_y, unsigned int dst_width,
VAImageID image, int src_x, int src_y,
unsigned int src_width, unsigned int src_height,
int dst_x, int dst_y, unsigned int dst_width,
unsigned int dst_height);
#endif
+9 -5
View File
@@ -22,9 +22,9 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <sys/select.h>
@@ -40,7 +40,8 @@ int media_request_alloc(int media_fd)
rc = ioctl(media_fd, MEDIA_IOC_REQUEST_ALLOC, &request_alloc);
if (rc < 0) {
sunxi_cedrus_log("Unable to allocate media request: %s\n", strerror(errno));
sunxi_cedrus_log("Unable to allocate media request: %s\n",
strerror(errno));
return -1;
}
@@ -53,7 +54,8 @@ int media_request_reinit(int request_fd)
rc = ioctl(request_fd, MEDIA_REQUEST_IOC_REINIT, NULL);
if (rc < 0) {
sunxi_cedrus_log("Unable to reinit media request: %s\n", strerror(errno));
sunxi_cedrus_log("Unable to reinit media request: %s\n",
strerror(errno));
return -1;
}
@@ -66,7 +68,8 @@ int media_request_queue(int request_fd)
rc = ioctl(request_fd, MEDIA_REQUEST_IOC_QUEUE, NULL);
if (rc < 0) {
sunxi_cedrus_log("Unable to queue media request: %s\n", strerror(errno));
sunxi_cedrus_log("Unable to queue media request: %s\n",
strerror(errno));
return -1;
}
@@ -87,7 +90,8 @@ int media_request_wait_completion(int request_fd)
sunxi_cedrus_log("Timeout when waiting for media request\n");
return -1;
} else if (rc < 0) {
sunxi_cedrus_log("Unable to select media request: %s\n", strerror(errno));
sunxi_cedrus_log("Unable to select media request: %s\n",
strerror(errno));
return -1;
}
+36 -18
View File
@@ -23,16 +23,16 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "mpeg2.h"
#include "context.h"
#include "sunxi_cedrus.h"
#include "mpeg2.h"
#include "surface.h"
#include <assert.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <linux/videodev2.h>
@@ -41,7 +41,8 @@
int mpeg2_set_controls(struct cedrus_data *driver_data,
struct object_surface *surface_object)
{
VAPictureParameterBufferMPEG2 *parameters = &surface_object->params.mpeg2.picture;
VAPictureParameterBufferMPEG2 *parameters =
&surface_object->params.mpeg2.picture;
struct v4l2_ctrl_mpeg2_slice_params slice_params;
struct object_surface *forward_reference_surface;
struct object_surface *backward_reference_surface;
@@ -61,28 +62,45 @@ int mpeg2_set_controls(struct cedrus_data *driver_data,
slice_params.f_code[1][0] = (parameters->f_code >> 4) & 0x0f;
slice_params.f_code[1][1] = (parameters->f_code >> 0) & 0x0f;
slice_params.intra_dc_precision = parameters->picture_coding_extension.bits.intra_dc_precision;
slice_params.picture_structure = parameters->picture_coding_extension.bits.picture_structure;
slice_params.top_field_first = parameters->picture_coding_extension.bits.top_field_first;
slice_params.frame_pred_frame_dct = parameters->picture_coding_extension.bits.frame_pred_frame_dct;
slice_params.concealment_motion_vectors = parameters->picture_coding_extension.bits.concealment_motion_vectors;
slice_params.q_scale_type = parameters->picture_coding_extension.bits.q_scale_type;
slice_params.intra_vlc_format = parameters->picture_coding_extension.bits.intra_vlc_format;
slice_params.alternate_scan = parameters->picture_coding_extension.bits.alternate_scan;
slice_params.intra_dc_precision =
parameters->picture_coding_extension.bits.intra_dc_precision;
slice_params.picture_structure =
parameters->picture_coding_extension.bits.picture_structure;
slice_params.top_field_first =
parameters->picture_coding_extension.bits.top_field_first;
slice_params.frame_pred_frame_dct =
parameters->picture_coding_extension.bits.frame_pred_frame_dct;
slice_params.concealment_motion_vectors =
parameters->picture_coding_extension.bits
.concealment_motion_vectors;
slice_params.q_scale_type =
parameters->picture_coding_extension.bits.q_scale_type;
slice_params.intra_vlc_format =
parameters->picture_coding_extension.bits.intra_vlc_format;
slice_params.alternate_scan =
parameters->picture_coding_extension.bits.alternate_scan;
forward_reference_surface = SURFACE(driver_data, parameters->forward_reference_picture);
forward_reference_surface =
SURFACE(driver_data, parameters->forward_reference_picture);
if (forward_reference_surface != NULL)
slice_params.forward_ref_index = forward_reference_surface->destination_index;
slice_params.forward_ref_index =
forward_reference_surface->destination_index;
else
slice_params.forward_ref_index = surface_object->destination_index;
slice_params.forward_ref_index =
surface_object->destination_index;
backward_reference_surface = SURFACE(driver_data, parameters->backward_reference_picture);
backward_reference_surface =
SURFACE(driver_data, parameters->backward_reference_picture);
if (backward_reference_surface != NULL)
slice_params.backward_ref_index = backward_reference_surface->destination_index;
slice_params.backward_ref_index =
backward_reference_surface->destination_index;
else
slice_params.backward_ref_index = surface_object->destination_index;
slice_params.backward_ref_index =
surface_object->destination_index;
rc = v4l2_set_control(driver_data->video_fd, surface_object->request_fd, V4L2_CID_MPEG_VIDEO_MPEG2_SLICE_PARAMS, &slice_params, sizeof(slice_params));
rc = v4l2_set_control(driver_data->video_fd, surface_object->request_fd,
V4L2_CID_MPEG_VIDEO_MPEG2_SLICE_PARAMS,
&slice_params, sizeof(slice_params));
if (rc < 0)
return VA_STATUS_ERROR_OPERATION_FAILED;
+20 -9
View File
@@ -39,7 +39,8 @@ static int object_heap_expand(struct object_heap *heap)
int new_num_buckets = heap->num_buckets + 8;
void **new_bucket;
new_bucket = realloc(heap->bucket, new_num_buckets * sizeof(void *));
new_bucket = realloc(heap->bucket,
new_num_buckets * sizeof(void *));
if (new_bucket == NULL)
return -1;
@@ -55,7 +56,9 @@ static int object_heap_expand(struct object_heap *heap)
next_free = heap->next_free;
for (i = new_heap_size; i-- > heap->heap_size;) {
object = (struct object_base *)(new_heap_index + (i - heap->heap_size) * heap->object_size);
object = (struct object_base *)(new_heap_index +
(i - heap->heap_size) *
heap->object_size);
object->id = i + heap->id_offset;
object->next_free = next_free;
next_free = i;
@@ -82,7 +85,8 @@ static int object_heap_allocate_unlocked(struct object_heap *heap)
bucket_index = heap->next_free / heap->heap_increment;
object_index = heap->next_free % heap->heap_increment;
object = (struct object_base *) (heap->bucket[bucket_index] + object_index * heap->object_size);
object = (struct object_base *)(heap->bucket[bucket_index] +
object_index * heap->object_size);
heap->next_free = object->next_free;
object->next_free = OBJECT_HEAP_ALLOCATED;
@@ -115,19 +119,22 @@ int object_heap_allocate(struct object_heap *heap)
return rc;
}
static struct object_base *object_heap_lookup_unlocked(struct object_heap *heap, int id)
static struct object_base *object_heap_lookup_unlocked(struct object_heap *heap,
int id)
{
struct object_base *object;
int bucket_index, object_index;
if ((id < heap->id_offset) || (id > (heap->heap_size + heap->id_offset)))
if ((id < heap->id_offset) ||
(id > (heap->heap_size + heap->id_offset)))
return NULL;
id &= OBJECT_HEAP_ID_MASK;
bucket_index = id / heap->heap_increment;
object_index = id % heap->heap_increment;
object = (struct object_base *)(heap->bucket[bucket_index] + object_index * heap->object_size);
object = (struct object_base *)(heap->bucket[bucket_index] +
object_index * heap->object_size);
if (object->next_free != OBJECT_HEAP_ALLOCATED)
return NULL;
@@ -153,7 +160,8 @@ struct object_base *object_heap_first(struct object_heap *heap, int *iterator)
return object_heap_next(heap, iterator);
}
static struct object_base *object_heap_next_unlocked(struct object_heap *heap, int *iterator)
static struct object_base *object_heap_next_unlocked(struct object_heap *heap,
int *iterator)
{
struct object_base *object;
int bucket_index, object_index;
@@ -163,7 +171,9 @@ static struct object_base *object_heap_next_unlocked(struct object_heap *heap, i
bucket_index = i / heap->heap_increment;
object_index = i % heap->heap_increment;
object = (struct object_base *)(heap->bucket[bucket_index] + object_index * heap->object_size);
object = (struct object_base *)(heap->bucket[bucket_index] +
object_index *
heap->object_size);
if (object->next_free == OBJECT_HEAP_ALLOCATED) {
*iterator = i;
return object;
@@ -188,7 +198,8 @@ struct object_base *object_heap_next(struct object_heap *heap, int *iterator)
return object;
}
static void object_heap_free_unlocked(struct object_heap *heap, struct object_base *object)
static void object_heap_free_unlocked(struct object_heap *heap,
struct object_base *object)
{
object->next_free = heap->next_free;
heap->next_free = object->id & OBJECT_HEAP_ID_MASK;
-1
View File
@@ -41,7 +41,6 @@
* Structures
*/
struct object_base {
int id;
int next_free;
+48 -23
View File
@@ -23,15 +23,15 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "sunxi_cedrus.h"
#include "picture.h"
#include "buffer.h"
#include "context.h"
#include "surface.h"
#include "config.h"
#include "context.h"
#include "sunxi_cedrus.h"
#include "surface.h"
#include "mpeg2.h"
#include "h264.h"
#include "mpeg2.h"
#include <assert.h>
#include <string.h>
@@ -42,12 +42,13 @@
#include <linux/videodev2.h>
#include "v4l2.h"
#include "media.h"
#include "utils.h"
#include "v4l2.h"
static VAStatus codec_store_buffer(struct cedrus_data *driver_data,
VAProfile profile, struct object_surface *surface_object,
VAProfile profile,
struct object_surface *surface_object,
struct object_buffer *buffer_object)
{
switch (buffer_object->type) {
@@ -58,22 +59,30 @@ static VAStatus codec_store_buffer(struct cedrus_data *driver_data,
* RenderPicture), we can't use a V4L2 buffer directly
* and have to copy from a regular buffer.
*/
memcpy(surface_object->source_data + surface_object->slices_size, buffer_object->data, buffer_object->size * buffer_object->count);
surface_object->slices_size += buffer_object->size * buffer_object->count;
memcpy(surface_object->source_data +
surface_object->slices_size,
buffer_object->data,
buffer_object->size * buffer_object->count);
surface_object->slices_size +=
buffer_object->size * buffer_object->count;
break;
case VAPictureParameterBufferType:
switch (profile) {
case VAProfileMPEG2Simple:
case VAProfileMPEG2Main:
memcpy(&surface_object->params.mpeg2.picture, buffer_object->data, sizeof(surface_object->params.mpeg2.picture));
memcpy(&surface_object->params.mpeg2.picture,
buffer_object->data,
sizeof(surface_object->params.mpeg2.picture));
break;
case VAProfileH264Main:
case VAProfileH264High:
case VAProfileH264ConstrainedBaseline:
case VAProfileH264MultiviewHigh:
case VAProfileH264StereoHigh:
memcpy(&surface_object->params.h264.picture, buffer_object->data, sizeof(surface_object->params.h264.picture));
memcpy(&surface_object->params.h264.picture,
buffer_object->data,
sizeof(surface_object->params.h264.picture));
break;
default:
break;
@@ -87,7 +96,9 @@ static VAStatus codec_store_buffer(struct cedrus_data *driver_data,
case VAProfileH264ConstrainedBaseline:
case VAProfileH264MultiviewHigh:
case VAProfileH264StereoHigh:
memcpy(&surface_object->params.h264.slice, buffer_object->data, sizeof(surface_object->params.h264.slice));
memcpy(&surface_object->params.h264.slice,
buffer_object->data,
sizeof(surface_object->params.h264.slice));
break;
default:
@@ -102,7 +113,9 @@ static VAStatus codec_store_buffer(struct cedrus_data *driver_data,
case VAProfileH264ConstrainedBaseline:
case VAProfileH264MultiviewHigh:
case VAProfileH264StereoHigh:
memcpy(&surface_object->params.h264.matrix, buffer_object->data, sizeof(surface_object->params.h264.matrix));
memcpy(&surface_object->params.h264.matrix,
buffer_object->data,
sizeof(surface_object->params.h264.matrix));
break;
default:
@@ -118,7 +131,8 @@ static VAStatus codec_store_buffer(struct cedrus_data *driver_data,
}
static VAStatus codec_set_controls(struct cedrus_data *driver_data,
VAProfile profile, struct object_surface *surface_object)
VAProfile profile,
struct object_surface *surface_object)
{
int rc;
@@ -173,7 +187,8 @@ VAStatus SunxiCedrusBeginPicture(VADriverContextP context,
}
VAStatus SunxiCedrusRenderPicture(VADriverContextP context,
VAContextID context_id, VABufferID *buffers_ids, int buffers_count)
VAContextID context_id,
VABufferID *buffers_ids, int buffers_count)
{
struct cedrus_data *driver_data =
(struct cedrus_data *)context->pDriverData;
@@ -192,7 +207,8 @@ VAStatus SunxiCedrusRenderPicture(VADriverContextP context,
if (config_object == NULL)
return VA_STATUS_ERROR_INVALID_CONFIG;
surface_object = SURFACE(driver_data, context_object->render_surface_id);
surface_object =
SURFACE(driver_data, context_object->render_surface_id);
if (surface_object == NULL)
return VA_STATUS_ERROR_INVALID_SURFACE;
@@ -201,7 +217,8 @@ VAStatus SunxiCedrusRenderPicture(VADriverContextP context,
if (buffer_object == NULL)
return VA_STATUS_ERROR_INVALID_BUFFER;
rc = codec_store_buffer(driver_data, config_object->profile, surface_object, buffer_object);
rc = codec_store_buffer(driver_data, config_object->profile,
surface_object, buffer_object);
if (rc != VA_STATUS_SUCCESS)
return rc;
}
@@ -209,8 +226,7 @@ VAStatus SunxiCedrusRenderPicture(VADriverContextP context,
return VA_STATUS_SUCCESS;
}
VAStatus SunxiCedrusEndPicture(VADriverContextP context,
VAContextID context_id)
VAStatus SunxiCedrusEndPicture(VADriverContextP context, VAContextID context_id)
{
struct cedrus_data *driver_data =
(struct cedrus_data *)context->pDriverData;
@@ -229,7 +245,8 @@ VAStatus SunxiCedrusEndPicture(VADriverContextP context,
if (config_object == NULL)
return VA_STATUS_ERROR_INVALID_CONFIG;
surface_object = SURFACE(driver_data, context_object->render_surface_id);
surface_object =
SURFACE(driver_data, context_object->render_surface_id);
if (surface_object == NULL)
return VA_STATUS_ERROR_INVALID_SURFACE;
@@ -242,21 +259,29 @@ VAStatus SunxiCedrusEndPicture(VADriverContextP context,
surface_object->request_fd = request_fd;
}
rc = codec_set_controls(driver_data, config_object->profile, surface_object);
rc = codec_set_controls(driver_data, config_object->profile,
surface_object);
if (rc != VA_STATUS_SUCCESS)
return rc;
rc = v4l2_queue_buffer(driver_data->video_fd, -1, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, surface_object->destination_index, 0, surface_object->destination_buffers_count);
rc = v4l2_queue_buffer(driver_data->video_fd, -1,
V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
surface_object->destination_index, 0,
surface_object->destination_buffers_count);
if (rc < 0)
return VA_STATUS_ERROR_OPERATION_FAILED;
rc = v4l2_queue_buffer(driver_data->video_fd, request_fd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, surface_object->source_index, surface_object->slices_size, 1);
rc = v4l2_queue_buffer(driver_data->video_fd, request_fd,
V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
surface_object->source_index,
surface_object->slices_size, 1);
if (rc < 0)
return VA_STATUS_ERROR_OPERATION_FAILED;
surface_object->slices_size = 0;
status = SunxiCedrusSyncSurface(context, context_object->render_surface_id);
status = SunxiCedrusSyncSurface(context,
context_object->render_surface_id);
if (status != VA_STATUS_SUCCESS)
return status;
+4 -2
View File
@@ -31,9 +31,11 @@
#include "object_heap.h"
VAStatus SunxiCedrusBeginPicture(VADriverContextP context,
VAContextID context_id, VASurfaceID surface_id);
VAContextID context_id,
VASurfaceID surface_id);
VAStatus SunxiCedrusRenderPicture(VADriverContextP context,
VAContextID context_id, VABufferID *buffers, int buffers_count);
VAContextID context_id, VABufferID *buffers,
int buffers_count);
VAStatus SunxiCedrusEndPicture(VADriverContextP context,
VAContextID context_id);
+27 -13
View File
@@ -23,11 +23,12 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "sunxi_cedrus.h"
#include "subpicture.h"
#include "sunxi_cedrus.h"
VAStatus SunxiCedrusCreateSubpicture(VADriverContextP context,
VAImageID image_id, VASubpictureID *subpicture_id)
VAImageID image_id,
VASubpictureID *subpicture_id)
{
return VA_STATUS_SUCCESS;
}
@@ -39,48 +40,61 @@ VAStatus SunxiCedrusDestroySubpicture(VADriverContextP context,
}
VAStatus SunxiCedrusQuerySubpictureFormats(VADriverContextP context,
VAImageFormat *formats, unsigned int *flags,
VAImageFormat *formats,
unsigned int *flags,
unsigned int *formats_count)
{
return VA_STATUS_SUCCESS;
}
VAStatus SunxiCedrusSetSubpictureImage(VADriverContextP context,
VASubpictureID subpicture_id, VAImageID image_id)
VASubpictureID subpicture_id,
VAImageID image_id)
{
return VA_STATUS_SUCCESS;
}
VAStatus SunxiCedrusSetSubpicturePalette(VADriverContextP context,
VASubpictureID subpicture_id, unsigned char *palette)
VASubpictureID subpicture_id,
unsigned char *palette)
{
return VA_STATUS_SUCCESS;
}
VAStatus SunxiCedrusSetSubpictureChromakey(VADriverContextP context,
VASubpictureID subpicture_id, unsigned int chromakey_min,
unsigned int chromakey_max, unsigned int chromakey_mask)
VASubpictureID subpicture_id,
unsigned int chromakey_min,
unsigned int chromakey_max,
unsigned int chromakey_mask)
{
return VA_STATUS_SUCCESS;
}
VAStatus SunxiCedrusSetSubpictureGlobalAlpha(VADriverContextP context,
VASubpictureID subpicture_id, float global_alpha)
VASubpictureID subpicture_id,
float global_alpha)
{
return VA_STATUS_SUCCESS;
}
VAStatus SunxiCedrusAssociateSubpicture(VADriverContextP context,
VASubpictureID subpicture_id, VASurfaceID *surfaces_ids,
int surfaces_count, short src_x, short src_y, unsigned short src_width,
unsigned short src_height, short dst_x, short dst_y,
unsigned short dst_width, unsigned short dst_height, unsigned int flags)
VASubpictureID subpicture_id,
VASurfaceID *surfaces_ids,
int surfaces_count,
short src_x, short src_y,
unsigned short src_width,
unsigned short src_height,
short dst_x, short dst_y,
unsigned short dst_width,
unsigned short dst_height,
unsigned int flags)
{
return VA_STATUS_SUCCESS;
}
VAStatus SunxiCedrusDeassociateSubpicture(VADriverContextP context,
VASubpictureID subpicture_id, VASurfaceID *surfaces_ids,
VASubpictureID subpicture_id,
VASurfaceID *surfaces_ids,
int surfaces_count)
{
return VA_STATUS_SUCCESS;
+25 -12
View File
@@ -29,29 +29,42 @@
#include <va/va_backend.h>
VAStatus SunxiCedrusCreateSubpicture(VADriverContextP context,
VAImageID image_id, VASubpictureID *subpicture_id);
VAImageID image_id,
VASubpictureID *subpicture_id);
VAStatus SunxiCedrusDestroySubpicture(VADriverContextP context,
VASubpictureID subpicture_id);
VAStatus SunxiCedrusQuerySubpictureFormats(VADriverContextP context,
VAImageFormat *formats, unsigned int *flags,
VAImageFormat *formats,
unsigned int *flags,
unsigned int *formats_count);
VAStatus SunxiCedrusSetSubpictureImage(VADriverContextP context,
VASubpictureID subpicture_id, VAImageID image_id);
VASubpictureID subpicture_id,
VAImageID image_id);
VAStatus SunxiCedrusSetSubpicturePalette(VADriverContextP context,
VASubpictureID subpicture_id, unsigned char *palette);
VASubpictureID subpicture_id,
unsigned char *palette);
VAStatus SunxiCedrusSetSubpictureChromakey(VADriverContextP context,
VASubpictureID subpicture_id, unsigned int chromakey_min,
unsigned int chromakey_max, unsigned int chromakey_mask);
VASubpictureID subpicture_id,
unsigned int chromakey_min,
unsigned int chromakey_max,
unsigned int chromakey_mask);
VAStatus SunxiCedrusSetSubpictureGlobalAlpha(VADriverContextP context,
VASubpictureID subpicture_id, float global_alpha);
VASubpictureID subpicture_id,
float global_alpha);
VAStatus SunxiCedrusAssociateSubpicture(VADriverContextP context,
VASubpictureID subpicture_id, VASurfaceID *surfaces_ids,
int surfaces_count, short src_x, short src_y, unsigned short src_width,
unsigned short src_height, short dst_x, short dst_y,
unsigned short dst_width, unsigned short dst_height,
VASubpictureID subpicture_id,
VASurfaceID *surfaces_ids,
int surfaces_count,
short src_x, short src_y,
unsigned short src_width,
unsigned short src_height,
short dst_x, short dst_y,
unsigned short dst_width,
unsigned short dst_height,
unsigned int flags);
VAStatus SunxiCedrusDeassociateSubpicture(VADriverContextP context,
VASubpictureID subpicture_id, VASurfaceID *surfaces_ids,
VASubpictureID subpicture_id,
VASurfaceID *surfaces_ids,
int surfaces_count);
#endif
+49 -26
View File
@@ -24,12 +24,12 @@
*/
#include "buffer.h"
#include "config.h"
#include "context.h"
#include "image.h"
#include "picture.h"
#include "subpicture.h"
#include "surface.h"
#include "config.h"
#include "autoconfig.h"
@@ -39,13 +39,13 @@
#include "utils.h"
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <stdarg.h>
#include <string.h>
#include <unistd.h>
#include <stdarg.h>
#include <fcntl.h>
#include <sys/ioctl.h>
@@ -112,7 +112,8 @@ VAStatus VA_DRIVER_INIT_FUNC(VADriverContextP context)
vtable->vaDestroySubpicture = SunxiCedrusDestroySubpicture;
vtable->vaSetSubpictureImage = SunxiCedrusSetSubpictureImage;
vtable->vaSetSubpictureChromakey = SunxiCedrusSetSubpictureChromakey;
vtable->vaSetSubpictureGlobalAlpha = SunxiCedrusSetSubpictureGlobalAlpha;
vtable->vaSetSubpictureGlobalAlpha =
SunxiCedrusSetSubpictureGlobalAlpha;
vtable->vaAssociateSubpicture = SunxiCedrusAssociateSubpicture;
vtable->vaDeassociateSubpicture = SunxiCedrusDeassociateSubpicture;
vtable->vaQueryDisplayAttributes = SunxiCedrusQueryDisplayAttributes;
@@ -127,11 +128,16 @@ VAStatus VA_DRIVER_INIT_FUNC(VADriverContextP context)
context->pDriverData = (void *)driver_data;
object_heap_init(&driver_data->config_heap, sizeof(struct object_config), CONFIG_ID_OFFSET);
object_heap_init(&driver_data->context_heap, sizeof(struct object_context), CONTEXT_ID_OFFSET);
object_heap_init(&driver_data->surface_heap, sizeof(struct object_surface), SURFACE_ID_OFFSET);
object_heap_init(&driver_data->buffer_heap, sizeof(struct object_buffer), BUFFER_ID_OFFSET);
object_heap_init(&driver_data->image_heap, sizeof(struct object_image), IMAGE_ID_OFFSET);
object_heap_init(&driver_data->config_heap,
sizeof(struct object_config), CONFIG_ID_OFFSET);
object_heap_init(&driver_data->context_heap,
sizeof(struct object_context), CONTEXT_ID_OFFSET);
object_heap_init(&driver_data->surface_heap,
sizeof(struct object_surface), SURFACE_ID_OFFSET);
object_heap_init(&driver_data->buffer_heap,
sizeof(struct object_buffer), BUFFER_ID_OFFSET);
object_heap_init(&driver_data->image_heap, sizeof(struct object_image),
IMAGE_ID_OFFSET);
video_path = getenv("LIBVA_CEDRUS_VIDEO_PATH");
if (video_path == NULL)
@@ -143,7 +149,8 @@ VAStatus VA_DRIVER_INIT_FUNC(VADriverContextP context)
rc = ioctl(video_fd, VIDIOC_QUERYCAP, &capability);
if (rc < 0 || !(capability.capabilities & V4L2_CAP_VIDEO_M2M_MPLANE)) {
sunxi_cedrus_log("Video device %s does not support m2m mplanes\n", video_path);
sunxi_cedrus_log("Video device %s does not support m2m mplanes\n",
video_path);
status = VA_STATUS_ERROR_OPERATION_FAILED;
goto error;
}
@@ -191,42 +198,58 @@ VAStatus SunxiCedrusTerminate(VADriverContextP context)
/* Cleanup leftover buffers. */
image_object = (struct object_image *) object_heap_first(&driver_data->image_heap, &iterator);
image_object = (struct object_image *)
object_heap_first(&driver_data->image_heap, &iterator);
while (image_object != NULL) {
SunxiCedrusDestroyImage(context, (VAImageID) image_object->base.id);
image_object = (struct object_image *) object_heap_next(&driver_data->image_heap, &iterator);
SunxiCedrusDestroyImage(context,
(VAImageID)image_object->base.id);
image_object = (struct object_image *)
object_heap_next(&driver_data->image_heap, &iterator);
}
object_heap_destroy(&driver_data->image_heap);
buffer_object = (struct object_buffer *) object_heap_first(&driver_data->buffer_heap, &iterator);
buffer_object = (struct object_buffer *)
object_heap_first(&driver_data->buffer_heap, &iterator);
while (buffer_object != NULL) {
SunxiCedrusDestroyBuffer(context, (VABufferID) buffer_object->base.id);
buffer_object = (struct object_buffer *) object_heap_next(&driver_data->buffer_heap, &iterator);
SunxiCedrusDestroyBuffer(context,
(VABufferID)buffer_object->base.id);
buffer_object = (struct object_buffer *)
object_heap_next(&driver_data->buffer_heap, &iterator);
}
object_heap_destroy(&driver_data->buffer_heap);
surface_object = (struct object_surface *) object_heap_first(&driver_data->surface_heap, &iterator);
surface_object = (struct object_surface *)
object_heap_first(&driver_data->surface_heap, &iterator);
while (surface_object != NULL) {
SunxiCedrusDestroySurfaces(context, (VASurfaceID *) &surface_object->base.id, 1);
surface_object = (struct object_surface *) object_heap_next(&driver_data->surface_heap, &iterator);
SunxiCedrusDestroySurfaces(context,
(VASurfaceID *)&surface_object->base.id,
1);
surface_object = (struct object_surface *)
object_heap_next(&driver_data->surface_heap, &iterator);
}
object_heap_destroy(&driver_data->surface_heap);
context_object = (struct object_context *) object_heap_first(&driver_data->context_heap, &iterator);
context_object = (struct object_context *)
object_heap_first(&driver_data->context_heap, &iterator);
while (context_object != NULL) {
SunxiCedrusDestroyContext(context, (VAContextID) context_object->base.id);
context_object = (struct object_context *) object_heap_next(&driver_data->context_heap, &iterator);
SunxiCedrusDestroyContext(context,
(VAContextID)context_object->base.id);
context_object = (struct object_context *)
object_heap_next(&driver_data->context_heap, &iterator);
}
object_heap_destroy(&driver_data->context_heap);
config_object = (struct object_config *) object_heap_first(&driver_data->config_heap, &iterator);
config_object = (struct object_config *)
object_heap_first(&driver_data->config_heap, &iterator);
while (config_object != NULL) {
SunxiCedrusDestroyConfig(context, (VAConfigID) config_object->base.id);
config_object = (struct object_config *) object_heap_next(&driver_data->config_heap, &iterator);
SunxiCedrusDestroyConfig(context,
(VAConfigID)config_object->base.id);
config_object = (struct object_config *)
object_heap_next(&driver_data->config_heap, &iterator);
}
object_heap_destroy(&driver_data->config_heap);
+2 -2
View File
@@ -28,9 +28,9 @@
#include <stdbool.h>
#include <va/va.h>
#include "object_heap.h"
#include "context.h"
#include "object_heap.h"
#include <va/va.h>
#include <linux/videodev2.h>
+91 -42
View File
@@ -23,27 +23,28 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "sunxi_cedrus.h"
#include "surface.h"
#include "sunxi_cedrus.h"
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <linux/videodev2.h>
#include "v4l2.h"
#include "video.h"
#include "media.h"
#include "utils.h"
#include "v4l2.h"
#include "video.h"
VAStatus SunxiCedrusCreateSurfaces(VADriverContextP context, int width,
int height, int format, int surfaces_count, VASurfaceID *surfaces_ids)
int height, int format, int surfaces_count,
VASurfaceID *surfaces_ids)
{
struct cedrus_data *driver_data =
(struct cedrus_data *)context->pDriverData;
@@ -62,7 +63,9 @@ VAStatus SunxiCedrusCreateSurfaces(VADriverContextP context, int width,
driver_data->tiled_format = true;
found = v4l2_find_format(driver_data->video_fd, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, V4L2_PIX_FMT_NV12);
found = v4l2_find_format(driver_data->video_fd,
V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
V4L2_PIX_FMT_NV12);
if (found)
driver_data->tiled_format = false;
@@ -70,15 +73,22 @@ VAStatus SunxiCedrusCreateSurfaces(VADriverContextP context, int width,
if (video_format == NULL)
return VA_STATUS_ERROR_OPERATION_FAILED;
rc = v4l2_set_format(driver_data->video_fd, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, video_format->v4l2_format, width, height);
rc = v4l2_set_format(driver_data->video_fd,
V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
video_format->v4l2_format, width, height);
if (rc < 0)
return VA_STATUS_ERROR_OPERATION_FAILED;
rc = v4l2_get_format(driver_data->video_fd, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, NULL, NULL, destination_bytesperlines, destination_sizes, &destination_planes_count);
rc = v4l2_get_format(driver_data->video_fd,
V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, NULL, NULL,
destination_bytesperlines, destination_sizes,
&destination_planes_count);
if (rc < 0)
return VA_STATUS_ERROR_OPERATION_FAILED;
rc = v4l2_create_buffers(driver_data->video_fd, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, surfaces_count);
rc = v4l2_create_buffers(driver_data->video_fd,
V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
surfaces_count);
if (rc < 0)
return VA_STATUS_ERROR_ALLOCATION_FAILED;
@@ -88,29 +98,47 @@ VAStatus SunxiCedrusCreateSurfaces(VADriverContextP context, int width,
if (surface_object == NULL)
return VA_STATUS_ERROR_ALLOCATION_FAILED;
rc = v4l2_request_buffer(driver_data->video_fd, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, i, surface_object->destination_map_lengths, surface_object->destination_map_offsets, video_format->v4l2_buffers_count);
rc = v4l2_request_buffer(driver_data->video_fd,
V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, i,
surface_object->destination_map_lengths,
surface_object->destination_map_offsets,
video_format->v4l2_buffers_count);
if (rc < 0)
return VA_STATUS_ERROR_ALLOCATION_FAILED;
for (j = 0; j < video_format->v4l2_buffers_count; j++) {
surface_object->destination_map[j] = mmap(NULL, surface_object->destination_map_lengths[j], PROT_READ | PROT_WRITE, MAP_SHARED, driver_data->video_fd, surface_object->destination_map_offsets[j]);
surface_object->destination_map[j] =
mmap(NULL,
surface_object->destination_map_lengths[j],
PROT_READ | PROT_WRITE, MAP_SHARED,
driver_data->video_fd,
surface_object->destination_map_offsets[j]);
if (surface_object->destination_map[j] == MAP_FAILED)
return VA_STATUS_ERROR_ALLOCATION_FAILED;
}
if (video_format->v4l2_buffers_count == 1) {
for (j = 0; j < destination_planes_count; j++) {
surface_object->destination_offsets[j] = j > 0 ? destination_sizes[j-1] : 0;
surface_object->destination_data[j] = (void *) ((unsigned char *) surface_object->destination_map[0] + surface_object->destination_offsets[j]);
surface_object->destination_sizes[j] = destination_sizes[j];
surface_object->destination_bytesperlines[j] = destination_bytesperlines[j];
surface_object->destination_offsets[j] =
j > 0 ? destination_sizes[j - 1] : 0;
surface_object->destination_data[j] =
(void *)((unsigned char *)surface_object->destination_map[0] +
surface_object->destination_offsets[j]);
surface_object->destination_sizes[j] =
destination_sizes[j];
surface_object->destination_bytesperlines[j] =
destination_bytesperlines[j];
}
} else if (video_format->v4l2_buffers_count == destination_planes_count) {
for (j = 0; j < destination_planes_count; j++) {
surface_object->destination_offsets[j] = 0;
surface_object->destination_data[j] = surface_object->destination_map[j];
surface_object->destination_sizes[j] = destination_sizes[j];
surface_object->destination_bytesperlines[j] = destination_bytesperlines[j];
surface_object->destination_data[j] =
surface_object->destination_map[j];
surface_object->destination_sizes[j] =
destination_sizes[j];
surface_object->destination_bytesperlines[j] =
destination_bytesperlines[j];
}
} else {
return VA_STATUS_ERROR_ALLOCATION_FAILED;
@@ -126,10 +154,13 @@ VAStatus SunxiCedrusCreateSurfaces(VADriverContextP context, int width,
surface_object->destination_index = 0;
surface_object->destination_planes_count = destination_planes_count;
surface_object->destination_buffers_count = video_format->v4l2_buffers_count;
surface_object->destination_planes_count =
destination_planes_count;
surface_object->destination_buffers_count =
video_format->v4l2_buffers_count;
memset(&surface_object->params, 0, sizeof(surface_object->params));
memset(&surface_object->params, 0,
sizeof(surface_object->params));
surface_object->slices_size = 0;
surface_object->request_fd = -1;
@@ -141,7 +172,8 @@ VAStatus SunxiCedrusCreateSurfaces(VADriverContextP context, int width,
}
VAStatus SunxiCedrusDestroySurfaces(VADriverContextP context,
VASurfaceID *surfaces_ids, int surfaces_count)
VASurfaceID *surfaces_ids,
int surfaces_count)
{
struct cedrus_data *driver_data =
(struct cedrus_data *)context->pDriverData;
@@ -153,20 +185,25 @@ VAStatus SunxiCedrusDestroySurfaces(VADriverContextP context,
if (surface_object == NULL)
return VA_STATUS_ERROR_INVALID_SURFACE;
if (surface_object->source_data != NULL && surface_object->source_size > 0)
munmap(surface_object->source_data, surface_object->source_size);
if (surface_object->source_data != NULL &&
surface_object->source_size > 0)
munmap(surface_object->source_data,
surface_object->source_size);
if (surface_object->request_fd >= 0)
close(surface_object->request_fd);
for (j = 0; j < surface_object->destination_buffers_count; j++)
if (surface_object->destination_map[j] != NULL && surface_object->destination_map_lengths[j] > 0)
munmap(surface_object->destination_map[j], surface_object->destination_map_lengths[j]);
if (surface_object->destination_map[j] != NULL &&
surface_object->destination_map_lengths[j] > 0)
munmap(surface_object->destination_map[j],
surface_object->destination_map_lengths[j]);
if (surface_object->request_fd > 0)
close(surface_object->request_fd);
object_heap_free(&driver_data->surface_heap, (struct object_base *) surface_object);
object_heap_free(&driver_data->surface_heap,
(struct object_base *)surface_object);
}
return VA_STATUS_SUCCESS;
@@ -217,13 +254,18 @@ VAStatus SunxiCedrusSyncSurface(VADriverContextP context,
goto error;
}
rc = v4l2_dequeue_buffer(driver_data->video_fd, -1, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, surface_object->source_index, 1);
rc = v4l2_dequeue_buffer(driver_data->video_fd, -1,
V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
surface_object->source_index, 1);
if (rc < 0) {
status = VA_STATUS_ERROR_OPERATION_FAILED;
goto error;
}
rc = v4l2_dequeue_buffer(driver_data->video_fd, -1, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, surface_object->destination_index, surface_object->destination_buffers_count);
rc = v4l2_dequeue_buffer(driver_data->video_fd, -1,
V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
surface_object->destination_index,
surface_object->destination_buffers_count);
if (rc < 0) {
status = VA_STATUS_ERROR_OPERATION_FAILED;
goto error;
@@ -245,7 +287,8 @@ complete:
}
VAStatus SunxiCedrusQuerySurfaceStatus(VADriverContextP context,
VASurfaceID surface_id, VASurfaceStatus *status)
VASurfaceID surface_id,
VASurfaceStatus *status)
{
struct cedrus_data *driver_data =
(struct cedrus_data *)context->pDriverData;
@@ -261,20 +304,26 @@ VAStatus SunxiCedrusQuerySurfaceStatus(VADriverContextP context,
}
VAStatus SunxiCedrusPutSurface(VADriverContextP context, VASurfaceID surface_id,
void *draw, short src_x, short src_y, unsigned short src_width,
unsigned short src_height, short dst_x, short dst_y,
unsigned short dst_width, unsigned short dst_height,
VARectangle *cliprects, unsigned int cliprects_count,
unsigned int flags)
void *draw, short src_x, short src_y,
unsigned short src_width,
unsigned short src_height, short dst_x,
short dst_y, unsigned short dst_width,
unsigned short dst_height,
VARectangle *cliprects,
unsigned int cliprects_count, unsigned int flags)
{
return VA_STATUS_ERROR_UNIMPLEMENTED;
}
VAStatus SunxiCedrusLockSurface(VADriverContextP context,
VASurfaceID surface_id, unsigned int *fourcc, unsigned int *luma_stride,
unsigned int *chroma_u_stride, unsigned int *chroma_v_stride,
unsigned int *luma_offset, unsigned int *chroma_u_offset,
unsigned int *chroma_v_offset, unsigned int *buffer_name, void **buffer)
VASurfaceID surface_id, unsigned int *fourcc,
unsigned int *luma_stride,
unsigned int *chroma_u_stride,
unsigned int *chroma_v_stride,
unsigned int *luma_offset,
unsigned int *chroma_u_offset,
unsigned int *chroma_v_offset,
unsigned int *buffer_name, void **buffer)
{
return VA_STATUS_ERROR_UNIMPLEMENTED;
}
+23 -13
View File
@@ -32,7 +32,8 @@
#include "object_heap.h"
#define SURFACE(data, id) ((struct object_surface *) object_heap_lookup(&(data)->surface_heap, id))
#define SURFACE(data, id) \
((struct object_surface *)object_heap_lookup(&(data)->surface_heap, id))
#define SURFACE_ID_OFFSET 0x04000000
struct object_surface {
@@ -74,25 +75,34 @@ struct object_surface {
};
VAStatus SunxiCedrusCreateSurfaces(VADriverContextP context, int width,
int height, int format, int surfaces_count, VASurfaceID *surfaces_ids);
int height, int format, int surfaces_count,
VASurfaceID *surfaces_ids);
VAStatus SunxiCedrusDestroySurfaces(VADriverContextP context,
VASurfaceID *surfaces_ids, int surfaces_count);
VASurfaceID *surfaces_ids,
int surfaces_count);
VAStatus SunxiCedrusSyncSurface(VADriverContextP context,
VASurfaceID surface_id);
VAStatus SunxiCedrusQuerySurfaceStatus(VADriverContextP context,
VASurfaceID surface_id, VASurfaceStatus *status);
VASurfaceID surface_id,
VASurfaceStatus *status);
VAStatus SunxiCedrusPutSurface(VADriverContextP context, VASurfaceID surface_id,
void *draw, short src_x, short src_y, unsigned short src_width,
unsigned short src_height, short dst_x, short dst_y,
unsigned short dst_width, unsigned short dst_height,
VARectangle *cliprects, unsigned int cliprects_count,
void *draw, short src_x, short src_y,
unsigned short src_width,
unsigned short src_height, short dst_x,
short dst_y, unsigned short dst_width,
unsigned short dst_height,
VARectangle *cliprects,
unsigned int cliprects_count,
unsigned int flags);
VAStatus SunxiCedrusLockSurface(VADriverContextP context,
VASurfaceID surface_id, unsigned int *fourcc, unsigned int *luma_stride,
unsigned int *chroma_u_stride, unsigned int *chroma_v_stride,
unsigned int *luma_offset, unsigned int *chroma_u_offset,
unsigned int *chroma_v_offset, unsigned int *buffer_name,
void **buffer);
VASurfaceID surface_id, unsigned int *fourcc,
unsigned int *luma_stride,
unsigned int *chroma_u_stride,
unsigned int *chroma_v_stride,
unsigned int *luma_offset,
unsigned int *chroma_u_offset,
unsigned int *chroma_v_offset,
unsigned int *buffer_name, void **buffer);
VAStatus SunxiCedrusUnlockSurface(VADriverContextP context,
VASurfaceID surface_id);
+2 -2
View File
@@ -24,7 +24,7 @@ void tiled_to_planar(void *src, void *dst, unsigned int dst_pitch,
unsigned int width, unsigned int height);
void tiled_deinterleave_to_planar(void *src, void *dst1, void *dst2,
unsigned int dst_pitch,
unsigned int width, unsigned int height);
unsigned int dst_pitch, unsigned int width,
unsigned int height);
#endif
+2 -2
View File
@@ -23,9 +23,9 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include "sunxi_cedrus.h"
#include "utils.h"
+30 -17
View File
@@ -22,15 +22,15 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <linux/videodev2.h>
#include "v4l2.h"
#include "utils.h"
#include "v4l2.h"
bool v4l2_find_format(int video_fd, unsigned int type, unsigned int pixelformat)
{
@@ -65,12 +65,14 @@ int v4l2_set_format(int video_fd, unsigned int type, unsigned int pixelformat,
format.type = type;
format.fmt.pix_mp.width = width;
format.fmt.pix_mp.height = height;
format.fmt.pix_mp.plane_fmt[0].sizeimage = type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE ? SOURCE_SIZE_MAX : 0;
format.fmt.pix_mp.plane_fmt[0].sizeimage =
type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE ? SOURCE_SIZE_MAX : 0;
format.fmt.pix_mp.pixelformat = pixelformat;
rc = ioctl(video_fd, VIDIOC_S_FMT, &format);
if (rc < 0) {
sunxi_cedrus_log("Unable to set format for type %d: %s\n", type, strerror(errno));
sunxi_cedrus_log("Unable to set format for type %d: %s\n", type,
strerror(errno));
return -1;
}
@@ -78,8 +80,8 @@ int v4l2_set_format(int video_fd, unsigned int type, unsigned int pixelformat,
}
int v4l2_get_format(int video_fd, unsigned int type, unsigned int *width,
unsigned int *height, unsigned int *bytesperline, unsigned int *sizes,
unsigned int *planes_count)
unsigned int *height, unsigned int *bytesperline,
unsigned int *sizes, unsigned int *planes_count)
{
struct v4l2_format format;
unsigned int count;
@@ -91,7 +93,8 @@ int v4l2_get_format(int video_fd, unsigned int type, unsigned int *width,
rc = ioctl(video_fd, VIDIOC_G_FMT, &format);
if (rc < 0) {
sunxi_cedrus_log("Unable to get format for type %d: %s\n", type, strerror(errno));
sunxi_cedrus_log("Unable to get format for type %d: %s\n", type,
strerror(errno));
return -1;
}
@@ -109,7 +112,8 @@ int v4l2_get_format(int video_fd, unsigned int type, unsigned int *width,
if (bytesperline != NULL)
for (i = 0; i < count; i++)
bytesperline[i] = format.fmt.pix_mp.plane_fmt[i].bytesperline;
bytesperline[i] =
format.fmt.pix_mp.plane_fmt[i].bytesperline;
if (sizes != NULL)
for (i = 0; i < count; i++)
@@ -134,13 +138,15 @@ int v4l2_create_buffers(int video_fd, unsigned int type,
rc = ioctl(video_fd, VIDIOC_G_FMT, &buffers.format);
if (rc < 0) {
sunxi_cedrus_log("Unable to get format for type %d: %s\n", type, strerror(errno));
sunxi_cedrus_log("Unable to get format for type %d: %s\n", type,
strerror(errno));
return -1;
}
rc = ioctl(video_fd, VIDIOC_CREATE_BUFS, &buffers);
if (rc < 0) {
sunxi_cedrus_log("Unable to create buffer for type %d: %s\n", type, strerror(errno));
sunxi_cedrus_log("Unable to create buffer for type %d: %s\n",
type, strerror(errno));
return -1;
}
@@ -167,7 +173,8 @@ int v4l2_request_buffer(int video_fd, unsigned int type, unsigned int index,
rc = ioctl(video_fd, VIDIOC_QUERYBUF, &buffer);
if (rc < 0) {
sunxi_cedrus_log("Unable to query buffer: %s\n", strerror(errno));
sunxi_cedrus_log("Unable to query buffer: %s\n",
strerror(errno));
return -1;
}
@@ -183,7 +190,8 @@ int v4l2_request_buffer(int video_fd, unsigned int type, unsigned int index,
}
int v4l2_queue_buffer(int video_fd, int request_fd, unsigned int type,
unsigned int index, unsigned int size, unsigned int buffers_count)
unsigned int index, unsigned int size,
unsigned int buffers_count)
{
struct v4l2_plane planes[buffers_count];
struct v4l2_buffer buffer;
@@ -209,7 +217,8 @@ int v4l2_queue_buffer(int video_fd, int request_fd, unsigned int type,
rc = ioctl(video_fd, VIDIOC_QBUF, &buffer);
if (rc < 0) {
sunxi_cedrus_log("Unable to queue buffer: %s\n", strerror(errno));
sunxi_cedrus_log("Unable to queue buffer: %s\n",
strerror(errno));
return -1;
}
@@ -239,7 +248,8 @@ int v4l2_dequeue_buffer(int video_fd, int request_fd, unsigned int type,
rc = ioctl(video_fd, VIDIOC_DQBUF, &buffer);
if (rc < 0) {
sunxi_cedrus_log("Unable to dequeue buffer: %s\n", strerror(errno));
sunxi_cedrus_log("Unable to dequeue buffer: %s\n",
strerror(errno));
return -1;
}
@@ -270,7 +280,8 @@ int v4l2_set_control(int video_fd, int request_fd, unsigned int id, void *data,
rc = ioctl(video_fd, VIDIOC_S_EXT_CTRLS, &controls);
if (rc < 0) {
sunxi_cedrus_log("Unable to set control: %s\n", strerror(errno));
sunxi_cedrus_log("Unable to set control: %s\n",
strerror(errno));
return -1;
}
@@ -282,9 +293,11 @@ int v4l2_set_stream(int video_fd, unsigned int type, bool enable)
enum v4l2_buf_type buf_type = type;
int rc;
rc = ioctl(video_fd, enable ? VIDIOC_STREAMON : VIDIOC_STREAMOFF, &buf_type);
rc = ioctl(video_fd, enable ? VIDIOC_STREAMON : VIDIOC_STREAMOFF,
&buf_type);
if (rc < 0) {
sunxi_cedrus_log("Unable to %sable stream: %s\n", enable ? "en" : "dis", strerror(errno));
sunxi_cedrus_log("Unable to %sable stream: %s\n",
enable ? "en" : "dis", strerror(errno));
return -1;
}
+4 -3
View File
@@ -34,15 +34,16 @@ bool v4l2_find_format(int video_fd, unsigned int type,
int v4l2_set_format(int video_fd, unsigned int type, unsigned int pixelformat,
unsigned int width, unsigned int height);
int v4l2_get_format(int video_fd, unsigned int type, unsigned int *width,
unsigned int *height, unsigned int *bytesperline, unsigned int *sizes,
unsigned int *planes_count);
unsigned int *height, unsigned int *bytesperline,
unsigned int *sizes, unsigned int *planes_count);
int v4l2_create_buffers(int video_fd, unsigned int type,
unsigned int buffers_count);
int v4l2_request_buffer(int video_fd, unsigned int type, unsigned int index,
unsigned int *lengths, unsigned int *offsets,
unsigned int buffers_count);
int v4l2_queue_buffer(int video_fd, int request_fd, unsigned int type,
unsigned int index, unsigned int size, unsigned int buffers_count);
unsigned int index, unsigned int size,
unsigned int buffers_count);
int v4l2_dequeue_buffer(int video_fd, int request_fd, unsigned int type,
unsigned int index, unsigned int buffers_count);
int v4l2_set_control(int video_fd, int request_fd, unsigned int id, void *data,
+5 -5
View File
@@ -22,17 +22,17 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <errno.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <linux/videodev2.h>
#include <drm_fourcc.h>
#include <linux/videodev2.h>
#include "video.h"
#include "utils.h"
#include "video.h"
static inline unsigned int video_v4l2_format(bool tiled_format)
{