Making this function not depend on drm_head::output field through
drm_output_find_by_connector() will later allow to remove the
drm_head::output field before removing the unused_connectors array. This
helps keeping the commit more fine-grained.
drm_backend_update_unused_outputs() was only interested in enabled
outputs. The new code is 100% equivalent to the old code. The
difference is that weston_head::output is only set for attached heads. A
connector cannot be in use if it is not attached to an output.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
Switch drm_output_find_by_connector() to search for the output by
iterating the compositor's head_list. drm_head_find_by_connector() will
be useful later on its own.
As of "compositor-drm: start migration to head-based output API" the
head list is guaranteed to contain all created drm_outputs through the
automatically created drm_head.
This simplifies the code a little, introduces
drm_head_find_by_connector(), and works towards the eventual removal of
drm_output_find_by_connector().
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
Hook up the libweston facing head-based output API by introducing struct
drm_head, but leave it as a fake so that members can be migrated in
pieces in follow-up patches.
The DRM backend continues to create an output for each connected
connector only, and during output creation it also creates a drm_head
for it. This allows it to pretend it supports the head-based output API
as long as there is only one head per output ever attached.
create_output callback is fake, it will only look up the existing
drm_output by the head name.
Clones are not yet supported, hence max is defined to 1.
This unfortunately introduces some temporary code that will be revomed
later, but seems to be necessary to avoid a single big patch.
v6:
- add missing drm_head_destroy() call
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
In order to support clone modes, libweston needs the concept of a head
that is separate from weston_output. While weston_output manages buffers
and the repaint state machine, weston_head will represent a single
monitor. In the future it will be possible to have a single
weston_output drive one or more weston_heads for a clone mode that
shares the framebuffers between all cloned heads.
All the fields that are obviously properties of the monitor are moved
from weston_output into weston_head.
As moving the fields requires one to touch all the backends for all the
assingments, introduce setter functions for them while we are here. The
setters are identical to the old assignments, for now.
As a temporary measure, weston_output embeds a single head. Also the
ugly casts in weston_head_set_monitor_strings() will be removed by a
follow-up patch.
Libweston major version is bumped, because weston_output struct layout
is changed.
v7:
- Bump libweston major version.
v6:
- adapt to upstream changes in weston_output_set_transform()
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
v5 Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
v6 Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
ret is overwritten by drmModeAddFB2 call
(Found by clang source code analyzer)
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
If AddFB2 ever fails for any reason, we fall back to legacy AddFB, which
doesn't support the same swathe of formats, or multi-planar formats, or
modifiers.
This can happen with arbitrary client buffers, condemning us to the
fallback forever more. Remove this, at the cost of an unnecessary ioctl
for users on old kernels without AddFB2; unfortunately, we cannot detect
the complete absence of the ioctl, as the return here is -EINVAL rather
than -ENOTTY.
A check for whether or not the format is valid has been replaced with an
assert, as its callers either check that the format is non-zero, return
a FourCC format code from GBM, or use a static FourCC format.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Make it a bit more clear what the purpose of the variable is.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Nothing in this loop reorders views within the compositor's view_list.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Leaks spotted by Valgrind.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Spotted by Valgrind.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Fixes the following Valgrind error:
==21607== Syscall param ioctl(generic) points to uninitialised byte(s)
==21607== at 0x5E8C787: ioctl (in /lib64/libc-2.25.so)
==21607== by 0x8220C17: drmIoctl (in /usr/lib64/libdrm.so.2.4.0)
==21607== by 0x82263CD: drmModeSetCrtc (in /usr/lib64/libdrm.so.2.4.0)
==21607== by 0x7B22095: drm_output_apply_state_legacy (compositor-drm.c:2107)
==21607== by 0x7B2335D: drm_pending_state_apply (compositor-drm.c:2539)
==21607== by 0x7B23AEB: drm_repaint_flush (compositor-drm.c:2773)
==21607== by 0x4E4A3E4: output_repaint_timer_handler (compositor.c:2500)
==21607== by 0x5081496: wl_event_source_timer_dispatch (event-loop.c:235)
==21607== by 0x5081B61: wl_event_loop_dispatch (event-loop.c:633)
==21607== by 0x50803A4: wl_display_run (wayland-server.c:1245)
==21607== by 0x409DD8: main (main.c:2644)
==21607== Address 0xffefff59a is on thread 1's stack
==21607== in frame #2, created by drmModeSetCrtc (???:)
==21607== Uninitialised value was created by a stack allocation
==21607== at 0x7B2782F: drm_output_choose_initial_mode (compositor-drm.c:4842)
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
[Pekka: switch to memset]
Reviewed-by: Daniel Stone <daniels@collabora.com>
Move it into to a new function. Following patches want to compute it
elsewhere as well.
No functional changes.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
This function needs to reset the structures to NULL, otherwise it is not
possible to re-use a once "freed" property info array.
Being able to re-use an array is useful when the memory allocation and
array lifetimes do not match. A specific example is drm_output that is
changed to allocate the CRTC on enable() and deallocate it on disable().
A drm_output might be enabled and disabled multiple times.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
I need to destroy the list from more places, so factor out the common
bits. No functional changes.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Factor out drm_output_init_crtc() and drm_output_fini_crtc(), so that
the call sites can later be moved easily.
On fini, reset scanout_plane and cursor_plane to NULL, so that in the
future when the drm_output is not longer destroyed immediately after, we
free the planes for other use.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
[Pekka: set crtc_id/pipe at top, reset both on error]
Reviewed-by: Daniel Stone <daniels@collabora.com>
Move this bit of code into its own function. The caller of this already
cluttered and origcrtc is not used for anything else.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Let drm_output_enable() remove the CRTC and the connector from the
unused id arrays.
In the future when a list of drm_heads supersedes unused_connectors
array, the usedness of a connector will be determined by the enabled
state of the output the connector (head) is attached to. The enabled
state is turned on by drm_output_enable(). If unused_crtcs array was
still updated in drm_output_repaint(), the CRTC and connector usedness
would be tracked in different places. Logically the two belong together.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Setting state_invalid to true is moved together with the code adding new
unused CRTCs and connectors in drm_output_deinit(). Logically these two
operations belong together: state_invalid is required for the new unused
item to be turned off.
This does not hinder initial turning off of outputs, because on
compositor start-up, state_invalid is initialized to true, making calls
to drm_output_disable() for non-enabled outputs a no-op.
Previous changes already ensure that if a compositor does not explicitly
enable an output, the CRTC and connector will be turned off even without
an explicit disable (provided there is a at least one enabled output).
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Rather than smashing the state to disable a CRTC immediately, just
delegate that to the normal repaint cycle by setting state_invalid =
true. drm_pending_state_apply() will pick up the unused_crtcs.
A caveat here is that we have no enabled outputs at all, we will never
enter repaint, and so CRTCs do not actually get turned off until we get
at least one output to drive.
However, this should help the problem reported here:
https://lists.freedesktop.org/archives/wayland-devel/2018-January/036713.html
Arguably it is better to leave an output spuriously on in rare cases
rather than fail modeset completely in somewhat more common cases.
My personal motivation for this change is that it helps if we later move
CRTC allocation to output enable/deinit instead of create/destroy,
because then the CRTC will not be available here for initial turn-off as
the output has not been enabled to begin with.
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
This was used from the crash handlers, which do not exist anymore.
Nothing calls restore, so delete the dead code.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Add support for using the atomic-modesetting API to apply output state.
Unlike previous series, this commit does not unflip sprites_are_broken,
until further work has been done with assign_planes to make it reliable.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Co-authored-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Co-authored-by: Louis-Francis Ratté-Boulianne <louis-francis.ratte-boulianne@collabora.com>
Co-authored-by: Derek Foreman <derek.foreman@collabora.co.uk>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
For atomic modesetting support, the mode is identified by a blob
property ID, rather than being passed inline. Add a blob_id member to
drm_mode to handle this, including refactoring mode destruction into a
helper function.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Set the atomic client cap, where it exists, and use this to discover the
plane/CRTC/connector properties we require for atomic modesetting.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Co-authored-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
When leaving Weston, don't attempt to restore the previous CRTC
settings. The framebuffer may well have disappeared, and in every
likelihood, whoever gets the KMS device afterwards will be repainting
anyway.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Rather than a smattering of error handlers, use consistent jump labels
for error paths in create_output_for_connector().
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reported-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Rather than open-coding it ourselves, use the new apply_state helper in
drm_output_start_repaint.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reported-by: Fabien DESSENNE <fabien.dessenne@st.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Split repaint into two stages, as implied by the grouped-repaint
interface: drm_output_repaint generates the repaint state only, and
drm_repaint_flush applies it.
This also moves DPMS into output state. Previously, the usual way to
DPMS off was that repaint would be called and apply its state, followed
by set_dpms being called afterwards to push the DPMS state separately.
As this happens before the repaint_flush hook, with no change to DPMS we
would set DPMS off, then immediately re-enable the output by posting the
repaint. Not ideal.
Moving DPMS application at the same time complicates this patch, but I
couldn't find a way to split it; if we keep set_dpms before begin_flush
then we break DPMS off, or if we try to move DPMS to output state before
using the repaint flush, we get stuck as the repaint hook generates an
asynchronous state update, followed immediately by set_dpms generating a
synchronous state update.
In drm_output_update_complete, the *_pending flags are cleared
before any of the pending actions are taken; this ensures that the
actions cannot recurse.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
If we have an unused CRTC or connector, explicitly disable it during the
end of the repaint cycle, or when we get VT-switched back in.
This commit moves state_invalid from an output property to a backend
property, as the unused CRTCs or connectors are likely not tracked by
drm_outputs. This matches the mechanics of later commits, where we move
to a global repaint-flush hook, applying the state for all outputs in
one go.
The output state_invalid flag originally provoked full changes on output
creation (via setting the flag at output enable time) and session enter.
For the new-output case, we will not have any FB in output->state_cur,
so we still take the same path in repaint as if state_invalid were set.
At session enter, we preserve the existing behaviour: as
start_repaint_loop will fail when state_invalid is set, all outputs will
be scheduled for repaint together, and state_invalid will not be cleared
until after all outputs have been repainted, inside repaint_flush.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Rather than a more piecemeal approach at backend creation, explicitly
track connectors and CRTCs we do not intend to use, so we can ensure
they are disabled where appropriate.
When we have an updated list of connector and CRTC IDs, we add any which
are not owned by an enabled drm_output to the list. We remove them from
the list when drm_output_repaint() is called for that output, and re-add
them when the output is disabled or destroyed.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Much like we already have to_drm_output and to_drm_backend.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
If we don't have any damage for the primary plane, then don't force a
repaint; simply reuse the old buffer we already have.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Calling switch_mode with no output or mode never makes any sense. Drop
the NULL checks.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Use a real drm_plane to back the scanout plane, displacing
output->fb_{last,cur,pending} to their plane-tracked equivalents.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Change the type of cursor_plane from a weston_plane (base tracking
structure) to a drm_plane (wrapper containing additional DRM-specific
details), and make it a dynamically-allocated pointer.
Using the standard drm_plane allows us to reuse code which already deals
with drm_planes, e.g. a common cleanup function.
This patch introduces a 'special plane' helper, creating a drm_plane
either from a real KMS plane when using universal planes, or a fake plane
otherwise. Without universal planes, the cursor and primary planes are
hidden from us; this helper allows us to pretend otherwise.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Helper for the pattern of checking whether or not a plane can be used on
an output during the current repaint cycle.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Track dynamic plane state (CRTC, FB, position) in separate structures,
rather than as part of the plane. This will make it easier to handle
state management later, and much more closely tracks what the kernel
does with atomic modesets.
The fb_last pointer previously used in drm_plane now becomes part of
output->state_last, and is not directly visible from the plane itself.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Currently this doesn't actually really do anything, but will be used in
the future to track the state for both modeset and repaint requests.
Completion of the request gives us a single request-completion path for
both pageflip and vblank events.
This merges the timing paths for scanout and plane-but-but-atomic-plane
content.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Does what it says on the box: is true when the compositor is shutting
down.
When we begin to use universal planes, we need divergent destruction
paths. With universal planes, the drm_planes are created at backend
initialisation time, and destroyed with the backend. However, without
universal planes, we create per-output drm_planes to hold the
primary/scanout and cursor planes, whose lifetime is tied to the output.
We will use the new shutting_down flag to determine if output
destruction is hot-unplug or compositor shutdown, and make a decision on
whether or not to destroy the special planes.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Developers with testing rigs having multiple graphics cards plugged in
often want to test things on a specific card. We have ways to choose a
card through seat assignments, but configuring that run by run is
awkward.
Add a new DRM backend option to try to open a specific device, and quit
if it fails.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
As discussed in the following thread:
https://lists.freedesktop.org/archives/wayland-devel/2017-August/034755.html
the existing plane assignment in the DRM backend is vulnerable to
accidental masking of the intended fullscreen surface. This change
adds a simple stateful memory to the plane assignment algorithm
to prevent that.
Reviewed-by: Daniel Stone <daniels@collabora.com>
Stop suggesting to run Weston as root, it is only meant for debugging.
Instead, mention the two supported ways to run Weston on DRM and fbdev:
weston-launch helper and logind service.
Cc: "Ucan, Emre (ADITG/ESB)" <eucan@de.adit-jv.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
[Pekka: added forgotten "using" word.]
Change code related to key events to use struct timespec to represent
time.
This commit is part of a larger effort to transition the Weston codebase
to struct timespec.
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Add a test environment variable to allow disabling universal planes.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Change all backends to set the core backend pointer early.
This is necessary for libweston core to be able to access the backend
vfuncs before the backend init function returns. Particularly,
weston_output_init() will be needing to inspect the backend vfuncs to
see if the backend has been converted to a new API. Backends that create
outputs as part of their init would fail without setting the pointer
earlier.
For consistency, all backends are modified instead of just those that
could hit an issue.
Libweston core will take care of resetting the backend pointer to NULL
in case of error since "libweston: ensure backend is not loaded twice".
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by Daniel Stone <daniels@collabora.com>
'release' is a more appropriate name because the function does not free
the underlying memory. The main reason for this is that we need the name
weston_output_destroy() for new API that actually will free also the
underlying memory.
Since the function is only used in backends and external backends are
not a thing, this does not cause libweston major version bump, even
though it does change the ABI. There is no way external users could have
successfully used this function.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by Daniel Stone <daniels@collabora.com>
Move the remaining scattered setup of the fixed properties into
create_output_for_connector(). All these are already known and they
cannot change.
This helps future refactoring.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by Daniel Stone <daniels@collabora.com>
This fixes a regression where monitor make and model would always be
advertised as "unknown" to Wayland clients. The EDID strings were parsed
at create_output_for_connector() time, but the fallback "unknown" values
were set in weston_drm_output_api::set_mode vfunc later. This made the
correct monitor info be shown in the log, but not sent to clients.
The purpose of the "unknown" assignments is to give fallback values in
case EDID is not providing them.
Fix all that by moving all setting of the make, model and serial into
create_output_for_connector(). These values cannot change afterwards
anyway. While at it, document find_and_parse_output_edid().
The ugly casts in create_output_for_connector() are required to silence
compositor warnings from ignoring const attribute. This is temporary,
and a future refactoring will get rid of the casts.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by Daniel Stone <daniels@collabora.com>
Add 'name' argument to weston_output_init(). This is much more obvious
than the assert inside weston_output_init() to ensure the caller has set
a field in weston_output first.
Now weston_output_init() will strdup() the name itself, which means we
can drop a whole bunch of strdup()s in the backends. This matches
weston_output_destroy() which was already calling free() on the name.
All backends are slightly reordered to call weston_output_init() before
accessing any fields of weston_output, except the Wayland backend which
would make it a little awkward to do it in this patch. Mind, that
weston_output_init() still does not reset the struct to zero - it is
presumed the caller has done it, since weston_output is embedded in the
backend output structs.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: David Fort <contact@hardening-consulting.com>
[Daniel: document name copying]
Acked-by Daniel Stone <daniels@collabora.com>
Initialize the list in weston_output_init() instead of doing it
separately in each backend.
One would expect weston_output_init() to initialize all weston_output
members, at least those that are not NULL.
We rely on the set_size() functions to be called only once, as is
assert()'d. If set_size() becomes callable multiple times, this patch
will force them to be fixed to properly manage the mode list instead of
losing all members.
compositor-wayland.c is strange in
wayland_output_create_for_parent_output(): it first called
wayland_output_set_size() that initialized the mode list with a single
mode manufactured from width and height and set that mode as current.
Then it continued to reset the mode list and adding the list of modes
from the parent output, leaving the current mode left to point to a mode
struct that is no longer in the mode list and with a broken 'link'
element. This patch changes things such that the manufactured mode is
left in the list, and the parent mode list is added. This is probably
not quite right either.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Acked-by Daniel Stone <daniels@collabora.com>