Commit adf5691c authored by Gustavo Padovan's avatar Gustavo Padovan Committed by Inki Dae

drm/exynos: create exynos_check_plane()

Split update plane in two parts, an initial check part that can fail
and the update part that can't fail.

This is a important step for the upcoming atomic modesetting support.
Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
parent dc81252f
...@@ -92,6 +92,7 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode, ...@@ -92,6 +92,7 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
struct drm_framebuffer *fb = crtc->primary->fb; struct drm_framebuffer *fb = crtc->primary->fb;
unsigned int crtc_w; unsigned int crtc_w;
unsigned int crtc_h; unsigned int crtc_h;
int ret;
/* /*
* copy the mode data adjusted by mode_fixup() into crtc->mode * copy the mode data adjusted by mode_fixup() into crtc->mode
...@@ -99,10 +100,16 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode, ...@@ -99,10 +100,16 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode,
*/ */
memcpy(&crtc->mode, adjusted_mode, sizeof(*adjusted_mode)); memcpy(&crtc->mode, adjusted_mode, sizeof(*adjusted_mode));
ret = exynos_check_plane(crtc->primary, fb);
if (ret < 0)
return ret;
crtc_w = fb->width - x; crtc_w = fb->width - x;
crtc_h = fb->height - y; crtc_h = fb->height - y;
return exynos_plane_mode_set(crtc->primary, crtc, fb, 0, 0, exynos_plane_mode_set(crtc->primary, crtc, fb, 0, 0,
crtc_w, crtc_h, x, y, crtc_w, crtc_h); crtc_w, crtc_h, x, y, crtc_w, crtc_h);
return 0;
} }
static int exynos_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, static int exynos_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <drm/drmP.h> #include <drm/drmP.h>
#include <drm/exynos_drm.h> #include <drm/exynos_drm.h>
#include <drm/drm_plane_helper.h>
#include "exynos_drm_drv.h" #include "exynos_drm_drv.h"
#include "exynos_drm_crtc.h" #include "exynos_drm_crtc.h"
#include "exynos_drm_fb.h" #include "exynos_drm_fb.h"
...@@ -61,16 +62,9 @@ static int exynos_plane_get_size(int start, unsigned length, unsigned last) ...@@ -61,16 +62,9 @@ static int exynos_plane_get_size(int start, unsigned length, unsigned last)
return size; return size;
} }
int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc, int exynos_check_plane(struct drm_plane *plane, struct drm_framebuffer *fb)
struct drm_framebuffer *fb, int crtc_x, int crtc_y,
unsigned int crtc_w, unsigned int crtc_h,
uint32_t src_x, uint32_t src_y,
uint32_t src_w, uint32_t src_h)
{ {
struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane); struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
unsigned int actual_w;
unsigned int actual_h;
int nr; int nr;
int i; int i;
...@@ -89,6 +83,20 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc, ...@@ -89,6 +83,20 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,
i, (unsigned long)exynos_plane->dma_addr[i]); i, (unsigned long)exynos_plane->dma_addr[i]);
} }
return 0;
}
void exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,
struct drm_framebuffer *fb, int crtc_x, int crtc_y,
unsigned int crtc_w, unsigned int crtc_h,
uint32_t src_x, uint32_t src_y,
uint32_t src_w, uint32_t src_h)
{
struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(crtc);
unsigned int actual_w;
unsigned int actual_h;
actual_w = exynos_plane_get_size(crtc_x, crtc_w, crtc->mode.hdisplay); actual_w = exynos_plane_get_size(crtc_x, crtc_w, crtc->mode.hdisplay);
actual_h = exynos_plane_get_size(crtc_y, crtc_h, crtc->mode.vdisplay); actual_h = exynos_plane_get_size(crtc_y, crtc_h, crtc->mode.vdisplay);
...@@ -135,8 +143,6 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc, ...@@ -135,8 +143,6 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,
if (exynos_crtc->ops->win_mode_set) if (exynos_crtc->ops->win_mode_set)
exynos_crtc->ops->win_mode_set(exynos_crtc, exynos_plane); exynos_crtc->ops->win_mode_set(exynos_crtc, exynos_plane);
return 0;
} }
void exynos_plane_dpms(struct drm_plane *plane, int mode) void exynos_plane_dpms(struct drm_plane *plane, int mode)
...@@ -177,12 +183,14 @@ exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, ...@@ -177,12 +183,14 @@ exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane); struct exynos_drm_plane *exynos_plane = to_exynos_plane(plane);
int ret; int ret;
ret = exynos_plane_mode_set(plane, crtc, fb, crtc_x, crtc_y, ret = exynos_check_plane(plane, fb);
crtc_w, crtc_h, src_x >> 16, src_y >> 16,
src_w >> 16, src_h >> 16);
if (ret < 0) if (ret < 0)
return ret; return ret;
exynos_plane_mode_set(plane, crtc, fb, crtc_x, crtc_y,
crtc_w, crtc_h, src_x >> 16, src_y >> 16,
src_w >> 16, src_h >> 16);
if (exynos_crtc->ops->win_commit) if (exynos_crtc->ops->win_commit)
exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos); exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos);
......
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
* *
*/ */
int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc, int exynos_check_plane(struct drm_plane *plane, struct drm_framebuffer *fb);
void exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,
struct drm_framebuffer *fb, int crtc_x, int crtc_y, struct drm_framebuffer *fb, int crtc_x, int crtc_y,
unsigned int crtc_w, unsigned int crtc_h, unsigned int crtc_w, unsigned int crtc_h,
uint32_t src_x, uint32_t src_y, uint32_t src_x, uint32_t src_y,
......
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