Commit 69a12263 authored by Laurent Pinchart's avatar Laurent Pinchart

drm: omapdrm: Wire up atomic state object scaffolding

Hook up the default .reset(), .atomic_duplicate_state() and
.atomic_free_state() helpers to ensure that state objects are properly
created and destroyed, and call drm_mode_config_reset() at init time to
create the initial state objects.

Framebuffer reference count also gets maintained automatically by the
transitional helpers except for the legacy page flip operation. Maintain
it explicitly there.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent 68dc0390
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
* this program. If not, see <http://www.gnu.org/licenses/>. * this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <drm/drm_atomic_helper.h>
#include <drm/drm_crtc.h> #include <drm/drm_crtc.h>
#include <drm/drm_crtc_helper.h> #include <drm/drm_crtc_helper.h>
...@@ -260,9 +261,12 @@ struct drm_encoder *omap_connector_attached_encoder( ...@@ -260,9 +261,12 @@ struct drm_encoder *omap_connector_attached_encoder(
static const struct drm_connector_funcs omap_connector_funcs = { static const struct drm_connector_funcs omap_connector_funcs = {
.dpms = drm_helper_connector_dpms, .dpms = drm_helper_connector_dpms,
.reset = drm_atomic_helper_connector_reset,
.detect = omap_connector_detect, .detect = omap_connector_detect,
.fill_modes = drm_helper_probe_single_connector_modes, .fill_modes = drm_helper_probe_single_connector_modes,
.destroy = omap_connector_destroy, .destroy = omap_connector_destroy,
.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
}; };
static const struct drm_connector_helper_funcs omap_connector_helper_funcs = { static const struct drm_connector_helper_funcs omap_connector_helper_funcs = {
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
#include <linux/completion.h> #include <linux/completion.h>
#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_crtc.h> #include <drm/drm_crtc.h>
#include <drm/drm_crtc_helper.h> #include <drm/drm_crtc_helper.h>
#include <drm/drm_mode.h> #include <drm/drm_mode.h>
...@@ -742,6 +744,7 @@ static int omap_crtc_page_flip(struct drm_crtc *crtc, ...@@ -742,6 +744,7 @@ static int omap_crtc_page_flip(struct drm_crtc *crtc,
omap_crtc->flip_event = event; omap_crtc->flip_event = event;
omap_crtc->flip_state = OMAP_PAGE_FLIP_WAIT; omap_crtc->flip_state = OMAP_PAGE_FLIP_WAIT;
drm_atomic_set_fb_for_plane(primary->state, fb);
primary->fb = fb; primary->fb = fb;
spin_unlock_irqrestore(&dev->event_lock, flags); spin_unlock_irqrestore(&dev->event_lock, flags);
...@@ -771,10 +774,13 @@ static int omap_crtc_set_property(struct drm_crtc *crtc, ...@@ -771,10 +774,13 @@ static int omap_crtc_set_property(struct drm_crtc *crtc,
} }
static const struct drm_crtc_funcs omap_crtc_funcs = { static const struct drm_crtc_funcs omap_crtc_funcs = {
.reset = drm_atomic_helper_crtc_reset,
.set_config = drm_crtc_helper_set_config, .set_config = drm_crtc_helper_set_config,
.destroy = omap_crtc_destroy, .destroy = omap_crtc_destroy,
.page_flip = omap_crtc_page_flip, .page_flip = omap_crtc_page_flip,
.set_property = omap_crtc_set_property, .set_property = omap_crtc_set_property,
.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 omap_crtc_helper_funcs = { static const struct drm_crtc_helper_funcs omap_crtc_helper_funcs = {
......
...@@ -350,6 +350,8 @@ static int omap_modeset_init(struct drm_device *dev) ...@@ -350,6 +350,8 @@ static int omap_modeset_init(struct drm_device *dev)
dev->mode_config.funcs = &omap_mode_config_funcs; dev->mode_config.funcs = &omap_mode_config_funcs;
drm_mode_config_reset(dev);
return 0; return 0;
} }
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
* this program. If not, see <http://www.gnu.org/licenses/>. * this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <drm/drm_atomic_helper.h>
#include "omap_dmm_tiler.h" #include "omap_dmm_tiler.h"
#include "omap_drv.h" #include "omap_drv.h"
...@@ -287,8 +289,11 @@ int omap_plane_set_property(struct drm_plane *plane, ...@@ -287,8 +289,11 @@ int omap_plane_set_property(struct drm_plane *plane,
static const struct drm_plane_funcs omap_plane_funcs = { static const struct drm_plane_funcs omap_plane_funcs = {
.update_plane = omap_plane_update, .update_plane = omap_plane_update,
.disable_plane = omap_plane_disable, .disable_plane = omap_plane_disable,
.reset = drm_atomic_helper_plane_reset,
.destroy = omap_plane_destroy, .destroy = omap_plane_destroy,
.set_property = omap_plane_set_property, .set_property = omap_plane_set_property,
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
}; };
static void omap_plane_error_irq(struct omap_drm_irq *irq, uint32_t irqstatus) static void omap_plane_error_irq(struct omap_drm_irq *irq, uint32_t irqstatus)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment