summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/omapdrm
AgeCommit message (Collapse)AuthorFilesLines
2015-04-21dma-buf: cleanup dma_buf_export() to make it easily extensibleSumit Semwal1-1/+8
At present, dma_buf_export() takes a series of parameters, which makes it difficult to add any new parameters for exporters, if required. Make it simpler by moving all these parameters into a struct, and pass the struct * as parameter to dma_buf_export(). While at it, unite dma_buf_export_named() with dma_buf_export(), and change all callers accordingly. Reviewed-by: Maarten Lankhorst <maarten.lankhorst@canonical.com> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Acked-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Acked-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
2015-04-20Merge tag 'fbdev-4.1' of ↵Linus Torvalds1-1/+1
git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux Pull fbdev updates from Tomi Valkeinen: "Small fixes and improvements to various fbdev drivers" * tag 'fbdev-4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux: (24 commits) omapdss: extend pm notifier to handle hibernation OMAPDSS: Correct video ports description file path in DT binding doc OMAPDSS: disable VT switch fbdev: sh_mobile_lcdc: Fix destruction of uninitialized mutex video: fbdev: sh_mobile_lcdcfb: Fix ROP3 sysfs attribute parsing fbdev: pm3fb: cleanup some confusing indenting hyperv: hyperv_fb: match wait_for_completion_timeout return type video: fbdev: use msecs_to_jiffies for time conversions fbdev: via/via_clock: fix sparse warning video: fbdev: make of_device_id array const fbdev: sm501fb: use memset_io OMAPDSS: workaround for MFLAG + NV12 issue OMAPDSS: Add support for MFLAG OMAPDSS: setup default fifo thresholds OMAPDSS: DISPC: lock access to DISPC_CONTROL & DISPC_CONFIG OMAPDSS: DISPC: fix div by zero issue in overlay scaling OMAPDSS: DISPC: change sync_pclk_edge default value OMAPDSS: change signal_level & signal_edge enum values OMAPDSS: DISPC: explicit handling for sync and de levels OMAPDSS: DISPC: remove OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES ...
2015-03-24drm/omap: tiler: add hibernation callbackGrygorii Strashko1-7/+3
Setting a dev_pm_ops resume callback but not a set of hibernation handler means that pm function will not be called upon hibernation. Fix this by using SIMPLE_DEV_PM_OPS, which appropriately assigns the suspend and hibernation handlers and move omap_dmm_resume under CONFIG_PM_SLEEP to avoid build warnings. Signed-off-by: Grygorii Strashko <grygorii.strashko@linaro.org> Reviewed-by: Rob Clark <robdclark@gmail.com> [tomi valkeinen: add missing 'static'] Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-03-24drm/omap: add hibernation callbacksGrygorii Strashko1-8/+3
Setting a dev_pm_ops suspend/resume pair but not a set of hibernation functions means those pm functions will not be called upon hibernation. Fix this by using SIMPLE_DEV_PM_OPS, which appropriately assigns the suspend and hibernation handlers and move omap_drm_suspend/omap_drm_resume under CONFIG_PM_SLEEP to avoid build warnings. Signed-off-by: Grygorii Strashko <Grygorii.Strashko@linaro.org> [tomi.valkeinen@ti.com: fix conflict, clean up description] Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-03-24drm/omap: keep ref to old_fbTomi Valkeinen1-0/+7
We store the fb being page-flipped to 'old_fb' field, but we don't increase the ref count of the fb when doing that. While I am not sure if it can cause problem in practice, it's still safer to keep a ref when storing a pointer to a fb. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-03-24drm/omap: fix race conditon in DMMTomi Valkeinen2-8/+9
The omapdrm DMM code sometimes crashes with: WARNING: CPU: 0 PID: 1235 at lib/list_debug.c:36 __list_add+0x8c/0xbc() list_add double add: new=e9265368, prev=e90139c4, next=e9265368. This is caused by the code calling release_engine() twice for the same engine. dmm_txn_commit(wait=true) call is supposed to wait until the DMM transaction has been finished. And it does that, but it does not wait for the irq handler to finish. What happens is that the irq handler is triggered, and it either wakes up the thread that called dmm_txn_commit(), or that thread never even slept because the transaction was finished in the HW very quickly. That thread then continues executing, even if the irq handler is not yet finished, and a new transaction may be initiated. If that transaction is async (i.e. wait=false), a 'async' flag is set to true. The original irq handler, which has yet not finished, then sees the transaction as 'async', even if it was supposed to be 'sync'. When that happens, the irq handler does an extra release_engine() call because it thinks it need to release the engine, leading to the crash. This patch fixes the issue by using completion to ensure that the irq handler has finished before a dmm_txn_commit(wait=true) may continue. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-03-24drm/omap: fix race condition with dev->obj_listTomi Valkeinen3-0/+9
omap_gem_objects are added to dev->obj_list in omap_gem_new, and removed in omap_gem_free_object. Unfortunately there's no locking for dev->obj_list, which eventually leads to a crash: WARNING: CPU: 1 PID: 1123 at lib/list_debug.c:59 __list_del_entry+0xa4/0xe0() list_del corruption. prev->next should be e9281344, but was ea722b84 Add a spinlock to protect dev->obj_list. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-03-24drm/omap: do not use BUG_ON(!spin_is_locked(x))Tomi Valkeinen1-1/+1
spin_is_locked(x) returns always 0 on uniprocessor, triggering BUG() in omapdrm. Change it to use assert_spin_locked() to fix the issue. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-03-24drm/omap: only ignore DIGIT SYNC LOST for TV outputTomi Valkeinen1-8/+12
We need to ignore DIGIT SYNC LOST error when enabling/disabling TV output. The code does that, but it ignores the DIGI SYNC LOST when enabling any output. Normally this does no harm, but it could make us miss DIGIT SYNC LOST on some rare occasions. Fix the code to only ignore DIGIT SYNC LOST when enabling/disabling TV. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-03-24drm/omap: fix race with error_irqTomi Valkeinen1-8/+13
omapdrm tries to avoid error floods by unregistering the error irq when an error happens, and then registering the error irq again later. However, the code is racy, as it sometimes tries to unregister the error irq when it's already unregistered, leading to WARN(). Also, the code only registers the error irq again when something is done on that particular output, i.e. if only TV is used to flip the buffers, and LCD is showing a same buffer, an error on LCD will cause the LCD error irq to be unregistered and never registered again. To fix this, let's keep the error irqs always enabled and trust the DRM_ERROR_RATELIMITED to limit the flood. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-03-24drm/omap: use DRM_ERROR_RATELIMITED() for error irqsTomi Valkeinen2-2/+3
omapdrm uses normal DRM_ERROR() print when the HW reports an error. As we sometimes may get a flood of errors, let's rather use DRM_ERROR_RATELIMITED(). Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-03-24drm/omap: stop connector polling during suspendTomi Valkeinen1-1/+20
When not using proper hotplug detection, DRM polls periodically the connectors to find out if a cable is connected. This polling can happen at any time, even very late in the suspend process. This causes a problem with omapdrm, when the poll happens during the suspend process after GPIOs have been disabled, leading to a crash in gpio_get(). This patch fixes the issue by adding suspend and resume hooks to omapdrm, in which we disable and enable, respectively, the polling. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-03-24drm/omap: remove dummy PM functionsTomi Valkeinen1-20/+0
omapdrm has dummy functions for platform_device's suspend/resume/shutdown. The functions don't do anything, and those platform device functions are deprecated, so remove them from omapdrm. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-03-24drm/omap: tiler: fix race condition with engine->asyncTomi Valkeinen1-0/+2
The tiler irq handler uses engine->async value, but the code that sets engine->async and enables the interrupt does not have a barrier. This may cause the irq handler to see the old value of engine->async, causing memory corruption. Reported-by: Harinarayan Bhatta <harinarayan@ti.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-03-24drm/omap: fix plane's channel selectionTomi Valkeinen1-1/+2
omap_plane_pre_apply() sets the plane's output channel too late, only after the plane has already been otherwise configured and enabled. This causes problems, as at the configuration stage we need to make decisions based on the output channel. This may lead to bad plane settings or failing to setup the plane. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-03-24drm/omap: fix TILER on OMAP5Tomi Valkeinen4-4/+46
On OMAP5 it is not possible to use TILER buffer with CPU when caching or write-combining is used. Doing so leads to errors from the memory manager. However, on OMAP4, write-combining works fine. This patch adds platform specific data for the TILER, and a function tiler_get_cpu_cache_flags() which can be used to get the caching mode to be used. Note that without write-combining the use of the TILER buffer with CPU is unusably slow. It's still good to have it operational for testing purposes. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-03-24drm/omap: handle incompatible buffer stride and pixel sizeTomi Valkeinen1-0/+8
omapdrm doesn't check if the pitch of the framebuffer and the color format's bits-per-pixel are compatible. omapdss requires that the stride of a buffer is an integer number of pixels For example, when using modetest with a display that has x resolution of 1280, and using packed 24 RGB mode (3 bytes per pixel), modetest allocates a buffer with a byte stride of 4 * 1280 = 5120. But 5120 / 3 = 1706.666... pixels, which causes wrong colors and a tilt on the screen. Add a check into omapdrm to return an error if the user tries to use such a combination. Note: this is not a HW requirement at least for non-rotation use cases, but a SW driver requirement. In the future we should study if also rotation use cases are fine with any stride size, and if so, change the driver to allow these strides. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-03-24drm/omap: fix error handling in omap_framebuffer_create()Tomi Valkeinen1-3/+2
When an error happens in omap_framebuffer_create(), omap_framebuffer_create() calls omap_framebuffer_destroy() if the fb struct has been allocated. However, that crashes, as omap_framebuffer_destroy(), which calls drm_framebuffer_cleanup(), should only be called after drm_framebuffer_init() Fix this by just calling kfree() for the allocated fb when an error happens. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-03-24drm/omap: fix operation without fbdevTomi Valkeinen1-4/+7
omapdrm should work fine even if fbdev is missing. The current driver crashes in that case, though, as it is missing checks for the fbdev. Add the checks so that we don't free fbdev or restore fbdev mode when there's no fbdev. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-03-24drm/omap: add a comment why locking is missingTomi Valkeinen1-0/+4
unpin_worker() calls omap_framebuffer_unpin() without any locks, which looks very suspicious. However, both pin and unpin are always called via the driver's private workqueue, so the access is synchronized that way. Add a comment to make this clear. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-03-24drm/omap: add pin refcounting to omap_framebufferTomi Valkeinen1-0/+13
omap_framebuffer_pin() and omap_framebuffer_unpin() are currently broken, as they cannot be called multiple times (i.e. pin, pin, unpin, unpin), which is what happens in certain cases. This issue causes the driver to possibly use 0 as an address for a displayed buffer, leading to OCP error from DSS. This patch fixes the issue by adding a simple pin_count, used to track the number of pins. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-03-24drm/omap: clear omap_obj->paddr in omap_gem_put_paddr()Tomi Valkeinen1-0/+1
Clear omap_obj's paddr when unmapping the memory, so that it's easier to catch bad use of the paddr. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-03-24drm/omap: page_flip: return -EBUSY if flip pendingTomi Valkeinen1-1/+1
The DRM documentation says: "If a page flip is already pending, the page_flip operation must return -EBUSY." Currently omapdrm returns -EINVAL instead. Fix omapdrm by returning -EBUSY. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-03-24drm/omap: fix encoder-crtc mappingTomi Valkeinen1-4/+3
OMAP DSS hardware supports changing the output port to which an overlay manager's video stream goes. For example, DPI video stream can come from any of the four overlay managers on OMAP5. However, as it's difficult to manage the change in the driver, the omapdss driver does not support that at the moment, and has a hardcoded overlay manager per output. omapdrm, on the other hand, uses the hardware features to find out which overlay manager to use for an output, which causes problems. For example, on OMAP5, omapdrm tries to use DIGIT overlay manager for DPI output, instead of the LCD3 required by the omapdss driver. This patch changes the omapdrm to use the omapdss driver's hardcoded overlay managers, which fixes the issue. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-03-20drm: omapdrm: Reorder CRTC functionsLaurent Pinchart1-190/+206
The next commit will need functions to be reordered. Do it separately to help review. This only moves functions without any change to the code. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-03-20drm: omapdrm: Planes are already disabled when destroyedLaurent Pinchart1-1/+0
Planes are destroyed after framebuffers, which has the side effect of disabling all planes. There is thus no need to disable planes explicitly when destroying them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-03-20drm: omapdrm: Pass integer source coordinates to omap_plane_mode_set()Laurent Pinchart3-30/+27
The function will convert the Q16 source coordinates to integers, avoid converting integers to Q16 first and perform the opposite conversion. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-03-20drm: omapdrm: Prefix all plane functions with omap_plane_Laurent Pinchart1-9/+10
This matches the rest of the file and clarifies the functions' purpose. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-03-20drm: omapdrm: Avoid function forward declaration in omap_crtc.cLaurent Pinchart1-54/+53
Move the set_enabled function to avoid the forward declaration. While at it prefix it with omap_crtc_ like most other functions in the file, and fix the comment stating in which contexts the function is called. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-03-20drm: omapdrm: Remove omap_crtc->full_update fieldLaurent Pinchart1-16/+7
The full_update field is always set to true before calling omap_crtc_appy(), resulting in its value always being true in the single location where it is tested, in omap_crtc_pre_apply(). Remove it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-03-20drm: omapdrm: Remove manual update display supportLaurent Pinchart5-115/+4
All the manual update display code implements eventually ends up to just calls to omap_connector_flush(), currently implemented as an empty TODO stub. Remove it, the code can always be revived and implemented later if interest in manual update displays becomes a reality. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-03-20drm: omapdrm: Fix race condition between GO and vblank IRQLaurent Pinchart1-1/+1
The vblank interrupt is used by the driver as a completion signal when applying new settings. A race condition exist between enabling the vblank interrupt and applying new settings to the hardware by setting the GO bit. If a vblank interrupt occurs in-between, the driver will incorrectly consider the new settings to be applied. Fix this by enabling the interrupt after setting the GO bit. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-03-20drm: omapdrm: Reset the zorder property when disabling a planeLaurent Pinchart1-0/+3
Whether to reset plane properties at disable time isn't well-defined in DRM, but resetting only part of them is probably as bad as it can get. Make the behaviour coherent by resetting the zorder property in addition to the rotation property. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-03-20drm: omapdrm: Rename omap_plane_dpms() to omap_plane_set_enable()Laurent Pinchart3-11/+9
The planes don't care about DPMS states, don't propagate it unnecessarily to the plane functions. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-03-20drm: omapdrm: Switch to the universal plane APILaurent Pinchart4-39/+46
Remove the CRTC private planes by switching to the universal plane API. This results in a merge of the CRTC private plane created by the driver (omap_crtc->plane) and the CRTC primary plane created by the DRM core (crtc->primary). Reference counting of the framebuffers in the update plane operation is thus simplified as no reference needs to be stored in the private plane anymore. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-03-20drm: omapdrm: Remove unused variablesLaurent Pinchart1-7/+2
The ilace variable is unused and the replication variable is assigned to false and just passed to a function. Remove them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-03-20drm: omapdrm: Refactor CRTC creation codeLaurent Pinchart2-33/+45
Create a omap_modeset_create_crtc() function to avoid duplicating plane and CRTC creation code. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-03-20drm: omapdrm: Fix indentation of structure and array initializersLaurent Pinchart5-96/+96
Indenting by one tab is enough. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2015-02-26OMAPDSS: DISPC: remove OMAPDSS_DRIVE_SIG_OPPOSITE_EDGESTomi Valkeinen1-1/+1
DISPC can drive data lines either on rising or falling pixel clock edge, which can be configured by the user. Sync lines can also be driven on rising or falling pixel clock edge, but additionally the HW can be configured to drive the sync lines on opposite clock edge from the data lines. This opposite edge setting does not make any sense, as the same effect can be achieved by just setting the sync lines to be driven on the other edge compared to the data lines. It feels like some kind of backward compatibility option, even if all DSS versions seem to have the same implementation. To simplify the code and configuration of the signals, and to make the dispc timings more compatible with what is used on other platforms, let's just remove the whole opposite-edge support. The drivers that used OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES setting are changed so that they use the opposite setting from the data edge. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2015-01-21drm/fb-helper: Propagate errors from initial config failureThierry Reding1-2/+8
Make drm_fb_helper_initial_config() return an int rather than a bool so that the error can be properly propagated. While at it, update drivers to propagate errors further rather than just ignore them. v2: - cirrus: No cleanup is required, the top-level cirrus_driver_load() will do it as part of cirrus_driver_unload() in its cleanup path. Reported-by: Fengguang Wu <fengguang.wu@intel.com> Cc: David Airlie <airlied@linux.ie> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com> Cc: Rob Clark <robdclark@gmail.com> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Alex Deucher <alexander.deucher@amd.com> Cc: Christian König <christian.koenig@amd.com> Cc: Ben Skeggs <bskeggs@redhat.com> Signed-off-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com> Reviewed-by: Christian König <christian.koenig@amd.com> [danvet: Squash in simplification patch from kbuild.] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-12-15Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linuxLinus Torvalds3-15/+4
Pull drm updates from Dave Airlie: "Highlights: - AMD KFD driver merge This is the AMD HSA interface for exposing a lowlevel interface for GPGPU use. They have an open source userspace built on top of this interface, and the code looks as good as it was going to get out of tree. - Initial atomic modesetting work The need for an atomic modesetting interface to allow userspace to try and send a complete set of modesetting state to the driver has arisen, and been suffering from neglect this past year. No more, the start of the common code and changes for msm driver to use it are in this tree. Ongoing work to get the userspace ioctl finished and the code clean will probably wait until next kernel. - DisplayID 1.3 and tiled monitor exposed to userspace. Tiled monitor property is now exposed for userspace to make use of. - Rockchip drm driver merged. - imx gpu driver moved out of staging Other stuff: - core: panel - MIPI DSI + new panels. expose suggested x/y properties for virtual GPUs - i915: Initial Skylake (SKL) support gen3/4 reset work start of dri1/ums removal infoframe tracking fixes for lots of things. - nouveau: tegra k1 voltage support GM204 modesetting support GT21x memory reclocking work - radeon: CI dpm fixes GPUVM improvements Initial DPM fan control - rcar-du: HDMI support added removed some support for old boards slave encoder driver for Analog Devices adv7511 - exynos: Exynos4415 SoC support - msm: a4xx gpu support atomic helper conversion - tegra: iommu support universal plane support ganged-mode DSI support - sti: HDMI i2c improvements - vmwgfx: some late fixes. - qxl: use suggested x/y properties" * 'drm-next' of git://people.freedesktop.org/~airlied/linux: (969 commits) drm: sti: fix module compilation issue drm/i915: save/restore GMBUS freq across suspend/resume on gen4 drm: sti: correctly cleanup CRTC and planes drm: sti: add HQVDP plane drm: sti: add cursor plane drm: sti: enable auxiliary CRTC drm: sti: fix delay in VTG programming drm: sti: prepare sti_tvout to support auxiliary crtc drm: sti: use drm_crtc_vblank_{on/off} instead of drm_vblank_{on/off} drm: sti: fix hdmi avi infoframe drm: sti: remove event lock while disabling vblank drm: sti: simplify gdp code drm: sti: clear all mixer control drm: sti: remove gpio for HDMI hot plug detection drm: sti: allow to change hdmi ddc i2c adapter drm/doc: Document drm_add_modes_noedid() usage drm/i915: Remove '& 0xffff' from the mask given to WA_REG() drm/i915: Invert the mask and val arguments in wa_add() and WA_REG() drm: Zero out DRM object memory upon cleanup drm/i915/bdw: Fix the write setting up the WIZ hashing mode ...
2014-11-20drm: omapdrm: remove unused variableBoris BREZILLON1-1/+0
Commit f9b9faf6d94dd29eab8c128905c7d091f955481d "drm: flip-work: change drm_flip_work_init prototype" changed the drm_flip_work_init prototype to a void function, which makes 'ret' an unused variable. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-11-15Merge tag 'drm/gem-cma/for-3.19-rc1' of ↵Dave Airlie1-2/+1
git://people.freedesktop.org/~tagr/linux into drm-next drm: Sanitize DRM_IOCTL_MODE_CREATE_DUMB input Some drivers erroneously treat the .pitch and .size fields of struct drm_mode_create_dumb as inputs. While the include/uapi/drm/drm_mode.h header has a comment denoting them as outputs, that seemingly wasn't enough to make drivers use them properly. The result is that some userspace doesn't explicitly zero out those fields, assuming that the kernel won't use them. That causes problems since the data within the structure might be uninitialized, so bogus data may end up confusing drivers (ridiculously large values for the pitch, ...). This series attempts to improve the situation by fixing all drivers to not use the output fields. Furthermore to spare new drivers this bad surprise, the DRM core now zeros out these fields prior to handing the data structure to the driver. Lessons learned from this are that future IOCTLs should be properly documented (in the DRM DocBook for example) and should be rigorously defined. To prevent misuse like this, userspace should be required to zero out all output fields. The kernel should check for this and fail if that's not the case. * tag 'drm/gem-cma/for-3.19-rc1' of git://people.freedesktop.org/~tagr/linux: drm/cma: Remove call to drm_gem_free_mmap_offset() drm: Sanitize DRM_IOCTL_MODE_CREATE_DUMB input drm/rcar: gem: dumb: pitch is an output drm/omap: gem: dumb: pitch is an output drm/cma: Introduce drm_gem_cma_dumb_create_internal() drm/doc: Add GEM/CMA helpers to kerneldoc drm/doc: mm: Fix indentation drm/gem: Fix a few kerneldoc typos
2014-11-15drm: flip-work: change drm_flip_work_init prototypeBoris BREZILLON1-12/+2
Now that we're using lists instead of kfifo to store drm flip-work tasks we do not need the size parameter passed to drm_flip_work_init function anymore. Moreover this function cannot fail anymore, we can thus remove the return code. Modify drm_flip_work_init users to take account of these changes. [airlied: fixed two unused variable warnings] Signed-off-by: Boris BREZILLON <boris.brezillon@free-electrons.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-11-13drm/omap: gem: dumb: pitch is an outputThierry Reding1-2/+1
When creating a dumb buffer object using the DRM_IOCTL_MODE_CREATE_DUMB IOCTL, only the width, height, bpp and flags fields are inputs. The caller is not guaranteed to zero out or set handle, pitch and size. Drivers must not treat these values as possible inputs, otherwise they may use uninitialized memory during the computation of the framebuffer size. The OMAP driver uses the pitch field passed in by userspace as a minimum and only override it if the driver-computed pitch is larger than what userspace provided. To prevent this from causing overallocation, fix the minimum pitch to 0 to enforce the driver-computed pitch. Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Rob Clark <robdclark@gmail.com> Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-11-05drm: Move drm_crtc_init from drm_crtc.h to drm_plane_helper.hDaniel Vetter1-0/+1
Just a bit of OCD cleanup on headers - this function isn't the core interface any more but just a helper for drivers who haven't yet transitioned to universal planes. Put the declaration at the right spot and sprinkle necessary #includes over all drivers. Maybe this helps to encourage driver maintainers to do the switch. v2: Fix #include ordering for tegra, reported by 0-day builder. v3: Include required headers, reported by Thierry. Cc: Matt Roper <matthew.d.roper@intel.com> Cc: Thierry Reding <treding@nvidia.com> Reviewed-by: Matt Roper <matthew.d.roper@intel.com> Reviewed-by: Sean Paul <seanpaul@chromium.org> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2014-10-20gpu: drm: omapdrm: drop owner assignment from platform_driversWolfram Sang1-1/+0
A platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-09-24drm: Extract <drm/drm_gem.h>Daniel Vetter1-0/+1
v2: Don't forget git add, noticed by David. Cc: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Acked-by: David Herrmann <dh.herrmann@gmail.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-09-10drm: add driver->set_busid() callbackDavid Herrmann1-0/+1
One step closer to dropping all the drm_bus_* code: Add a driver->set_busid() callback and make all drivers use the generic helpers. Nouveau is the only driver that uses two different bus-types with the same drm_driver. This is totally broken if both buses are available on the same machine (unlikely, but lets be safe). Therefore, we create two different drivers for each platform during module_init() and set the set_busid() callback respectively. Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Reviewed-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-08-08Merge tag 'fbdev-3.17' of ↵Linus Torvalds3-0/+40
git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux Pull fbdev updates from Tomi Valkeinen: - much better HDMI infoframe support for OMAP - Cirrus Logic CLPS711X framebuffer driver - DT support for PL11x CLCD driver - various small fixes * tag 'fbdev-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux: (35 commits) OMAPDSS: DSI: fix depopulating dsi peripherals video: hyperv: hyperv_fb: refresh the VM screen by force on VM panic video: ARM CLCD: Fix DT-related build problems drivers: video: fbdev: atmel_lcdfb.c: Add ability to inverted backlight PWM. video: ARM CLCD: Add DT support drm/omap: Add infoframe & dvi/hdmi mode support OMAPDSS: HDMI: remove the unused code OMAPDSS: HDMI5: add support to set infoframe & HDMI mode OMAPDSS: HDMI4: add support to set infoframe & HDMI mode OMAPDSS: HDMI: add infoframe and hdmi_dvi_mode fields OMAPDSS: add hdmi ops to hdmi-connector and tpd12s015 OMAPDSS: add hdmi ops to hdmi_ops and omap_dss_driver OMAPDSS: HDMI: remove custom avi infoframe OMAPDSS: HDMI5: use common AVI infoframe support OMAPDSS: HDMI4: use common AVI infoframe support OMAPDSS: Kconfig: select HDMI OMAPDSS: HDMI: fix name conflict OMAPDSS: DISPC: clean up dispc_mgr_timings_ok OMAPDSS: DISPC: reject interlace for lcd out OMAPDSS: DISPC: fix debugfs reg dump ...