drm: Move simple_display_pipe prepare_fb helper into gem fb helpers
There's nothing tinydrm specific to this, and there's a few more copies of the same in various other drivers. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Gustavo Padovan <gustavo@padovan.org> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Sean Paul <seanpaul@chromium.org> Cc: David Airlie <airlied@linux.ie> Cc: David Lechner <david@lechnology.com> Cc: "Noralf Trønnes" <noralf@tronnes.org> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Shawn Guo <shawnguo@kernel.org> Cc: Neil Armstrong <narmstrong@baylibre.com> Cc: Daniel Stone <daniels@collabora.com> Cc: Haneen Mohammed <hamohammed.sa@gmail.com> Cc: Ben Widawsky <ben@bwidawsk.net> Cc: "Ville Syrjälä" <ville.syrjala@linux.intel.com> Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com> Acked-by: David Lechner <david@lechnology.com> Reviewed-by: Noralf Trønnes <noralf@tronnes.org> Link: https://patchwork.freedesktop.org/patch/msgid/20180405154449.23038-3-daniel.vetter@ffwll.ch
This commit is contained in:
parent
3fbe86be6c
commit
ccc3b2b348
|
@ -22,6 +22,7 @@
|
||||||
#include <drm/drm_gem.h>
|
#include <drm/drm_gem.h>
|
||||||
#include <drm/drm_gem_framebuffer_helper.h>
|
#include <drm/drm_gem_framebuffer_helper.h>
|
||||||
#include <drm/drm_modeset_helper.h>
|
#include <drm/drm_modeset_helper.h>
|
||||||
|
#include <drm/drm_simple_kms_helper.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DOC: overview
|
* DOC: overview
|
||||||
|
@ -265,6 +266,24 @@ int drm_gem_fb_prepare_fb(struct drm_plane *plane,
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(drm_gem_fb_prepare_fb);
|
EXPORT_SYMBOL_GPL(drm_gem_fb_prepare_fb);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* drm_gem_fb_simple_display_pipe_prepare_fb - prepare_fb helper for
|
||||||
|
* &drm_simple_display_pipe
|
||||||
|
* @pipe: Simple display pipe
|
||||||
|
* @plane_state: Plane state
|
||||||
|
*
|
||||||
|
* This function uses drm_gem_fb_prepare_fb() to check if the plane FB has a
|
||||||
|
* &dma_buf attached, extracts the exclusive fence and attaches it to plane
|
||||||
|
* state for the atomic helper to wait on. Drivers can use this as their
|
||||||
|
* &drm_simple_display_pipe_funcs.prepare_fb callback.
|
||||||
|
*/
|
||||||
|
int drm_gem_fb_simple_display_pipe_prepare_fb(struct drm_simple_display_pipe *pipe,
|
||||||
|
struct drm_plane_state *plane_state)
|
||||||
|
{
|
||||||
|
return drm_gem_fb_prepare_fb(&pipe->plane, plane_state);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(drm_gem_fb_simple_display_pipe_prepare_fb);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* drm_gem_fbdev_fb_create - Create a GEM backed &drm_framebuffer for fbdev
|
* drm_gem_fbdev_fb_create - Create a GEM backed &drm_framebuffer for fbdev
|
||||||
* emulation
|
* emulation
|
||||||
|
|
|
@ -138,23 +138,6 @@ void tinydrm_display_pipe_update(struct drm_simple_display_pipe *pipe,
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(tinydrm_display_pipe_update);
|
EXPORT_SYMBOL(tinydrm_display_pipe_update);
|
||||||
|
|
||||||
/**
|
|
||||||
* tinydrm_display_pipe_prepare_fb - Display pipe prepare_fb helper
|
|
||||||
* @pipe: Simple display pipe
|
|
||||||
* @plane_state: Plane state
|
|
||||||
*
|
|
||||||
* This function uses drm_gem_fb_prepare_fb() to check if the plane FB has an
|
|
||||||
* dma-buf attached, extracts the exclusive fence and attaches it to plane
|
|
||||||
* state for the atomic helper to wait on. Drivers can use this as their
|
|
||||||
* &drm_simple_display_pipe_funcs->prepare_fb callback.
|
|
||||||
*/
|
|
||||||
int tinydrm_display_pipe_prepare_fb(struct drm_simple_display_pipe *pipe,
|
|
||||||
struct drm_plane_state *plane_state)
|
|
||||||
{
|
|
||||||
return drm_gem_fb_prepare_fb(&pipe->plane, plane_state);
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(tinydrm_display_pipe_prepare_fb);
|
|
||||||
|
|
||||||
static int tinydrm_rotate_mode(struct drm_display_mode *mode,
|
static int tinydrm_rotate_mode(struct drm_display_mode *mode,
|
||||||
unsigned int rotation)
|
unsigned int rotation)
|
||||||
{
|
{
|
||||||
|
|
|
@ -354,7 +354,7 @@ static const struct drm_simple_display_pipe_funcs ili9225_pipe_funcs = {
|
||||||
.enable = ili9225_pipe_enable,
|
.enable = ili9225_pipe_enable,
|
||||||
.disable = ili9225_pipe_disable,
|
.disable = ili9225_pipe_disable,
|
||||||
.update = tinydrm_display_pipe_update,
|
.update = tinydrm_display_pipe_update,
|
||||||
.prepare_fb = tinydrm_display_pipe_prepare_fb,
|
.prepare_fb = drm_gem_fb_simple_display_pipe_prepare_fb,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct drm_display_mode ili9225_mode = {
|
static const struct drm_display_mode ili9225_mode = {
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include <drm/drm_fb_helper.h>
|
#include <drm/drm_fb_helper.h>
|
||||||
#include <drm/drm_modeset_helper.h>
|
#include <drm/drm_modeset_helper.h>
|
||||||
|
#include <drm/drm_gem_framebuffer_helper.h>
|
||||||
#include <drm/tinydrm/mipi-dbi.h>
|
#include <drm/tinydrm/mipi-dbi.h>
|
||||||
#include <drm/tinydrm/tinydrm-helpers.h>
|
#include <drm/tinydrm/tinydrm-helpers.h>
|
||||||
#include <video/mipi_display.h>
|
#include <video/mipi_display.h>
|
||||||
|
@ -134,7 +135,7 @@ static const struct drm_simple_display_pipe_funcs mi0283qt_pipe_funcs = {
|
||||||
.enable = mi0283qt_enable,
|
.enable = mi0283qt_enable,
|
||||||
.disable = mipi_dbi_pipe_disable,
|
.disable = mipi_dbi_pipe_disable,
|
||||||
.update = tinydrm_display_pipe_update,
|
.update = tinydrm_display_pipe_update,
|
||||||
.prepare_fb = tinydrm_display_pipe_prepare_fb,
|
.prepare_fb = drm_gem_fb_simple_display_pipe_prepare_fb,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct drm_display_mode mi0283qt_mode = {
|
static const struct drm_display_mode mi0283qt_mode = {
|
||||||
|
|
|
@ -841,7 +841,7 @@ static const struct drm_simple_display_pipe_funcs repaper_pipe_funcs = {
|
||||||
.enable = repaper_pipe_enable,
|
.enable = repaper_pipe_enable,
|
||||||
.disable = repaper_pipe_disable,
|
.disable = repaper_pipe_disable,
|
||||||
.update = tinydrm_display_pipe_update,
|
.update = tinydrm_display_pipe_update,
|
||||||
.prepare_fb = tinydrm_display_pipe_prepare_fb,
|
.prepare_fb = drm_gem_fb_simple_display_pipe_prepare_fb,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint32_t repaper_formats[] = {
|
static const uint32_t repaper_formats[] = {
|
||||||
|
|
|
@ -290,7 +290,7 @@ static const struct drm_simple_display_pipe_funcs st7586_pipe_funcs = {
|
||||||
.enable = st7586_pipe_enable,
|
.enable = st7586_pipe_enable,
|
||||||
.disable = st7586_pipe_disable,
|
.disable = st7586_pipe_disable,
|
||||||
.update = tinydrm_display_pipe_update,
|
.update = tinydrm_display_pipe_update,
|
||||||
.prepare_fb = tinydrm_display_pipe_prepare_fb,
|
.prepare_fb = drm_gem_fb_simple_display_pipe_prepare_fb,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct drm_display_mode st7586_mode = {
|
static const struct drm_display_mode st7586_mode = {
|
||||||
|
|
|
@ -106,7 +106,7 @@ static const struct drm_simple_display_pipe_funcs jd_t18003_t01_pipe_funcs = {
|
||||||
.enable = jd_t18003_t01_pipe_enable,
|
.enable = jd_t18003_t01_pipe_enable,
|
||||||
.disable = mipi_dbi_pipe_disable,
|
.disable = mipi_dbi_pipe_disable,
|
||||||
.update = tinydrm_display_pipe_update,
|
.update = tinydrm_display_pipe_update,
|
||||||
.prepare_fb = tinydrm_display_pipe_prepare_fb,
|
.prepare_fb = drm_gem_fb_simple_display_pipe_prepare_fb,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct drm_display_mode jd_t18003_t01_mode = {
|
static const struct drm_display_mode jd_t18003_t01_mode = {
|
||||||
|
|
|
@ -10,6 +10,7 @@ struct drm_gem_object;
|
||||||
struct drm_mode_fb_cmd2;
|
struct drm_mode_fb_cmd2;
|
||||||
struct drm_plane;
|
struct drm_plane;
|
||||||
struct drm_plane_state;
|
struct drm_plane_state;
|
||||||
|
struct drm_simple_display_pipe;
|
||||||
|
|
||||||
struct drm_gem_object *drm_gem_fb_get_obj(struct drm_framebuffer *fb,
|
struct drm_gem_object *drm_gem_fb_get_obj(struct drm_framebuffer *fb,
|
||||||
unsigned int plane);
|
unsigned int plane);
|
||||||
|
@ -27,6 +28,8 @@ drm_gem_fb_create(struct drm_device *dev, struct drm_file *file,
|
||||||
|
|
||||||
int drm_gem_fb_prepare_fb(struct drm_plane *plane,
|
int drm_gem_fb_prepare_fb(struct drm_plane *plane,
|
||||||
struct drm_plane_state *state);
|
struct drm_plane_state *state);
|
||||||
|
int drm_gem_fb_simple_display_pipe_prepare_fb(struct drm_simple_display_pipe *pipe,
|
||||||
|
struct drm_plane_state *plane_state);
|
||||||
|
|
||||||
struct drm_framebuffer *
|
struct drm_framebuffer *
|
||||||
drm_gem_fbdev_fb_create(struct drm_device *dev,
|
drm_gem_fbdev_fb_create(struct drm_device *dev,
|
||||||
|
|
|
@ -116,6 +116,9 @@ struct drm_simple_display_pipe_funcs {
|
||||||
* Optional, called by &drm_plane_helper_funcs.prepare_fb. Please read
|
* Optional, called by &drm_plane_helper_funcs.prepare_fb. Please read
|
||||||
* the documentation for the &drm_plane_helper_funcs.prepare_fb hook for
|
* the documentation for the &drm_plane_helper_funcs.prepare_fb hook for
|
||||||
* more details.
|
* more details.
|
||||||
|
*
|
||||||
|
* Drivers which always have their buffers pinned should use
|
||||||
|
* drm_gem_fb_simple_display_pipe_prepare_fb() for this hook.
|
||||||
*/
|
*/
|
||||||
int (*prepare_fb)(struct drm_simple_display_pipe *pipe,
|
int (*prepare_fb)(struct drm_simple_display_pipe *pipe,
|
||||||
struct drm_plane_state *plane_state);
|
struct drm_plane_state *plane_state);
|
||||||
|
|
|
@ -95,8 +95,6 @@ void tinydrm_shutdown(struct tinydrm_device *tdev);
|
||||||
|
|
||||||
void tinydrm_display_pipe_update(struct drm_simple_display_pipe *pipe,
|
void tinydrm_display_pipe_update(struct drm_simple_display_pipe *pipe,
|
||||||
struct drm_plane_state *old_state);
|
struct drm_plane_state *old_state);
|
||||||
int tinydrm_display_pipe_prepare_fb(struct drm_simple_display_pipe *pipe,
|
|
||||||
struct drm_plane_state *plane_state);
|
|
||||||
int
|
int
|
||||||
tinydrm_display_pipe_init(struct tinydrm_device *tdev,
|
tinydrm_display_pipe_init(struct tinydrm_device *tdev,
|
||||||
const struct drm_simple_display_pipe_funcs *funcs,
|
const struct drm_simple_display_pipe_funcs *funcs,
|
||||||
|
|
Loading…
Reference in New Issue