Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
0002 /**************************************************************************
0003  *
0004  * Copyright 2009-2022 VMware, Inc., Palo Alto, CA., USA
0005  *
0006  * Permission is hereby granted, free of charge, to any person obtaining a
0007  * copy of this software and associated documentation files (the
0008  * "Software"), to deal in the Software without restriction, including
0009  * without limitation the rights to use, copy, modify, merge, publish,
0010  * distribute, sub license, and/or sell copies of the Software, and to
0011  * permit persons to whom the Software is furnished to do so, subject to
0012  * the following conditions:
0013  *
0014  * The above copyright notice and this permission notice (including the
0015  * next paragraph) shall be included in all copies or substantial portions
0016  * of the Software.
0017  *
0018  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0019  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0020  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
0021  * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
0022  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
0023  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
0024  * USE OR OTHER DEALINGS IN THE SOFTWARE.
0025  *
0026  **************************************************************************/
0027 
0028 #ifndef VMWGFX_KMS_H_
0029 #define VMWGFX_KMS_H_
0030 
0031 #include <drm/drm_encoder.h>
0032 #include <drm/drm_framebuffer.h>
0033 #include <drm/drm_probe_helper.h>
0034 
0035 #include "vmwgfx_drv.h"
0036 
0037 /**
0038  * struct vmw_du_update_plane - Closure structure for vmw_du_helper_plane_update
0039  * @plane: Plane which is being updated.
0040  * @old_state: Old state of plane.
0041  * @dev_priv: Device private.
0042  * @du: Display unit on which to update the plane.
0043  * @vfb: Framebuffer which is blitted to display unit.
0044  * @out_fence: Out fence for resource finish.
0045  * @mutex: The mutex used to protect resource reservation.
0046  * @cpu_blit: True if need cpu blit.
0047  * @intr: Whether to perform waits interruptible if possible.
0048  *
0049  * This structure loosely represent the set of operations needed to perform a
0050  * plane update on a display unit. Implementer will define that functionality
0051  * according to the function callbacks for this structure. In brief it involves
0052  * surface/buffer object validation, populate FIFO commands and command
0053  * submission to the device.
0054  */
0055 struct vmw_du_update_plane {
0056     /**
0057      * @calc_fifo_size: Calculate fifo size.
0058      *
0059      * Determine fifo size for the commands needed for update. The number of
0060      * damage clips on display unit @num_hits will be passed to allocate
0061      * sufficient fifo space.
0062      *
0063      * Return: Fifo size needed
0064      */
0065     uint32_t (*calc_fifo_size)(struct vmw_du_update_plane *update,
0066                    uint32_t num_hits);
0067 
0068     /**
0069      * @post_prepare: Populate fifo for resource preparation.
0070      *
0071      * Some surface resource or buffer object need some extra cmd submission
0072      * like update GB image for proxy surface and define a GMRFB for screen
0073      * object. That should should be done here as this callback will be
0074      * called after FIFO allocation with the address of command buufer.
0075      *
0076      * This callback is optional.
0077      *
0078      * Return: Size of commands populated to command buffer.
0079      */
0080     uint32_t (*post_prepare)(struct vmw_du_update_plane *update, void *cmd);
0081 
0082     /**
0083      * @pre_clip: Populate fifo before clip.
0084      *
0085      * This is where pre clip related command should be populated like
0086      * surface copy/DMA, etc.
0087      *
0088      * This callback is optional.
0089      *
0090      * Return: Size of commands populated to command buffer.
0091      */
0092     uint32_t (*pre_clip)(struct vmw_du_update_plane *update, void *cmd,
0093                  uint32_t num_hits);
0094 
0095     /**
0096      * @clip: Populate fifo for clip.
0097      *
0098      * This is where to populate clips for surface copy/dma or blit commands
0099      * if needed. This will be called times have damage in display unit,
0100      * which is one if doing full update. @clip is the damage in destination
0101      * coordinates which is crtc/DU and @src_x, @src_y is damage clip src in
0102      * framebuffer coordinate.
0103      *
0104      * This callback is optional.
0105      *
0106      * Return: Size of commands populated to command buffer.
0107      */
0108     uint32_t (*clip)(struct vmw_du_update_plane *update, void *cmd,
0109              struct drm_rect *clip, uint32_t src_x, uint32_t src_y);
0110 
0111     /**
0112      * @post_clip: Populate fifo after clip.
0113      *
0114      * This is where to populate display unit update commands or blit
0115      * commands.
0116      *
0117      * Return: Size of commands populated to command buffer.
0118      */
0119     uint32_t (*post_clip)(struct vmw_du_update_plane *update, void *cmd,
0120                     struct drm_rect *bb);
0121 
0122     struct drm_plane *plane;
0123     struct drm_plane_state *old_state;
0124     struct vmw_private *dev_priv;
0125     struct vmw_display_unit *du;
0126     struct vmw_framebuffer *vfb;
0127     struct vmw_fence_obj **out_fence;
0128     struct mutex *mutex;
0129     bool cpu_blit;
0130     bool intr;
0131 };
0132 
0133 /**
0134  * struct vmw_du_update_plane_surface - closure structure for surface
0135  * @base: base closure structure.
0136  * @cmd_start: FIFO command start address (used by SOU only).
0137  */
0138 struct vmw_du_update_plane_surface {
0139     struct vmw_du_update_plane base;
0140     /* This member is to handle special case SOU surface update */
0141     void *cmd_start;
0142 };
0143 
0144 /**
0145  * struct vmw_du_update_plane_buffer - Closure structure for buffer object
0146  * @base: Base closure structure.
0147  * @fb_left: x1 for fb damage bounding box.
0148  * @fb_top: y1 for fb damage bounding box.
0149  */
0150 struct vmw_du_update_plane_buffer {
0151     struct vmw_du_update_plane base;
0152     int fb_left, fb_top;
0153 };
0154 
0155 /**
0156  * struct vmw_kms_dirty - closure structure for the vmw_kms_helper_dirty
0157  * function.
0158  *
0159  * @fifo_commit: Callback that is called once for each display unit after
0160  * all clip rects. This function must commit the fifo space reserved by the
0161  * helper. Set up by the caller.
0162  * @clip: Callback that is called for each cliprect on each display unit.
0163  * Set up by the caller.
0164  * @fifo_reserve_size: Fifo size that the helper should try to allocat for
0165  * each display unit. Set up by the caller.
0166  * @dev_priv: Pointer to the device private. Set up by the helper.
0167  * @unit: The current display unit. Set up by the helper before a call to @clip.
0168  * @cmd: The allocated fifo space. Set up by the helper before the first @clip
0169  * call.
0170  * @crtc: The crtc for which to build dirty commands.
0171  * @num_hits: Number of clip rect commands for this display unit.
0172  * Cleared by the helper before the first @clip call. Updated by the @clip
0173  * callback.
0174  * @fb_x: Clip rect left side in framebuffer coordinates.
0175  * @fb_y: Clip rect right side in framebuffer coordinates.
0176  * @unit_x1: Clip rect left side in crtc coordinates.
0177  * @unit_y1: Clip rect top side in crtc coordinates.
0178  * @unit_x2: Clip rect right side in crtc coordinates.
0179  * @unit_y2: Clip rect bottom side in crtc coordinates.
0180  *
0181  * The clip rect coordinates are updated by the helper for each @clip call.
0182  * Note that this may be derived from if more info needs to be passed between
0183  * helper caller and helper callbacks.
0184  */
0185 struct vmw_kms_dirty {
0186     void (*fifo_commit)(struct vmw_kms_dirty *);
0187     void (*clip)(struct vmw_kms_dirty *);
0188     size_t fifo_reserve_size;
0189     struct vmw_private *dev_priv;
0190     struct vmw_display_unit *unit;
0191     void *cmd;
0192     struct drm_crtc *crtc;
0193     u32 num_hits;
0194     s32 fb_x;
0195     s32 fb_y;
0196     s32 unit_x1;
0197     s32 unit_y1;
0198     s32 unit_x2;
0199     s32 unit_y2;
0200 };
0201 
0202 #define VMWGFX_NUM_DISPLAY_UNITS 8
0203 
0204 
0205 #define vmw_framebuffer_to_vfb(x) \
0206     container_of(x, struct vmw_framebuffer, base)
0207 #define vmw_framebuffer_to_vfbs(x) \
0208     container_of(x, struct vmw_framebuffer_surface, base.base)
0209 #define vmw_framebuffer_to_vfbd(x) \
0210     container_of(x, struct vmw_framebuffer_bo, base.base)
0211 
0212 /**
0213  * Base class for framebuffers
0214  *
0215  * @pin is called the when ever a crtc uses this framebuffer
0216  * @unpin is called
0217  */
0218 struct vmw_framebuffer {
0219     struct drm_framebuffer base;
0220     int (*pin)(struct vmw_framebuffer *fb);
0221     int (*unpin)(struct vmw_framebuffer *fb);
0222     bool bo;
0223     uint32_t user_handle;
0224 };
0225 
0226 /*
0227  * Clip rectangle
0228  */
0229 struct vmw_clip_rect {
0230     int x1, x2, y1, y2;
0231 };
0232 
0233 struct vmw_framebuffer_surface {
0234     struct vmw_framebuffer base;
0235     struct vmw_surface *surface;
0236     struct vmw_buffer_object *buffer;
0237     struct list_head head;
0238     bool is_bo_proxy;  /* true if this is proxy surface for DMA buf */
0239 };
0240 
0241 
0242 struct vmw_framebuffer_bo {
0243     struct vmw_framebuffer base;
0244     struct vmw_buffer_object *buffer;
0245 };
0246 
0247 
0248 static const uint32_t __maybe_unused vmw_primary_plane_formats[] = {
0249     DRM_FORMAT_XRGB1555,
0250     DRM_FORMAT_RGB565,
0251     DRM_FORMAT_XRGB8888,
0252     DRM_FORMAT_ARGB8888,
0253 };
0254 
0255 static const uint32_t __maybe_unused vmw_cursor_plane_formats[] = {
0256     DRM_FORMAT_ARGB8888,
0257 };
0258 
0259 
0260 #define vmw_crtc_state_to_vcs(x) container_of(x, struct vmw_crtc_state, base)
0261 #define vmw_plane_state_to_vps(x) container_of(x, struct vmw_plane_state, base)
0262 #define vmw_connector_state_to_vcs(x) \
0263         container_of(x, struct vmw_connector_state, base)
0264 #define vmw_plane_to_vcp(x) container_of(x, struct vmw_cursor_plane, base)
0265 
0266 /**
0267  * Derived class for crtc state object
0268  *
0269  * @base DRM crtc object
0270  */
0271 struct vmw_crtc_state {
0272     struct drm_crtc_state base;
0273 };
0274 
0275 /**
0276  * Derived class for plane state object
0277  *
0278  * @base DRM plane object
0279  * @surf Display surface for STDU
0280  * @bo display bo for SOU
0281  * @content_fb_type Used by STDU.
0282  * @bo_size Size of the bo, used by Screen Object Display Unit
0283  * @pinned pin count for STDU display surface
0284  */
0285 struct vmw_plane_state {
0286     struct drm_plane_state base;
0287     struct vmw_surface *surf;
0288     struct vmw_buffer_object *bo;
0289 
0290     int content_fb_type;
0291     unsigned long bo_size;
0292 
0293     int pinned;
0294 
0295     /* For CPU Blit */
0296     unsigned int cpp;
0297 
0298     /* CursorMob flipping index; -1 if cursor mobs not used */
0299     unsigned int cursor_mob_idx;
0300     /* Currently-active CursorMob */
0301     struct ttm_buffer_object *cm_bo;
0302     /* CursorMob kmap_obj; expected valid at cursor_plane_atomic_update
0303        IFF currently-active CursorMob above is valid */
0304     struct ttm_bo_kmap_obj cm_map;
0305 };
0306 
0307 
0308 /**
0309  * Derived class for connector state object
0310  *
0311  * @base DRM connector object
0312  * @is_implicit connector property
0313  *
0314  */
0315 struct vmw_connector_state {
0316     struct drm_connector_state base;
0317 
0318     /**
0319      * @gui_x:
0320      *
0321      * vmwgfx connector property representing the x position of this display
0322      * unit (connector is synonymous to display unit) in overall topology.
0323      * This is what the device expect as xRoot while creating screen.
0324      */
0325     int gui_x;
0326 
0327     /**
0328      * @gui_y:
0329      *
0330      * vmwgfx connector property representing the y position of this display
0331      * unit (connector is synonymous to display unit) in overall topology.
0332      * This is what the device expect as yRoot while creating screen.
0333      */
0334     int gui_y;
0335 };
0336 
0337 /**
0338  * Derived class for cursor plane object
0339  *
0340  * @base DRM plane object
0341  * @cursor_mob array of two MOBs for CursorMob flipping
0342  */
0343 struct vmw_cursor_plane {
0344     struct drm_plane base;
0345     struct ttm_buffer_object *cursor_mob[2];
0346 };
0347 
0348 /**
0349  * Base class display unit.
0350  *
0351  * Since the SVGA hw doesn't have a concept of a crtc, encoder or connector
0352  * so the display unit is all of them at the same time. This is true for both
0353  * legacy multimon and screen objects.
0354  */
0355 struct vmw_display_unit {
0356     struct drm_crtc crtc;
0357     struct drm_encoder encoder;
0358     struct drm_connector connector;
0359     struct drm_plane primary;
0360     struct vmw_cursor_plane cursor;
0361 
0362     struct vmw_surface *cursor_surface;
0363     struct vmw_buffer_object *cursor_bo;
0364     size_t cursor_age;
0365 
0366     int cursor_x;
0367     int cursor_y;
0368 
0369     int hotspot_x;
0370     int hotspot_y;
0371     s32 core_hotspot_x;
0372     s32 core_hotspot_y;
0373 
0374     unsigned unit;
0375 
0376     /*
0377      * Prefered mode tracking.
0378      */
0379     unsigned pref_width;
0380     unsigned pref_height;
0381     bool pref_active;
0382     struct drm_display_mode *pref_mode;
0383 
0384     /*
0385      * Gui positioning
0386      */
0387     int gui_x;
0388     int gui_y;
0389     bool is_implicit;
0390     int set_gui_x;
0391     int set_gui_y;
0392 };
0393 
0394 struct vmw_validation_ctx {
0395     struct vmw_resource *res;
0396     struct vmw_buffer_object *buf;
0397 };
0398 
0399 #define vmw_crtc_to_du(x) \
0400     container_of(x, struct vmw_display_unit, crtc)
0401 #define vmw_connector_to_du(x) \
0402     container_of(x, struct vmw_display_unit, connector)
0403 
0404 
0405 /*
0406  * Shared display unit functions - vmwgfx_kms.c
0407  */
0408 void vmw_du_cleanup(struct vmw_display_unit *du);
0409 void vmw_du_crtc_save(struct drm_crtc *crtc);
0410 void vmw_du_crtc_restore(struct drm_crtc *crtc);
0411 int vmw_du_crtc_gamma_set(struct drm_crtc *crtc,
0412                u16 *r, u16 *g, u16 *b,
0413                uint32_t size,
0414                struct drm_modeset_acquire_ctx *ctx);
0415 int vmw_du_connector_set_property(struct drm_connector *connector,
0416                   struct drm_property *property,
0417                   uint64_t val);
0418 int vmw_du_connector_atomic_set_property(struct drm_connector *connector,
0419                      struct drm_connector_state *state,
0420                      struct drm_property *property,
0421                      uint64_t val);
0422 int
0423 vmw_du_connector_atomic_get_property(struct drm_connector *connector,
0424                      const struct drm_connector_state *state,
0425                      struct drm_property *property,
0426                      uint64_t *val);
0427 int vmw_du_connector_dpms(struct drm_connector *connector, int mode);
0428 void vmw_du_connector_save(struct drm_connector *connector);
0429 void vmw_du_connector_restore(struct drm_connector *connector);
0430 enum drm_connector_status
0431 vmw_du_connector_detect(struct drm_connector *connector, bool force);
0432 int vmw_du_connector_fill_modes(struct drm_connector *connector,
0433                 uint32_t max_width, uint32_t max_height);
0434 int vmw_kms_helper_dirty(struct vmw_private *dev_priv,
0435              struct vmw_framebuffer *framebuffer,
0436              const struct drm_clip_rect *clips,
0437              const struct drm_vmw_rect *vclips,
0438              s32 dest_x, s32 dest_y,
0439              int num_clips,
0440              int increment,
0441              struct vmw_kms_dirty *dirty);
0442 
0443 void vmw_kms_helper_validation_finish(struct vmw_private *dev_priv,
0444                       struct drm_file *file_priv,
0445                       struct vmw_validation_context *ctx,
0446                       struct vmw_fence_obj **out_fence,
0447                       struct drm_vmw_fence_rep __user *
0448                       user_fence_rep);
0449 int vmw_kms_readback(struct vmw_private *dev_priv,
0450              struct drm_file *file_priv,
0451              struct vmw_framebuffer *vfb,
0452              struct drm_vmw_fence_rep __user *user_fence_rep,
0453              struct drm_vmw_rect *vclips,
0454              uint32_t num_clips);
0455 struct vmw_framebuffer *
0456 vmw_kms_new_framebuffer(struct vmw_private *dev_priv,
0457             struct vmw_buffer_object *bo,
0458             struct vmw_surface *surface,
0459             bool only_2d,
0460             const struct drm_mode_fb_cmd2 *mode_cmd);
0461 int vmw_kms_fbdev_init_data(struct vmw_private *dev_priv,
0462                 unsigned unit,
0463                 u32 max_width,
0464                 u32 max_height,
0465                 struct drm_connector **p_con,
0466                 struct drm_crtc **p_crtc,
0467                 struct drm_display_mode **p_mode);
0468 void vmw_guess_mode_timing(struct drm_display_mode *mode);
0469 void vmw_kms_update_implicit_fb(struct vmw_private *dev_priv);
0470 void vmw_kms_create_implicit_placement_property(struct vmw_private *dev_priv);
0471 
0472 /* Universal Plane Helpers */
0473 void vmw_du_primary_plane_destroy(struct drm_plane *plane);
0474 void vmw_du_cursor_plane_destroy(struct drm_plane *plane);
0475 int vmw_du_create_cursor_mob_array(struct vmw_cursor_plane *vcp);
0476 void vmw_du_destroy_cursor_mob_array(struct vmw_cursor_plane *vcp);
0477 
0478 /* Atomic Helpers */
0479 int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
0480                       struct drm_atomic_state *state);
0481 int vmw_du_cursor_plane_atomic_check(struct drm_plane *plane,
0482                      struct drm_atomic_state *state);
0483 void vmw_du_cursor_plane_atomic_update(struct drm_plane *plane,
0484                        struct drm_atomic_state *state);
0485 int vmw_du_cursor_plane_prepare_fb(struct drm_plane *plane,
0486                    struct drm_plane_state *new_state);
0487 void vmw_du_cursor_plane_cleanup_fb(struct drm_plane *plane,
0488                  struct drm_plane_state *old_state);
0489 void vmw_du_plane_cleanup_fb(struct drm_plane *plane,
0490                  struct drm_plane_state *old_state);
0491 void vmw_du_plane_reset(struct drm_plane *plane);
0492 struct drm_plane_state *vmw_du_plane_duplicate_state(struct drm_plane *plane);
0493 void vmw_du_plane_destroy_state(struct drm_plane *plane,
0494                 struct drm_plane_state *state);
0495 void vmw_du_plane_unpin_surf(struct vmw_plane_state *vps,
0496                  bool unreference);
0497 
0498 int vmw_du_crtc_atomic_check(struct drm_crtc *crtc,
0499                  struct drm_atomic_state *state);
0500 void vmw_du_crtc_atomic_begin(struct drm_crtc *crtc,
0501                   struct drm_atomic_state *state);
0502 void vmw_du_crtc_atomic_flush(struct drm_crtc *crtc,
0503                   struct drm_atomic_state *state);
0504 void vmw_du_crtc_reset(struct drm_crtc *crtc);
0505 struct drm_crtc_state *vmw_du_crtc_duplicate_state(struct drm_crtc *crtc);
0506 void vmw_du_crtc_destroy_state(struct drm_crtc *crtc,
0507                 struct drm_crtc_state *state);
0508 void vmw_du_connector_reset(struct drm_connector *connector);
0509 struct drm_connector_state *
0510 vmw_du_connector_duplicate_state(struct drm_connector *connector);
0511 
0512 void vmw_du_connector_destroy_state(struct drm_connector *connector,
0513                     struct drm_connector_state *state);
0514 
0515 /*
0516  * Legacy display unit functions - vmwgfx_ldu.c
0517  */
0518 int vmw_kms_ldu_init_display(struct vmw_private *dev_priv);
0519 int vmw_kms_ldu_close_display(struct vmw_private *dev_priv);
0520 int vmw_kms_ldu_do_bo_dirty(struct vmw_private *dev_priv,
0521                 struct vmw_framebuffer *framebuffer,
0522                 unsigned int flags, unsigned int color,
0523                 struct drm_clip_rect *clips,
0524                 unsigned int num_clips, int increment);
0525 int vmw_kms_update_proxy(struct vmw_resource *res,
0526              const struct drm_clip_rect *clips,
0527              unsigned num_clips,
0528              int increment);
0529 
0530 /*
0531  * Screen Objects display functions - vmwgfx_scrn.c
0532  */
0533 int vmw_kms_sou_init_display(struct vmw_private *dev_priv);
0534 int vmw_kms_sou_do_surface_dirty(struct vmw_private *dev_priv,
0535                  struct vmw_framebuffer *framebuffer,
0536                  struct drm_clip_rect *clips,
0537                  struct drm_vmw_rect *vclips,
0538                  struct vmw_resource *srf,
0539                  s32 dest_x,
0540                  s32 dest_y,
0541                  unsigned num_clips, int inc,
0542                  struct vmw_fence_obj **out_fence,
0543                  struct drm_crtc *crtc);
0544 int vmw_kms_sou_do_bo_dirty(struct vmw_private *dev_priv,
0545                 struct vmw_framebuffer *framebuffer,
0546                 struct drm_clip_rect *clips,
0547                 struct drm_vmw_rect *vclips,
0548                 unsigned int num_clips, int increment,
0549                 bool interruptible,
0550                 struct vmw_fence_obj **out_fence,
0551                 struct drm_crtc *crtc);
0552 int vmw_kms_sou_readback(struct vmw_private *dev_priv,
0553              struct drm_file *file_priv,
0554              struct vmw_framebuffer *vfb,
0555              struct drm_vmw_fence_rep __user *user_fence_rep,
0556              struct drm_vmw_rect *vclips,
0557              uint32_t num_clips,
0558              struct drm_crtc *crtc);
0559 
0560 /*
0561  * Screen Target Display Unit functions - vmwgfx_stdu.c
0562  */
0563 int vmw_kms_stdu_init_display(struct vmw_private *dev_priv);
0564 int vmw_kms_stdu_surface_dirty(struct vmw_private *dev_priv,
0565                    struct vmw_framebuffer *framebuffer,
0566                    struct drm_clip_rect *clips,
0567                    struct drm_vmw_rect *vclips,
0568                    struct vmw_resource *srf,
0569                    s32 dest_x,
0570                    s32 dest_y,
0571                    unsigned num_clips, int inc,
0572                    struct vmw_fence_obj **out_fence,
0573                    struct drm_crtc *crtc);
0574 int vmw_kms_stdu_dma(struct vmw_private *dev_priv,
0575              struct drm_file *file_priv,
0576              struct vmw_framebuffer *vfb,
0577              struct drm_vmw_fence_rep __user *user_fence_rep,
0578              struct drm_clip_rect *clips,
0579              struct drm_vmw_rect *vclips,
0580              uint32_t num_clips,
0581              int increment,
0582              bool to_surface,
0583              bool interruptible,
0584              struct drm_crtc *crtc);
0585 
0586 int vmw_du_helper_plane_update(struct vmw_du_update_plane *update);
0587 
0588 /**
0589  * vmw_du_translate_to_crtc - Translate a rect from framebuffer to crtc
0590  * @state: Plane state.
0591  * @r: Rectangle to translate.
0592  */
0593 static inline void vmw_du_translate_to_crtc(struct drm_plane_state *state,
0594                         struct drm_rect *r)
0595 {
0596     int translate_crtc_x = -((state->src_x >> 16) - state->crtc_x);
0597     int translate_crtc_y = -((state->src_y >> 16) - state->crtc_y);
0598 
0599     drm_rect_translate(r, translate_crtc_x, translate_crtc_y);
0600 }
0601 
0602 #endif