When the fb is detached from one CRTC/plane, paddr was set back to zero. But really we don't want to do this because the fb could still be attached to other CRTC/plane(s). This originally worked like this to catch cases of freeing a pinned fb (but with the refcnt'ing this should no longer be needed). Also, there is checking in the GEM code for freeing a pinned GEM object, so this extra level of checking is redundant. Signed-off-by: Rob Clark <firstname.lastname@example.org>
We never really clarified if unmap could be done in atomic context. But since mapping might require sleeping, this implies mutex in use to synchronize mapping/unmapping, so unmap could sleep as well. Add a might_sleep() to clarify this. Signed-off-by: Rob Clark <email@example.com> Acked-by: Daniel Vetter <firstname.lastname@example.org>
Start breaking out the mutable state of the CRTC into it's own structure. Plus add _check_state() and _set_property() helpers. This only moves the state that is related to scanout fb, which is needed for nuclear-pageflip. The rest of the mutable state should be moved from drm_crtc to drm_crtc_state as part of the atomic-modeset implementation.
Break the mutable state of a plane out into a separate structure. This makes it easier to have some helpers for plane->set_property() and for checking for invalid params. The idea is that individual drivers can wrap the state struct in their own struct which adds driver specific parameters, for easy build-up of state across multiple set_property() calls and for easy atomic commit or roll- back. The same should be done for CRTC, encoder, and connector, but this patch only includes the first part (plane).
This indicates to userspace that the property is something that can be set dynamically without requiring a "test" step to check if the hw is capable. This allows a userspace compositor, such as weston, to avoid an extra ioctl to check whether it needs to fall-back to GPU to composite some surface prior to submission of GPU render commands.
The 'atomic' mechanism allows for multiple properties to be updated, checked, and commited atomically. This will be the basis of atomic- modeset and nuclear-pageflip. The basic flow is: state = dev->atomic_begin(); for (... one or more ...) obj->set_property(obj, state, prop, value); if (dev->atomic_check(state)) dev->atomic_commit(state, event); dev->atomic_end(state); The split of check and commit steps is to allow for ioctls with a test-only flag (which would skip the commit step). The atomic functions are mandatory, as they will end up getting called from enough places that it is easier not to have to bother with if-null checks everywhere. TODO: + add some stub atomic functions that can be used by drivers until they are updated to support atomic operations natively + roll-back previous property values if check/commit fails, so userspace doesn't see incorrect values.
If the timings sent to check does not match any of the standard modes, assume that is a custom timing and set it to VESA mode with 0 as code, As CEA standard would need to send CEA code during the AVI info frame and behaviour is a wrong code is sent is not understood currently on VESA (non- Audio) non-standard timing is supported if the max pixel clock requested is less than the maximum pixel clock supported by OMAP for HDMI. Signed-off-by: Mythri P K <email@example.com>
Previously read-only KMS ioctls had some somewhat inconsistent settings regarding whether mastership was required. For example, GETRESOURCES did not require master, but GETPLANERESOURCES, GETPROPERTY, etc. did. At least for debugging, it is nice to be able to use modetest to dump property values while another process is master, and there seems to be no harm in allowing read-only access to the KMS state to other processes. Signed-off-by: Rob Clark <firstname.lastname@example.org>
This is still work in progress, but it nicely solves the omapdss vs drm impedence mismatches, and properly fixes unpin confusion vs GO bit status. As an added bonus, we also no longer leave the last overlay buffer pinned. Adding the previously missing vblank event handling for userspace should be pretty trivial now too. v1: initial version v2: Reshuffle mapping of kms to dss.. now it is plane->ovl, crtc->manager. The encoder is still a placeholder and connector is dssdev, but eventually encoder should map to dss encoder (DSI/DPI/VENC/HDMI) and connector to panel. v3: few cleanups, add debugfs, etc v4: rebase and fix some irq issues
Legacy drivers would 'select OMAP2_DSS_HL' to get the full "high level" omapdss interface, while omapdrm would not and instead directly use the low level omapdss interface. v1: original v2: add stuff needed for nuclear page-flip v3: add DSI.. sort of
Signed-off-by: Rob Clark <email@example.com>
This simplifies drm fb lifetime, and if the crtc/plane needs to hold a ref to the fb when disabling a pipe until the next vblank, this avoids the need to make disabling an overlay synchronous. This is a problem that shows up when userspace is using a drm plane to implement a hw cursor.. making overlay disable synchronous causes a performance problem when x11 is rapidly enabling/disabling the hw cursor. But not making it synchronous opens up a race condition for crashing if userspace turns around and immediately deletes the fb. Refcnt'ing the fb makes it possible to solve this problem. v1: original v2: add drm_framebuffer_remove() which is called in all paths where fb->funcs->destroy() was directly called before. This cleans up the CRTCs/planes that the fb was attached to. You should only directly use drm_framebuffer_unreference() if you are also using drm_framebuffer_reference() to keep a ref to the fb. v3: add comment explaining the fb refcount v4: remove duplicate 'list_del(&fb->filp_head)' Signed-off-by: Rob Clark <firstname.lastname@example.org>
'struct omap_video_timings' was updated w/ a 'bool interlaced'. Without a matching update in omap_connector, this field could have undefined values from the stack, which isn't quite ideal. Update the fxns to convert omapdss<->drm timings structs, and zero-init 'struct omap_video_timings' when it is declared on stack to avoid issues like this in the future. Signed-off-by: Rob Clark <email@example.com>
Since the plane hasn't yet taken a reference, we need to hold a reference while waiting to ensure the backing GEM bo doesn't get freed from under us. Signed-off-by: Rob Clark <firstname.lastname@example.org>
… max_active = 1 This is an equivalent conversion and will ease scheduled removal of WQ_NON_REENTRANT. Only compile tested. Signed-off-by: Tejun Heo <email@example.com> Signed-off-by: Rob Clark <firstname.lastname@example.org> Signed-off-by: Greg Kroah-Hartman <email@example.com>
This patch adds fail checks for kmalloc and kzalloc calls and also adds a error path that frees allocated pages by introducing a call to _drm_gem_put_pages. Signed-off-by: Emil Goode <firstname.lastname@example.org> Signed-off-by: Rob Clark <email@example.com> Signed-off-by: Greg Kroah-Hartman <firstname.lastname@example.org>
For drivers that can support rotated scanout, the extra parameter checking in drm-core, while nice, tends to get confused. To solve this drivers can set the crtc or plane invert_dimensions field so that the dimension checking takes into account the rotation that the driver is performing. v1: original v2: remove invert_dimensions from plane, at Ville's suggestion. Userspace can give rotated src coordinates, so invert_dimensions is not required for planes. Signed-off-by: Rob Clark <email@example.com>
Pull drm fixes from Dave Airlie: "Intel: edid fixes, power consumption fix, s/r fix, haswell fix Radeon: BIOS loading fixes for UEFI and Thunderbolt machines, better MSAA validation, lockup timeout fixes, modesetting fixes One udl dpms fix, one vmwgfx fix, a couple of trivial core changes. There is an export added to ACPI as part of the radeon bios fixes. I've also included the fbcon flashing cursor vs deinit race fix, that seems the simplest place to start" Trivial conflict in drivers/video/console/fbcon.c due to me having already applied the fbcon flashing cursor vs deinit race fix, and Dave had added a comment in there too. * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux: (22 commits) fbcon: fix race condition between console lock and cursor timer (v1.1) drm: Add missing static storage class specifiers in drm_proc.c file drm/udl: dpms off the crtc when disabled. drm: Remove two unused fields from struct drm_display_mode drm: stop vmgfx driver explosion drm/radeon/ss: use num_crtc rather than hardcoded 6 Revert "drm/radeon: fix bo creation retry path" drm/i915: use hsw rps tuning values everywhere on gen6+ drm/radeon: split ATRM support out from the ATPX handler (v3) drm/radeon: convert radeon vfct code to use acpi_get_table_with_size ACPI: export symbol acpi_get_table_with_size drm/radeon: implement ACPI VFCT vbios fetch (v3) drm/radeon/kms: extend the Fujitsu D3003-S2 board connector quirk to cover later silicon stepping drm/radeon: fix checking of MSAA renderbuffers on r600-r700 drm/radeon: allow CMASK and FMASK in the CS checker on r600-r700 drm/radeon: init lockup timeout on ring init drm/radeon: avoid turning off spread spectrum for used pll drm/i915: fall back to bit-banging if GMBUS fails in CRT EDID reads drm/i915: extract connector update from intel_ddc_get_modes() for reuse drm/i915: fix hsw uncached pte ...