aboutsummaryrefslogtreecommitdiff
path: root/drivers/video/adf
AgeCommit message (Collapse)Author
2016-11-15ANDROID: video: adf: Avoid directly referencing user pointersJonathan Hamilton
Enabling KASAN on a kernel using ADF causes a number of places where user-supplied pointers to ioctls pointers are directly dereferenced without copy_from_user or access_ok. Bug: 31806036 Signed-off-by: Jonathan Hamilton <jonathan.hamilton@imgtec.com> Change-Id: I6e86237aaa6cec0f6e1c385336aefcc5332080ae
2016-04-07video: adf: Set ADF_MEMBLOCK to booleanGuenter Roeck
Attempts to build with CONFIG_ADF_MEMBLOCK=m result in the following build error. ERROR: "memblock_free" [drivers/video/adf/adf_memblock.ko] undefined! memblock_free() is marked as __init_memblock, so exporting it seems to be a bad idea. All other callers are only configurable into the kernel, so do the same with ADF_MEMBLOCK. Signed-off-by: Guenter Roeck <groeck@chromium.org>
2016-04-07video: adf: Fix modular buildGuenter Roeck
Builds with ADF configured as module fail the following errors. ERROR: "adf_fops" [drivers/video/adf/adf_sysfs.ko] undefined! ERROR: "adf_obj_sysfs_find" [drivers/video/adf/adf_fops.ko] undefined! ERROR: "adf_buffer_cleanup" [drivers/video/adf/adf_fops.ko] undefined! ERROR: "adf_attachment_validate" [drivers/video/adf/adf_client.ko] undefined! ERROR: "adf_attachment_find" [drivers/video/adf/adf_client.ko] undefined! ERROR: "adf_buffer_mapping_cleanup" [drivers/video/adf/adf_client.ko] undefined! ERROR: "adf_attachment_free" [drivers/video/adf/adf_client.ko] undefined! ERROR: "adf_obj_find_event_refcount" [drivers/video/adf/adf_client.ko] undefined! ERROR: "adf_file_queue_event" [drivers/video/adf/adf.ko] undefined! ERROR: "adf_interface_sysfs_init" [drivers/video/adf/adf.ko] undefined! ERROR: "adf_interface_sysfs_destroy" [drivers/video/adf/adf.ko] undefined! ERROR: "adf_device_sysfs_init" [drivers/video/adf/adf.ko] undefined! ERROR: "adf_device_sysfs_destroy" [drivers/video/adf/adf.ko] undefined! ERROR: "adf_sysfs_destroy" [drivers/video/adf/adf.ko] undefined! ERROR: "adf_overlay_engine_sysfs_init" [drivers/video/adf/adf.ko] undefined! ERROR: "adf_overlay_engine_sysfs_destroy" [drivers/video/adf/adf.ko] undefined! ERROR: "adf_sysfs_init" [drivers/video/adf/adf.ko] undefined! If ADF is configured as module, each of the object files ends up being a separate module. Since the functions are used across the various files but not exported, this results in the observed build errors. Modify the Makefile to create a single module instead. Fixes: 066a50cee536 ("video: add atomic display framework") Signed-off-by: Guenter Roeck <groeck@chromium.org>
2016-02-16video: adf: build fixes for 4.1Amit Pundir
Couple of ADF build fixes for v4.1 adf/adf_fops.c fix: get_unused_fd() is obsolete, use get_unused_fd_flags(O_CLOEXEC) instead to allocate a default file descriptor. This fix is a followup of upstream commit f938612dd97d "include/linux/file.h: remove get_unused_fd() macro". adf/adf_memblock.c fix: Fix dma_buf_export() call. Based on mainline commit d8fbe341beb6 "dma-buf: cleanup dma_buf_export() to make it easily extensible". Otherwise we run into following build failures: ---------- CC drivers/video/adf/adf_fops.o CC drivers/video/adf/adf_memblock.o drivers/video/adf/adf_memblock.c: In function ‘adf_memblock_export’: drivers/video/adf/adf_memblock.c:154:2: warning: passing argument 1 of ‘dma_buf_export’ from incompatible pointer type [enabled by default] In file included from drivers/video/adf/adf_memblock.c:15:0: include/linux/dma-buf.h:211:17: note: expected ‘const struct dma_buf_export_info *’ but argument is of type ‘struct adf_memblock_pdata *’ drivers/video/adf/adf_memblock.c:154:2: error: too many arguments to function ‘dma_buf_export’ In file included from drivers/video/adf/adf_memblock.c:15:0: include/linux/dma-buf.h:211:17: note: declared here make[3]: *** [drivers/video/adf/adf_memblock.o] Error 1 make[3]: *** Waiting for unfinished jobs.... drivers/video/adf/adf_fops.c: In function ‘adf_device_post_config’: drivers/video/adf/adf_fops.c:228:2: error: implicit declaration of function ‘get_unused_fd’ [-Werror=implicit-function-declaration] cc1: some warnings being treated as errors make[3]: *** [drivers/video/adf/adf_fops.o] Error 1 make[2]: *** [drivers/video/adf] Error 2 make[2]: *** Waiting for unfinished jobs.... ---------- Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
2016-02-16video: adf: fix memblock build failureAmit Pundir
Pass 'NULL' as the 5th argument to dma_buf_export() to fix the following build failure: ---------- CC drivers/video/adf/adf_memblock.o drivers/video/adf/adf_memblock.c: In function ‘adf_memblock_export’: drivers/video/adf/adf_memblock.c:154:60: error: macro "dma_buf_export" requires 5 arguments, but only 4 given drivers/video/adf/adf_memblock.c:154:8: error: ‘dma_buf_export’ undeclared (first use in this function) drivers/video/adf/adf_memblock.c:154:8: note: each undeclared identifier is reported only once for each function it appears in make[3]: *** [drivers/video/adf/adf_memblock.o] Error 1 make[2]: *** [drivers/video/adf] Error 2 ---------- 5th argument to dma_buf_export() is a pointer to 'reservation-object' and a new 'reservation-object' is allocated in case 'NULL' is passed. Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
2016-02-16video: adf: fix wrong bitops in adf_modeinfo_to_fb_videomode()Greg Hackmann
Change-Id: I1296153e382c0b66b713a0e7d09665ed5961f13d Signed-off-by: Greg Hackmann <ghackmann@google.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
2016-02-16video: adf: Cleanup sw_sync timeline at adf_device_destroyJonathan Hamilton
If a sw_sync timeline was created by ADF (for drivers that do not implement ops->complete_fence) we should clean it up when the ADF device is destroyed. Change-Id: Idd90180fcae56a87111f7d12bdd80190756a6b80 Signed-off-by: Jonathan Hamilton <jonathan.hamilton@imgtec.com>
2016-02-16video: adf: memblock: map buffer for dmaGreg Hackmann
Change-Id: I4df13c8b45b57fd0594b5e7bf351a4da33a8cb11 Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-02-16video: adf: use rb_erase in adf_obj_destroy.Alistair Strachan
Not calling rb_erase() can cause slab corruption, as the rb_first() call after kfree() in adf_obj_destroy() can return the same node twice unless it is erased. This problem was reproduced by unloading a kernel module that used the adf framework *after* a vsync event was registered. A crash would occur in rb_first(). (Just loading and immediately unloading the module without the vsync event worked correctly.) Change-Id: I9fa7cb5d7519691e38a281439844aa193da13d1b Signed-off-by: Alistair Strachan <alistair.strachan@imgtec.com> Cc: Jonathan Hamilton <jonathan.hamilton@imgtec.com> Cc: Greg Hackmann <ghackmann@google.com>
2016-02-16video: adf: adf_memblock_export symbol should be exportedGreg Hackmann
Change-Id: I228db28da885b47b6fa9fc7e4001663797d24f49 Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-02-16video: adf: add buffer padding quirkGreg Hackmann
Quirks specify common behaviors that vary slightly among devices, and which ADF must account for. The buffer padding quirk captures the way different devices fetch the last scanline in a buffer: some devices fetch an entire line (including padding to the pitch) while others only fetch up to the visible width. ADF's buffer size validation now takes this quirk into account. Change-Id: I828b13316e27621d8a9efd9d5fffa6ce12a525ff Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-02-16video: adf: document adf_format_validate_yuv's originGreg Hackmann
Change-Id: I929045a96a56bdb2c915be92b8ef11b560f3ab79 Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-02-16video: adf: ensure consistent alignment on userspace facing structsGreg Hackmann
64-bit types in structs create alignment problems when a 32-bit x86 userspace talks to an x86_64 kernel. In most cases the 64-bit types can be replaced with 32-bit ones, since they're being used for fds and should have been __s32 in the first place. For adf_vsync_event, alignment can be enforced by making the timestamp an __aligned_u64. Change-Id: I87cf73d8f57730bd7bb43ffce6b7b411eb0ff198 Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-02-16video: adf: replace fbdev helper's open flag with refcountGreg Hackmann
A device's fb_info is shared between clients. fb_release() is called when each client is released, not just the last one. Since the fbdev helper needs to release its dma-buf when the last client goes away, it must keep its own reference count. fbmem and fbcon hold different locks while calling fb_release(), so explicit locking is needed. Change-Id: I42cd659f7633adba7c11f407d4b594bd43305d6a Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-02-16video: adf: export the adf_attachment_allow symbol to modules.Alistair Strachan
There are no in-tree users of adf_attachment_allow, but out-of-tree modules want to use it. It looks like this function should be EXPORT_SYMBOL. Change-Id: Iad522dc5d32ac09fec6483bbc317db8ecae12e97 Signed-off-by: Alistair Strachan <alistair.strachan@imgtec.com>
2016-02-16video: adf: use %zu when printing size_tGreg Hackmann
Change-Id: I9cf7ebc368bad0a83db9e5aa370feadf117b21c0 Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-02-16video: adf: fix compat ioctls calling ioctl with wrong cmdGreg Hackmann
Change-Id: Icdbac3edd123b3114103dc138a60e6955006cda4 Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-02-16video: adf: use ADF_IOCTL_TYPE in compat ioctl definitionsGreg Hackmann
Change-Id: I7451a282d9d972c9957568b366c164b67b4b47e8 Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-02-16video: adf: fix fbdev blank -> dpms state mappingGreg Hackmann
Change-Id: I96132a1b7275d389a6d0ba8899c6be838b63c422 Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-02-16video: adf: validate dpms state passed to blankGreg Hackmann
Change-Id: I3a4228d50fc4a2553b3e92e5675a94cbc6e71b8a Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-02-16video: adf: make device node names less hierarchicalGreg Hackmann
adf/foobar/device -> adf0 adf/foobar/interface1 -> adf-interface0.1 adf/foobar/overlay-engine1 -> adf-overlay-engine0.1 Change-Id: I7af7f84ce3f101ecb02f448070c200ff3e03f2ec Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-02-16video: adf: expose adf_modeinfo_set_{name,vrefresh} to driversGreg Hackmann
Change-Id: Id9f8b2184927a77b244ce0b33d619d6e44a0f17a Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-02-16video: adf: set default interface dpms_state to OFFGreg Hackmann
Interfaces default to unplugged, so they should also default to off Change-Id: I36500a54b11f354a0d7dd2c9924a79e0d9c6f855 Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-02-16video: adf: make dpms_state sysfs attribute writableGreg Hackmann
Change-Id: I04e7785cbddac160003e6c9edaf62d20b367fdc9 Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-02-16video: adf: add helpers for validating custom formatsGreg Hackmann
Many custom formats look a lot like the standard ones, but with different subsampling, bpp, etc. Expose and document adf_buffer_validate()'s main body, so drivers can reuse its logic when validating these formats. Change-Id: I1d06981c9e5aab26f3ab2956c08c679f2c823bcc Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-02-16video: adf: add informational flags to interfacesGreg Hackmann
Informational flags don't affect ADF directly but may be useful to clients. Currently used to indicate primary and external displays. Change-Id: I343c7f0148da0869244c8e818350e9855525df85 Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-02-16video: adf: add fbdev compatibility helperGreg Hackmann
Change-Id: I2b82bb625f805e8edb27799743b290dda5befb97 Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-02-16video: adf: add supported formats to adf_overlay_engine_dataGreg Hackmann
Change-Id: If2aa783b9ece60160f465bf697508fc58682e1bc Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-02-16video: adf: support "simple" buffersGreg Hackmann
Simple buffers are linear RGB buffers analogous to KMS's dumb buffers. Simple buffers can be allocated and posted to a display interface without any driver-private data. Internally, ADF drivers provide the driver-private data needed (if any) to post a simple buffer to the display. Change-Id: Ib0b737622eaf343111310f6623f99d69cf3807d2 Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-02-16video: adf: add memblock helperGreg Hackmann
Provides a dma-buf exporter for memblocks, mainly useful for ADF devices to wrap their bootloader logos Change-Id: I936a9b5df099ab6084d433fcaf50f3bc29f93289 Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-02-16video: add atomic display frameworkGreg Hackmann
Change-Id: I693257e269a99012cd0dbb57576ac222869cf4c7 Signed-off-by: Greg Hackmann <ghackmann@google.com>