From: Oleksandr Andrushchenko <andr2000@gmail.com>
To: Gerd Hoffmann <kraxel@redhat.com>,
dri-devel@lists.freedesktop.org,
David Airlie <airlied@redhat.com>
Cc: David Airlie <airlied@linux.ie>,
open list <linux-kernel@vger.kernel.org>,
"open list:DRM DRIVER FOR BOCHS VIRTUAL GPU"
<virtualization@lists.linux-foundation.org>
Subject: Re: [PATCH 05/14] drm/bochs: atomic: switch planes to atomic, wire up helpers.
Date: Thu, 20 Dec 2018 14:14:26 +0200 [thread overview]
Message-ID: <277f1e16-aa7b-b741-4ceb-3dea0f776a60@gmail.com> (raw)
In-Reply-To: <20181219115127.31359-6-kraxel@redhat.com>
On 12/19/18 1:51 PM, Gerd Hoffmann wrote:
> Conversion to atomic modesetting, step three.
> Wire up atomic helpers. Switch planes to atomic.
>
> We are late to the party, the transitional helpers are gone,
> so this can't be splitted into smaller steps any more.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> drivers/gpu/drm/bochs/bochs_fbdev.c | 3 ++
> drivers/gpu/drm/bochs/bochs_kms.c | 70 +++++++++++++++++++++++++++++++++++--
> 2 files changed, 70 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/bochs/bochs_fbdev.c b/drivers/gpu/drm/bochs/bochs_fbdev.c
> index dd3c7df267..d9f3d42999 100644
> --- a/drivers/gpu/drm/bochs/bochs_fbdev.c
> +++ b/drivers/gpu/drm/bochs/bochs_fbdev.c
> @@ -6,6 +6,7 @@
> */
>
> #include "bochs.h"
> +#include <drm/drm_atomic_helper.h>
> #include <drm/drm_gem_framebuffer_helper.h>
>
> /* ---------------------------------------------------------------------- */
> @@ -149,6 +150,8 @@ bochs_gem_fb_create(struct drm_device *dev, struct drm_file *file,
>
> const struct drm_mode_config_funcs bochs_mode_funcs = {
> .fb_create = bochs_gem_fb_create,
> + .atomic_check = drm_atomic_helper_check,
> + .atomic_commit = drm_atomic_helper_commit,
> };
>
> int bochs_fbdev_init(struct bochs_device *bochs)
> diff --git a/drivers/gpu/drm/bochs/bochs_kms.c b/drivers/gpu/drm/bochs/bochs_kms.c
> index 18b705fb0b..aa3ba0377a 100644
> --- a/drivers/gpu/drm/bochs/bochs_kms.c
> +++ b/drivers/gpu/drm/bochs/bochs_kms.c
> @@ -6,7 +6,9 @@
> */
>
> #include "bochs.h"
> +#include <drm/drm_atomic_helper.h>
> #include <drm/drm_plane_helper.h>
> +#include <drm/drm_atomic_uapi.h>
>
> static int defx = 1024;
> static int defy = 768;
> @@ -113,7 +115,7 @@ static int bochs_crtc_page_flip(struct drm_crtc *crtc,
> struct drm_framebuffer *old_fb = crtc->primary->fb;
> unsigned long irqflags;
>
> - crtc->primary->fb = fb;
> + drm_atomic_set_fb_for_plane(crtc->primary->state, fb);
Taking into account that crtc->primary access goes away in the series:
Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
> bochs_crtc_mode_set_base(crtc, 0, 0, old_fb);
> if (event) {
> spin_lock_irqsave(&bochs->dev->event_lock, irqflags);
> @@ -151,6 +153,9 @@ static const struct drm_crtc_funcs bochs_crtc_funcs = {
> .set_config = drm_crtc_helper_set_config,
> .destroy = drm_crtc_cleanup,
> .page_flip = bochs_crtc_page_flip,
> + .reset = drm_atomic_helper_crtc_reset,
> + .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
> + .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
> };
>
> static const struct drm_crtc_helper_funcs bochs_helper_funcs = {
> @@ -169,6 +174,59 @@ static const uint32_t bochs_formats[] = {
> DRM_FORMAT_BGRX8888,
> };
>
> +static void bochs_plane_atomic_update(struct drm_plane *plane,
> + struct drm_plane_state *old_state)
> +{
> + struct bochs_device *bochs = plane->dev->dev_private;
> + struct bochs_bo *bo;
> +
> + if (!plane->state->fb)
> + return;
> + bo = gem_to_bochs_bo(plane->state->fb->obj[0]);
> + bochs_hw_setbase(bochs,
> + plane->state->crtc_x,
> + plane->state->crtc_y,
> + bo->bo.offset);
> + bochs_hw_setformat(bochs, plane->state->fb->format);
> +}
> +
> +static int bochs_plane_prepare_fb(struct drm_plane *plane,
> + struct drm_plane_state *new_state)
> +{
> + struct bochs_bo *bo;
> +
> + if (!new_state->fb)
> + return 0;
> + bo = gem_to_bochs_bo(new_state->fb->obj[0]);
> + return bochs_bo_pin(bo, TTM_PL_FLAG_VRAM, NULL);
> +}
> +
> +static void bochs_plane_cleanup_fb(struct drm_plane *plane,
> + struct drm_plane_state *old_state)
> +{
> + struct bochs_bo *bo;
> +
> + if (!old_state->fb)
> + return;
> + bo = gem_to_bochs_bo(old_state->fb->obj[0]);
> + bochs_bo_unpin(bo);
> +}
> +
> +static const struct drm_plane_helper_funcs bochs_plane_helper_funcs = {
> + .atomic_update = bochs_plane_atomic_update,
> + .prepare_fb = bochs_plane_prepare_fb,
> + .cleanup_fb = bochs_plane_cleanup_fb,
> +};
> +
> +static const struct drm_plane_funcs bochs_plane_funcs = {
> + .update_plane = drm_atomic_helper_update_plane,
> + .disable_plane = drm_atomic_helper_disable_plane,
> + .destroy = drm_primary_helper_destroy,
> + .reset = drm_atomic_helper_plane_reset,
> + .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
> + .atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
> +};
> +
> static struct drm_plane *bochs_primary_plane(struct drm_device *dev)
> {
> struct drm_plane *primary;
> @@ -181,16 +239,17 @@ static struct drm_plane *bochs_primary_plane(struct drm_device *dev)
> }
>
> ret = drm_universal_plane_init(dev, primary, 0,
> - &drm_primary_helper_funcs,
> + &bochs_plane_funcs,
> bochs_formats,
> ARRAY_SIZE(bochs_formats),
> NULL,
> DRM_PLANE_TYPE_PRIMARY, NULL);
> if (ret) {
> kfree(primary);
> - primary = NULL;
> + return NULL;
> }
>
> + drm_plane_helper_add(primary, &bochs_plane_helper_funcs);
> return primary;
> }
>
> @@ -275,6 +334,9 @@ static const struct drm_connector_funcs bochs_connector_connector_funcs = {
> .dpms = drm_helper_connector_dpms,
> .fill_modes = drm_helper_probe_single_connector_modes,
> .destroy = drm_connector_cleanup,
> + .reset = drm_atomic_helper_connector_reset,
> + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
> + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
> };
>
> static void bochs_connector_init(struct drm_device *dev)
> @@ -318,6 +380,8 @@ int bochs_kms_init(struct bochs_device *bochs)
> drm_connector_attach_encoder(&bochs->connector,
> &bochs->encoder);
>
> + drm_mode_config_reset(bochs->dev);
> +
> return 0;
> }
>
next prev parent reply other threads:[~2018-12-20 12:14 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20181219115127.31359-1-kraxel@redhat.com>
2018-12-19 11:51 ` [PATCH 01/14] drm/bochs: encoder cleanup Gerd Hoffmann
2018-12-19 14:43 ` Oleksandr Andrushchenko
2018-12-19 11:51 ` [PATCH 02/14] drm/bochs: split bochs_hw_setmode Gerd Hoffmann
2018-12-19 15:10 ` Oleksandr Andrushchenko
2018-12-19 11:51 ` [PATCH 03/14] drm/bochs: atomic: add atomic_flush+atomic_enable callbacks Gerd Hoffmann
2018-12-19 15:30 ` Oleksandr Andrushchenko
2018-12-19 11:51 ` [PATCH 04/14] drm/bochs: atomic: add mode_set_nofb callback Gerd Hoffmann
2018-12-20 12:08 ` Oleksandr Andrushchenko
2018-12-19 11:51 ` [PATCH 05/14] drm/bochs: atomic: switch planes to atomic, wire up helpers Gerd Hoffmann
2018-12-20 12:14 ` Oleksandr Andrushchenko [this message]
2018-12-19 11:51 ` [PATCH 06/14] drm/bochs: atomic: use atomic set_config helper Gerd Hoffmann
2018-12-20 12:14 ` Oleksandr Andrushchenko
2018-12-19 11:51 ` [PATCH 07/14] drm/bochs: atomic: use atomic page_flip helper Gerd Hoffmann
2018-12-20 12:34 ` Oleksandr Andrushchenko
2018-12-19 11:51 ` [PATCH 08/14] drm/bochs: atomic: set DRIVER_ATOMIC Gerd Hoffmann
2018-12-20 12:34 ` Oleksandr Andrushchenko
2018-12-19 11:51 ` [PATCH 09/14] drm/bochs: remove old bochs_crtc_* functions Gerd Hoffmann
2018-12-20 12:46 ` Oleksandr Andrushchenko
2018-12-19 11:51 ` [PATCH 10/14] drm/bochs: drop unused gpu_addr arg from bochs_bo_pin() Gerd Hoffmann
2018-12-20 12:54 ` Oleksandr Andrushchenko
2018-12-19 11:51 ` [PATCH 11/14] drm/bochs: add basic prime support Gerd Hoffmann
2018-12-20 13:07 ` Oleksandr Andrushchenko
2018-12-19 11:51 ` [PATCH 12/14] drm/bochs: switch to generic drm fbdev emulation Gerd Hoffmann
2018-12-20 13:15 ` Oleksandr Andrushchenko
2018-12-19 11:51 ` [PATCH 13/14] drm/bochs: drop old fbdev emulation code Gerd Hoffmann
2018-12-20 13:16 ` Oleksandr Andrushchenko
2018-12-19 11:51 ` [PATCH 14/14] drm/bochs: move remaining fb bits to kms Gerd Hoffmann
2018-12-20 13:17 ` Oleksandr Andrushchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=277f1e16-aa7b-b741-4ceb-3dea0f776a60@gmail.com \
--to=andr2000@gmail.com \
--cc=airlied@linux.ie \
--cc=airlied@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kraxel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).