LCOV - code coverage report
Current view: top level - drivers/video/fbdev/core - fbcon_rotate.h (source / functions) Hit Total Coverage
Test: gcov_data_raspi2_real_modules_combined.info Lines: 0 35 0.0 %
Date: 2020-09-30 20:25:40 Functions: 0 3 0.0 %
Branches: 0 18 0.0 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  *  linux/drivers/video/console/fbcon_rotate.h -- Software Display Rotation
       3                 :            :  *
       4                 :            :  *      Copyright (C) 2005 Antonino Daplas <adaplas@pol.net>
       5                 :            :  *
       6                 :            :  *  This file is subject to the terms and conditions of the GNU General Public
       7                 :            :  *  License.  See the file COPYING in the main directory of this archive
       8                 :            :  *  for more details.
       9                 :            :  */
      10                 :            : 
      11                 :            : #ifndef _FBCON_ROTATE_H
      12                 :            : #define _FBCON_ROTATE_H
      13                 :            : 
      14                 :            : #define GETVYRES(s,i) ({                           \
      15                 :            :         (s == SCROLL_REDRAW || s == SCROLL_MOVE) ? \
      16                 :            :         (i)->var.yres : (i)->var.yres_virtual; })
      17                 :            : 
      18                 :            : #define GETVXRES(s,i) ({                           \
      19                 :            :         (s == SCROLL_REDRAW || s == SCROLL_MOVE || !(i)->fix.xpanstep) ? \
      20                 :            :         (i)->var.xres : (i)->var.xres_virtual; })
      21                 :            : 
      22                 :            : 
      23                 :            : static inline int pattern_test_bit(u32 x, u32 y, u32 pitch, const char *pat)
      24                 :            : {
      25                 :          0 :         u32 tmp = (y * pitch) + x, index = tmp / 8,  bit = tmp % 8;
      26                 :            : 
      27                 :          0 :         pat +=index;
      28                 :          0 :         return (*pat) & (0x80 >> bit);
      29                 :            : }
      30                 :            : 
      31                 :            : static inline void pattern_set_bit(u32 x, u32 y, u32 pitch, char *pat)
      32                 :            : {
      33                 :          0 :         u32 tmp = (y * pitch) + x, index = tmp / 8, bit = tmp % 8;
      34                 :            : 
      35                 :          0 :         pat += index;
      36                 :            : 
      37                 :          0 :         (*pat) |= 0x80 >> bit;
      38                 :            : }
      39                 :            : 
      40                 :          0 : static inline void rotate_ud(const char *in, char *out, u32 width, u32 height)
      41                 :            : {
      42                 :            :         int i, j;
      43                 :          0 :         int shift = (8 - (width % 8)) & 7;
      44                 :            : 
      45                 :          0 :         width = (width + 7) & ~7;
      46                 :            : 
      47         [ #  # ]:          0 :         for (i = 0; i < height; i++) {
      48         [ #  # ]:          0 :                 for (j = 0; j < width - shift; j++) {
      49         [ #  # ]:          0 :                         if (pattern_test_bit(j, i, width, in))
      50                 :          0 :                                 pattern_set_bit(width - (1 + j + shift),
      51                 :          0 :                                                 height - (1 + i),
      52                 :            :                                                 width, out);
      53                 :            :                 }
      54                 :            : 
      55                 :            :         }
      56                 :          0 : }
      57                 :            : 
      58                 :          0 : static inline void rotate_cw(const char *in, char *out, u32 width, u32 height)
      59                 :            : {
      60                 :          0 :         int i, j, h = height, w = width;
      61                 :          0 :         int shift = (8 - (height % 8)) & 7;
      62                 :            : 
      63                 :          0 :         width = (width + 7) & ~7;
      64                 :          0 :         height = (height + 7) & ~7;
      65                 :            : 
      66         [ #  # ]:          0 :         for (i = 0; i < h; i++) {
      67         [ #  # ]:          0 :                 for (j = 0; j < w; j++) {
      68         [ #  # ]:          0 :                         if (pattern_test_bit(j, i, width, in))
      69                 :          0 :                                 pattern_set_bit(height - 1 - i - shift, j,
      70                 :            :                                                 height, out);
      71                 :            : 
      72                 :            :                 }
      73                 :            :         }
      74                 :          0 : }
      75                 :            : 
      76                 :          0 : static inline void rotate_ccw(const char *in, char *out, u32 width, u32 height)
      77                 :            : {
      78                 :          0 :         int i, j, h = height, w = width;
      79                 :          0 :         int shift = (8 - (width % 8)) & 7;
      80                 :            : 
      81                 :          0 :         width = (width + 7) & ~7;
      82                 :          0 :         height = (height + 7) & ~7;
      83                 :            : 
      84         [ #  # ]:          0 :         for (i = 0; i < h; i++) {
      85         [ #  # ]:          0 :                 for (j = 0; j < w; j++) {
      86         [ #  # ]:          0 :                         if (pattern_test_bit(j, i, width, in))
      87                 :          0 :                                 pattern_set_bit(i, width - 1 - j - shift,
      88                 :            :                                                 height, out);
      89                 :            :                 }
      90                 :            :         }
      91                 :          0 : }
      92                 :            : 
      93                 :            : extern void fbcon_rotate_cw(struct fbcon_ops *ops);
      94                 :            : extern void fbcon_rotate_ud(struct fbcon_ops *ops);
      95                 :            : extern void fbcon_rotate_ccw(struct fbcon_ops *ops);
      96                 :            : #endif

Generated by: LCOV version 1.14