drm: omapdrm: Pass integer source coordinates to omap_plane_mode_set()
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Sat, 17 Jan 2015 20:31:42 +0000 (22:31 +0200)
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Fri, 20 Mar 2015 12:30:21 +0000 (14:30 +0200)
The function will convert the Q16 source coordinates to integers, avoid
converting integers to Q16 first and perform the opposite conversion.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
drivers/gpu/drm/omapdrm/omap_crtc.c
drivers/gpu/drm/omapdrm/omap_drv.h
drivers/gpu/drm/omapdrm/omap_plane.c

index 1ef3e0146c684ab9293fd1c750a9e020f6b0729e..105eab7cb830d4c15459111561e81ae33d33f827 100644 (file)
@@ -307,10 +307,9 @@ static int omap_crtc_mode_set(struct drm_crtc *crtc,
        crtc->primary->crtc = crtc;
 
        return omap_plane_mode_set(crtc->primary, crtc, crtc->primary->fb,
-                       0, 0, mode->hdisplay, mode->vdisplay,
-                       x << 16, y << 16,
-                       mode->hdisplay << 16, mode->vdisplay << 16,
-                       NULL, NULL);
+                                  0, 0, mode->hdisplay, mode->vdisplay,
+                                  x, y, mode->hdisplay, mode->vdisplay,
+                                  NULL, NULL);
 }
 
 static void omap_crtc_prepare(struct drm_crtc *crtc)
@@ -334,10 +333,9 @@ static int omap_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
        struct drm_display_mode *mode = &crtc->mode;
 
        return omap_plane_mode_set(plane, crtc, crtc->primary->fb,
-                       0, 0, mode->hdisplay, mode->vdisplay,
-                       x << 16, y << 16,
-                       mode->hdisplay << 16, mode->vdisplay << 16,
-                       NULL, NULL);
+                                  0, 0, mode->hdisplay, mode->vdisplay,
+                                  x, y, mode->hdisplay, mode->vdisplay,
+                                  NULL, NULL);
 }
 
 static void vblank_cb(void *arg)
@@ -369,10 +367,9 @@ static void page_flip_worker(struct work_struct *work)
 
        drm_modeset_lock(&crtc->mutex, NULL);
        omap_plane_mode_set(crtc->primary, crtc, crtc->primary->fb,
-                       0, 0, mode->hdisplay, mode->vdisplay,
-                       crtc->x << 16, crtc->y << 16,
-                       mode->hdisplay << 16, mode->vdisplay << 16,
-                       vblank_cb, crtc);
+                           0, 0, mode->hdisplay, mode->vdisplay,
+                           crtc->x, crtc->y, mode->hdisplay, mode->vdisplay,
+                           vblank_cb, crtc);
        drm_modeset_unlock(&crtc->mutex);
 
        bo = omap_framebuffer_bo(crtc->primary->fb, 0);
index 1805edc0107d92e6f3ed352234b8b911b4dd6cd4..57e11c1f589fc9456be01eb8f9854f02b2a4f8db 100644 (file)
@@ -163,12 +163,12 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,
                int id, enum drm_plane_type type);
 int omap_plane_set_enable(struct drm_plane *plane, bool enable);
 int omap_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,
-               void (*fxn)(void *), void *arg);
+                       struct drm_crtc *crtc, struct drm_framebuffer *fb,
+                       int crtc_x, int crtc_y,
+                       unsigned int crtc_w, unsigned int crtc_h,
+                       unsigned int src_x, unsigned int src_y,
+                       unsigned int src_w, unsigned int src_h,
+                       void (*fxn)(void *), void *arg);
 void omap_plane_install_properties(struct drm_plane *plane,
                struct drm_mode_object *obj);
 int omap_plane_set_property(struct drm_plane *plane,
index 309a2246b6e097d274ca7bedcdc422d7afb8581a..29f4371e9e00fc425fed1a972c9b8ffc800fab3d 100644 (file)
@@ -184,12 +184,12 @@ static int omap_plane_apply(struct drm_plane *plane)
 }
 
 int omap_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,
-               void (*fxn)(void *), void *arg)
+                       struct drm_crtc *crtc, struct drm_framebuffer *fb,
+                       int crtc_x, int crtc_y,
+                       unsigned int crtc_w, unsigned int crtc_h,
+                       unsigned int src_x, unsigned int src_y,
+                       unsigned int src_w, unsigned int src_h,
+                       void (*fxn)(void *), void *arg)
 {
        struct omap_plane *omap_plane = to_omap_plane(plane);
        struct omap_drm_window *win = &omap_plane->win;
@@ -199,11 +199,10 @@ int omap_plane_mode_set(struct drm_plane *plane,
        win->crtc_w = crtc_w;
        win->crtc_h = crtc_h;
 
-       /* src values are in Q16 fixed point, convert to integer: */
-       win->src_x = src_x >> 16;
-       win->src_y = src_y >> 16;
-       win->src_w = src_w >> 16;
-       win->src_h = src_h >> 16;
+       win->src_x = src_x;
+       win->src_y = src_y;
+       win->src_w = src_w;
+       win->src_h = src_h;
 
        if (fxn) {
                /* omap_crtc should ensure that a new page flip
@@ -243,9 +242,10 @@ static int omap_plane_update(struct drm_plane *plane,
        plane->fb = fb;
        plane->crtc = crtc;
 
+       /* src values are in Q16 fixed point, convert to integer: */
        return omap_plane_mode_set(plane, crtc, fb,
                        crtc_x, crtc_y, crtc_w, crtc_h,
-                       src_x, src_y, src_w, src_h,
+                       src_x >> 16, src_y >> 16, src_w >> 16, src_h >> 16,
                        NULL, NULL);
 }
 
This page took 0.027805 seconds and 5 git commands to generate.