Rev 6137 | Rev 6334 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6137 | Rev 6142 | ||
---|---|---|---|
Line 613... | Line 613... | ||
613 | err_0: |
613 | err_0: |
614 | free(bitmap); |
614 | free(bitmap); |
615 | return NULL; |
615 | return NULL; |
616 | }; |
616 | }; |
Line -... | Line 617... | ||
- | 617 | ||
- | 618 | static int hw_destroy_planar(planar_t *planar) |
|
- | 619 | { |
|
- | 620 | glDeleteTextures(planar->num_planes, &planar->tex[0]); |
|
- | 621 | ||
- | 622 | if(planar->image[2] != NULL) |
|
- | 623 | eglDestroyImageKHR(px->dpy, planar->image[2]); |
|
- | 624 | if(planar->image[1] != NULL) |
|
- | 625 | eglDestroyImageKHR(px->dpy, planar->image[1]); |
|
- | 626 | if(planar->image[0] != NULL) |
|
- | 627 | eglDestroyImageKHR(px->dpy, planar->image[0]); |
|
- | 628 | if(planar->planar_image != NULL) |
|
- | 629 | eglDestroyImageKHR(px->dpy, planar->planar_image); |
|
- | 630 | free(planar); |
|
- | 631 | return 0; |
|
- | 632 | }; |
|
617 | 633 | ||
618 | static planar_t* hw_create_planar(EGLint name, EGLint format, uint32_t width, uint32_t height, |
634 | static planar_t* hw_create_planar(EGLint name, EGLint format, uint32_t width, uint32_t height, |
619 | uint32_t offset0, uint32_t pitch0, |
635 | uint32_t offset0, uint32_t pitch0, |
620 | uint32_t offset1, uint32_t pitch1, |
636 | uint32_t offset1, uint32_t pitch1, |
621 | uint32_t offset2, uint32_t pitch2) |
637 | uint32_t offset2, uint32_t pitch2) |
Line 668... | Line 684... | ||
668 | goto err_0; |
684 | goto err_0; |
Line 669... | Line 685... | ||
669 | 685 | ||
670 | planar->width = width; |
686 | planar->width = width; |
671 | planar->height = height; |
687 | planar->height = height; |
- | 688 | planar->name = name; |
|
672 | planar->name = name; |
689 | planar->num_planes = num_planes; |
Line 673... | Line 690... | ||
673 | planar->planar_image = img; |
690 | planar->planar_image = img; |
674 | 691 | ||
675 | planar->offset[0] = offset0; |
692 | planar->offset[0] = offset0; |
Line 679... | Line 696... | ||
679 | planar->pitch[0] = pitch0; |
696 | planar->pitch[0] = pitch0; |
680 | planar->pitch[1] = pitch1; |
697 | planar->pitch[1] = pitch1; |
681 | planar->pitch[2] = pitch2; |
698 | planar->pitch[2] = pitch2; |
Line 682... | Line 699... | ||
682 | 699 | ||
- | 700 | glGenTextures(num_planes, &planar->tex[0]); |
|
- | 701 | if(glGetError() != GL_NO_ERROR) |
|
Line 683... | Line 702... | ||
683 | glGenTextures(num_planes, &planar->tex[0]); |
702 | goto err_0; |
684 | 703 | ||
685 | for(i = 0; i < num_planes; i++) |
704 | for(i = 0; i < num_planes; i++) |
686 | { |
705 | { |
Line 690... | Line 709... | ||
690 | attr[1] = i; |
709 | attr[1] = i; |
691 | attr[2] = EGL_NONE; |
710 | attr[2] = EGL_NONE; |
Line 692... | Line 711... | ||
692 | 711 | ||
693 | image = eglCreateImageKHR(px->dpy, px->context, |
712 | image = eglCreateImageKHR(px->dpy, px->context, |
- | 713 | EGL_WAYLAND_BUFFER_WL,(EGLClientBuffer)img, attr); |
|
- | 714 | if(image == NULL) |
|
Line 694... | Line 715... | ||
694 | EGL_WAYLAND_BUFFER_WL,(EGLClientBuffer)img, attr); |
715 | goto err_1; |
695 | 716 | ||
696 | planar->image[i] = image; |
- | |
697 | glBindTexture(GL_TEXTURE_2D, planar->tex[i]); |
717 | planar->image[i] = image; |
698 | 718 | glBindTexture(GL_TEXTURE_2D, planar->tex[i]); |
|
699 | if(glGetError() != GL_NO_ERROR) |
719 | if(glGetError() != GL_NO_ERROR) |
700 | { |
720 | { |
Line 701... | Line 721... | ||
701 | goto fail; |
721 | goto err_1; |
702 | }; |
722 | }; |
703 | 723 | ||
704 | glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image); |
724 | glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image); |
705 | if(glGetError() != GL_NO_ERROR) |
725 | if(glGetError() != GL_NO_ERROR) |
Line 706... | Line 726... | ||
706 | { |
726 | { |
707 | goto fail; |
727 | goto err_1; |
708 | } |
728 | } |
Line 709... | Line 729... | ||
709 | 729 | ||
Line -... | Line 730... | ||
- | 730 | glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); |
|
- | 731 | glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); |
|
- | 732 | }; |
|
- | 733 | ||
710 | glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); |
734 | return planar; |
711 | glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); |
735 | |
712 | }; |
736 | err_1: |
713 | - | ||
714 | return planar; |
737 | hw_destroy_planar(planar); |
715 | 738 | return NULL; |
|
Line 716... | Line -... | ||
716 | err_0: |
- | |
717 | free(planar); |
739 | |
718 | fail: |
740 | err_0: |
719 | 741 | free(planar); |
|
Line 720... | Line 742... | ||
720 | return NULL; |
742 | fail: |
721 | } |
743 | return NULL; |
722 | 744 | } |
|
723 | 745 | ||
724 | static int hw_destroy_bitmap(bitmap_t * bitmap) |
746 | static int hw_destroy_bitmap(bitmap_t * bitmap) |
725 | { |
747 | { |
- | 748 | struct drm_gem_close close; |
|
726 | struct drm_gem_close close; |
749 | |
Line 727... | Line 750... | ||
727 | 750 | glDeleteTextures(1, &bitmap->tex); |
|
728 | glDeleteTextures(1, &bitmap->tex); |
751 | eglDestroyImageKHR(px->dpy, bitmap->image); |
729 | eglDestroyImageKHR(px->dpy, bitmap->image); |
752 | user_free(bitmap->buffer); |
Line 1013... | Line 1036... | ||
1013 | hw_blit, |
1036 | hw_blit, |
1014 | hw_create_client, |
1037 | hw_create_client, |
1015 | hw_resize_client, |
1038 | hw_resize_client, |
1016 | hw_fini, |
1039 | hw_fini, |
1017 | hw_create_planar, |
1040 | hw_create_planar, |
- | 1041 | hw_destroy_planar, |
|
1018 | hw_blit_planar |
1042 | hw_blit_planar |
1019 | }; |
1043 | }; |
Line 1020... | Line 1044... | ||
1020 | 1044 | ||
1021 | struct pix_driver *DrvInit(uint32_t service) |
1045 | struct pix_driver *DrvInit(uint32_t service) |