| @@ -119,11 +119,23 @@ void sun4i_frontend_update_buffer(struct sun4i_frontend *frontend, · 118 unmodified lines |
| 119 | regmap_write(frontend->regs, SUN4I_FRONTEND_LINESTRD0_REG, | 119 | regmap_write(frontend->regs, SUN4I_FRONTEND_LINESTRD0_REG, |
| 120 | fb->pitches[0]); | 120 | fb->pitches[0]); |
| 121 | | 121 | |
| | 122 | if (fb->format->num_planes > 1) |
| | 123 | regmap_write(frontend->regs, SUN4I_FRONTEND_LINESTRD1_REG, |
| | 124 | fb->pitches[1]); |
| | 125 | |
| 122 | /* Set the physical address of the buffer in memory */ | 126 | /* Set the physical address of the buffer in memory */ |
| 123 | paddr = drm_fb_cma_get_gem_addr(fb, state, 0); | 127 | paddr = drm_fb_cma_get_gem_addr(fb, state, 0); |
| 124 | paddr -= PHYS_OFFSET; | 128 | paddr -= PHYS_OFFSET; |
| 125 | DRM_DEBUG_DRIVER("Setting buffer address to %pad\n", &paddr); | 129 | DRM_DEBUG_DRIVER("Setting buffer #0 address to %pad\n", &paddr); |
| 126 | regmap_write(frontend->regs, SUN4I_FRONTEND_BUF_ADDR0_REG, paddr); | 130 | regmap_write(frontend->regs, SUN4I_FRONTEND_BUF_ADDR0_REG, paddr); |
| | 131 | |
| | 132 | if (fb->format->num_planes > 1) { |
| | 133 | paddr = drm_fb_cma_get_gem_addr(fb, state, 1); |
| | 134 | paddr -= PHYS_OFFSET; |
| | 135 | DRM_DEBUG_DRIVER("Setting buffer #1 address to %pad\n", &paddr); |
| | 136 | regmap_write(frontend->regs, SUN4I_FRONTEND_BUF_ADDR1_REG, |
| | 137 | paddr); |
| | 138 | } |
| 127 | } | 139 | } |
| 128 | EXPORT_SYMBOL(sun4i_frontend_update_buffer); | 140 | EXPORT_SYMBOL(sun4i_frontend_update_buffer); |
| 129 | | 141 | |
| @@ -133,6 +145,8 @@ sun4i_frontend_drm_format_to_input_fmt(const struct drm_format_info *format, · 3 unmodified lines |
| 133 | { | 145 | { |
| 134 | if (!format->is_yuv) | 146 | if (!format->is_yuv) |
| 135 | *val = SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_RGB; | 147 | *val = SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_RGB; |
| | 148 | else if (drm_format_info_is_yuv_sampling_420(format)) |
| | 149 | *val = SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_YUV420; |
| 136 | else if (drm_format_info_is_yuv_sampling_422(format)) | 150 | else if (drm_format_info_is_yuv_sampling_422(format)) |
| 137 | *val = SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_YUV422; | 151 | *val = SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_YUV422; |
| 138 | else | 152 | else |
| @@ -145,12 +159,18 @@ static int · 6 unmodified lines |
| 145 | sun4i_frontend_drm_format_to_input_mode(const struct drm_format_info *format, | 159 | sun4i_frontend_drm_format_to_input_mode(const struct drm_format_info *format, |
| 146 | u32 *val) | 160 | u32 *val) |
| 147 | { | 161 | { |
| 148 | if (format->num_planes == 1) | 162 | switch (format->num_planes) { |
| | 163 | case 1: |
| 149 | *val = SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_PACKED; | 164 | *val = SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_PACKED; |
| 150 | else | 165 | return 0; |
| 151 | return -EINVAL; | | |
| 152 | | 166 | |
| 153 | return 0; | 167 | case 2: |
| | 168 | *val = SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_SEMIPLANAR; |
| | 169 | return 0; |
| | 170 | |
| | 171 | default: |
| | 172 | return -EINVAL; |
| | 173 | } |
| 154 | } | 174 | } |
| 155 | | 175 | |
| 156 | static int | 176 | static int |
| @@ -162,6 +182,22 @@ sun4i_frontend_drm_format_to_input_sequence(const struct drm_format_info *format · 5 unmodified lines |
| 162 | *val = SUN4I_FRONTEND_INPUT_FMT_DATA_PS_BGRX; | 182 | *val = SUN4I_FRONTEND_INPUT_FMT_DATA_PS_BGRX; |
| 163 | return 0; | 183 | return 0; |
| 164 | | 184 | |
| | 185 | case DRM_FORMAT_NV12: |
| | 186 | *val = SUN4I_FRONTEND_INPUT_FMT_DATA_PS_UV; |
| | 187 | return 0; |
| | 188 | |
| | 189 | case DRM_FORMAT_NV16: |
| | 190 | *val = SUN4I_FRONTEND_INPUT_FMT_DATA_PS_UV; |
| | 191 | return 0; |
| | 192 | |
| | 193 | case DRM_FORMAT_NV21: |
| | 194 | *val = SUN4I_FRONTEND_INPUT_FMT_DATA_PS_VU; |
| | 195 | return 0; |
| | 196 | |
| | 197 | case DRM_FORMAT_NV61: |
| | 198 | *val = SUN4I_FRONTEND_INPUT_FMT_DATA_PS_VU; |
| | 199 | return 0; |
| | 200 | |
| 165 | case DRM_FORMAT_UYVY: | 201 | case DRM_FORMAT_UYVY: |
| 166 | *val = SUN4I_FRONTEND_INPUT_FMT_DATA_PS_UYVY; | 202 | *val = SUN4I_FRONTEND_INPUT_FMT_DATA_PS_UYVY; |
| 167 | return 0; | 203 | return 0; |
| @@ -205,6 +241,10 @@ static int sun4i_frontend_drm_format_to_output_fmt(uint32_t fmt, u32 *val) · 37 unmodified lines |
| 205 | | 241 | |
| 206 | static const uint32_t sun4i_frontend_formats[] = { | 242 | static const uint32_t sun4i_frontend_formats[] = { |
| 207 | DRM_FORMAT_BGRX8888, | 243 | DRM_FORMAT_BGRX8888, |
| | 244 | DRM_FORMAT_NV12, |
| | 245 | DRM_FORMAT_NV16, |
| | 246 | DRM_FORMAT_NV21, |
| | 247 | DRM_FORMAT_NV61, |
| 208 | DRM_FORMAT_UYVY, | 248 | DRM_FORMAT_UYVY, |
| 209 | DRM_FORMAT_VYUY, | 249 | DRM_FORMAT_VYUY, |
| 210 | DRM_FORMAT_XRGB8888, | 250 | DRM_FORMAT_XRGB8888, |