mirror of
https://github.com/tbsdtv/media_build.git
synced 2025-07-23 04:13:02 +02:00
Build frame_vector.c
Needed for vb2. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
This commit is contained in:
@@ -11,6 +11,7 @@ TARDIR += drivers/media/
|
||||
TARDIR += drivers/staging/media/
|
||||
TARDIR += drivers/misc/altera-stapl/
|
||||
TARFILES += sound/pci/bt87x.c
|
||||
TARFILES += mm/frame_vector.c
|
||||
|
||||
# Includes
|
||||
|
||||
|
2
v4l/Kconfig.mm
Normal file
2
v4l/Kconfig.mm
Normal file
@@ -0,0 +1,2 @@
|
||||
config FRAME_VECTOR
|
||||
tristate
|
@@ -104,6 +104,7 @@ endif
|
||||
ifeq ($(makefile-media),1)
|
||||
-include $(obj)/Makefile.media
|
||||
-include $(obj)/Makefile.sound
|
||||
-include $(obj)/Makefile.mm
|
||||
endif
|
||||
|
||||
-include $(obj)/.kconfig.dep
|
||||
@@ -256,6 +257,7 @@ links::
|
||||
@echo creating symbolic links...
|
||||
@find ../linux/drivers/media -name '*.[ch]' -type f -print0 | xargs -0n 255 ln -sf --target-directory=.
|
||||
@find ../linux/sound -name '*.[ch]' -type f -print0 | xargs -0n 255 ln -sf --target-directory=.
|
||||
@find ../linux/mm -name '*.[ch]' -type f -print0 | xargs -0n 255 ln -sf --target-directory=.
|
||||
@find ../linux/drivers/staging -name '*.[ch]' -type f -print0 | xargs -0n 255 ln -sf --target-directory=.
|
||||
@find ../linux/drivers/misc -name '*.[ch]' -type f -print0 | xargs -0n 255 ln -sf --target-directory=.
|
||||
|
||||
|
13
v4l/Makefile.mm
Normal file
13
v4l/Makefile.mm
Normal file
@@ -0,0 +1,13 @@
|
||||
# From mm/Makefile
|
||||
|
||||
obj-$(CONFIG_FRAME_VECTOR) += frame_vector.o
|
||||
|
||||
KDIRA := /lib/modules/$(KERNELRELEASE)/kernel
|
||||
|
||||
mm-install install-mm::
|
||||
@dir="mm"; \
|
||||
files='frame_vector.ko'; \
|
||||
echo -e "\nInstalling $(KDIRA)/$$dir files:"; \
|
||||
install -d $(KDIRA)/$$dir; \
|
||||
for i in $$files;do if [ -e $$i ]; then echo -n "$$i "; \
|
||||
install -m 644 -c $$i $(KDIRA)/$$dir; fi; done; echo;
|
49
v4l/compat.h
49
v4l/compat.h
@@ -1623,4 +1623,53 @@ static inline void eth_zero_addr(u8 *addr)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NEED_FRAME_VECTOR
|
||||
#include <linux/mm.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
/* Container for pinned pfns / pages */
|
||||
struct frame_vector {
|
||||
unsigned int nr_allocated; /* Number of frames we have space for */
|
||||
unsigned int nr_frames; /* Number of frames stored in ptrs array */
|
||||
bool got_ref; /* Did we pin pages by getting page ref? */
|
||||
bool is_pfns; /* Does array contain pages or pfns? */
|
||||
void *ptrs[0]; /* Array of pinned pfns / pages. Use
|
||||
* pfns_vector_pages() or pfns_vector_pfns()
|
||||
* for access */
|
||||
};
|
||||
|
||||
struct frame_vector *frame_vector_create(unsigned int nr_frames);
|
||||
void frame_vector_destroy(struct frame_vector *vec);
|
||||
int get_vaddr_frames(unsigned long start, unsigned int nr_pfns,
|
||||
bool write, bool force, struct frame_vector *vec);
|
||||
void put_vaddr_frames(struct frame_vector *vec);
|
||||
int frame_vector_to_pages(struct frame_vector *vec);
|
||||
void frame_vector_to_pfns(struct frame_vector *vec);
|
||||
|
||||
static inline unsigned int frame_vector_count(struct frame_vector *vec)
|
||||
{
|
||||
return vec->nr_frames;
|
||||
}
|
||||
|
||||
static inline struct page **frame_vector_pages(struct frame_vector *vec)
|
||||
{
|
||||
if (vec->is_pfns) {
|
||||
int err = frame_vector_to_pages(vec);
|
||||
|
||||
if (err)
|
||||
return ERR_PTR(err);
|
||||
}
|
||||
return (struct page **)(vec->ptrs);
|
||||
}
|
||||
|
||||
static inline unsigned long *frame_vector_pfns(struct frame_vector *vec)
|
||||
{
|
||||
if (!vec->is_pfns)
|
||||
frame_vector_to_pfns(vec);
|
||||
return (unsigned long *)(vec->ptrs);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _COMPAT_H */
|
||||
|
@@ -650,6 +650,7 @@ sub check_other_dependencies()
|
||||
check_files_for_func("of_property_read_u64_array", "NEED_PROP_READ_U64_ARRAY", "include/linux/of.h");
|
||||
check_files_for_func("module_pnp_driver", "NEED_MODULE_PNP_DRIVER", "include/linux/pnp.h");
|
||||
check_files_for_func("eth_zero_addr", "NEED_ETH_ZERO_ADDR", "include/linux/etherdevice.h");
|
||||
check_files_for_func("frame_vector_create", "NEED_FRAME_VECTOR", "include/linux/mm.h");
|
||||
|
||||
# For tests for uapi-dependent logic
|
||||
check_files_for_func_uapi("usb_endpoint_maxp", "NEED_USB_ENDPOINT_MAXP", "usb/ch9.h");
|
||||
|
@@ -602,6 +602,7 @@ EOF
|
||||
|
||||
open_kconfig('../linux', '../linux/drivers/media/Kconfig');
|
||||
open_kconfig('.', './Kconfig.sound');
|
||||
open_kconfig('.', './Kconfig.mm');
|
||||
open_kconfig('.', './Kconfig.misc');
|
||||
open_kconfig('../linux', './Kconfig.staging');
|
||||
close OUT;
|
||||
|
Reference in New Issue
Block a user