mirror of
				https://github.com/Ysurac/openmptcprouter.git
				synced 2025-03-09 15:40:20 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			59 lines
		
	
	
	
		
			1.8 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			59 lines
		
	
	
	
		
			1.8 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
| From 266614ed47177e31d5fbd91eecae8ec5c59f5c40 Mon Sep 17 00:00:00 2001
 | |
| From: Maxime Ripard <maxime@cerno.tech>
 | |
| Date: Thu, 27 Apr 2023 09:47:54 +0200
 | |
| Subject: [PATCH] drm/vc4: txp: Add horizontal and vertical size offset toggle
 | |
|  bit
 | |
| 
 | |
| The new writeback controllers that can be found on the BCM2712 require
 | |
| to have their horizontal and vertical size reduced by one.
 | |
| 
 | |
| Let's tie that behaviour to the compatible so we can support both the
 | |
| new and old controllers.
 | |
| 
 | |
| Signed-off-by: Maxime Ripard <maxime@cerno.tech>
 | |
| ---
 | |
|  drivers/gpu/drm/vc4/vc4_drv.h |  1 +
 | |
|  drivers/gpu/drm/vc4/vc4_txp.c | 14 ++++++++++++--
 | |
|  2 files changed, 13 insertions(+), 2 deletions(-)
 | |
| 
 | |
| --- a/drivers/gpu/drm/vc4/vc4_drv.h
 | |
| +++ b/drivers/gpu/drm/vc4/vc4_drv.h
 | |
| @@ -564,6 +564,7 @@ struct vc4_crtc_data {
 | |
|  struct vc4_txp_data {
 | |
|  	struct vc4_crtc_data	base;
 | |
|  	unsigned int has_byte_enable:1;
 | |
| +	unsigned int size_minus_one:1;
 | |
|  };
 | |
|  
 | |
|  extern const struct vc4_txp_data bcm2835_txp_data;
 | |
| --- a/drivers/gpu/drm/vc4/vc4_txp.c
 | |
| +++ b/drivers/gpu/drm/vc4/vc4_txp.c
 | |
| @@ -295,6 +295,8 @@ static void vc4_txp_connector_atomic_com
 | |
|  	struct drm_gem_dma_object *gem;
 | |
|  	struct drm_display_mode *mode;
 | |
|  	struct drm_framebuffer *fb;
 | |
| +	unsigned int hdisplay;
 | |
| +	unsigned int vdisplay;
 | |
|  	u32 ctrl;
 | |
|  	int idx;
 | |
|  	int i;
 | |
| @@ -334,9 +336,17 @@ static void vc4_txp_connector_atomic_com
 | |
|  	gem = drm_fb_dma_get_gem_obj(fb, 0);
 | |
|  	TXP_WRITE(TXP_DST_PTR, gem->dma_addr + fb->offsets[0]);
 | |
|  	TXP_WRITE(TXP_DST_PITCH, fb->pitches[0]);
 | |
| +
 | |
| +	hdisplay = mode->hdisplay ?: 1;
 | |
| +	vdisplay = mode->vdisplay ?: 1;
 | |
| +	if (txp_data->size_minus_one) {
 | |
| +		hdisplay -= 1;
 | |
| +		vdisplay -= 1;
 | |
| +	}
 | |
| +
 | |
|  	TXP_WRITE(TXP_DIM,
 | |
| -		  VC4_SET_FIELD(mode->hdisplay, TXP_WIDTH) |
 | |
| -		  VC4_SET_FIELD(mode->vdisplay, TXP_HEIGHT));
 | |
| +		  VC4_SET_FIELD(hdisplay, TXP_WIDTH) |
 | |
| +		  VC4_SET_FIELD(vdisplay, TXP_HEIGHT));
 | |
|  
 | |
|  	TXP_WRITE(TXP_DST_CTRL, ctrl);
 | |
|  
 |