2020-08-30 07:20:00 -07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
|
2022-02-04 10:05:41 -07:00
|
|
|
#include <linux/iosys-map.h>
|
2020-11-03 02:30:11 -07:00
|
|
|
|
drm: Pass the full state to connectors atomic functions
The current atomic helpers have either their object state being passed as
an argument or the full atomic state.
The former is the pattern that was done at first, before switching to the
latter for new hooks or when it was needed.
Now that the CRTCs have been converted, let's move forward with the
connectors to provide a consistent interface.
The conversion was done using the coccinelle script below, and built tested
on all the drivers.
@@
identifier connector, connector_state;
@@
struct drm_connector_helper_funcs {
...
struct drm_encoder* (*atomic_best_encoder)(struct drm_connector *connector,
- struct drm_connector_state *connector_state);
+ struct drm_atomic_state *state);
...
}
@@
identifier connector, connector_state;
@@
struct drm_connector_helper_funcs {
...
void (*atomic_commit)(struct drm_connector *connector,
- struct drm_connector_state *connector_state);
+ struct drm_atomic_state *state);
...
}
@@
struct drm_connector_helper_funcs *FUNCS;
identifier state;
identifier connector, connector_state;
identifier f;
@@
f(..., struct drm_atomic_state *state, ...)
{
<+...
- FUNCS->atomic_commit(connector, connector_state);
+ FUNCS->atomic_commit(connector, state);
...+>
}
@@
struct drm_connector_helper_funcs *FUNCS;
identifier state;
identifier connector, connector_state;
identifier var, f;
@@
f(struct drm_atomic_state *state, ...)
{
<+...
- var = FUNCS->atomic_best_encoder(connector, connector_state);
+ var = FUNCS->atomic_best_encoder(connector, state);
...+>
}
@ connector_atomic_func @
identifier helpers;
identifier func;
@@
(
static struct drm_connector_helper_funcs helpers = {
...,
.atomic_best_encoder = func,
...,
};
|
static struct drm_connector_helper_funcs helpers = {
...,
.atomic_commit = func,
...,
};
)
@@
identifier connector_atomic_func.func;
identifier connector;
symbol state;
@@
func(struct drm_connector *connector,
- struct drm_connector_state *state
+ struct drm_connector_state *connector_state
)
{
...
- state
+ connector_state
...
}
@ ignores_state @
identifier connector_atomic_func.func;
identifier connector, connector_state;
@@
func(struct drm_connector *connector,
struct drm_connector_state *connector_state)
{
... when != connector_state
}
@ adds_state depends on connector_atomic_func && !ignores_state @
identifier connector_atomic_func.func;
identifier connector, connector_state;
@@
func(struct drm_connector *connector, struct drm_connector_state *connector_state)
{
+ struct drm_connector_state *connector_state = drm_atomic_get_new_connector_state(state, connector);
...
}
@ depends on connector_atomic_func @
identifier connector_atomic_func.func;
identifier connector_state;
identifier connector;
@@
func(struct drm_connector *connector,
- struct drm_connector_state *connector_state
+ struct drm_atomic_state *state
)
{ ... }
@ include depends on adds_state @
@@
#include <drm/drm_atomic.h>
@ no_include depends on !include && adds_state @
@@
+ #include <drm/drm_atomic.h>
#include <drm/...>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Cc: Leo Li <sunpeng.li@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Cc: Melissa Wen <melissa.srw@gmail.com>
Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201118094758.506730-1-maxime@cerno.tech
2020-11-18 02:47:58 -07:00
|
|
|
#include <drm/drm_atomic.h>
|
2022-06-14 02:02:45 -07:00
|
|
|
#include <drm/drm_edid.h>
|
2020-08-30 07:20:00 -07:00
|
|
|
#include <drm/drm_fourcc.h>
|
|
|
|
#include <drm/drm_writeback.h>
|
|
|
|
#include <drm/drm_probe_helper.h>
|
|
|
|
#include <drm/drm_atomic_helper.h>
|
|
|
|
#include <drm/drm_gem_framebuffer_helper.h>
|
2020-10-13 04:10:27 -07:00
|
|
|
#include <drm/drm_gem_shmem_helper.h>
|
2020-08-30 07:20:00 -07:00
|
|
|
|
2020-11-03 02:30:11 -07:00
|
|
|
#include "vkms_drv.h"
|
2022-09-05 12:08:08 -07:00
|
|
|
#include "vkms_formats.h"
|
2020-11-03 02:30:11 -07:00
|
|
|
|
2020-08-30 07:20:00 -07:00
|
|
|
static const u32 vkms_wb_formats[] = {
|
2023-05-15 06:52:04 -07:00
|
|
|
DRM_FORMAT_ARGB8888,
|
2020-08-30 07:20:00 -07:00
|
|
|
DRM_FORMAT_XRGB8888,
|
2022-09-05 12:08:10 -07:00
|
|
|
DRM_FORMAT_XRGB16161616,
|
2022-09-05 12:08:11 -07:00
|
|
|
DRM_FORMAT_ARGB16161616,
|
|
|
|
DRM_FORMAT_RGB565
|
2020-08-30 07:20:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
static const struct drm_connector_funcs vkms_wb_connector_funcs = {
|
|
|
|
.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,
|
|
|
|
};
|
|
|
|
|
2023-12-07 18:03:14 -07:00
|
|
|
static int vkms_wb_atomic_check(struct drm_connector *connector,
|
|
|
|
struct drm_atomic_state *state)
|
2020-08-30 07:20:00 -07:00
|
|
|
{
|
2023-12-07 18:03:14 -07:00
|
|
|
struct drm_connector_state *conn_state =
|
|
|
|
drm_atomic_get_new_connector_state(state, connector);
|
|
|
|
struct drm_crtc_state *crtc_state;
|
2020-08-30 07:20:00 -07:00
|
|
|
struct drm_framebuffer *fb;
|
2023-12-07 18:03:14 -07:00
|
|
|
const struct drm_display_mode *mode;
|
2022-09-05 12:08:05 -07:00
|
|
|
int ret;
|
2020-08-30 07:20:00 -07:00
|
|
|
|
|
|
|
if (!conn_state->writeback_job || !conn_state->writeback_job->fb)
|
|
|
|
return 0;
|
|
|
|
|
2023-12-07 18:03:14 -07:00
|
|
|
if (!conn_state->crtc)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc);
|
|
|
|
mode = &crtc_state->mode;
|
|
|
|
|
2020-08-30 07:20:00 -07:00
|
|
|
fb = conn_state->writeback_job->fb;
|
|
|
|
if (fb->width != mode->hdisplay || fb->height != mode->vdisplay) {
|
|
|
|
DRM_DEBUG_KMS("Invalid framebuffer size %ux%u\n",
|
|
|
|
fb->width, fb->height);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2023-12-07 18:03:14 -07:00
|
|
|
ret = drm_atomic_helper_check_wb_connector_state(connector, state);
|
2022-09-05 12:08:05 -07:00
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
2020-08-30 07:20:00 -07:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int vkms_wb_connector_get_modes(struct drm_connector *connector)
|
|
|
|
{
|
|
|
|
struct drm_device *dev = connector->dev;
|
|
|
|
|
|
|
|
return drm_add_modes_noedid(connector, dev->mode_config.max_width,
|
|
|
|
dev->mode_config.max_height);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int vkms_wb_prepare_job(struct drm_writeback_connector *wb_connector,
|
|
|
|
struct drm_writeback_job *job)
|
|
|
|
{
|
2021-07-30 11:35:11 -07:00
|
|
|
struct vkms_writeback_job *vkmsjob;
|
2020-11-03 02:30:11 -07:00
|
|
|
int ret;
|
2020-08-30 07:20:00 -07:00
|
|
|
|
|
|
|
if (!job->fb)
|
|
|
|
return 0;
|
|
|
|
|
2021-07-30 11:35:11 -07:00
|
|
|
vkmsjob = kzalloc(sizeof(*vkmsjob), GFP_KERNEL);
|
|
|
|
if (!vkmsjob)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
2022-09-05 12:08:07 -07:00
|
|
|
ret = drm_gem_fb_vmap(job->fb, vkmsjob->wb_frame_info.map, vkmsjob->data);
|
2020-11-03 02:30:11 -07:00
|
|
|
if (ret) {
|
|
|
|
DRM_ERROR("vmap failed: %d\n", ret);
|
2021-07-30 11:35:11 -07:00
|
|
|
goto err_kfree;
|
2020-08-30 07:20:00 -07:00
|
|
|
}
|
|
|
|
|
2022-09-05 12:08:07 -07:00
|
|
|
vkmsjob->wb_frame_info.fb = job->fb;
|
|
|
|
drm_framebuffer_get(vkmsjob->wb_frame_info.fb);
|
|
|
|
|
2021-07-30 11:35:11 -07:00
|
|
|
job->priv = vkmsjob;
|
2020-08-30 07:20:00 -07:00
|
|
|
|
|
|
|
return 0;
|
2021-07-30 11:35:11 -07:00
|
|
|
|
|
|
|
err_kfree:
|
|
|
|
kfree(vkmsjob);
|
|
|
|
return ret;
|
2020-08-30 07:20:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void vkms_wb_cleanup_job(struct drm_writeback_connector *connector,
|
|
|
|
struct drm_writeback_job *job)
|
|
|
|
{
|
2021-07-30 11:35:11 -07:00
|
|
|
struct vkms_writeback_job *vkmsjob = job->priv;
|
2020-08-30 07:20:00 -07:00
|
|
|
struct vkms_device *vkmsdev;
|
|
|
|
|
|
|
|
if (!job->fb)
|
|
|
|
return;
|
|
|
|
|
2022-09-05 12:08:07 -07:00
|
|
|
drm_gem_fb_vunmap(job->fb, vkmsjob->wb_frame_info.map);
|
|
|
|
|
|
|
|
drm_framebuffer_put(vkmsjob->wb_frame_info.fb);
|
2020-08-30 07:20:00 -07:00
|
|
|
|
2021-07-30 11:35:11 -07:00
|
|
|
vkmsdev = drm_device_to_vkms_device(job->fb->dev);
|
2020-08-30 07:20:00 -07:00
|
|
|
vkms_set_composer(&vkmsdev->output, false);
|
2021-07-30 11:35:11 -07:00
|
|
|
kfree(vkmsjob);
|
2020-08-30 07:20:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void vkms_wb_atomic_commit(struct drm_connector *conn,
|
drm: Pass the full state to connectors atomic functions
The current atomic helpers have either their object state being passed as
an argument or the full atomic state.
The former is the pattern that was done at first, before switching to the
latter for new hooks or when it was needed.
Now that the CRTCs have been converted, let's move forward with the
connectors to provide a consistent interface.
The conversion was done using the coccinelle script below, and built tested
on all the drivers.
@@
identifier connector, connector_state;
@@
struct drm_connector_helper_funcs {
...
struct drm_encoder* (*atomic_best_encoder)(struct drm_connector *connector,
- struct drm_connector_state *connector_state);
+ struct drm_atomic_state *state);
...
}
@@
identifier connector, connector_state;
@@
struct drm_connector_helper_funcs {
...
void (*atomic_commit)(struct drm_connector *connector,
- struct drm_connector_state *connector_state);
+ struct drm_atomic_state *state);
...
}
@@
struct drm_connector_helper_funcs *FUNCS;
identifier state;
identifier connector, connector_state;
identifier f;
@@
f(..., struct drm_atomic_state *state, ...)
{
<+...
- FUNCS->atomic_commit(connector, connector_state);
+ FUNCS->atomic_commit(connector, state);
...+>
}
@@
struct drm_connector_helper_funcs *FUNCS;
identifier state;
identifier connector, connector_state;
identifier var, f;
@@
f(struct drm_atomic_state *state, ...)
{
<+...
- var = FUNCS->atomic_best_encoder(connector, connector_state);
+ var = FUNCS->atomic_best_encoder(connector, state);
...+>
}
@ connector_atomic_func @
identifier helpers;
identifier func;
@@
(
static struct drm_connector_helper_funcs helpers = {
...,
.atomic_best_encoder = func,
...,
};
|
static struct drm_connector_helper_funcs helpers = {
...,
.atomic_commit = func,
...,
};
)
@@
identifier connector_atomic_func.func;
identifier connector;
symbol state;
@@
func(struct drm_connector *connector,
- struct drm_connector_state *state
+ struct drm_connector_state *connector_state
)
{
...
- state
+ connector_state
...
}
@ ignores_state @
identifier connector_atomic_func.func;
identifier connector, connector_state;
@@
func(struct drm_connector *connector,
struct drm_connector_state *connector_state)
{
... when != connector_state
}
@ adds_state depends on connector_atomic_func && !ignores_state @
identifier connector_atomic_func.func;
identifier connector, connector_state;
@@
func(struct drm_connector *connector, struct drm_connector_state *connector_state)
{
+ struct drm_connector_state *connector_state = drm_atomic_get_new_connector_state(state, connector);
...
}
@ depends on connector_atomic_func @
identifier connector_atomic_func.func;
identifier connector_state;
identifier connector;
@@
func(struct drm_connector *connector,
- struct drm_connector_state *connector_state
+ struct drm_atomic_state *state
)
{ ... }
@ include depends on adds_state @
@@
#include <drm/drm_atomic.h>
@ no_include depends on !include && adds_state @
@@
+ #include <drm/drm_atomic.h>
#include <drm/...>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Cc: Leo Li <sunpeng.li@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Cc: Melissa Wen <melissa.srw@gmail.com>
Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201118094758.506730-1-maxime@cerno.tech
2020-11-18 02:47:58 -07:00
|
|
|
struct drm_atomic_state *state)
|
2020-08-30 07:20:00 -07:00
|
|
|
{
|
drm: Pass the full state to connectors atomic functions
The current atomic helpers have either their object state being passed as
an argument or the full atomic state.
The former is the pattern that was done at first, before switching to the
latter for new hooks or when it was needed.
Now that the CRTCs have been converted, let's move forward with the
connectors to provide a consistent interface.
The conversion was done using the coccinelle script below, and built tested
on all the drivers.
@@
identifier connector, connector_state;
@@
struct drm_connector_helper_funcs {
...
struct drm_encoder* (*atomic_best_encoder)(struct drm_connector *connector,
- struct drm_connector_state *connector_state);
+ struct drm_atomic_state *state);
...
}
@@
identifier connector, connector_state;
@@
struct drm_connector_helper_funcs {
...
void (*atomic_commit)(struct drm_connector *connector,
- struct drm_connector_state *connector_state);
+ struct drm_atomic_state *state);
...
}
@@
struct drm_connector_helper_funcs *FUNCS;
identifier state;
identifier connector, connector_state;
identifier f;
@@
f(..., struct drm_atomic_state *state, ...)
{
<+...
- FUNCS->atomic_commit(connector, connector_state);
+ FUNCS->atomic_commit(connector, state);
...+>
}
@@
struct drm_connector_helper_funcs *FUNCS;
identifier state;
identifier connector, connector_state;
identifier var, f;
@@
f(struct drm_atomic_state *state, ...)
{
<+...
- var = FUNCS->atomic_best_encoder(connector, connector_state);
+ var = FUNCS->atomic_best_encoder(connector, state);
...+>
}
@ connector_atomic_func @
identifier helpers;
identifier func;
@@
(
static struct drm_connector_helper_funcs helpers = {
...,
.atomic_best_encoder = func,
...,
};
|
static struct drm_connector_helper_funcs helpers = {
...,
.atomic_commit = func,
...,
};
)
@@
identifier connector_atomic_func.func;
identifier connector;
symbol state;
@@
func(struct drm_connector *connector,
- struct drm_connector_state *state
+ struct drm_connector_state *connector_state
)
{
...
- state
+ connector_state
...
}
@ ignores_state @
identifier connector_atomic_func.func;
identifier connector, connector_state;
@@
func(struct drm_connector *connector,
struct drm_connector_state *connector_state)
{
... when != connector_state
}
@ adds_state depends on connector_atomic_func && !ignores_state @
identifier connector_atomic_func.func;
identifier connector, connector_state;
@@
func(struct drm_connector *connector, struct drm_connector_state *connector_state)
{
+ struct drm_connector_state *connector_state = drm_atomic_get_new_connector_state(state, connector);
...
}
@ depends on connector_atomic_func @
identifier connector_atomic_func.func;
identifier connector_state;
identifier connector;
@@
func(struct drm_connector *connector,
- struct drm_connector_state *connector_state
+ struct drm_atomic_state *state
)
{ ... }
@ include depends on adds_state @
@@
#include <drm/drm_atomic.h>
@ no_include depends on !include && adds_state @
@@
+ #include <drm/drm_atomic.h>
#include <drm/...>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Cc: Leo Li <sunpeng.li@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Cc: Melissa Wen <melissa.srw@gmail.com>
Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201118094758.506730-1-maxime@cerno.tech
2020-11-18 02:47:58 -07:00
|
|
|
struct drm_connector_state *connector_state = drm_atomic_get_new_connector_state(state,
|
|
|
|
conn);
|
2020-08-30 07:20:00 -07:00
|
|
|
struct vkms_device *vkmsdev = drm_device_to_vkms_device(conn->dev);
|
|
|
|
struct vkms_output *output = &vkmsdev->output;
|
|
|
|
struct drm_writeback_connector *wb_conn = &output->wb_connector;
|
|
|
|
struct drm_connector_state *conn_state = wb_conn->base.state;
|
|
|
|
struct vkms_crtc_state *crtc_state = output->composer_state;
|
2022-09-05 12:08:07 -07:00
|
|
|
struct drm_framebuffer *fb = connector_state->writeback_job->fb;
|
2022-09-05 12:08:09 -07:00
|
|
|
u16 crtc_height = crtc_state->base.crtc->mode.vdisplay;
|
|
|
|
u16 crtc_width = crtc_state->base.crtc->mode.hdisplay;
|
2022-09-05 12:08:07 -07:00
|
|
|
struct vkms_writeback_job *active_wb;
|
|
|
|
struct vkms_frame_info *wb_frame_info;
|
2022-09-05 12:08:08 -07:00
|
|
|
u32 wb_format = fb->format->format;
|
2020-08-30 07:20:00 -07:00
|
|
|
|
|
|
|
if (!conn_state)
|
|
|
|
return;
|
|
|
|
|
|
|
|
vkms_set_composer(&vkmsdev->output, true);
|
|
|
|
|
2022-09-05 12:08:07 -07:00
|
|
|
active_wb = conn_state->writeback_job->priv;
|
|
|
|
wb_frame_info = &active_wb->wb_frame_info;
|
|
|
|
|
2020-08-30 07:20:00 -07:00
|
|
|
spin_lock_irq(&output->composer_lock);
|
2022-09-05 12:08:07 -07:00
|
|
|
crtc_state->active_writeback = active_wb;
|
2023-05-15 06:52:03 -07:00
|
|
|
crtc_state->wb_pending = true;
|
|
|
|
spin_unlock_irq(&output->composer_lock);
|
|
|
|
|
2022-09-05 12:08:07 -07:00
|
|
|
wb_frame_info->offset = fb->offsets[0];
|
|
|
|
wb_frame_info->pitch = fb->pitches[0];
|
|
|
|
wb_frame_info->cpp = fb->format->cpp[0];
|
2023-05-15 06:52:03 -07:00
|
|
|
|
drm: Pass the full state to connectors atomic functions
The current atomic helpers have either their object state being passed as
an argument or the full atomic state.
The former is the pattern that was done at first, before switching to the
latter for new hooks or when it was needed.
Now that the CRTCs have been converted, let's move forward with the
connectors to provide a consistent interface.
The conversion was done using the coccinelle script below, and built tested
on all the drivers.
@@
identifier connector, connector_state;
@@
struct drm_connector_helper_funcs {
...
struct drm_encoder* (*atomic_best_encoder)(struct drm_connector *connector,
- struct drm_connector_state *connector_state);
+ struct drm_atomic_state *state);
...
}
@@
identifier connector, connector_state;
@@
struct drm_connector_helper_funcs {
...
void (*atomic_commit)(struct drm_connector *connector,
- struct drm_connector_state *connector_state);
+ struct drm_atomic_state *state);
...
}
@@
struct drm_connector_helper_funcs *FUNCS;
identifier state;
identifier connector, connector_state;
identifier f;
@@
f(..., struct drm_atomic_state *state, ...)
{
<+...
- FUNCS->atomic_commit(connector, connector_state);
+ FUNCS->atomic_commit(connector, state);
...+>
}
@@
struct drm_connector_helper_funcs *FUNCS;
identifier state;
identifier connector, connector_state;
identifier var, f;
@@
f(struct drm_atomic_state *state, ...)
{
<+...
- var = FUNCS->atomic_best_encoder(connector, connector_state);
+ var = FUNCS->atomic_best_encoder(connector, state);
...+>
}
@ connector_atomic_func @
identifier helpers;
identifier func;
@@
(
static struct drm_connector_helper_funcs helpers = {
...,
.atomic_best_encoder = func,
...,
};
|
static struct drm_connector_helper_funcs helpers = {
...,
.atomic_commit = func,
...,
};
)
@@
identifier connector_atomic_func.func;
identifier connector;
symbol state;
@@
func(struct drm_connector *connector,
- struct drm_connector_state *state
+ struct drm_connector_state *connector_state
)
{
...
- state
+ connector_state
...
}
@ ignores_state @
identifier connector_atomic_func.func;
identifier connector, connector_state;
@@
func(struct drm_connector *connector,
struct drm_connector_state *connector_state)
{
... when != connector_state
}
@ adds_state depends on connector_atomic_func && !ignores_state @
identifier connector_atomic_func.func;
identifier connector, connector_state;
@@
func(struct drm_connector *connector, struct drm_connector_state *connector_state)
{
+ struct drm_connector_state *connector_state = drm_atomic_get_new_connector_state(state, connector);
...
}
@ depends on connector_atomic_func @
identifier connector_atomic_func.func;
identifier connector_state;
identifier connector;
@@
func(struct drm_connector *connector,
- struct drm_connector_state *connector_state
+ struct drm_atomic_state *state
)
{ ... }
@ include depends on adds_state @
@@
#include <drm/drm_atomic.h>
@ no_include depends on !include && adds_state @
@@
+ #include <drm/drm_atomic.h>
#include <drm/...>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Reviewed-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Cc: Leo Li <sunpeng.li@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Cc: Melissa Wen <melissa.srw@gmail.com>
Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201118094758.506730-1-maxime@cerno.tech
2020-11-18 02:47:58 -07:00
|
|
|
drm_writeback_queue_job(wb_conn, connector_state);
|
2023-05-09 13:28:53 -07:00
|
|
|
active_wb->pixel_write = get_pixel_write_function(wb_format);
|
2022-09-05 12:08:09 -07:00
|
|
|
drm_rect_init(&wb_frame_info->src, 0, 0, crtc_width, crtc_height);
|
|
|
|
drm_rect_init(&wb_frame_info->dst, 0, 0, crtc_width, crtc_height);
|
2020-08-30 07:20:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static const struct drm_connector_helper_funcs vkms_wb_conn_helper_funcs = {
|
|
|
|
.get_modes = vkms_wb_connector_get_modes,
|
|
|
|
.prepare_writeback_job = vkms_wb_prepare_job,
|
|
|
|
.cleanup_writeback_job = vkms_wb_cleanup_job,
|
|
|
|
.atomic_commit = vkms_wb_atomic_commit,
|
2023-12-07 18:03:14 -07:00
|
|
|
.atomic_check = vkms_wb_atomic_check,
|
2020-08-30 07:20:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
int vkms_enable_writeback_connector(struct vkms_device *vkmsdev)
|
|
|
|
{
|
|
|
|
struct drm_writeback_connector *wb = &vkmsdev->output.wb_connector;
|
|
|
|
|
|
|
|
drm_connector_helper_add(&wb->base, &vkms_wb_conn_helper_funcs);
|
|
|
|
|
|
|
|
return drm_writeback_connector_init(&vkmsdev->drm, wb,
|
|
|
|
&vkms_wb_connector_funcs,
|
2023-12-07 18:03:14 -07:00
|
|
|
NULL,
|
2020-08-30 07:20:00 -07:00
|
|
|
vkms_wb_formats,
|
2022-04-26 07:41:18 -07:00
|
|
|
ARRAY_SIZE(vkms_wb_formats),
|
|
|
|
1);
|
2020-08-30 07:20:00 -07:00
|
|
|
}
|