* [PATCH 1/2] drm/exynos: use src_x and src_y instead of fb_x and fb_y
@ 2015-04-07 6:59 Joonyoung Shim
2015-04-07 6:59 ` [PATCH 2/2] drm/exynos: add ratio calculation Joonyoung Shim
2015-04-07 13:36 ` [PATCH 1/2] drm/exynos: use src_x and src_y instead of fb_x and fb_y Inki Dae
0 siblings, 2 replies; 3+ messages in thread
From: Joonyoung Shim @ 2015-04-07 6:59 UTC (permalink / raw)
To: dri-devel; +Cc: tjakobi, sw0312.kim
It's more reasonable to use src_x and src_y to represent source as
counterpart of destination(crtc). Already we are using src_width and
src_height for width and height of source.
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
---
drivers/gpu/drm/exynos/exynos7_drm_decon.c | 4 ++--
drivers/gpu/drm/exynos/exynos_drm_drv.h | 16 ++++++++--------
drivers/gpu/drm/exynos/exynos_drm_fimd.c | 4 ++--
drivers/gpu/drm/exynos/exynos_drm_plane.c | 8 ++++----
drivers/gpu/drm/exynos/exynos_mixer.c | 8 ++++----
5 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index 84a3638..1f7e33f 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -440,8 +440,8 @@ static void decon_win_commit(struct exynos_drm_crtc *crtc, unsigned int win)
writel(plane->fb_height, ctx->regs + VIDW_WHOLE_Y(win));
/* offset from the start of the buffer to read */
- writel(plane->fb_x, ctx->regs + VIDW_OFFSET_X(win));
- writel(plane->fb_y, ctx->regs + VIDW_OFFSET_Y(win));
+ writel(plane->src_x, ctx->regs + VIDW_OFFSET_X(win));
+ writel(plane->src_y, ctx->regs + VIDW_OFFSET_Y(win));
DRM_DEBUG_KMS("start addr = 0x%lx\n",
(unsigned long)val);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 4a4ba82..f576719 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -47,14 +47,14 @@ enum exynos_drm_output_type {
* Exynos drm common overlay structure.
*
* @base: plane object
- * @fb_x: offset x on a framebuffer to be displayed.
+ * @src_x: offset x on a framebuffer to be displayed.
* - the unit is screen coordinates.
- * @fb_y: offset y on a framebuffer to be displayed.
+ * @src_y: offset y on a framebuffer to be displayed.
* - the unit is screen coordinates.
- * @fb_width: width of a framebuffer.
- * @fb_height: height of a framebuffer.
* @src_width: width of a partial image to be displayed from framebuffer.
* @src_height: height of a partial image to be displayed from framebuffer.
+ * @fb_width: width of a framebuffer.
+ * @fb_height: height of a framebuffer.
* @crtc_x: offset x on hardware screen.
* @crtc_y: offset y on hardware screen.
* @crtc_width: window width to be displayed (hardware screen).
@@ -85,12 +85,12 @@ enum exynos_drm_output_type {
struct exynos_drm_plane {
struct drm_plane base;
- unsigned int fb_x;
- unsigned int fb_y;
- unsigned int fb_width;
- unsigned int fb_height;
+ unsigned int src_x;
+ unsigned int src_y;
unsigned int src_width;
unsigned int src_height;
+ unsigned int fb_width;
+ unsigned int fb_height;
unsigned int crtc_x;
unsigned int crtc_y;
unsigned int crtc_width;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 7964b27..f039041 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -653,8 +653,8 @@ static void fimd_win_commit(struct exynos_drm_crtc *crtc, unsigned int win)
fimd_shadow_protect_win(ctx, win, true);
- offset = plane->fb_x * (plane->bpp >> 3);
- offset += plane->fb_y * plane->pitch;
+ offset = plane->src_x * (plane->bpp >> 3);
+ offset += plane->src_y * plane->pitch;
/* buffer start address */
dma_addr = plane->dma_addr[0] + offset;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index 5d3066d..1e875f4 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -89,12 +89,12 @@ static void exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc
}
/* set drm framebuffer data. */
- exynos_plane->fb_x = src_x;
- exynos_plane->fb_y = src_y;
- exynos_plane->fb_width = fb->width;
- exynos_plane->fb_height = fb->height;
+ exynos_plane->src_x = src_x;
+ exynos_plane->src_y = src_y;
exynos_plane->src_width = src_w;
exynos_plane->src_height = src_h;
+ exynos_plane->fb_width = fb->width;
+ exynos_plane->fb_height = fb->height;
exynos_plane->bpp = fb->bits_per_pixel;
exynos_plane->pitch = fb->pitches[0];
exynos_plane->pixel_format = fb->pixel_format;
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index b95ed91..ede402b 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -457,8 +457,8 @@ static void vp_video_buffer(struct mixer_context *ctx, int win)
vp_reg_write(res, VP_SRC_WIDTH, plane->src_width);
vp_reg_write(res, VP_SRC_HEIGHT, plane->src_height);
vp_reg_write(res, VP_SRC_H_POSITION,
- VP_SRC_H_POSITION_VAL(plane->fb_x));
- vp_reg_write(res, VP_SRC_V_POSITION, plane->fb_y);
+ VP_SRC_H_POSITION_VAL(plane->src_x));
+ vp_reg_write(res, VP_SRC_V_POSITION, plane->src_y);
vp_reg_write(res, VP_DST_WIDTH, plane->crtc_width);
vp_reg_write(res, VP_DST_H_POSITION, plane->crtc_x);
@@ -561,8 +561,8 @@ static void mixer_graph_buffer(struct mixer_context *ctx, int win)
/* converting dma address base and source offset */
dma_addr = plane->dma_addr[0]
- + (plane->fb_x * plane->bpp >> 3)
- + (plane->fb_y * plane->pitch);
+ + (plane->src_x * plane->bpp >> 3)
+ + (plane->src_y * plane->pitch);
src_x_offset = 0;
src_y_offset = 0;
--
1.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] drm/exynos: add ratio calculation
2015-04-07 6:59 [PATCH 1/2] drm/exynos: use src_x and src_y instead of fb_x and fb_y Joonyoung Shim
@ 2015-04-07 6:59 ` Joonyoung Shim
2015-04-07 13:36 ` [PATCH 1/2] drm/exynos: use src_x and src_y instead of fb_x and fb_y Inki Dae
1 sibling, 0 replies; 3+ messages in thread
From: Joonyoung Shim @ 2015-04-07 6:59 UTC (permalink / raw)
To: dri-devel; +Cc: tjakobi, sw0312.kim
Calculation ratio from exynos_drm plane codes, then each hw drivers can
use it without extra operation. Also this fixes width and height of
source used for actual crtc shown via screen.
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
---
drivers/gpu/drm/exynos/exynos_drm_drv.h | 4 ++++
drivers/gpu/drm/exynos/exynos_drm_plane.c | 8 ++++++--
drivers/gpu/drm/exynos/exynos_mixer.c | 9 ++-------
3 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index f576719..33ae657 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -61,6 +61,8 @@ enum exynos_drm_output_type {
* @crtc_height: window height to be displayed (hardware screen).
* @mode_width: width of screen mode.
* @mode_height: height of screen mode.
+ * @h_ratio: horizontal scaling ratio, 16.16 fixed point
+ * @v_ratio: vertical scaling ratio, 16.16 fixed point
* @refresh: refresh rate.
* @scan_flag: interlace or progressive way.
* (it could be DRM_MODE_FLAG_*)
@@ -97,6 +99,8 @@ struct exynos_drm_plane {
unsigned int crtc_height;
unsigned int mode_width;
unsigned int mode_height;
+ unsigned int h_ratio;
+ unsigned int v_ratio;
unsigned int refresh;
unsigned int scan_flag;
unsigned int bpp;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index 1e875f4..8bad40e 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -88,11 +88,15 @@ static void exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc
crtc_y = 0;
}
+ /* set ratio */
+ exynos_plane->h_ratio = (src_w << 16) / crtc_w;
+ exynos_plane->v_ratio = (src_h << 16) / crtc_h;
+
/* set drm framebuffer data. */
exynos_plane->src_x = src_x;
exynos_plane->src_y = src_y;
- exynos_plane->src_width = src_w;
- exynos_plane->src_height = src_h;
+ exynos_plane->src_width = (actual_w * exynos_plane->h_ratio) >> 16;
+ exynos_plane->src_height = (actual_h * exynos_plane->v_ratio) >> 16;
exynos_plane->fb_width = fb->width;
exynos_plane->fb_height = fb->height;
exynos_plane->bpp = fb->bits_per_pixel;
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index ede402b..fbec750 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -382,7 +382,6 @@ static void vp_video_buffer(struct mixer_context *ctx, int win)
struct mixer_resources *res = &ctx->mixer_res;
unsigned long flags;
struct exynos_drm_plane *plane;
- unsigned int x_ratio, y_ratio;
unsigned int buf_num = 1;
dma_addr_t luma_addr[2], chroma_addr[2];
bool tiled_mode = false;
@@ -407,10 +406,6 @@ static void vp_video_buffer(struct mixer_context *ctx, int win)
return;
}
- /* scaling feature: (src << 16) / dst */
- x_ratio = (plane->src_width << 16) / plane->crtc_width;
- y_ratio = (plane->src_height << 16) / plane->crtc_height;
-
if (buf_num == 2) {
luma_addr[0] = plane->dma_addr[0];
chroma_addr[0] = plane->dma_addr[1];
@@ -470,8 +465,8 @@ static void vp_video_buffer(struct mixer_context *ctx, int win)
vp_reg_write(res, VP_DST_V_POSITION, plane->crtc_y);
}
- vp_reg_write(res, VP_H_RATIO, x_ratio);
- vp_reg_write(res, VP_V_RATIO, y_ratio);
+ vp_reg_write(res, VP_H_RATIO, plane->h_ratio);
+ vp_reg_write(res, VP_V_RATIO, plane->v_ratio);
vp_reg_write(res, VP_ENDIAN_MODE, VP_ENDIAN_MODE_LITTLE);
--
1.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] drm/exynos: use src_x and src_y instead of fb_x and fb_y
2015-04-07 6:59 [PATCH 1/2] drm/exynos: use src_x and src_y instead of fb_x and fb_y Joonyoung Shim
2015-04-07 6:59 ` [PATCH 2/2] drm/exynos: add ratio calculation Joonyoung Shim
@ 2015-04-07 13:36 ` Inki Dae
1 sibling, 0 replies; 3+ messages in thread
From: Inki Dae @ 2015-04-07 13:36 UTC (permalink / raw)
To: Joonyoung Shim; +Cc: tjakobi, sw0312.kim, dri-devel
On 2015년 04월 07일 15:59, Joonyoung Shim wrote:
> It's more reasonable to use src_x and src_y to represent source as
> counterpart of destination(crtc). Already we are using src_width and
> src_height for width and height of source.
1 thourgh 2, Applied.
Thanks,
Inki Dae
>
> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
> ---
> drivers/gpu/drm/exynos/exynos7_drm_decon.c | 4 ++--
> drivers/gpu/drm/exynos/exynos_drm_drv.h | 16 ++++++++--------
> drivers/gpu/drm/exynos/exynos_drm_fimd.c | 4 ++--
> drivers/gpu/drm/exynos/exynos_drm_plane.c | 8 ++++----
> drivers/gpu/drm/exynos/exynos_mixer.c | 8 ++++----
> 5 files changed, 20 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
> index 84a3638..1f7e33f 100644
> --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
> +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
> @@ -440,8 +440,8 @@ static void decon_win_commit(struct exynos_drm_crtc *crtc, unsigned int win)
> writel(plane->fb_height, ctx->regs + VIDW_WHOLE_Y(win));
>
> /* offset from the start of the buffer to read */
> - writel(plane->fb_x, ctx->regs + VIDW_OFFSET_X(win));
> - writel(plane->fb_y, ctx->regs + VIDW_OFFSET_Y(win));
> + writel(plane->src_x, ctx->regs + VIDW_OFFSET_X(win));
> + writel(plane->src_y, ctx->regs + VIDW_OFFSET_Y(win));
>
> DRM_DEBUG_KMS("start addr = 0x%lx\n",
> (unsigned long)val);
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
> index 4a4ba82..f576719 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
> @@ -47,14 +47,14 @@ enum exynos_drm_output_type {
> * Exynos drm common overlay structure.
> *
> * @base: plane object
> - * @fb_x: offset x on a framebuffer to be displayed.
> + * @src_x: offset x on a framebuffer to be displayed.
> * - the unit is screen coordinates.
> - * @fb_y: offset y on a framebuffer to be displayed.
> + * @src_y: offset y on a framebuffer to be displayed.
> * - the unit is screen coordinates.
> - * @fb_width: width of a framebuffer.
> - * @fb_height: height of a framebuffer.
> * @src_width: width of a partial image to be displayed from framebuffer.
> * @src_height: height of a partial image to be displayed from framebuffer.
> + * @fb_width: width of a framebuffer.
> + * @fb_height: height of a framebuffer.
> * @crtc_x: offset x on hardware screen.
> * @crtc_y: offset y on hardware screen.
> * @crtc_width: window width to be displayed (hardware screen).
> @@ -85,12 +85,12 @@ enum exynos_drm_output_type {
>
> struct exynos_drm_plane {
> struct drm_plane base;
> - unsigned int fb_x;
> - unsigned int fb_y;
> - unsigned int fb_width;
> - unsigned int fb_height;
> + unsigned int src_x;
> + unsigned int src_y;
> unsigned int src_width;
> unsigned int src_height;
> + unsigned int fb_width;
> + unsigned int fb_height;
> unsigned int crtc_x;
> unsigned int crtc_y;
> unsigned int crtc_width;
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> index 7964b27..f039041 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> @@ -653,8 +653,8 @@ static void fimd_win_commit(struct exynos_drm_crtc *crtc, unsigned int win)
> fimd_shadow_protect_win(ctx, win, true);
>
>
> - offset = plane->fb_x * (plane->bpp >> 3);
> - offset += plane->fb_y * plane->pitch;
> + offset = plane->src_x * (plane->bpp >> 3);
> + offset += plane->src_y * plane->pitch;
>
> /* buffer start address */
> dma_addr = plane->dma_addr[0] + offset;
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c
> index 5d3066d..1e875f4 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
> @@ -89,12 +89,12 @@ static void exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc
> }
>
> /* set drm framebuffer data. */
> - exynos_plane->fb_x = src_x;
> - exynos_plane->fb_y = src_y;
> - exynos_plane->fb_width = fb->width;
> - exynos_plane->fb_height = fb->height;
> + exynos_plane->src_x = src_x;
> + exynos_plane->src_y = src_y;
> exynos_plane->src_width = src_w;
> exynos_plane->src_height = src_h;
> + exynos_plane->fb_width = fb->width;
> + exynos_plane->fb_height = fb->height;
> exynos_plane->bpp = fb->bits_per_pixel;
> exynos_plane->pitch = fb->pitches[0];
> exynos_plane->pixel_format = fb->pixel_format;
> diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
> index b95ed91..ede402b 100644
> --- a/drivers/gpu/drm/exynos/exynos_mixer.c
> +++ b/drivers/gpu/drm/exynos/exynos_mixer.c
> @@ -457,8 +457,8 @@ static void vp_video_buffer(struct mixer_context *ctx, int win)
> vp_reg_write(res, VP_SRC_WIDTH, plane->src_width);
> vp_reg_write(res, VP_SRC_HEIGHT, plane->src_height);
> vp_reg_write(res, VP_SRC_H_POSITION,
> - VP_SRC_H_POSITION_VAL(plane->fb_x));
> - vp_reg_write(res, VP_SRC_V_POSITION, plane->fb_y);
> + VP_SRC_H_POSITION_VAL(plane->src_x));
> + vp_reg_write(res, VP_SRC_V_POSITION, plane->src_y);
>
> vp_reg_write(res, VP_DST_WIDTH, plane->crtc_width);
> vp_reg_write(res, VP_DST_H_POSITION, plane->crtc_x);
> @@ -561,8 +561,8 @@ static void mixer_graph_buffer(struct mixer_context *ctx, int win)
>
> /* converting dma address base and source offset */
> dma_addr = plane->dma_addr[0]
> - + (plane->fb_x * plane->bpp >> 3)
> - + (plane->fb_y * plane->pitch);
> + + (plane->src_x * plane->bpp >> 3)
> + + (plane->src_y * plane->pitch);
> src_x_offset = 0;
> src_y_offset = 0;
>
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-04-07 13:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-07 6:59 [PATCH 1/2] drm/exynos: use src_x and src_y instead of fb_x and fb_y Joonyoung Shim
2015-04-07 6:59 ` [PATCH 2/2] drm/exynos: add ratio calculation Joonyoung Shim
2015-04-07 13:36 ` [PATCH 1/2] drm/exynos: use src_x and src_y instead of fb_x and fb_y Inki Dae
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.