Skip to contentSkip to conversation

dri3: Handle radeon_get_pixmap_bo returning NULL

PATCH In review Michel Dänzer 2 participants 2 messages Oct 18, 2018 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dri3: Handle radeon_get_pixmap_bo returning NULL

From: Michel Dänzer <[email protected]>

We were trying to already, but testing the wrong pointer.

Fixes b85b7b11f5b5 "Add struct radeon_buffer"
---
 src/radeon_dri3.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
src/radeon_dri3.c +5 -5
index 7e89a2f0b..25078bae1 100644
@@ -212,7 +212,7 @@ static int radeon_dri3_fd_from_pixmap(ScreenPtr screen,
 				      CARD16 *stride,
 				      CARD32 *size)
 {
-	struct radeon_bo *bo;
+	struct radeon_buffer *bo;
 	int fd;
 #ifdef USE_GLAMOR
 	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
@@ -222,10 +222,10 @@ static int radeon_dri3_fd_from_pixmap(ScreenPtr screen,
 		return glamor_fd_from_pixmap(screen, pixmap, stride, size);
 #endif
 
-	bo = radeon_get_pixmap_bo(pixmap)->bo.radeon;
+	bo = radeon_get_pixmap_bo(pixmap);
 	if (!bo) {
 		exaMoveInPixmap(pixmap);
-		bo = radeon_get_pixmap_bo(pixmap)->bo.radeon;
+		bo = radeon_get_pixmap_bo(pixmap);
 		if (!bo)
 			return -1;
 	}
@@ -233,11 +233,11 @@ static int radeon_dri3_fd_from_pixmap(ScreenPtr screen,
 	if (pixmap->devKind > UINT16_MAX)
 		return -1;
 
-	if (radeon_gem_prime_share_bo(bo, &fd) < 0)
+	if (radeon_gem_prime_share_bo(bo->bo.radeon, &fd) < 0)
 		return -1;
 
 	*stride = pixmap->devKind;
-	*size = bo->size;
+	*size = bo->bo.radeon->size;
 	return fd;
 }
 
Signature · 6 lines
2.19.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20181018081358.28915-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org

Reviewed-by
#2 lore raw

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Michel Dänzer <[email protected]>
Sent: Thursday, October 18, 2018 4:13:58 AM
To: [email protected]
Subject: [PATCH xf86-video-ati] dri3: Handle radeon_get_pixmap_bo returning NULL

From: Michel Dänzer <[email protected]>

We were trying to already, but testing the wrong pointer.

Fixes b85b7b11f5b5 "Add struct radeon_buffer"
---
 src/radeon_dri3.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
src/radeon_dri3.c +5 -5
index 7e89a2f0b..25078bae1 100644
@@ -212,7 +212,7 @@ static int radeon_dri3_fd_from_pixmap(ScreenPtr screen,
                                       CARD16 *stride,
                                       CARD32 *size)
 {
-       struct radeon_bo *bo;
+       struct radeon_buffer *bo;
         int fd;
 #ifdef USE_GLAMOR
         ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
@@ -222,10 +222,10 @@ static int radeon_dri3_fd_from_pixmap(ScreenPtr screen,
                 return glamor_fd_from_pixmap(screen, pixmap, stride, size);
 #endif
 
-       bo = radeon_get_pixmap_bo(pixmap)->bo.radeon;
+       bo = radeon_get_pixmap_bo(pixmap);
         if (!bo) {
                 exaMoveInPixmap(pixmap);
-               bo = radeon_get_pixmap_bo(pixmap)->bo.radeon;
+               bo = radeon_get_pixmap_bo(pixmap);
                 if (!bo)
                         return -1;
         }
@@ -233,11 +233,11 @@ static int radeon_dri3_fd_from_pixmap(ScreenPtr screen,
         if (pixmap->devKind > UINT16_MAX)
                 return -1;
 
-       if (radeon_gem_prime_share_bo(bo, &fd) < 0)
+       if (radeon_gem_prime_share_bo(bo->bo.radeon, &fd) < 0)
                 return -1;
 
         *stride = pixmap->devKind;
-       *size = bo->size;
+       *size = bo->bo.radeon->size;
         return fd;
 }
 

--
2.19.1

_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx